Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 26 additions & 12 deletions src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ public sealed partial class CrawlClient : global::Firecrawl.ICrawlClient, global
/// <summary>
///
/// </summary>
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<global::Firecrawl.EndPointAuthorization> _authorizations;
private bool _disposeHttpClient = true;

/// <inheritdoc/>
public global::System.Net.Http.HttpClient HttpClient { get; }

/// <inheritdoc/>
public System.Uri? BaseUri => HttpClient.BaseAddress;

/// <inheritdoc/>
public global::System.Collections.Generic.List<global::Firecrawl.EndPointAuthorization> Authorizations { get; }

/// <summary>
///
Expand All @@ -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.
/// </summary>
/// <param name="httpClient"></param>
/// <param name="baseUri"></param>
/// <param name="authorizations"></param>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public CrawlClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::Firecrawl.EndPointAuthorization>? authorizations = null)
global::System.Collections.Generic.List<global::Firecrawl.EndPointAuthorization>? 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<global::Firecrawl.EndPointAuthorization>();
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List<global::Firecrawl.EndPointAuthorization>();
_disposeHttpClient = disposeHttpClient;

Initialized(_httpClient);
Initialized(HttpClient);
}

/// <inheritdoc/>
public void Dispose()
{
_httpClient.Dispose();
if (_disposeHttpClient)
{
HttpClient.Dispose();
}
}

partial void Initialized(
Expand Down
Loading