From 28408724c6934ef9dd07fbf9d88def6b478e96ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 23 Oct 2024 01:44:29 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Firecrawl.CrawlClient.CancelCrawlJob.g.cs | 62 ++++++++--------- .../Firecrawl.CrawlClient.GetCrawlStatus.g.cs | 62 ++++++++--------- .../Generated/Firecrawl.CrawlClient.g.cs | 38 +++++++---- .../Firecrawl.CrawlingClient.CrawlUrls.g.cs | 68 +++++++++---------- .../Generated/Firecrawl.CrawlingClient.g.cs | 38 +++++++---- ...wl.FirecrawlApp.Authorizations.Bearer.g.cs | 4 +- ...rawl.FirecrawlApp.Constructors.Bearer.g.cs | 9 +-- .../Generated/Firecrawl.FirecrawlApp.g.cs | 46 ++++++++----- .../Generated/Firecrawl.ICrawlClient.g.cs | 15 ++++ .../Generated/Firecrawl.ICrawlingClient.g.cs | 15 ++++ .../Generated/Firecrawl.IFirecrawlApp.g.cs | 15 ++++ .../Generated/Firecrawl.IScrapingClient.g.cs | 15 ++++ .../Generated/Firecrawl.ISearchClient.g.cs | 15 ++++ .../Firecrawl.ScrapingClient.Scrape.g.cs | 68 +++++++++---------- .../Generated/Firecrawl.ScrapingClient.g.cs | 38 +++++++---- .../Firecrawl.SearchClient.SearchGoogle.g.cs | 68 +++++++++---------- .../Generated/Firecrawl.SearchClient.g.cs | 38 +++++++---- 17 files changed, 380 insertions(+), 234 deletions(-) diff --git a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.CancelCrawlJob.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.CancelCrawlJob.g.cs index fff3f7d..6df3d5f 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.CancelCrawlJob.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.CancelCrawlJob.g.cs @@ -32,73 +32,73 @@ partial void ProcessCancelCrawlJobResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelCrawlJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, jobId: ref jobId); var __pathBuilder = new PathBuilder( path: $"/crawl/cancel/{jobId}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Delete, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelCrawlJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, jobId: jobId); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCancelCrawlJobResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCancelCrawlJobResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.GetCrawlStatus.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.GetCrawlStatus.g.cs index 76c5604..c22173d 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.GetCrawlStatus.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.GetCrawlStatus.g.cs @@ -32,73 +32,73 @@ partial void ProcessGetCrawlStatusResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetCrawlStatusArguments( - httpClient: _httpClient, + httpClient: HttpClient, jobId: ref jobId); var __pathBuilder = new PathBuilder( path: $"/crawl/status/{jobId}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Get, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetCrawlStatusRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, jobId: jobId); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetCrawlStatusResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetCrawlStatusResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs index 26aafcb..e652e57 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class CrawlClient : global::Firecrawl.ICrawlClient, global /// /// /// - public const string BaseUrl = "https://api.firecrawl.dev/v0"; + public const string DefaultBaseUrl = "https://api.firecrawl.dev/v0"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -28,25 +36,31 @@ public sealed partial class CrawlClient : global::Firecrawl.ICrawlClient, global /// If no httpClient is provided, a new one will be created. /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public CrawlClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.CrawlUrls.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.CrawlUrls.g.cs index 21e8e6d..b5066c4 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.CrawlUrls.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.CrawlUrls.g.cs @@ -34,32 +34,32 @@ partial void ProcessCrawlUrlsResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCrawlUrlsArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/crawl", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCrawlUrlsResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCrawlUrlsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCrawlUrlsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCrawlUrlsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -130,7 +130,7 @@ partial void ProcessCrawlUrlsResponseContent( global::Firecrawl.CrawlUrlsRequestPageOptions? pageOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Firecrawl.CrawlUrlsRequest + var __request = new global::Firecrawl.CrawlUrlsRequest { Url = url, CrawlerOptions = crawlerOptions, @@ -138,7 +138,7 @@ partial void ProcessCrawlUrlsResponseContent( }; return await CrawlUrlsAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.g.cs index b239a56..7d5b6ea 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.CrawlingClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class CrawlingClient : global::Firecrawl.ICrawlingClient, /// /// /// - public const string BaseUrl = "https://api.firecrawl.dev/v0"; + public const string DefaultBaseUrl = "https://api.firecrawl.dev/v0"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -28,25 +36,31 @@ public sealed partial class CrawlingClient : global::Firecrawl.ICrawlingClient, /// If no httpClient is provided, a new one will be created. /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public CrawlingClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Authorizations.Bearer.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Authorizations.Bearer.g.cs index f21e6ac..85a4a4c 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Authorizations.Bearer.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Authorizations.Bearer.g.cs @@ -14,8 +14,8 @@ public void AuthorizeUsingBearer( { apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); - _authorizations.Clear(); - _authorizations.Add(new global::Firecrawl.EndPointAuthorization + Authorizations.Clear(); + Authorizations.Add(new global::Firecrawl.EndPointAuthorization { Type = "Http", Location = "Header", diff --git a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Constructors.Bearer.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Constructors.Bearer.g.cs index 3028f2c..1551067 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Constructors.Bearer.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.Constructors.Bearer.g.cs @@ -5,18 +5,19 @@ namespace Firecrawl { public sealed partial class FirecrawlApp { - /// + /// public FirecrawlApp( string apiKey, global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) : this(httpClient, baseUri, authorizations) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient) { - Authorizing(_httpClient, ref apiKey); + Authorizing(HttpClient, ref apiKey); AuthorizeUsingBearer(apiKey); - Authorized(_httpClient); + Authorized(HttpClient); } partial void Authorizing( diff --git a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.g.cs index 27a79f3..cc9a1b1 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.FirecrawlApp.g.cs @@ -13,10 +13,18 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// /// /// - public const string BaseUrl = "https://api.firecrawl.dev/v0"; + public const string DefaultBaseUrl = "https://api.firecrawl.dev/v0"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -27,7 +35,7 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// /// /// - public ScrapingClient Scraping => new ScrapingClient(_httpClient, authorizations: _authorizations) + public ScrapingClient Scraping => new ScrapingClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -35,7 +43,7 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// /// /// - public CrawlingClient Crawling => new CrawlingClient(_httpClient, authorizations: _authorizations) + public CrawlingClient Crawling => new CrawlingClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -43,7 +51,7 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// /// /// - public SearchClient Search => new SearchClient(_httpClient, authorizations: _authorizations) + public SearchClient Search => new SearchClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -51,7 +59,7 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// /// /// - public CrawlClient Crawl => new CrawlClient(_httpClient, authorizations: _authorizations) + public CrawlClient Crawl => new CrawlClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -61,25 +69,31 @@ public sealed partial class FirecrawlApp : global::Firecrawl.IFirecrawlApp, glob /// If no httpClient is provided, a new one will be created. /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public FirecrawlApp( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Firecrawl/Generated/Firecrawl.ICrawlClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.ICrawlClient.g.cs index 91fff7d..e0ad031 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.ICrawlClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.ICrawlClient.g.cs @@ -9,6 +9,21 @@ namespace Firecrawl /// public partial interface ICrawlClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Firecrawl/Generated/Firecrawl.ICrawlingClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.ICrawlingClient.g.cs index 43f87be..57a7a92 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.ICrawlingClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.ICrawlingClient.g.cs @@ -9,6 +9,21 @@ namespace Firecrawl /// public partial interface ICrawlingClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Firecrawl/Generated/Firecrawl.IFirecrawlApp.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.IFirecrawlApp.g.cs index 1cb2058..4787761 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.IFirecrawlApp.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.IFirecrawlApp.g.cs @@ -10,6 +10,21 @@ namespace Firecrawl /// public partial interface IFirecrawlApp : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Firecrawl/Generated/Firecrawl.IScrapingClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.IScrapingClient.g.cs index cdfeab7..e0d104e 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.IScrapingClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.IScrapingClient.g.cs @@ -9,6 +9,21 @@ namespace Firecrawl /// public partial interface IScrapingClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Firecrawl/Generated/Firecrawl.ISearchClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.ISearchClient.g.cs index 3e68968..a425486 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.ISearchClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.ISearchClient.g.cs @@ -9,6 +9,21 @@ namespace Firecrawl /// public partial interface ISearchClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.Scrape.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.Scrape.g.cs index fb67986..2cac02c 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.Scrape.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.Scrape.g.cs @@ -34,32 +34,32 @@ partial void ProcessScrapeResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareScrapeArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/scrape", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessScrapeResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareScrapeRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessScrapeResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessScrapeResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -164,7 +164,7 @@ partial void ProcessScrapeResponseContent( int? waitFor = 0, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Firecrawl.ScrapeRequest + var __request = new global::Firecrawl.ScrapeRequest { Url = url, Formats = formats, @@ -177,7 +177,7 @@ partial void ProcessScrapeResponseContent( }; return await ScrapeAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.g.cs index 2347b3d..b6f79b0 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.ScrapingClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class ScrapingClient : global::Firecrawl.IScrapingClient, /// /// /// - public const string BaseUrl = "https://api.firecrawl.dev/v0"; + public const string DefaultBaseUrl = "https://api.firecrawl.dev/v0"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -28,25 +36,31 @@ public sealed partial class ScrapingClient : global::Firecrawl.IScrapingClient, /// If no httpClient is provided, a new one will be created. /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public ScrapingClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.SearchGoogle.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.SearchGoogle.g.cs index 2683803..0183584 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.SearchGoogle.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.SearchGoogle.g.cs @@ -34,32 +34,32 @@ partial void ProcessSearchGoogleResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareSearchGoogleArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/search", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessSearchGoogleResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareSearchGoogleRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessSearchGoogleResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessSearchGoogleResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -130,7 +130,7 @@ partial void ProcessSearchGoogleResponseContent( global::Firecrawl.SearchGoogleRequestSearchOptions? searchOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Firecrawl.SearchGoogleRequest + var __request = new global::Firecrawl.SearchGoogleRequest { Query = query, PageOptions = pageOptions, @@ -138,7 +138,7 @@ partial void ProcessSearchGoogleResponseContent( }; return await SearchGoogleAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.g.cs b/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.g.cs index 272e3c9..a185060 100644 --- a/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.g.cs +++ b/src/libs/Firecrawl/Generated/Firecrawl.SearchClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class SearchClient : global::Firecrawl.ISearchClient, glob /// /// /// - public const string BaseUrl = "https://api.firecrawl.dev/v0"; + public const string DefaultBaseUrl = "https://api.firecrawl.dev/v0"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -28,25 +36,31 @@ public sealed partial class SearchClient : global::Firecrawl.ISearchClient, glob /// If no httpClient is provided, a new one will be created. /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public SearchClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized(