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
161 changes: 143 additions & 18 deletions src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.CancelCrawlJob.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ partial void ProcessCancelCrawlJobResponseContent(
/// </summary>
/// <param name="jobId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Firecrawl.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Firecrawl.CancelCrawlJobResponse> CancelCrawlJobAsync(
string jobId,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -80,30 +80,155 @@ partial void ProcessCancelCrawlJobResponseContent(
ProcessCancelCrawlJobResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Payment required
if ((int)__response.StatusCode == 402)
{
string? __content_402 = null;
global::Firecrawl.CancelCrawlJobResponse2? __value_402 = null;
if (ReadResponseAsString)
{
__content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_402 = global::Firecrawl.CancelCrawlJobResponse2.FromJson(__content_402, JsonSerializerContext);
}
else
{
var __contentStream_402 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_402 = await global::Firecrawl.CancelCrawlJobResponse2.FromJsonStreamAsync(__contentStream_402, JsonSerializerContext).ConfigureAwait(false);
}

var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessCancelCrawlJobResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);
throw new global::Firecrawl.ApiException<global::Firecrawl.CancelCrawlJobResponse2>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_402,
ResponseObject = __value_402,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Too many requests
if ((int)__response.StatusCode == 429)
{
string? __content_429 = null;
global::Firecrawl.CancelCrawlJobResponse3? __value_429 = null;
if (ReadResponseAsString)
{
__content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_429 = global::Firecrawl.CancelCrawlJobResponse3.FromJson(__content_429, JsonSerializerContext);
}
else
{
var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_429 = await global::Firecrawl.CancelCrawlJobResponse3.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false);
}

try
throw new global::Firecrawl.ApiException<global::Firecrawl.CancelCrawlJobResponse3>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_429,
ResponseObject = __value_429,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Server error
if ((int)__response.StatusCode == 500)
{
__response.EnsureSuccessStatusCode();
string? __content_500 = null;
global::Firecrawl.CancelCrawlJobResponse4? __value_500 = null;
if (ReadResponseAsString)
{
__content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_500 = global::Firecrawl.CancelCrawlJobResponse4.FromJson(__content_500, JsonSerializerContext);
}
else
{
var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_500 = await global::Firecrawl.CancelCrawlJobResponse4.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::Firecrawl.ApiException<global::Firecrawl.CancelCrawlJobResponse4>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_500,
ResponseObject = __value_500,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
catch (global::System.Net.Http.HttpRequestException __ex)

if (ReadResponseAsString)
{
throw new global::System.InvalidOperationException(__content, __ex);
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessCancelCrawlJobResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Firecrawl.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return
global::Firecrawl.CancelCrawlJobResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
else
{
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Firecrawl.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

return
global::Firecrawl.CancelCrawlJobResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
var __responseValue = await global::Firecrawl.CancelCrawlJobResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false);

return
__responseValue ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
161 changes: 143 additions & 18 deletions src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.GetCrawlStatus.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ partial void ProcessGetCrawlStatusResponseContent(
/// </summary>
/// <param name="jobId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
/// <exception cref="global::Firecrawl.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Firecrawl.GetCrawlStatusResponse> GetCrawlStatusAsync(
string jobId,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -80,30 +80,155 @@ partial void ProcessGetCrawlStatusResponseContent(
ProcessGetCrawlStatusResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Payment required
if ((int)__response.StatusCode == 402)
{
string? __content_402 = null;
global::Firecrawl.GetCrawlStatusResponse2? __value_402 = null;
if (ReadResponseAsString)
{
__content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_402 = global::Firecrawl.GetCrawlStatusResponse2.FromJson(__content_402, JsonSerializerContext);
}
else
{
var __contentStream_402 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_402 = await global::Firecrawl.GetCrawlStatusResponse2.FromJsonStreamAsync(__contentStream_402, JsonSerializerContext).ConfigureAwait(false);
}

var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetCrawlStatusResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);
throw new global::Firecrawl.ApiException<global::Firecrawl.GetCrawlStatusResponse2>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_402,
ResponseObject = __value_402,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Too many requests
if ((int)__response.StatusCode == 429)
{
string? __content_429 = null;
global::Firecrawl.GetCrawlStatusResponse3? __value_429 = null;
if (ReadResponseAsString)
{
__content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_429 = global::Firecrawl.GetCrawlStatusResponse3.FromJson(__content_429, JsonSerializerContext);
}
else
{
var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_429 = await global::Firecrawl.GetCrawlStatusResponse3.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false);
}

try
throw new global::Firecrawl.ApiException<global::Firecrawl.GetCrawlStatusResponse3>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_429,
ResponseObject = __value_429,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Server error
if ((int)__response.StatusCode == 500)
{
__response.EnsureSuccessStatusCode();
string? __content_500 = null;
global::Firecrawl.GetCrawlStatusResponse4? __value_500 = null;
if (ReadResponseAsString)
{
__content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_500 = global::Firecrawl.GetCrawlStatusResponse4.FromJson(__content_500, JsonSerializerContext);
}
else
{
var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_500 = await global::Firecrawl.GetCrawlStatusResponse4.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::Firecrawl.ApiException<global::Firecrawl.GetCrawlStatusResponse4>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_500,
ResponseObject = __value_500,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
catch (global::System.Net.Http.HttpRequestException __ex)

if (ReadResponseAsString)
{
throw new global::System.InvalidOperationException(__content, __ex);
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetCrawlStatusResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Firecrawl.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return
global::Firecrawl.GetCrawlStatusResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
else
{
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Firecrawl.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

using var __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);

return
global::Firecrawl.GetCrawlStatusResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
var __responseValue = await global::Firecrawl.GetCrawlStatusResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false);

return
__responseValue ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
5 changes: 5 additions & 0 deletions src/libs/Firecrawl/Generated/Firecrawl.CrawlClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public sealed partial class CrawlClient : global::Firecrawl.ICrawlClient, global
/// <inheritdoc/>
public global::System.Collections.Generic.List<global::Firecrawl.EndPointAuthorization> Authorizations { get; }

/// <inheritdoc/>
public bool ReadResponseAsString { get; set; }
#if DEBUG
= true;
#endif
/// <summary>
///
/// </summary>
Expand Down
Loading