From 78016ac35f6cd13073bd2d18bde426e46859f641 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 10 Apr 2026 02:34:02 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ...rnV1AdminQueryRedisCacheByPatternPost.g.cs | 446 ++++++++++++----- .../Generated/ScrapeGraphAI.AdminClient.g.cs | 29 ++ ...genticBrowserV2V1WorkflowsExecutePost.g.cs | 454 ++++++++++++----- ....AgenticScrapperV1AgenticScrapperPost.g.cs | 454 ++++++++++++----- ...LiveSessionUrlV1GetLiveSessionUrlPost.g.cs | 454 ++++++++++++----- ...erClient.StopSessionV1StopSessionPost.g.cs | 446 ++++++++++++----- .../ScrapeGraphAI.AgenticScrapperClient.g.cs | 29 ++ ...Client.GetCrawlResultV1CrawlTaskIdGet.g.cs | 429 +++++++++++----- ...tWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs | 429 +++++++++++----- ...hookStatusV1WebhookStatusWebhookIdGet.g.cs | 429 +++++++++++----- ...I.CrawlerClient.StartCrawlV1CrawlPost.g.cs | 446 ++++++++++++----- .../ScrapeGraphAI.CrawlerClient.g.cs | 29 ++ ...pointV1EndpointEndpointIdFullPathPost.g.cs | 450 ++++++++++++----- ...msDetailsV1BandcampGetItemDetailsPost.g.cs | 369 ++++++++++---- ...dItemsV1BandcampGetSalesFeedItemsPost.g.cs | 369 ++++++++++---- ...ggestionsV1EndpointGetSuggestionsPost.g.cs | 454 ++++++++++++----- ...aveEndpointV1EndpointSaveEndpointPost.g.cs | 446 ++++++++++++----- .../ScrapeGraphAI.EndpointPocClient.g.cs | 29 ++ ...AI.HealthClient.HealthCheckHealthzGet.g.cs | 369 ++++++++++---- .../Generated/ScrapeGraphAI.HealthClient.g.cs | 29 ++ ...aperHistoryV1HistoryAgenticScraperGet.g.cs | 466 ++++++++++++------ ...nt.GetCrawlerHistoryV1HistoryCrawlGet.g.cs | 466 ++++++++++++------ ...downifyHistoryV1HistoryMarkdownifyGet.g.cs | 466 ++++++++++++------ ...nt.GetScrapeHistoryV1HistoryScrapeGet.g.cs | 466 ++++++++++++------ ...raperHistoryV1HistorySearchscraperGet.g.cs | 466 ++++++++++++------ ....GetSitemapHistoryV1HistorySitemapGet.g.cs | 466 ++++++++++++------ ...craperHistoryV1HistorySmartscraperGet.g.cs | 466 ++++++++++++------ .../ScrapeGraphAI.HistoryClient.g.cs | 29 ++ ...rnV1AdminQueryRedisCacheByPatternPost.g.cs | 4 + .../Generated/ScrapeGraphAI.IAdminClient.g.cs | 5 + ...genticBrowserV2V1WorkflowsExecutePost.g.cs | 4 + ....AgenticScrapperV1AgenticScrapperPost.g.cs | 4 + ...LiveSessionUrlV1GetLiveSessionUrlPost.g.cs | 4 + ...erClient.StopSessionV1StopSessionPost.g.cs | 4 + .../ScrapeGraphAI.IAgenticScrapperClient.g.cs | 5 + ...Client.GetCrawlResultV1CrawlTaskIdGet.g.cs | 2 + ...tWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs | 2 + ...hookStatusV1WebhookStatusWebhookIdGet.g.cs | 2 + ....ICrawlerClient.StartCrawlV1CrawlPost.g.cs | 4 + .../ScrapeGraphAI.ICrawlerClient.g.cs | 5 + ...pointV1EndpointEndpointIdFullPathPost.g.cs | 4 + ...msDetailsV1BandcampGetItemDetailsPost.g.cs | 2 + ...dItemsV1BandcampGetSalesFeedItemsPost.g.cs | 2 + ...ggestionsV1EndpointGetSuggestionsPost.g.cs | 4 + ...aveEndpointV1EndpointSaveEndpointPost.g.cs | 4 + .../ScrapeGraphAI.IEndpointPocClient.g.cs | 5 + ...I.IHealthClient.HealthCheckHealthzGet.g.cs | 2 + .../ScrapeGraphAI.IHealthClient.g.cs | 5 + ...aperHistoryV1HistoryAgenticScraperGet.g.cs | 4 + ...nt.GetCrawlerHistoryV1HistoryCrawlGet.g.cs | 4 + ...downifyHistoryV1HistoryMarkdownifyGet.g.cs | 4 + ...nt.GetScrapeHistoryV1HistoryScrapeGet.g.cs | 4 + ...raperHistoryV1HistorySearchscraperGet.g.cs | 4 + ....GetSitemapHistoryV1HistorySitemapGet.g.cs | 4 + ...craperHistoryV1HistorySmartscraperGet.g.cs | 4 + .../ScrapeGraphAI.IHistoryClient.g.cs | 5 + ...ownifyStatusV1MarkdownifyRequestIdGet.g.cs | 2 + ...ent.StartMarkdownifyV1MarkdownifyPost.g.cs | 4 + .../ScrapeGraphAI.IMarkdownifyClient.g.cs | 5 + ....IOrthogonalClient.ProxyX402PathPost.g.cs} | 4 +- ...IOrthogonalClient.ProxyX402PathPost2.g.cs} | 4 +- ...IOrthogonalClient.ProxyX402PathPost3.g.cs} | 4 +- ...IOrthogonalClient.ProxyX402PathPost4.g.cs} | 4 +- ....IOrthogonalClient.ProxyX402PathPost5.g.cs | 21 + ...I.IOrthogonalClient.ProxyX402PathPut5.g.cs | 19 - .../ScrapeGraphAI.IOrthogonalClient.g.cs | 5 + ...CreateScheduledJobV1ScheduledJobsPost.g.cs | 4 + ...cheduledJobV1ScheduledJobsJobIdDelete.g.cs | 2 + ....FetchScheduledJobsV1ScheduledJobsGet.g.cs | 2 + ...ionsV1ScheduledJobsJobIdExecutionsGet.g.cs | 2 + ...etScheduledJobV1ScheduledJobsJobIdGet.g.cs | 2 + ...duledJobV1ScheduledJobsJobIdPausePost.g.cs | 2 + ...ceScheduledJobV1ScheduledJobsJobIdPut.g.cs | 4 + ...uledJobV1ScheduledJobsJobIdResumePost.g.cs | 2 + ...nuallyV1ScheduledJobsJobIdTriggerPost.g.cs | 2 + ...ScheduledJobV1ScheduledJobsJobIdPatch.g.cs | 4 + .../ScrapeGraphAI.IScheduledJobsClient.g.cs | 5 + ...emaStatusV1GenerateSchemaRequestIdGet.g.cs | 2 + ...artGenerateSchemaV1GenerateSchemaPost.g.cs | 4 + .../ScrapeGraphAI.ISchemaGeneratorClient.g.cs | 5 + ...phAI.IScrapeClient.ScrapeV1ScrapePost.g.cs | 4 + .../ScrapeGraphAI.IScrapeClient.g.cs | 5 + .../ScrapeGraphAI.IScrapeGraphAIClient.g.cs | 5 + ...aperStatusV1SearchscraperRequestIdGet.g.cs | 2 + ...StartSearchscraperV1SearchscraperPost.g.cs | 4 + .../ScrapeGraphAI.ISearchScraperClient.g.cs | 5 + ...lient.CreateMonitorV1SiteMonitorsPost.g.cs | 4 + ...eMonitorV1SiteMonitorsMonitorIdDelete.g.cs | 2 + ....GetMonitorV1SiteMonitorsMonitorIdGet.g.cs | 2 + ...sClient.ListMonitorsV1SiteMonitorsGet.g.cs | 2 + ...teMonitorV1SiteMonitorsMonitorIdPatch.g.cs | 4 + .../ScrapeGraphAI.ISiteMonitorsClient.g.cs | 5 + ...apClient.GenerateSitemapV1SitemapPost.g.cs | 4 + .../ScrapeGraphAI.ISitemapClient.g.cs | 5 + ...raperStatusV1SmartscraperRequestIdGet.g.cs | 2 + ...t.StartSmartscraperV1SmartscraperPost.g.cs | 4 + .../ScrapeGraphAI.ISmartScraperClient.g.cs | 5 + ...I.IToonifyClient.ToonifyV1ToonifyPost.g.cs | 4 + .../ScrapeGraphAI.IToonifyClient.g.cs | 5 + ...nt.GetUsageTimelineV1UsageTimelineGet.g.cs | 2 + .../Generated/ScrapeGraphAI.IUsageClient.g.cs | 5 + ...ient.DeductCreditsV1DeductCreditsPost.g.cs | 4 + ...AI.IUserClient.GetCreditsV1CreditsGet.g.cs | 2 + ...erClient.SubmitFeedbackV1FeedbackPost.g.cs | 4 + ...tProductFeedbackV1ProductFeedbackPost.g.cs | 4 + ...serClient.ValidateApiKeyV1ValidateGet.g.cs | 2 + .../Generated/ScrapeGraphAI.IUserClient.g.cs | 5 + ...ownifyStatusV1MarkdownifyRequestIdGet.g.cs | 429 +++++++++++----- ...ent.StartMarkdownifyV1MarkdownifyPost.g.cs | 454 ++++++++++++----- .../ScrapeGraphAI.MarkdownifyClient.g.cs | 29 ++ ...odels.ProxyX402PathPostResponse.Json.g.cs} | 22 +- ...hAI.Models.ProxyX402PathPostResponse.g.cs} | 2 +- ...dels.ProxyX402PathPostResponse2.Json.g.cs} | 22 +- ...AI.Models.ProxyX402PathPostResponse2.g.cs} | 2 +- ...dels.ProxyX402PathPostResponse3.Json.g.cs} | 22 +- ...AI.Models.ProxyX402PathPostResponse3.g.cs} | 2 +- ...dels.ProxyX402PathPostResponse4.Json.g.cs} | 22 +- ...AI.Models.ProxyX402PathPostResponse4.g.cs} | 2 +- ...dels.ProxyX402PathPostResponse5.Json.g.cs} | 22 +- ...hAI.Models.ProxyX402PathPostResponse5.g.cs | 18 + ...phAI.Models.ProxyX402PathPutResponse5.g.cs | 18 - .../ScrapeGraphAI.Models.ScrapeRequestDB.g.cs | 4 +- .../ScrapeGraphAI.OptionsSupport.g.cs | 460 +++++++++++++++++ ...AI.OrthogonalClient.ProxyX402PathPost.g.cs | 417 ++++++++++++++++ ...I.OrthogonalClient.ProxyX402PathPost2.g.cs | 417 ++++++++++++++++ ...I.OrthogonalClient.ProxyX402PathPost3.g.cs | 417 ++++++++++++++++ ...I.OrthogonalClient.ProxyX402PathPost4.g.cs | 417 ++++++++++++++++ ...I.OrthogonalClient.ProxyX402PathPost5.g.cs | 417 ++++++++++++++++ ...hAI.OrthogonalClient.ProxyX402PathPut.g.cs | 234 --------- ...AI.OrthogonalClient.ProxyX402PathPut2.g.cs | 234 --------- ...AI.OrthogonalClient.ProxyX402PathPut3.g.cs | 234 --------- ...AI.OrthogonalClient.ProxyX402PathPut4.g.cs | 234 --------- ...AI.OrthogonalClient.ProxyX402PathPut5.g.cs | 234 --------- .../ScrapeGraphAI.OrthogonalClient.g.cs | 29 ++ .../Generated/ScrapeGraphAI.PathBuilder.g.cs | 5 + ...CreateScheduledJobV1ScheduledJobsPost.g.cs | 454 ++++++++++++----- ...cheduledJobV1ScheduledJobsJobIdDelete.g.cs | 429 +++++++++++----- ....FetchScheduledJobsV1ScheduledJobsGet.g.cs | 455 ++++++++++++----- ...ionsV1ScheduledJobsJobIdExecutionsGet.g.cs | 453 ++++++++++++----- ...etScheduledJobV1ScheduledJobsJobIdGet.g.cs | 437 +++++++++++----- ...duledJobV1ScheduledJobsJobIdPausePost.g.cs | 429 +++++++++++----- ...ceScheduledJobV1ScheduledJobsJobIdPut.g.cs | 456 ++++++++++++----- ...uledJobV1ScheduledJobsJobIdResumePost.g.cs | 429 +++++++++++----- ...nuallyV1ScheduledJobsJobIdTriggerPost.g.cs | 437 +++++++++++----- ...ScheduledJobV1ScheduledJobsJobIdPatch.g.cs | 456 ++++++++++++----- .../ScrapeGraphAI.ScheduledJobsClient.g.cs | 29 ++ ...emaStatusV1GenerateSchemaRequestIdGet.g.cs | 429 +++++++++++----- ...artGenerateSchemaV1GenerateSchemaPost.g.cs | 454 ++++++++++++----- .../ScrapeGraphAI.SchemaGeneratorClient.g.cs | 29 ++ ...aphAI.ScrapeClient.ScrapeV1ScrapePost.g.cs | 446 ++++++++++++----- .../Generated/ScrapeGraphAI.ScrapeClient.g.cs | 29 ++ ...IClient.Authorizations.ApiKeyInHeader.g.cs | 1 + .../ScrapeGraphAI.ScrapeGraphAIClient.g.cs | 65 ++- ...aperStatusV1SearchscraperRequestIdGet.g.cs | 429 +++++++++++----- ...StartSearchscraperV1SearchscraperPost.g.cs | 454 ++++++++++++----- .../ScrapeGraphAI.SearchScraperClient.g.cs | 29 ++ .../Generated/ScrapeGraphAI.Security.g.cs | 15 +- ...lient.CreateMonitorV1SiteMonitorsPost.g.cs | 454 ++++++++++++----- ...eMonitorV1SiteMonitorsMonitorIdDelete.g.cs | 429 +++++++++++----- ....GetMonitorV1SiteMonitorsMonitorIdGet.g.cs | 437 +++++++++++----- ...sClient.ListMonitorsV1SiteMonitorsGet.g.cs | 451 ++++++++++++----- ...teMonitorV1SiteMonitorsMonitorIdPatch.g.cs | 456 ++++++++++++----- .../ScrapeGraphAI.SiteMonitorsClient.g.cs | 29 ++ ...apClient.GenerateSitemapV1SitemapPost.g.cs | 454 ++++++++++++----- .../ScrapeGraphAI.SitemapClient.g.cs | 29 ++ ...raperStatusV1SmartscraperRequestIdGet.g.cs | 429 +++++++++++----- ...t.StartSmartscraperV1SmartscraperPost.g.cs | 454 ++++++++++++----- .../ScrapeGraphAI.SmartScraperClient.g.cs | 29 ++ ...AI.ToonifyClient.ToonifyV1ToonifyPost.g.cs | 446 ++++++++++++----- .../ScrapeGraphAI.ToonifyClient.g.cs | 29 ++ ...nt.GetUsageTimelineV1UsageTimelineGet.g.cs | 443 ++++++++++++----- .../Generated/ScrapeGraphAI.UsageClient.g.cs | 29 ++ ...ient.DeductCreditsV1DeductCreditsPost.g.cs | 454 ++++++++++++----- ...hAI.UserClient.GetCreditsV1CreditsGet.g.cs | 377 ++++++++++---- ...erClient.SubmitFeedbackV1FeedbackPost.g.cs | 454 ++++++++++++----- ...tProductFeedbackV1ProductFeedbackPost.g.cs | 454 ++++++++++++----- ...serClient.ValidateApiKeyV1ValidateGet.g.cs | 369 ++++++++++---- .../Generated/ScrapeGraphAI.UserClient.g.cs | 29 ++ src/libs/ScrapeGraphAI/openapi.yaml | 2 +- 179 files changed, 20398 insertions(+), 8203 deletions(-) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut.g.cs => ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost.g.cs} (74%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut2.g.cs => ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost2.g.cs} (74%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut3.g.cs => ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost3.g.cs} (74%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut4.g.cs => ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost4.g.cs} (74%) create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost5.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut5.g.cs rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse5.Json.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse.Json.g.cs} (86%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse4.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse.g.cs} (89%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse.Json.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse2.Json.g.cs} (86%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse2.g.cs} (89%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse2.Json.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse3.Json.g.cs} (86%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse2.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse3.g.cs} (89%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse3.Json.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse4.Json.g.cs} (86%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse3.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse4.g.cs} (89%) rename src/libs/ScrapeGraphAI/Generated/{ScrapeGraphAI.Models.ProxyX402PathPutResponse4.Json.g.cs => ScrapeGraphAI.Models.ProxyX402PathPostResponse5.Json.g.cs} (86%) create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OptionsSupport.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost2.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost3.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost4.g.cs create mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost5.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut2.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut3.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut4.g.cs delete mode 100644 src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut5.g.cs diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs index 110f02f..972848e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs @@ -14,6 +14,7 @@ public partial class AdminClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostR /// Query Redis Cache By Pattern /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync( global::ScrapeGraphAI.QueryRedisCacheByPatternRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostR securityRequirements: s_QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostSecurityRequirements, operationName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/admin/query_redis_cache_by_pattern", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/admin/query_redis_cache_by_pattern", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,152 +114,311 @@ partial void ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostR __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost", + methodName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync", + pathTemplate: "\"/v1/admin/query_redis_cache_by_pattern\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost", + methodName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync", + pathTemplate: "\"/v1/admin/query_redis_cache_by_pattern\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost", + methodName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync", + pathTemplate: "\"/v1/admin/query_redis_cache_by_pattern\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostResponseContent( + response: __response); + ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost", + methodName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync", + pathTemplate: "\"/v1/admin/query_redis_cache_by_pattern\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost", + methodName: "QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync", + pathTemplate: "\"/v1/admin/query_redis_cache_by_pattern\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Query Redis Cache By Pattern @@ -249,12 +432,14 @@ partial void ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostR /// /// Default Value: providers_order:* /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync( int? cursor = default, int? pageSize = default, string? pattern = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.QueryRedisCacheByPatternRequest @@ -266,6 +451,7 @@ partial void ProcessQueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostR return await QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.g.cs index 1730114..7fccdb1 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AdminClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class AdminClient : global::ScrapeGraphAI.IAdminClient, gl #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public AdminClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the AdminClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public AdminClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs index 085c32b..9cc79ab 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs @@ -14,6 +14,7 @@ public partial class AgenticScrapperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( /// Agentic Browser V2 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task AgenticBrowserV2V1WorkflowsExecutePostAsync( global::ScrapeGraphAI.WorkflowDefinition request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( securityRequirements: s_AgenticBrowserV2V1WorkflowsExecutePostSecurityRequirements, operationName: "AgenticBrowserV2V1WorkflowsExecutePostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/workflows/execute", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/workflows/execute", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareAgenticBrowserV2V1WorkflowsExecutePostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareAgenticBrowserV2V1WorkflowsExecutePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessAgenticBrowserV2V1WorkflowsExecutePostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticBrowserV2V1WorkflowsExecutePost", + methodName: "AgenticBrowserV2V1WorkflowsExecutePostAsync", + pathTemplate: "\"/v1/workflows/execute\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticBrowserV2V1WorkflowsExecutePost", + methodName: "AgenticBrowserV2V1WorkflowsExecutePostAsync", + pathTemplate: "\"/v1/workflows/execute\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticBrowserV2V1WorkflowsExecutePost", + methodName: "AgenticBrowserV2V1WorkflowsExecutePostAsync", + pathTemplate: "\"/v1/workflows/execute\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( + response: __response); + ProcessAgenticBrowserV2V1WorkflowsExecutePostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.WorkflowExecutionResult.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticBrowserV2V1WorkflowsExecutePost", + methodName: "AgenticBrowserV2V1WorkflowsExecutePostAsync", + pathTemplate: "\"/v1/workflows/execute\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticBrowserV2V1WorkflowsExecutePost", + methodName: "AgenticBrowserV2V1WorkflowsExecutePostAsync", + pathTemplate: "\"/v1/workflows/execute\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.WorkflowExecutionResult.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.WorkflowExecutionResult.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.WorkflowExecutionResult.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Agentic Browser V2 @@ -269,6 +452,7 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( /// /// List of variables to include in final output /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task AgenticBrowserV2V1WorkflowsExecutePostAsync( @@ -280,6 +464,7 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( bool? useSession = default, object? initialContext = default, global::System.Collections.Generic.IList? outputVariables = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.WorkflowDefinition @@ -296,6 +481,7 @@ partial void ProcessAgenticBrowserV2V1WorkflowsExecutePostResponseContent( return await AgenticBrowserV2V1WorkflowsExecutePostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs index c0f1eac..5945d41 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs @@ -14,6 +14,7 @@ public partial class AgenticScrapperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( /// Agentic Scrapper /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task AgenticScrapperV1AgenticScrapperPostAsync( global::ScrapeGraphAI.AgenticScrapperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( securityRequirements: s_AgenticScrapperV1AgenticScrapperPostSecurityRequirements, operationName: "AgenticScrapperV1AgenticScrapperPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/agentic-scrapper", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/agentic-scrapper", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareAgenticScrapperV1AgenticScrapperPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareAgenticScrapperV1AgenticScrapperPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessAgenticScrapperV1AgenticScrapperPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticScrapperV1AgenticScrapperPost", + methodName: "AgenticScrapperV1AgenticScrapperPostAsync", + pathTemplate: "\"/v1/agentic-scrapper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticScrapperV1AgenticScrapperPost", + methodName: "AgenticScrapperV1AgenticScrapperPostAsync", + pathTemplate: "\"/v1/agentic-scrapper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticScrapperV1AgenticScrapperPost", + methodName: "AgenticScrapperV1AgenticScrapperPostAsync", + pathTemplate: "\"/v1/agentic-scrapper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( + response: __response); + ProcessAgenticScrapperV1AgenticScrapperPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.AgenticScrapperResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticScrapperV1AgenticScrapperPost", + methodName: "AgenticScrapperV1AgenticScrapperPostAsync", + pathTemplate: "\"/v1/agentic-scrapper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AgenticScrapperV1AgenticScrapperPost", + methodName: "AgenticScrapperV1AgenticScrapperPostAsync", + pathTemplate: "\"/v1/agentic-scrapper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.AgenticScrapperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.AgenticScrapperResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.AgenticScrapperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Agentic Scrapper @@ -271,6 +454,7 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( /// /// The country code to use for the scrape (e.g. US, GB) /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task AgenticScrapperV1AgenticScrapperPostAsync( @@ -283,6 +467,7 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( bool? stream = default, string? webhookUrl = default, string? countryCode = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.AgenticScrapperRequest @@ -300,6 +485,7 @@ partial void ProcessAgenticScrapperV1AgenticScrapperPostResponseContent( return await AgenticScrapperV1AgenticScrapperPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs index d3a2468..4bbbc84 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs @@ -14,6 +14,7 @@ public partial class AgenticScrapperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( /// Get Live Session Url /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetLiveSessionUrlV1GetLiveSessionUrlPostAsync( global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( securityRequirements: s_GetLiveSessionUrlV1GetLiveSessionUrlPostSecurityRequirements, operationName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/get-live-session-url", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/get-live-session-url", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetLiveSessionUrlV1GetLiveSessionUrlPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetLiveSessionUrlV1GetLiveSessionUrlPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetLiveSessionUrlV1GetLiveSessionUrlPost", + methodName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync", + pathTemplate: "\"/v1/get-live-session-url\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetLiveSessionUrlV1GetLiveSessionUrlPost", + methodName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync", + pathTemplate: "\"/v1/get-live-session-url\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetLiveSessionUrlV1GetLiveSessionUrlPost", + methodName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync", + pathTemplate: "\"/v1/get-live-session-url\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( + response: __response); + ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetLiveSessionUrlV1GetLiveSessionUrlPost", + methodName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync", + pathTemplate: "\"/v1/get-live-session-url\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetLiveSessionUrlV1GetLiveSessionUrlPost", + methodName: "GetLiveSessionUrlV1GetLiveSessionUrlPostAsync", + pathTemplate: "\"/v1/get-live-session-url\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Live Session Url @@ -249,11 +432,13 @@ partial void ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( /// Timeout for the live session
/// Default Value: 300 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetLiveSessionUrlV1GetLiveSessionUrlPostAsync( string url, int? timeout = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlRequest @@ -264,6 +449,7 @@ partial void ProcessGetLiveSessionUrlV1GetLiveSessionUrlPostResponseContent( return await GetLiveSessionUrlV1GetLiveSessionUrlPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.StopSessionV1StopSessionPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.StopSessionV1StopSessionPost.g.cs index 015fd1d..4dabde2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.StopSessionV1StopSessionPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.StopSessionV1StopSessionPost.g.cs @@ -14,6 +14,7 @@ public partial class AgenticScrapperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessStopSessionV1StopSessionPostResponseContent( /// Stop Session ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StopSessionV1StopSessionPostAsync( global::ScrapeGraphAI.AgenticScrapperStopSessionRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessStopSessionV1StopSessionPostResponseContent( securityRequirements: s_StopSessionV1StopSessionPostSecurityRequirements, operationName: "StopSessionV1StopSessionPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/stop-session", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/stop-session", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,161 +114,322 @@ partial void ProcessStopSessionV1StopSessionPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStopSessionV1StopSessionPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStopSessionV1StopSessionPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStopSessionV1StopSessionPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StopSessionV1StopSessionPost", + methodName: "StopSessionV1StopSessionPostAsync", + pathTemplate: "\"/v1/stop-session\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StopSessionV1StopSessionPost", + methodName: "StopSessionV1StopSessionPostAsync", + pathTemplate: "\"/v1/stop-session\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StopSessionV1StopSessionPost", + methodName: "StopSessionV1StopSessionPostAsync", + pathTemplate: "\"/v1/stop-session\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStopSessionV1StopSessionPostResponseContent( + response: __response); + ProcessStopSessionV1StopSessionPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StopSessionV1StopSessionPost", + methodName: "StopSessionV1StopSessionPostAsync", + pathTemplate: "\"/v1/stop-session\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StopSessionV1StopSessionPost", + methodName: "StopSessionV1StopSessionPostAsync", + pathTemplate: "\"/v1/stop-session\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStopSessionV1StopSessionPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Stop Session /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StopSessionV1StopSessionPostAsync( string sessionId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.AgenticScrapperStopSessionRequest @@ -254,6 +439,7 @@ partial void ProcessStopSessionV1StopSessionPostResponseContent( return await StopSessionV1StopSessionPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.g.cs index 957c17f..1625578 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.AgenticScrapperClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class AgenticScrapperClient : global::ScrapeGraphAI.IAgent #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public AgenticScrapperClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the AgenticScrapperClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public AgenticScrapperClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs index 6116520..53f84a2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs @@ -14,6 +14,7 @@ public partial class CrawlerClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessGetCrawlResultV1CrawlTaskIdGetResponseContent( /// Get the result of a crawl job by task ID. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetCrawlResultV1CrawlTaskIdGetAsync( string taskId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessGetCrawlResultV1CrawlTaskIdGetResponseContent( securityRequirements: s_GetCrawlResultV1CrawlTaskIdGetSecurityRequirements, operationName: "GetCrawlResultV1CrawlTaskIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/crawl/{taskId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/crawl/{taskId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,146 +112,305 @@ partial void ProcessGetCrawlResultV1CrawlTaskIdGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetCrawlResultV1CrawlTaskIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - taskId: taskId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetCrawlResultV1CrawlTaskIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + taskId: taskId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetCrawlResultV1CrawlTaskIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlResultV1CrawlTaskIdGet", + methodName: "GetCrawlResultV1CrawlTaskIdGetAsync", + pathTemplate: "$\"/v1/crawl/{taskId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlResultV1CrawlTaskIdGet", + methodName: "GetCrawlResultV1CrawlTaskIdGetAsync", + pathTemplate: "$\"/v1/crawl/{taskId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlResultV1CrawlTaskIdGet", + methodName: "GetCrawlResultV1CrawlTaskIdGetAsync", + pathTemplate: "$\"/v1/crawl/{taskId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetCrawlResultV1CrawlTaskIdGetResponseContent( + response: __response); + ProcessGetCrawlResultV1CrawlTaskIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlResultV1CrawlTaskIdGet", + methodName: "GetCrawlResultV1CrawlTaskIdGetAsync", + pathTemplate: "$\"/v1/crawl/{taskId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlResultV1CrawlTaskIdGet", + methodName: "GetCrawlResultV1CrawlTaskIdGetAsync", + pathTemplate: "$\"/v1/crawl/{taskId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetCrawlResultV1CrawlTaskIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs index 6aba3b8..5cfb123 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs @@ -14,6 +14,7 @@ public partial class CrawlerClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponseContent( /// Get webhook delivery logs for a crawler job. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync( string crawlerId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponseContent( securityRequirements: s_GetWebhookLogsV1WebhookLogsCrawlerIdGetSecurityRequirements, operationName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/webhook/logs/{crawlerId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/webhook/logs/{crawlerId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,146 +112,305 @@ partial void ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetWebhookLogsV1WebhookLogsCrawlerIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - crawlerId: crawlerId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetWebhookLogsV1WebhookLogsCrawlerIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + crawlerId: crawlerId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookLogsV1WebhookLogsCrawlerIdGet", + methodName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync", + pathTemplate: "$\"/v1/webhook/logs/{crawlerId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookLogsV1WebhookLogsCrawlerIdGet", + methodName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync", + pathTemplate: "$\"/v1/webhook/logs/{crawlerId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookLogsV1WebhookLogsCrawlerIdGet", + methodName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync", + pathTemplate: "$\"/v1/webhook/logs/{crawlerId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponseContent( + response: __response); + ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookLogsV1WebhookLogsCrawlerIdGet", + methodName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync", + pathTemplate: "$\"/v1/webhook/logs/{crawlerId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookLogsV1WebhookLogsCrawlerIdGet", + methodName: "GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync", + pathTemplate: "$\"/v1/webhook/logs/{crawlerId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetWebhookLogsV1WebhookLogsCrawlerIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs index b79a038..d6aa581 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs @@ -14,6 +14,7 @@ public partial class CrawlerClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponseContent( /// Get status of a specific webhook delivery. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetWebhookStatusV1WebhookStatusWebhookIdGetAsync( string webhookId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponseContent( securityRequirements: s_GetWebhookStatusV1WebhookStatusWebhookIdGetSecurityRequirements, operationName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/webhook/status/{webhookId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/webhook/status/{webhookId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,146 +112,305 @@ partial void ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetWebhookStatusV1WebhookStatusWebhookIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - webhookId: webhookId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetWebhookStatusV1WebhookStatusWebhookIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookId: webhookId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookStatusV1WebhookStatusWebhookIdGet", + methodName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync", + pathTemplate: "$\"/v1/webhook/status/{webhookId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookStatusV1WebhookStatusWebhookIdGet", + methodName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync", + pathTemplate: "$\"/v1/webhook/status/{webhookId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookStatusV1WebhookStatusWebhookIdGet", + methodName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync", + pathTemplate: "$\"/v1/webhook/status/{webhookId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponseContent( + response: __response); + ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookStatusV1WebhookStatusWebhookIdGet", + methodName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync", + pathTemplate: "$\"/v1/webhook/status/{webhookId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookStatusV1WebhookStatusWebhookIdGet", + methodName: "GetWebhookStatusV1WebhookStatusWebhookIdGetAsync", + pathTemplate: "$\"/v1/webhook/status/{webhookId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetWebhookStatusV1WebhookStatusWebhookIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.StartCrawlV1CrawlPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.StartCrawlV1CrawlPost.g.cs index a39e31d..c775887 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.StartCrawlV1CrawlPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.StartCrawlV1CrawlPost.g.cs @@ -14,6 +14,7 @@ public partial class CrawlerClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,11 +46,13 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( /// Start a new crawl job. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartCrawlV1CrawlPostAsync( global::ScrapeGraphAI.CrawlJob request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -66,22 +69,43 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( securityRequirements: s_StartCrawlV1CrawlPostSecurityRequirements, operationName: "StartCrawlV1CrawlPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/crawl", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/crawl", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -91,152 +115,311 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStartCrawlV1CrawlPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStartCrawlV1CrawlPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStartCrawlV1CrawlPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartCrawlV1CrawlPost", + methodName: "StartCrawlV1CrawlPostAsync", + pathTemplate: "\"/v1/crawl\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartCrawlV1CrawlPost", + methodName: "StartCrawlV1CrawlPostAsync", + pathTemplate: "\"/v1/crawl\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartCrawlV1CrawlPost", + methodName: "StartCrawlV1CrawlPostAsync", + pathTemplate: "\"/v1/crawl\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStartCrawlV1CrawlPostResponseContent( + response: __response); + ProcessStartCrawlV1CrawlPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartCrawlV1CrawlPost", + methodName: "StartCrawlV1CrawlPostAsync", + pathTemplate: "\"/v1/crawl\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartCrawlV1CrawlPost", + methodName: "StartCrawlV1CrawlPostAsync", + pathTemplate: "\"/v1/crawl\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStartCrawlV1CrawlPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Start Crawl
@@ -283,6 +466,7 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( /// /// The country code to use for fetching (e.g. US, GB) /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartCrawlV1CrawlPostAsync( @@ -302,6 +486,7 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( bool? readerMode = default, int? waitMs = default, string? countryCode = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.CrawlJob @@ -326,6 +511,7 @@ partial void ProcessStartCrawlV1CrawlPostResponseContent( return await StartCrawlV1CrawlPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.g.cs index d774afe..2c7f3d0 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.CrawlerClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class CrawlerClient : global::ScrapeGraphAI.ICrawlerClient #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public CrawlerClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the CrawlerClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public CrawlerClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs index 0e8c5c8..6fae8c7 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs @@ -14,6 +14,7 @@ public partial class EndpointPocClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -50,6 +51,7 @@ partial void ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseConte /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync( @@ -57,6 +59,7 @@ partial void ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseConte string fullPath, object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -75,22 +78,43 @@ partial void ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseConte securityRequirements: s_ExecuteEndpointV1EndpointEndpointIdFullPathPostSecurityRequirements, operationName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/endpoint/{endpointId}/{fullPath}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/endpoint/{endpointId}/{fullPath}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -100,165 +124,326 @@ partial void ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseConte __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareExecuteEndpointV1EndpointEndpointIdFullPathPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - endpointId: endpointId, - fullPath: fullPath, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareExecuteEndpointV1EndpointEndpointIdFullPathPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + endpointId: endpointId, + fullPath: fullPath, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ExecuteEndpointV1EndpointEndpointIdFullPathPost", + methodName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync", + pathTemplate: "$\"/v1/endpoint/{endpointId}/{fullPath}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ExecuteEndpointV1EndpointEndpointIdFullPathPost", + methodName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync", + pathTemplate: "$\"/v1/endpoint/{endpointId}/{fullPath}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ExecuteEndpointV1EndpointEndpointIdFullPathPost", + methodName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync", + pathTemplate: "$\"/v1/endpoint/{endpointId}/{fullPath}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseContent( + response: __response); + ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ExecuteEndpointV1EndpointEndpointIdFullPathPost", + methodName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync", + pathTemplate: "$\"/v1/endpoint/{endpointId}/{fullPath}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ExecuteEndpointV1EndpointEndpointIdFullPathPost", + methodName: "ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync", + pathTemplate: "$\"/v1/endpoint/{endpointId}/{fullPath}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Execute Endpoint /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync( string endpointId, string fullPath, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -269,6 +454,7 @@ partial void ProcessExecuteEndpointV1EndpointEndpointIdFullPathPostResponseConte endpointId: endpointId, fullPath: fullPath, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs index fd45ad8..89cee61 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs @@ -14,6 +14,7 @@ public partial class EndpointPocClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -41,9 +42,11 @@ partial void ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponse /// /// Get Sales Feed Items Details /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -57,22 +60,43 @@ partial void ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponse securityRequirements: s_GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostSecurityRequirements, operationName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/bandcamp/get-item-details/", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/bandcamp/get-item-details/", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -82,107 +106,266 @@ partial void ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponse __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); + return __httpRequest; + } - if (ReadResponseAsString) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost", + methodName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-item-details/\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost", + methodName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-item-details/\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - try - { - __response.EnsureSuccessStatusCode(); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost", + methodName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-item-details/\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - return __content; + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - throw new global::ScrapeGraphAI.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), - }; + throw new global::System.InvalidOperationException("No response received."); } - } - else - { - try + + using (__response) { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - return __content; + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost", + methodName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-item-details/\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost", + methodName: "GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-item-details/\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs index 1333bd8..cd661b9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs @@ -14,6 +14,7 @@ public partial class EndpointPocClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -41,9 +42,11 @@ partial void ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponseCont /// /// Get Sales Feed Items /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -57,22 +60,43 @@ partial void ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponseCont securityRequirements: s_GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostSecurityRequirements, operationName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/bandcamp/get-sales-feed-items", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/bandcamp/get-sales-feed-items", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -82,107 +106,266 @@ partial void ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponseCont __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); + return __httpRequest; + } - if (ReadResponseAsString) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost", + methodName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-sales-feed-items\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost", + methodName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-sales-feed-items\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - try - { - __response.EnsureSuccessStatusCode(); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost", + methodName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-sales-feed-items\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - return __content; + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - throw new global::ScrapeGraphAI.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), - }; + throw new global::System.InvalidOperationException("No response received."); } - } - else - { - try + + using (__response) { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - return __content; + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost", + methodName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-sales-feed-items\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost", + methodName: "GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync", + pathTemplate: "\"/v1/bandcamp/get-sales-feed-items\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSalesFeedItemsV1BandcampGetSalesFeedItemsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs index 6854e35..1b86de4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs @@ -14,6 +14,7 @@ public partial class EndpointPocClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( /// Get Suggestions ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSuggestionsV1EndpointGetSuggestionsPostAsync( global::ScrapeGraphAI.EndPointSuggestionRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( securityRequirements: s_GetSuggestionsV1EndpointGetSuggestionsPostSecurityRequirements, operationName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/endpoint/get-suggestions", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/endpoint/get-suggestions", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,167 +114,328 @@ partial void ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSuggestionsV1EndpointGetSuggestionsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSuggestionsV1EndpointGetSuggestionsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSuggestionsV1EndpointGetSuggestionsPost", + methodName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync", + pathTemplate: "\"/v1/endpoint/get-suggestions\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSuggestionsV1EndpointGetSuggestionsPost", + methodName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync", + pathTemplate: "\"/v1/endpoint/get-suggestions\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSuggestionsV1EndpointGetSuggestionsPost", + methodName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync", + pathTemplate: "\"/v1/endpoint/get-suggestions\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( + response: __response); + ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.EndPointSuggestionsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSuggestionsV1EndpointGetSuggestionsPost", + methodName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync", + pathTemplate: "\"/v1/endpoint/get-suggestions\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSuggestionsV1EndpointGetSuggestionsPost", + methodName: "GetSuggestionsV1EndpointGetSuggestionsPostAsync", + pathTemplate: "\"/v1/endpoint/get-suggestions\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.EndPointSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.EndPointSuggestionsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.EndPointSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Suggestions /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSuggestionsV1EndpointGetSuggestionsPostAsync( string websiteUrl, string prompt, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.EndPointSuggestionRequest @@ -261,6 +446,7 @@ partial void ProcessGetSuggestionsV1EndpointGetSuggestionsPostResponseContent( return await GetSuggestionsV1EndpointGetSuggestionsPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs index 7072b0d..94c141c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs @@ -14,6 +14,7 @@ public partial class EndpointPocClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( /// Save Endpoint /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SaveEndpointV1EndpointSaveEndpointPostAsync( global::ScrapeGraphAI.EndPointSuggestions request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( securityRequirements: s_SaveEndpointV1EndpointSaveEndpointPostSecurityRequirements, operationName: "SaveEndpointV1EndpointSaveEndpointPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/endpoint/save-endpoint", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/endpoint/save-endpoint", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,161 +114,322 @@ partial void ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareSaveEndpointV1EndpointSaveEndpointPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSaveEndpointV1EndpointSaveEndpointPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessSaveEndpointV1EndpointSaveEndpointPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SaveEndpointV1EndpointSaveEndpointPost", + methodName: "SaveEndpointV1EndpointSaveEndpointPostAsync", + pathTemplate: "\"/v1/endpoint/save-endpoint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SaveEndpointV1EndpointSaveEndpointPost", + methodName: "SaveEndpointV1EndpointSaveEndpointPostAsync", + pathTemplate: "\"/v1/endpoint/save-endpoint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SaveEndpointV1EndpointSaveEndpointPost", + methodName: "SaveEndpointV1EndpointSaveEndpointPostAsync", + pathTemplate: "\"/v1/endpoint/save-endpoint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( + response: __response); + ProcessSaveEndpointV1EndpointSaveEndpointPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SaveEndpointV1EndpointSaveEndpointPost", + methodName: "SaveEndpointV1EndpointSaveEndpointPostAsync", + pathTemplate: "\"/v1/endpoint/save-endpoint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SaveEndpointV1EndpointSaveEndpointPost", + methodName: "SaveEndpointV1EndpointSaveEndpointPostAsync", + pathTemplate: "\"/v1/endpoint/save-endpoint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Save Endpoint /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SaveEndpointV1EndpointSaveEndpointPostAsync( global::System.Collections.Generic.IList suggestions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.EndPointSuggestions @@ -254,6 +439,7 @@ partial void ProcessSaveEndpointV1EndpointSaveEndpointPostResponseContent( return await SaveEndpointV1EndpointSaveEndpointPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.g.cs index 6a29f61..472db86 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.EndpointPocClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class EndpointPocClient : global::ScrapeGraphAI.IEndpointP #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public EndpointPocClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the EndpointPocClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public EndpointPocClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.HealthCheckHealthzGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.HealthCheckHealthzGet.g.cs index 59f5436..54dfba7 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.HealthCheckHealthzGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.HealthCheckHealthzGet.g.cs @@ -14,6 +14,7 @@ public partial class HealthClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -42,9 +43,11 @@ partial void ProcessHealthCheckHealthzGetResponseContent( /// Health Check
/// Health check endpoint that includes memory monitoring /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task HealthCheckHealthzGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -58,22 +61,43 @@ partial void ProcessHealthCheckHealthzGetResponseContent( securityRequirements: s_HealthCheckHealthzGetSecurityRequirements, operationName: "HealthCheckHealthzGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/healthz", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/healthz", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -83,107 +107,266 @@ partial void ProcessHealthCheckHealthzGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareHealthCheckHealthzGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareHealthCheckHealthzGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessHealthCheckHealthzGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); + return __httpRequest; + } - if (ReadResponseAsString) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "HealthCheckHealthzGet", + methodName: "HealthCheckHealthzGetAsync", + pathTemplate: "\"/healthz\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "HealthCheckHealthzGet", + methodName: "HealthCheckHealthzGetAsync", + pathTemplate: "\"/healthz\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessHealthCheckHealthzGetResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - try - { - __response.EnsureSuccessStatusCode(); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "HealthCheckHealthzGet", + methodName: "HealthCheckHealthzGetAsync", + pathTemplate: "\"/healthz\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - return __content; + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - throw new global::ScrapeGraphAI.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), - }; + throw new global::System.InvalidOperationException("No response received."); } - } - else - { - try + + using (__response) { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - return __content; + ProcessResponse( + client: HttpClient, + response: __response); + ProcessHealthCheckHealthzGetResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "HealthCheckHealthzGet", + methodName: "HealthCheckHealthzGetAsync", + pathTemplate: "\"/healthz\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "HealthCheckHealthzGet", + methodName: "HealthCheckHealthzGetAsync", + pathTemplate: "\"/healthz\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessHealthCheckHealthzGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.g.cs index dcfebbd..1876c4d 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HealthClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class HealthClient : global::ScrapeGraphAI.IHealthClient, #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public HealthClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the HealthClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public HealthClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs index 96a9053..bf44501 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -62,6 +63,7 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync( @@ -69,6 +71,7 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -87,26 +90,47 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo securityRequirements: s_GetAgenticScraperHistoryV1HistoryAgenticScraperGetSecurityRequirements, operationName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/agentic-scraper", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/agentic-scraper", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -116,158 +140,317 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetAgenticScraperHistoryV1HistoryAgenticScraperGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetAgenticScraperHistoryV1HistoryAgenticScraperGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetAgenticScraperHistoryV1HistoryAgenticScraperGet", + methodName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync", + pathTemplate: "\"/v1/history/agentic-scraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetAgenticScraperHistoryV1HistoryAgenticScraperGet", + methodName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync", + pathTemplate: "\"/v1/history/agentic-scraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetAgenticScraperHistoryV1HistoryAgenticScraperGet", + methodName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync", + pathTemplate: "\"/v1/history/agentic-scraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseContent( + response: __response); + ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.AgenticScraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetAgenticScraperHistoryV1HistoryAgenticScraperGet", + methodName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync", + pathTemplate: "\"/v1/history/agentic-scraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetAgenticScraperHistoryV1HistoryAgenticScraperGet", + methodName: "GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync", + pathTemplate: "\"/v1/history/agentic-scraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.AgenticScraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.AgenticScraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.AgenticScraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Agentic Scraper History
@@ -286,11 +469,13 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -301,6 +486,7 @@ partial void ProcessGetAgenticScraperHistoryV1HistoryAgenticScraperGetResponseCo page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs index 9869bc9..0dcbb6f 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -61,6 +62,7 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetCrawlerHistoryV1HistoryCrawlGetAsync( @@ -68,6 +70,7 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -86,26 +89,47 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( securityRequirements: s_GetCrawlerHistoryV1HistoryCrawlGetSecurityRequirements, operationName: "GetCrawlerHistoryV1HistoryCrawlGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/crawl", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/crawl", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -115,158 +139,317 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetCrawlerHistoryV1HistoryCrawlGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetCrawlerHistoryV1HistoryCrawlGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetCrawlerHistoryV1HistoryCrawlGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlerHistoryV1HistoryCrawlGet", + methodName: "GetCrawlerHistoryV1HistoryCrawlGetAsync", + pathTemplate: "\"/v1/history/crawl\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlerHistoryV1HistoryCrawlGet", + methodName: "GetCrawlerHistoryV1HistoryCrawlGetAsync", + pathTemplate: "\"/v1/history/crawl\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlerHistoryV1HistoryCrawlGet", + methodName: "GetCrawlerHistoryV1HistoryCrawlGetAsync", + pathTemplate: "\"/v1/history/crawl\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( + response: __response); + ProcessGetCrawlerHistoryV1HistoryCrawlGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.CrawlerHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlerHistoryV1HistoryCrawlGet", + methodName: "GetCrawlerHistoryV1HistoryCrawlGetAsync", + pathTemplate: "\"/v1/history/crawl\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCrawlerHistoryV1HistoryCrawlGet", + methodName: "GetCrawlerHistoryV1HistoryCrawlGetAsync", + pathTemplate: "\"/v1/history/crawl\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.CrawlerHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.CrawlerHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.CrawlerHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Crawler History
@@ -284,11 +467,13 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetCrawlerHistoryV1HistoryCrawlGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -299,6 +484,7 @@ partial void ProcessGetCrawlerHistoryV1HistoryCrawlGetResponseContent( page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs index 04501e1..e76d7c8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -61,6 +62,7 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync( @@ -68,6 +70,7 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -86,26 +89,47 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( securityRequirements: s_GetMarkdownifyHistoryV1HistoryMarkdownifyGetSecurityRequirements, operationName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/markdownify", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/markdownify", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -115,158 +139,317 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetMarkdownifyHistoryV1HistoryMarkdownifyGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetMarkdownifyHistoryV1HistoryMarkdownifyGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyHistoryV1HistoryMarkdownifyGet", + methodName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync", + pathTemplate: "\"/v1/history/markdownify\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyHistoryV1HistoryMarkdownifyGet", + methodName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync", + pathTemplate: "\"/v1/history/markdownify\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyHistoryV1HistoryMarkdownifyGet", + methodName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync", + pathTemplate: "\"/v1/history/markdownify\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( + response: __response); + ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.MarkdownifyHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyHistoryV1HistoryMarkdownifyGet", + methodName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync", + pathTemplate: "\"/v1/history/markdownify\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyHistoryV1HistoryMarkdownifyGet", + methodName: "GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync", + pathTemplate: "\"/v1/history/markdownify\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.MarkdownifyHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.MarkdownifyHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.MarkdownifyHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Markdownify History
@@ -284,11 +467,13 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -299,6 +484,7 @@ partial void ProcessGetMarkdownifyHistoryV1HistoryMarkdownifyGetResponseContent( page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs index 43f5e6e..7b97917 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -61,6 +62,7 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetScrapeHistoryV1HistoryScrapeGetAsync( @@ -68,6 +70,7 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -86,26 +89,47 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( securityRequirements: s_GetScrapeHistoryV1HistoryScrapeGetSecurityRequirements, operationName: "GetScrapeHistoryV1HistoryScrapeGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/scrape", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/scrape", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -115,158 +139,317 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetScrapeHistoryV1HistoryScrapeGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetScrapeHistoryV1HistoryScrapeGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetScrapeHistoryV1HistoryScrapeGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScrapeHistoryV1HistoryScrapeGet", + methodName: "GetScrapeHistoryV1HistoryScrapeGetAsync", + pathTemplate: "\"/v1/history/scrape\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScrapeHistoryV1HistoryScrapeGet", + methodName: "GetScrapeHistoryV1HistoryScrapeGetAsync", + pathTemplate: "\"/v1/history/scrape\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScrapeHistoryV1HistoryScrapeGet", + methodName: "GetScrapeHistoryV1HistoryScrapeGetAsync", + pathTemplate: "\"/v1/history/scrape\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( + response: __response); + ProcessGetScrapeHistoryV1HistoryScrapeGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScrapeHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScrapeHistoryV1HistoryScrapeGet", + methodName: "GetScrapeHistoryV1HistoryScrapeGetAsync", + pathTemplate: "\"/v1/history/scrape\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScrapeHistoryV1HistoryScrapeGet", + methodName: "GetScrapeHistoryV1HistoryScrapeGetAsync", + pathTemplate: "\"/v1/history/scrape\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScrapeHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScrapeHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScrapeHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Scrape History
@@ -284,11 +467,13 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetScrapeHistoryV1HistoryScrapeGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -299,6 +484,7 @@ partial void ProcessGetScrapeHistoryV1HistoryScrapeGetResponseContent( page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs index 125e5b3..8796c28 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -61,6 +62,7 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSearchscraperHistoryV1HistorySearchscraperGetAsync( @@ -68,6 +70,7 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -86,26 +89,47 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont securityRequirements: s_GetSearchscraperHistoryV1HistorySearchscraperGetSecurityRequirements, operationName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/searchscraper", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/searchscraper", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -115,158 +139,317 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSearchscraperHistoryV1HistorySearchscraperGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSearchscraperHistoryV1HistorySearchscraperGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperHistoryV1HistorySearchscraperGet", + methodName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync", + pathTemplate: "\"/v1/history/searchscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperHistoryV1HistorySearchscraperGet", + methodName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync", + pathTemplate: "\"/v1/history/searchscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperHistoryV1HistorySearchscraperGet", + methodName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync", + pathTemplate: "\"/v1/history/searchscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseContent( + response: __response); + ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SearchscraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperHistoryV1HistorySearchscraperGet", + methodName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync", + pathTemplate: "\"/v1/history/searchscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperHistoryV1HistorySearchscraperGet", + methodName: "GetSearchscraperHistoryV1HistorySearchscraperGetAsync", + pathTemplate: "\"/v1/history/searchscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SearchscraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SearchscraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SearchscraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Searchscraper History
@@ -284,11 +467,13 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSearchscraperHistoryV1HistorySearchscraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -299,6 +484,7 @@ partial void ProcessGetSearchscraperHistoryV1HistorySearchscraperGetResponseCont page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs index 8f3059b..28fee45 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -55,6 +56,7 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSitemapHistoryV1HistorySitemapGetAsync( @@ -62,6 +64,7 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -80,26 +83,47 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( securityRequirements: s_GetSitemapHistoryV1HistorySitemapGetSecurityRequirements, operationName: "GetSitemapHistoryV1HistorySitemapGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/sitemap", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/sitemap", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -109,158 +133,317 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSitemapHistoryV1HistorySitemapGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSitemapHistoryV1HistorySitemapGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSitemapHistoryV1HistorySitemapGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSitemapHistoryV1HistorySitemapGet", + methodName: "GetSitemapHistoryV1HistorySitemapGetAsync", + pathTemplate: "\"/v1/history/sitemap\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSitemapHistoryV1HistorySitemapGet", + methodName: "GetSitemapHistoryV1HistorySitemapGetAsync", + pathTemplate: "\"/v1/history/sitemap\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSitemapHistoryV1HistorySitemapGet", + methodName: "GetSitemapHistoryV1HistorySitemapGetAsync", + pathTemplate: "\"/v1/history/sitemap\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( + response: __response); + ProcessGetSitemapHistoryV1HistorySitemapGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SitemapHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSitemapHistoryV1HistorySitemapGet", + methodName: "GetSitemapHistoryV1HistorySitemapGetAsync", + pathTemplate: "\"/v1/history/sitemap\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSitemapHistoryV1HistorySitemapGet", + methodName: "GetSitemapHistoryV1HistorySitemapGetAsync", + pathTemplate: "\"/v1/history/sitemap\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SitemapHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SitemapHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SitemapHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Sitemap History
@@ -272,11 +455,13 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSitemapHistoryV1HistorySitemapGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -287,6 +472,7 @@ partial void ProcessGetSitemapHistoryV1HistorySitemapGetResponseContent( page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs index 3daeb3a..a8fa82f 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs @@ -14,6 +14,7 @@ public partial class HistoryClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -61,6 +62,7 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSmartscraperHistoryV1HistorySmartscraperGetAsync( @@ -68,6 +70,7 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -86,26 +89,47 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten securityRequirements: s_GetSmartscraperHistoryV1HistorySmartscraperGetSecurityRequirements, operationName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/history/smartscraper", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/history/smartscraper", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -115,158 +139,317 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSmartscraperHistoryV1HistorySmartscraperGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSmartscraperHistoryV1HistorySmartscraperGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperHistoryV1HistorySmartscraperGet", + methodName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync", + pathTemplate: "\"/v1/history/smartscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperHistoryV1HistorySmartscraperGet", + methodName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync", + pathTemplate: "\"/v1/history/smartscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperHistoryV1HistorySmartscraperGet", + methodName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync", + pathTemplate: "\"/v1/history/smartscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseContent( + response: __response); + ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SmartscraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperHistoryV1HistorySmartscraperGet", + methodName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync", + pathTemplate: "\"/v1/history/smartscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperHistoryV1HistorySmartscraperGet", + methodName: "GetSmartscraperHistoryV1HistorySmartscraperGetAsync", + pathTemplate: "\"/v1/history/smartscraper\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SmartscraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SmartscraperHistoryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SmartscraperHistoryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Get Smartscraper History
@@ -284,11 +467,13 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSmartscraperHistoryV1HistorySmartscraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -299,6 +484,7 @@ partial void ProcessGetSmartscraperHistoryV1HistorySmartscraperGetResponseConten page: page, pageSize: pageSize, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.g.cs index 16279ff..43458e9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.HistoryClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class HistoryClient : global::ScrapeGraphAI.IHistoryClient #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public HistoryClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the HistoryClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public HistoryClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs index e89bcf3..c6c190b 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPost.g.cs @@ -8,11 +8,13 @@ public partial interface IAdminClient /// Query Redis Cache By Pattern ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync( global::ScrapeGraphAI.QueryRedisCacheByPatternRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Query Redis Cache By Pattern @@ -26,12 +28,14 @@ public partial interface IAdminClient /// /// Default Value: providers_order:* /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task QueryRedisCacheByPatternV1AdminQueryRedisCacheByPatternPostAsync( int? cursor = default, int? pageSize = default, string? pattern = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.g.cs index 18b868f..93a30a1 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAdminClient.g.cs @@ -33,6 +33,11 @@ public partial interface IAdminClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs index cce3b07..39068cd 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticBrowserV2V1WorkflowsExecutePost.g.cs @@ -8,11 +8,13 @@ public partial interface IAgenticScrapperClient /// Agentic Browser V2 ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task AgenticBrowserV2V1WorkflowsExecutePostAsync( global::ScrapeGraphAI.WorkflowDefinition request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Agentic Browser V2 @@ -42,6 +44,7 @@ public partial interface IAgenticScrapperClient /// /// List of variables to include in final output /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task AgenticBrowserV2V1WorkflowsExecutePostAsync( @@ -53,6 +56,7 @@ public partial interface IAgenticScrapperClient bool? useSession = default, object? initialContext = default, global::System.Collections.Generic.IList? outputVariables = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs index 632bff8..73138e9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.AgenticScrapperV1AgenticScrapperPost.g.cs @@ -8,11 +8,13 @@ public partial interface IAgenticScrapperClient /// Agentic Scrapper /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task AgenticScrapperV1AgenticScrapperPostAsync( global::ScrapeGraphAI.AgenticScrapperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Agentic Scrapper @@ -44,6 +46,7 @@ public partial interface IAgenticScrapperClient /// /// The country code to use for the scrape (e.g. US, GB) /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task AgenticScrapperV1AgenticScrapperPostAsync( @@ -56,6 +59,7 @@ public partial interface IAgenticScrapperClient bool? stream = default, string? webhookUrl = default, string? countryCode = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs index 826c716..04193e4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.GetLiveSessionUrlV1GetLiveSessionUrlPost.g.cs @@ -8,11 +8,13 @@ public partial interface IAgenticScrapperClient /// Get Live Session Url /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetLiveSessionUrlV1GetLiveSessionUrlPostAsync( global::ScrapeGraphAI.AgenticScrapperLiveSessionUrlRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Live Session Url @@ -22,11 +24,13 @@ public partial interface IAgenticScrapperClient /// Timeout for the live session
/// Default Value: 300 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetLiveSessionUrlV1GetLiveSessionUrlPostAsync( string url, int? timeout = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.StopSessionV1StopSessionPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.StopSessionV1StopSessionPost.g.cs index 1dce4aa..b7dc113 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.StopSessionV1StopSessionPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.StopSessionV1StopSessionPost.g.cs @@ -8,20 +8,24 @@ public partial interface IAgenticScrapperClient /// Stop Session ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StopSessionV1StopSessionPostAsync( global::ScrapeGraphAI.AgenticScrapperStopSessionRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Stop Session /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StopSessionV1StopSessionPostAsync( string sessionId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.g.cs index 42fb5cb..d84ac1d 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IAgenticScrapperClient.g.cs @@ -33,6 +33,11 @@ public partial interface IAgenticScrapperClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs index 668a43f..f256b67 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetCrawlResultV1CrawlTaskIdGet.g.cs @@ -9,10 +9,12 @@ public partial interface ICrawlerClient /// Get the result of a crawl job by task ID. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetCrawlResultV1CrawlTaskIdGetAsync( string taskId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs index b4ba056..8ba1c4c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookLogsV1WebhookLogsCrawlerIdGet.g.cs @@ -9,10 +9,12 @@ public partial interface ICrawlerClient /// Get webhook delivery logs for a crawler job. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetWebhookLogsV1WebhookLogsCrawlerIdGetAsync( string crawlerId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs index e1cee73..d9864c9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.GetWebhookStatusV1WebhookStatusWebhookIdGet.g.cs @@ -9,10 +9,12 @@ public partial interface ICrawlerClient /// Get status of a specific webhook delivery. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetWebhookStatusV1WebhookStatusWebhookIdGetAsync( string webhookId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.StartCrawlV1CrawlPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.StartCrawlV1CrawlPost.g.cs index a747135..477ce50 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.StartCrawlV1CrawlPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.StartCrawlV1CrawlPost.g.cs @@ -9,11 +9,13 @@ public partial interface ICrawlerClient /// Start a new crawl job. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartCrawlV1CrawlPostAsync( global::ScrapeGraphAI.CrawlJob request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Start Crawl
@@ -60,6 +62,7 @@ public partial interface ICrawlerClient /// /// The country code to use for fetching (e.g. US, GB) /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartCrawlV1CrawlPostAsync( @@ -79,6 +82,7 @@ public partial interface ICrawlerClient bool? readerMode = default, int? waitMs = default, string? countryCode = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.g.cs index 13858f2..0f9a93a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ICrawlerClient.g.cs @@ -33,6 +33,11 @@ public partial interface ICrawlerClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs index fb82aaa..75bcfe4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.ExecuteEndpointV1EndpointEndpointIdFullPathPost.g.cs @@ -10,6 +10,7 @@ public partial interface IEndpointPocClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync( @@ -17,17 +18,20 @@ public partial interface IEndpointPocClient string fullPath, object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Execute Endpoint /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ExecuteEndpointV1EndpointEndpointIdFullPathPostAsync( string endpointId, string fullPath, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs index f8d0ecf..b7247a1 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPost.g.cs @@ -7,9 +7,11 @@ public partial interface IEndpointPocClient /// /// Get Sales Feed Items Details /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSalesFeedItemsDetailsV1BandcampGetItemDetailsPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs index e6dcc13..152eb2d 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSalesFeedItemsV1BandcampGetSalesFeedItemsPost.g.cs @@ -7,9 +7,11 @@ public partial interface IEndpointPocClient /// /// Get Sales Feed Items /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSalesFeedItemsV1BandcampGetSalesFeedItemsPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs index 509cf98..a6fa2ad 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.GetSuggestionsV1EndpointGetSuggestionsPost.g.cs @@ -8,22 +8,26 @@ public partial interface IEndpointPocClient /// Get Suggestions /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSuggestionsV1EndpointGetSuggestionsPostAsync( global::ScrapeGraphAI.EndPointSuggestionRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Suggestions /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSuggestionsV1EndpointGetSuggestionsPostAsync( string websiteUrl, string prompt, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs index 46c3549..da217db 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.SaveEndpointV1EndpointSaveEndpointPost.g.cs @@ -8,20 +8,24 @@ public partial interface IEndpointPocClient /// Save Endpoint /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SaveEndpointV1EndpointSaveEndpointPostAsync( global::ScrapeGraphAI.EndPointSuggestions request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Save Endpoint /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SaveEndpointV1EndpointSaveEndpointPostAsync( global::System.Collections.Generic.IList suggestions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.g.cs index 9ab6e66..233451c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IEndpointPocClient.g.cs @@ -33,6 +33,11 @@ public partial interface IEndpointPocClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.HealthCheckHealthzGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.HealthCheckHealthzGet.g.cs index 12cade5..51ccaa0 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.HealthCheckHealthzGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.HealthCheckHealthzGet.g.cs @@ -8,9 +8,11 @@ public partial interface IHealthClient /// Health Check
/// Health check endpoint that includes memory monitoring /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task HealthCheckHealthzGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.g.cs index 244baa5..7bf6ea2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHealthClient.g.cs @@ -33,6 +33,11 @@ public partial interface IHealthClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs index bf83614..05afabd 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetAgenticScraperHistoryV1HistoryAgenticScraperGet.g.cs @@ -22,6 +22,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync( @@ -29,6 +30,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Agentic Scraper History
@@ -47,11 +49,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetAgenticScraperHistoryV1HistoryAgenticScraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs index e173951..9a05325 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetCrawlerHistoryV1HistoryCrawlGet.g.cs @@ -21,6 +21,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetCrawlerHistoryV1HistoryCrawlGetAsync( @@ -28,6 +29,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Crawler History
@@ -45,11 +47,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetCrawlerHistoryV1HistoryCrawlGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs index 27f6372..9b365c5 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetMarkdownifyHistoryV1HistoryMarkdownifyGet.g.cs @@ -21,6 +21,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync( @@ -28,6 +29,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Markdownify History
@@ -45,11 +47,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetMarkdownifyHistoryV1HistoryMarkdownifyGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs index 341400e..acbc871 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetScrapeHistoryV1HistoryScrapeGet.g.cs @@ -21,6 +21,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetScrapeHistoryV1HistoryScrapeGetAsync( @@ -28,6 +29,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Scrape History
@@ -45,11 +47,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetScrapeHistoryV1HistoryScrapeGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs index cf539cb..b50302a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSearchscraperHistoryV1HistorySearchscraperGet.g.cs @@ -21,6 +21,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSearchscraperHistoryV1HistorySearchscraperGetAsync( @@ -28,6 +29,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Searchscraper History
@@ -45,11 +47,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSearchscraperHistoryV1HistorySearchscraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs index 895548f..3e69888 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSitemapHistoryV1HistorySitemapGet.g.cs @@ -15,6 +15,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSitemapHistoryV1HistorySitemapGetAsync( @@ -22,6 +23,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Sitemap History
@@ -33,11 +35,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSitemapHistoryV1HistorySitemapGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs index 113029c..970ce85 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.GetSmartscraperHistoryV1HistorySmartscraperGet.g.cs @@ -21,6 +21,7 @@ public partial interface IHistoryClient /// Default Value: 10 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSmartscraperHistoryV1HistorySmartscraperGetAsync( @@ -28,6 +29,7 @@ public partial interface IHistoryClient object request, int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Get Smartscraper History
@@ -45,11 +47,13 @@ public partial interface IHistoryClient /// /// Default Value: 10 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSmartscraperHistoryV1HistorySmartscraperGetAsync( int? page = default, int? pageSize = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.g.cs index b6dbab2..a95f426 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IHistoryClient.g.cs @@ -33,6 +33,11 @@ public partial interface IHistoryClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs index 493681f..5be9306 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs @@ -8,10 +8,12 @@ public partial interface IMarkdownifyClient /// Get Markdownify Status ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs index 794c4f8..b7f65e4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs @@ -8,11 +8,13 @@ public partial interface IMarkdownifyClient /// Start Markdownify ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartMarkdownifyV1MarkdownifyPostAsync( global::ScrapeGraphAI.MarkdownifyRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Start Markdownify @@ -51,6 +53,7 @@ public partial interface IMarkdownifyClient /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartMarkdownifyV1MarkdownifyPostAsync( @@ -65,6 +68,7 @@ public partial interface IMarkdownifyClient global::System.Collections.Generic.Dictionary? headers = default, global::System.Collections.Generic.IList? steps = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.g.cs index 5355369..5305aab 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IMarkdownifyClient.g.cs @@ -33,6 +33,11 @@ public partial interface IMarkdownifyClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost.g.cs similarity index 74% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost.g.cs index d084091..5d6f3f7 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost.g.cs @@ -10,10 +10,12 @@ public partial interface IOrthogonalClient /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ProxyX402PathPutAsync( + global::System.Threading.Tasks.Task ProxyX402PathPostAsync( string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut2.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost2.g.cs similarity index 74% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut2.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost2.g.cs index 250be6b..62a1b01 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut2.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost2.g.cs @@ -10,10 +10,12 @@ public partial interface IOrthogonalClient /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ProxyX402PathPut2Async( + global::System.Threading.Tasks.Task ProxyX402PathPost2Async( string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut3.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost3.g.cs similarity index 74% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut3.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost3.g.cs index d68e0c3..4bf4459 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut3.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost3.g.cs @@ -10,10 +10,12 @@ public partial interface IOrthogonalClient /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ProxyX402PathPut3Async( + global::System.Threading.Tasks.Task ProxyX402PathPost3Async( string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut4.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost4.g.cs similarity index 74% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut4.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost4.g.cs index 2fe6ebe..ca040d2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut4.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost4.g.cs @@ -10,10 +10,12 @@ public partial interface IOrthogonalClient /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ProxyX402PathPut4Async( + global::System.Threading.Tasks.Task ProxyX402PathPost4Async( string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost5.g.cs new file mode 100644 index 0000000..60d545c --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPost5.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +namespace ScrapeGraphAI +{ + public partial interface IOrthogonalClient + { + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ProxyX402PathPost5Async( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut5.g.cs deleted file mode 100644 index 006354e..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.ProxyX402PathPut5.g.cs +++ /dev/null @@ -1,19 +0,0 @@ -#nullable enable - -namespace ScrapeGraphAI -{ - public partial interface IOrthogonalClient - { - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task ProxyX402PathPut5Async( - string path, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.g.cs index fe2970d..fe6a7d8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IOrthogonalClient.g.cs @@ -33,6 +33,11 @@ public partial interface IOrthogonalClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs index 38d1c62..c8f5307 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs @@ -9,11 +9,13 @@ public partial interface IScheduledJobsClient /// Create a new scheduled job /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateScheduledJobV1ScheduledJobsPostAsync( global::ScrapeGraphAI.ScheduledJobCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create Scheduled Job
@@ -38,6 +40,7 @@ public partial interface IScheduledJobsClient /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateScheduledJobV1ScheduledJobsPostAsync( @@ -47,6 +50,7 @@ public partial interface IScheduledJobsClient object jobConfig, bool? isActive = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs index 80189da..72aa0db 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs @@ -9,10 +9,12 @@ public partial interface IScheduledJobsClient /// Delete a scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs index 27f6293..ba94c3f 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs @@ -22,6 +22,7 @@ public partial interface IScheduledJobsClient /// /// Filter by active status /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task FetchScheduledJobsV1ScheduledJobsGetAsync( @@ -29,6 +30,7 @@ public partial interface IScheduledJobsClient int? pageSize = default, global::ScrapeGraphAI.ServiceType? serviceType = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs index 10a1ed1..14d2ef7 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs @@ -20,6 +20,7 @@ public partial interface IScheduledJobsClient /// /// Filter by execution status /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync( @@ -27,6 +28,7 @@ public partial interface IScheduledJobsClient int? page = default, int? pageSize = default, string? status = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs index 2037267..8ed0744 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs @@ -9,10 +9,12 @@ public partial interface IScheduledJobsClient /// Get a specific scheduled job /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetScheduledJobV1ScheduledJobsJobIdGetAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs index 818abb9..9b939dc 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs @@ -8,10 +8,12 @@ public partial interface IScheduledJobsClient /// Pause Scheduled Job /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync( global::System.Guid jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs index ccb7f65..71d3dd9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs @@ -9,12 +9,14 @@ public partial interface IScheduledJobsClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync( string jobId, global::ScrapeGraphAI.ScheduledJobCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Replace Scheduled Job @@ -39,6 +41,7 @@ public partial interface IScheduledJobsClient /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync( @@ -49,6 +52,7 @@ public partial interface IScheduledJobsClient object jobConfig, bool? isActive = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs index e114e36..000b3f0 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs @@ -8,10 +8,12 @@ public partial interface IScheduledJobsClient /// Resume Scheduled Job /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs index 9448333..85839e8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs @@ -10,10 +10,12 @@ public partial interface IScheduledJobsClient /// Rate limited to 10 triggers per minute per user to prevent abuse. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs index 3dbbd0a..9e855db 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs @@ -10,22 +10,26 @@ public partial interface IScheduledJobsClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync( string jobId, object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Update Scheduled Job
/// Update a scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.g.cs index 07d1686..06c5f35 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScheduledJobsClient.g.cs @@ -33,6 +33,11 @@ public partial interface IScheduledJobsClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs index c18c49a..16adb47 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs @@ -8,10 +8,12 @@ public partial interface ISchemaGeneratorClient /// Get Generate Schema Status /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs index dfb238b..39ccf11 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs @@ -10,11 +10,13 @@ public partial interface ISchemaGeneratorClient /// Optionally modify an existing schema to better fit the current search query. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartGenerateSchemaV1GenerateSchemaPostAsync( global::ScrapeGraphAI.SchemaGenerationRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Generate or modify a JSON schema based on a search query
@@ -27,11 +29,13 @@ public partial interface ISchemaGeneratorClient /// /// Optional existing JSON schema to modify/extend /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartGenerateSchemaV1GenerateSchemaPostAsync( string userPrompt, object? existingSchema = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.g.cs index 0924c49..8788e91 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISchemaGeneratorClient.g.cs @@ -33,6 +33,11 @@ public partial interface ISchemaGeneratorClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.ScrapeV1ScrapePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.ScrapeV1ScrapePost.g.cs index 4ba8fad..9271b36 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.ScrapeV1ScrapePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.ScrapeV1ScrapePost.g.cs @@ -8,11 +8,13 @@ public partial interface IScrapeClient /// Scrape /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ScrapeV1ScrapePostAsync( global::ScrapeGraphAI.ScrapeRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Scrape @@ -44,6 +46,7 @@ public partial interface IScrapeClient /// The number of milliseconds to wait before scraping the website
/// Default Value: 3000 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ScrapeV1ScrapePostAsync( @@ -55,6 +58,7 @@ public partial interface IScrapeClient bool? stream = default, string? countryCode = default, int? waitMs = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.g.cs index b0bca26..cd550d4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeClient.g.cs @@ -33,6 +33,11 @@ public partial interface IScrapeClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeGraphAIClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeGraphAIClient.g.cs index 577660b..65c5f55 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeGraphAIClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IScrapeGraphAIClient.g.cs @@ -33,6 +33,11 @@ public partial interface IScrapeGraphAIClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs index 9fcc6dc..34c1f45 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs @@ -8,10 +8,12 @@ public partial interface ISearchScraperClient /// Get Searchscraper Status /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSearchscraperStatusV1SearchscraperRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs index 7f0b6d8..ca5ae12 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs @@ -8,11 +8,13 @@ public partial interface ISearchScraperClient /// Start Searchscraper /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartSearchscraperV1SearchscraperPostAsync( global::ScrapeGraphAI.SearchScraperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Start Searchscraper @@ -58,6 +60,7 @@ public partial interface ISearchScraperClient /// /// The date range to search in /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartSearchscraperV1SearchscraperPostAsync( @@ -73,6 +76,7 @@ public partial interface ISearchScraperClient string? webhookUrl = default, string? locationGeoCode = default, global::ScrapeGraphAI.TimeRange? timeRange = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.g.cs index c3f54b3..f83e174 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISearchScraperClient.g.cs @@ -33,6 +33,11 @@ public partial interface ISearchScraperClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs index 46f8e12..b12e150 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs @@ -9,11 +9,13 @@ public partial interface ISiteMonitorsClient /// Register a website for monitoring. We will check on the given cron schedule and POST webhook events on content change. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateMonitorV1SiteMonitorsPostAsync( global::ScrapeGraphAI.SiteMonitorCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Create Monitor
@@ -35,6 +37,7 @@ public partial interface ISiteMonitorsClient /// Optional: user_prompt and output_schema for structured extraction and diff
/// Default Value: {"user_prompt":"Extract all main content and key data as structured JSON."} /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateMonitorV1SiteMonitorsPostAsync( @@ -43,6 +46,7 @@ public partial interface ISiteMonitorsClient string cronExpression, string? name = default, global::ScrapeGraphAI.SiteMonitorExtractionConfig? extractionConfig = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs index 04e2063..9d9d954 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs @@ -9,10 +9,12 @@ public partial interface ISiteMonitorsClient /// Delete a site monitor and its schedule. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync( string monitorId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs index 1ba6f35..6975646 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs @@ -9,10 +9,12 @@ public partial interface ISiteMonitorsClient /// Get a site monitor by id. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetMonitorV1SiteMonitorsMonitorIdGetAsync( string monitorId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs index c5199f9..5d241b5 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs @@ -15,12 +15,14 @@ public partial interface ISiteMonitorsClient /// Default Value: 20 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ListMonitorsV1SiteMonitorsGetAsync( int? page = default, int? pageSize = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs index 4e12d6a..0a6e5c5 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs @@ -10,12 +10,14 @@ public partial interface ISiteMonitorsClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync( string monitorId, global::ScrapeGraphAI.SiteMonitorUpdate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Update Monitor
@@ -27,6 +29,7 @@ public partial interface ISiteMonitorsClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync( @@ -36,6 +39,7 @@ public partial interface ISiteMonitorsClient string? cronExpression = default, global::ScrapeGraphAI.SiteMonitorExtractionConfig? extractionConfig = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.g.cs index a36d994..d3c17a4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISiteMonitorsClient.g.cs @@ -33,6 +33,11 @@ public partial interface ISiteMonitorsClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.GenerateSitemapV1SitemapPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.GenerateSitemapV1SitemapPost.g.cs index 7b50e6a..1c792d8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.GenerateSitemapV1SitemapPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.GenerateSitemapV1SitemapPost.g.cs @@ -8,11 +8,13 @@ public partial interface ISitemapClient /// Generate Sitemap /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GenerateSitemapV1SitemapPostAsync( global::ScrapeGraphAI.SitemapRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Generate Sitemap @@ -24,11 +26,13 @@ public partial interface ISitemapClient /// Whether to return streaming response
/// Default Value: false /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GenerateSitemapV1SitemapPostAsync( string websiteUrl, bool? stream = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.g.cs index af1e584..9bb31d9 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISitemapClient.g.cs @@ -33,6 +33,11 @@ public partial interface ISitemapClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs index 69bfd56..ae060cd 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs @@ -8,10 +8,12 @@ public partial interface ISmartScraperClient /// Get Smartscraper Status /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetSmartscraperStatusV1SmartscraperRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs index 42adb5c..3b1bfd5 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs @@ -8,11 +8,13 @@ public partial interface ISmartScraperClient /// Start Smartscraper /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartSmartscraperV1SmartscraperPostAsync( global::ScrapeGraphAI.SmartscraperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Start Smartscraper @@ -90,6 +92,7 @@ public partial interface ISmartScraperClient /// Whether this is a multi-page child request
/// Default Value: false /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task StartSmartscraperV1SmartscraperPostAsync( @@ -114,6 +117,7 @@ public partial interface ISmartScraperClient string? webhookUrl = default, int? offset = default, bool? isMultipageChild = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.g.cs index f97fcab..d07db18 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ISmartScraperClient.g.cs @@ -33,6 +33,11 @@ public partial interface ISmartScraperClient : global::System.IDisposable ///
public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.ToonifyV1ToonifyPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.ToonifyV1ToonifyPost.g.cs index 1794fa3..adac03e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.ToonifyV1ToonifyPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.ToonifyV1ToonifyPost.g.cs @@ -8,18 +8,22 @@ public partial interface IToonifyClient /// Toonify /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ToonifyV1ToonifyPostAsync( object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Toonify /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ToonifyV1ToonifyPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.g.cs index 8ca07a4..05740ee 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IToonifyClient.g.cs @@ -33,6 +33,11 @@ public partial interface IToonifyClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs index a882588..bcca365 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs @@ -11,10 +11,12 @@ public partial interface IUsageClient /// /// Default Value: all /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetUsageTimelineV1UsageTimelineGetAsync( global::ScrapeGraphAI.GetUsageTimelineV1UsageTimelineGetDays2? days = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.g.cs index ddd7cb0..704b0f1 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUsageClient.g.cs @@ -33,6 +33,11 @@ public partial interface IUsageClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.DeductCreditsV1DeductCreditsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.DeductCreditsV1DeductCreditsPost.g.cs index c966797..7cb3bc8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.DeductCreditsV1DeductCreditsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.DeductCreditsV1DeductCreditsPost.g.cs @@ -8,20 +8,24 @@ public partial interface IUserClient /// Deduct Credits /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task DeductCreditsV1DeductCreditsPostAsync( global::ScrapeGraphAI.DeductCreditsBody request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Deduct Credits /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task DeductCreditsV1DeductCreditsPostAsync( int creditsToDeduct, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.GetCreditsV1CreditsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.GetCreditsV1CreditsGet.g.cs index d0ab6ee..4631db7 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.GetCreditsV1CreditsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.GetCreditsV1CreditsGet.g.cs @@ -7,9 +7,11 @@ public partial interface IUserClient /// /// Get Credits /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetCreditsV1CreditsGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitFeedbackV1FeedbackPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitFeedbackV1FeedbackPost.g.cs index eb2e54b..f3cbfed 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitFeedbackV1FeedbackPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitFeedbackV1FeedbackPost.g.cs @@ -8,11 +8,13 @@ public partial interface IUserClient /// Submit Feedback /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SubmitFeedbackV1FeedbackPostAsync( global::ScrapeGraphAI.FeedbackCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Submit Feedback @@ -22,12 +24,14 @@ public partial interface IUserClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SubmitFeedbackV1FeedbackPostAsync( global::System.Guid requestId, int rating, string? feedbackText = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs index 4fa2091..a9be49e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs @@ -8,11 +8,13 @@ public partial interface IUserClient /// Submit Product Feedback /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SubmitProductFeedbackV1ProductFeedbackPostAsync( global::ScrapeGraphAI.ProductFeedback request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); /// /// Submit Product Feedback @@ -34,6 +36,7 @@ public partial interface IUserClient /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task SubmitProductFeedbackV1ProductFeedbackPostAsync( @@ -54,6 +57,7 @@ public partial interface IUserClient string? improvementSuggestions = default, bool? canContact = default, string? contactMethod = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.ValidateApiKeyV1ValidateGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.ValidateApiKeyV1ValidateGet.g.cs index 9b86dea..a0fe68a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.ValidateApiKeyV1ValidateGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.ValidateApiKeyV1ValidateGet.g.cs @@ -7,9 +7,11 @@ public partial interface IUserClient /// /// Validate Api Key /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task ValidateApiKeyV1ValidateGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.g.cs index c9bffda..b429be2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.IUserClient.g.cs @@ -33,6 +33,11 @@ public partial interface IUserClient : global::System.IDisposable /// public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs index 558baf3..d6bf8ae 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.GetMarkdownifyStatusV1MarkdownifyRequestIdGet.g.cs @@ -14,6 +14,7 @@ public partial class MarkdownifyClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponseContent /// Get Markdownify Status /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponseContent securityRequirements: s_GetMarkdownifyStatusV1MarkdownifyRequestIdGetSecurityRequirements, operationName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/markdownify/{requestId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/markdownify/{requestId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponseContent __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetMarkdownifyStatusV1MarkdownifyRequestIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - requestId: requestId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetMarkdownifyStatusV1MarkdownifyRequestIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + requestId: requestId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyStatusV1MarkdownifyRequestIdGet", + methodName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync", + pathTemplate: "$\"/v1/markdownify/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyStatusV1MarkdownifyRequestIdGet", + methodName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync", + pathTemplate: "$\"/v1/markdownify/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyStatusV1MarkdownifyRequestIdGet", + methodName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync", + pathTemplate: "$\"/v1/markdownify/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponseContent( + response: __response); + ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyStatusV1MarkdownifyRequestIdGet", + methodName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync", + pathTemplate: "$\"/v1/markdownify/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMarkdownifyStatusV1MarkdownifyRequestIdGet", + methodName: "GetMarkdownifyStatusV1MarkdownifyRequestIdGetAsync", + pathTemplate: "$\"/v1/markdownify/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetMarkdownifyStatusV1MarkdownifyRequestIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs index a958947..2fc07e8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.StartMarkdownifyV1MarkdownifyPost.g.cs @@ -14,6 +14,7 @@ public partial class MarkdownifyClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( /// Start Markdownify /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartMarkdownifyV1MarkdownifyPostAsync( global::ScrapeGraphAI.MarkdownifyRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( securityRequirements: s_StartMarkdownifyV1MarkdownifyPostSecurityRequirements, operationName: "StartMarkdownifyV1MarkdownifyPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/markdownify", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/markdownify", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStartMarkdownifyV1MarkdownifyPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStartMarkdownifyV1MarkdownifyPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStartMarkdownifyV1MarkdownifyPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartMarkdownifyV1MarkdownifyPost", + methodName: "StartMarkdownifyV1MarkdownifyPostAsync", + pathTemplate: "\"/v1/markdownify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartMarkdownifyV1MarkdownifyPost", + methodName: "StartMarkdownifyV1MarkdownifyPostAsync", + pathTemplate: "\"/v1/markdownify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartMarkdownifyV1MarkdownifyPost", + methodName: "StartMarkdownifyV1MarkdownifyPostAsync", + pathTemplate: "\"/v1/markdownify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( + response: __response); + ProcessStartMarkdownifyV1MarkdownifyPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.CompletedMarkdownifyResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartMarkdownifyV1MarkdownifyPost", + methodName: "StartMarkdownifyV1MarkdownifyPostAsync", + pathTemplate: "\"/v1/markdownify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartMarkdownifyV1MarkdownifyPost", + methodName: "StartMarkdownifyV1MarkdownifyPostAsync", + pathTemplate: "\"/v1/markdownify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.CompletedMarkdownifyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.CompletedMarkdownifyResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.CompletedMarkdownifyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Start Markdownify @@ -278,6 +461,7 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartMarkdownifyV1MarkdownifyPostAsync( @@ -292,6 +476,7 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( global::System.Collections.Generic.Dictionary? headers = default, global::System.Collections.Generic.IList? steps = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.MarkdownifyRequest @@ -311,6 +496,7 @@ partial void ProcessStartMarkdownifyV1MarkdownifyPostResponseContent( return await StartMarkdownifyV1MarkdownifyPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.g.cs index afcb72a..c0ee75c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.MarkdownifyClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class MarkdownifyClient : global::ScrapeGraphAI.IMarkdowni #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public MarkdownifyClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the MarkdownifyClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public MarkdownifyClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.Json.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.Json.g.cs similarity index 86% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.Json.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.Json.g.cs index 5b74780..cc1ffdf 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.Json.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.Json.g.cs @@ -2,7 +2,7 @@ namespace ScrapeGraphAI { - public sealed partial class ProxyX402PathPutResponse5 + public sealed partial class ProxyX402PathPostResponse { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::ScrapeGraphAI.ProxyX402PathPutResponse5? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse5), - jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPutResponse5; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse), + jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPostResponse; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::ScrapeGraphAI.ProxyX402PathPutResponse5? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse5), - jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPutResponse5; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPostResponse; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.g.cs similarity index 89% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.g.cs index c3c5a21..c8371f2 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse.g.cs @@ -6,7 +6,7 @@ namespace ScrapeGraphAI /// /// /// - public sealed partial class ProxyX402PathPutResponse4 + public sealed partial class ProxyX402PathPostResponse { /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.Json.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.Json.g.cs similarity index 86% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.Json.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.Json.g.cs index 7db769f..7021695 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.Json.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.Json.g.cs @@ -2,7 +2,7 @@ namespace ScrapeGraphAI { - public sealed partial class ProxyX402PathPutResponse + public sealed partial class ProxyX402PathPostResponse2 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::ScrapeGraphAI.ProxyX402PathPutResponse? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse2? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse), - jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPutResponse; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse2), + jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPostResponse2; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::ScrapeGraphAI.ProxyX402PathPutResponse? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse2? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPutResponse; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse2), + jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPostResponse2; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.g.cs similarity index 89% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.g.cs index 511e32a..a20eb9e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse2.g.cs @@ -6,7 +6,7 @@ namespace ScrapeGraphAI /// /// /// - public sealed partial class ProxyX402PathPutResponse + public sealed partial class ProxyX402PathPostResponse2 { /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.Json.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.Json.g.cs similarity index 86% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.Json.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.Json.g.cs index df7bbc6..e9797e4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.Json.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.Json.g.cs @@ -2,7 +2,7 @@ namespace ScrapeGraphAI { - public sealed partial class ProxyX402PathPutResponse2 + public sealed partial class ProxyX402PathPostResponse3 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::ScrapeGraphAI.ProxyX402PathPutResponse2? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse3? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse2), - jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPutResponse2; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse3), + jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPostResponse3; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::ScrapeGraphAI.ProxyX402PathPutResponse2? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse3? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse2), - jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPutResponse2; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse3), + jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPostResponse3; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.g.cs similarity index 89% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.g.cs index a466d3a..b983d2c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse2.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse3.g.cs @@ -6,7 +6,7 @@ namespace ScrapeGraphAI /// /// /// - public sealed partial class ProxyX402PathPutResponse2 + public sealed partial class ProxyX402PathPostResponse3 { /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.Json.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.Json.g.cs similarity index 86% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.Json.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.Json.g.cs index ccac506..96c33f6 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.Json.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.Json.g.cs @@ -2,7 +2,7 @@ namespace ScrapeGraphAI { - public sealed partial class ProxyX402PathPutResponse3 + public sealed partial class ProxyX402PathPostResponse4 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::ScrapeGraphAI.ProxyX402PathPutResponse3? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse4? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse3), - jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPutResponse3; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse4), + jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPostResponse4; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::ScrapeGraphAI.ProxyX402PathPutResponse3? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse4? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse3), - jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPutResponse3; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse4), + jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPostResponse4; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.g.cs similarity index 89% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.g.cs index 74cad05..f4d22cf 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse3.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse4.g.cs @@ -6,7 +6,7 @@ namespace ScrapeGraphAI /// /// /// - public sealed partial class ProxyX402PathPutResponse3 + public sealed partial class ProxyX402PathPostResponse4 { /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.Json.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.Json.g.cs similarity index 86% rename from src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.Json.g.cs rename to src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.Json.g.cs index c2529ae..bd53e36 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse4.Json.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.Json.g.cs @@ -2,7 +2,7 @@ namespace ScrapeGraphAI { - public sealed partial class ProxyX402PathPutResponse4 + public sealed partial class ProxyX402PathPostResponse5 { /// /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. @@ -34,14 +34,14 @@ public string ToJson( /// /// Deserializes a JSON string using the provided JsonSerializerContext. /// - public static global::ScrapeGraphAI.ProxyX402PathPutResponse4? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse5? FromJson( string json, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return global::System.Text.Json.JsonSerializer.Deserialize( json, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse4), - jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPutResponse4; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse5), + jsonSerializerContext) as global::ScrapeGraphAI.ProxyX402PathPostResponse5; } /// @@ -51,11 +51,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::ScrapeGraphAI.ProxyX402PathPutResponse4? FromJson( + public static global::ScrapeGraphAI.ProxyX402PathPostResponse5? FromJson( string json, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.Deserialize( + return global::System.Text.Json.JsonSerializer.Deserialize( json, jsonSerializerOptions); } @@ -63,14 +63,14 @@ public string ToJson( /// /// Deserializes a JSON stream using the provided JsonSerializerContext. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) { return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, - typeof(global::ScrapeGraphAI.ProxyX402PathPutResponse4), - jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPutResponse4; + typeof(global::ScrapeGraphAI.ProxyX402PathPostResponse5), + jsonSerializerContext).ConfigureAwait(false)) as global::ScrapeGraphAI.ProxyX402PathPostResponse5; } /// @@ -80,11 +80,11 @@ public string ToJson( [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] #endif - public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( global::System.IO.Stream jsonStream, global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( + return global::System.Text.Json.JsonSerializer.DeserializeAsync( jsonStream, jsonSerializerOptions); } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.g.cs new file mode 100644 index 0000000..4102309 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPostResponse5.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + /// + /// + /// + public sealed partial class ProxyX402PathPostResponse5 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.g.cs deleted file mode 100644 index dc4bf4b..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ProxyX402PathPutResponse5.g.cs +++ /dev/null @@ -1,18 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - /// - /// - /// - public sealed partial class ProxyX402PathPutResponse5 - { - - /// - /// Additional properties that are not explicitly defined in the schema - /// - [global::System.Text.Json.Serialization.JsonExtensionData] - public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ScrapeRequestDB.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ScrapeRequestDB.g.cs index cc357bd..d4ead3d 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ScrapeRequestDB.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Models.ScrapeRequestDB.g.cs @@ -67,7 +67,7 @@ public sealed partial class ScrapeRequestDB public global::System.DateTime? FinishedAt { get; set; } /// - /// Default Value: 2026-04-09T14:29:31.850693 + /// Default Value: 2026-04-09T14:29:31.520007 /// [global::System.Text.Json.Serialization.JsonPropertyName("requested_at")] public global::System.DateTime? RequestedAt { get; set; } @@ -110,7 +110,7 @@ public sealed partial class ScrapeRequestDB /// /// /// - /// Default Value: 2026-04-09T14:29:31.850693 + /// Default Value: 2026-04-09T14:29:31.520007 /// /// /// Default Value: 0 diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OptionsSupport.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OptionsSupport.g.cs new file mode 100644 index 0000000..6231b73 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OptionsSupport.g.cs @@ -0,0 +1,460 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + /// + /// Global defaults applied to generated SDK requests. + /// + public sealed class AutoSDKClientOptions + { + /// + /// Additional headers applied to every request after generated headers are set. + /// Entries with the same key overwrite earlier header values. + /// + public global::System.Collections.Generic.Dictionary Headers { get; } = + new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase); + + /// + /// Additional query parameters appended to every request. + /// Request-level entries with the same key are appended after client defaults. + /// + public global::System.Collections.Generic.Dictionary QueryParameters { get; } = + new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal); + + /// + /// Optional timeout applied to the full request execution. + /// + public global::System.TimeSpan? Timeout { get; set; } + + /// + /// Default retry behavior for generated HTTP requests. + /// + public global::ScrapeGraphAI.AutoSDKRetryOptions Retry { get; set; } = new global::ScrapeGraphAI.AutoSDKRetryOptions(); + + /// + /// Overrides the client-wide response buffering mode when set. + /// + public bool? ReadResponseAsString { get; set; } + + /// + /// Reusable hooks invoked for every generated SDK request. + /// + public global::System.Collections.Generic.List Hooks { get; } = + new global::System.Collections.Generic.List(); + + /// + /// Registers a hook for all requests issued by this client. + /// + /// + /// The current options instance. + public global::ScrapeGraphAI.AutoSDKClientOptions AddHook( + global::ScrapeGraphAI.IAutoSDKHook hook) + { + Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook))); + return this; + } + } + + /// + /// Per-request overrides applied on top of . + /// + public sealed class AutoSDKRequestOptions + { + /// + /// Additional headers applied after generated and client-level headers. + /// + public global::System.Collections.Generic.Dictionary Headers { get; } = + new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase); + + /// + /// Additional query parameters appended after generated and client-level query parameters. + /// + public global::System.Collections.Generic.Dictionary QueryParameters { get; } = + new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal); + + /// + /// Optional timeout override for this request. + /// + public global::System.TimeSpan? Timeout { get; set; } + + /// + /// Optional retry override for this request. + /// + public global::ScrapeGraphAI.AutoSDKRetryOptions? Retry { get; set; } + + /// + /// Overrides response buffering for this request when set. + /// + public bool? ReadResponseAsString { get; set; } + } + + /// + /// Retry settings for generated HTTP requests. + /// + public sealed class AutoSDKRetryOptions + { + /// + /// Total number of attempts, including the initial request. + /// Values less than 1 are normalized to 1. + /// + public int MaxAttempts { get; set; } = 1; + + /// + /// Optional fixed delay between retry attempts. + /// + public global::System.TimeSpan? Delay { get; set; } + } + + /// + /// Runtime hook interface for generated SDK lifecycle events. + /// + public interface IAutoSDKHook + { + /// + /// Runs before a request is sent. + /// + /// + global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::ScrapeGraphAI.AutoSDKHookContext context); + + /// + /// Runs after a successful HTTP response is received. + /// + /// + global::System.Threading.Tasks.Task OnAfterSuccessAsync( + global::ScrapeGraphAI.AutoSDKHookContext context); + + /// + /// Runs after an error response or transport failure is observed. + /// + /// + global::System.Threading.Tasks.Task OnAfterErrorAsync( + global::ScrapeGraphAI.AutoSDKHookContext context); + } + + /// + /// Convenience base type for request hooks with no-op defaults. + /// + public abstract class AutoSDKHook : global::ScrapeGraphAI.IAutoSDKHook + { + /// + public virtual global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return global::System.Threading.Tasks.Task.CompletedTask; + } + + /// + public virtual global::System.Threading.Tasks.Task OnAfterSuccessAsync( + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return global::System.Threading.Tasks.Task.CompletedTask; + } + + /// + public virtual global::System.Threading.Tasks.Task OnAfterErrorAsync( + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return global::System.Threading.Tasks.Task.CompletedTask; + } + } + + /// + /// Runtime metadata passed to generated SDK hooks. + /// + public sealed class AutoSDKHookContext + { + /// + /// The source OpenAPI operation id or generated fallback id. + /// + public string OperationId { get; set; } = string.Empty; + + /// + /// The generated C# method name. + /// + public string MethodName { get; set; } = string.Empty; + + /// + /// The OpenAPI path template for the operation. + /// + public string PathTemplate { get; set; } = string.Empty; + + /// + /// The HTTP method used for the request. + /// + public string HttpMethod { get; set; } = string.Empty; + + /// + /// The client's resolved base URI. + /// + public global::System.Uri? BaseUri { get; set; } + + /// + /// The outgoing HTTP request for the current attempt. + /// + public global::System.Net.Http.HttpRequestMessage Request { get; set; } = null!; + + /// + /// The HTTP response when one was received. + /// + public global::System.Net.Http.HttpResponseMessage? Response { get; set; } + + /// + /// The transport or processing exception when one was observed. + /// + public global::System.Exception? Exception { get; set; } + + /// + /// The client-wide runtime options. + /// + public global::ScrapeGraphAI.AutoSDKClientOptions ClientOptions { get; set; } = null!; + + /// + /// The per-request runtime options. + /// + public global::ScrapeGraphAI.AutoSDKRequestOptions? RequestOptions { get; set; } + + /// + /// The current attempt number, starting at 1. + /// + public int Attempt { get; set; } + + /// + /// The total number of attempts allowed for this request. + /// + public int MaxAttempts { get; set; } + + /// + /// Indicates whether the generated client will retry after this hook invocation. + /// + public bool WillRetry { get; set; } + + /// + /// The effective cancellation token for the current request attempt. + /// + public global::System.Threading.CancellationToken CancellationToken { get; set; } + } + + internal static class AutoSDKRequestOptionsSupport + { + internal static global::ScrapeGraphAI.AutoSDKHookContext CreateHookContext( + string operationId, + string methodName, + string pathTemplate, + string httpMethod, + global::System.Uri? baseUri, + global::System.Net.Http.HttpRequestMessage request, + global::System.Net.Http.HttpResponseMessage? response, + global::System.Exception? exception, + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions, + int attempt, + int maxAttempts, + bool willRetry, + global::System.Threading.CancellationToken cancellationToken) + { + return new global::ScrapeGraphAI.AutoSDKHookContext + { + OperationId = operationId ?? string.Empty, + MethodName = methodName ?? string.Empty, + PathTemplate = pathTemplate ?? string.Empty, + HttpMethod = httpMethod ?? string.Empty, + BaseUri = baseUri, + Request = request, + Response = response, + Exception = exception, + ClientOptions = clientOptions, + RequestOptions = requestOptions, + Attempt = attempt, + MaxAttempts = maxAttempts, + WillRetry = willRetry, + CancellationToken = cancellationToken, + }; + } + + internal static global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnBeforeRequestAsync(hookContext), context); + } + + internal static global::System.Threading.Tasks.Task OnAfterSuccessAsync( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterSuccessAsync(hookContext), context); + } + + internal static global::System.Threading.Tasks.Task OnAfterErrorAsync( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKHookContext context) + { + return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterErrorAsync(hookContext), context); + } + + internal static bool GetReadResponseAsString( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions, + bool fallbackValue) + { + return requestOptions?.ReadResponseAsString ?? + clientOptions.ReadResponseAsString ?? + fallbackValue; + } + + internal static global::System.Threading.CancellationTokenSource? CreateTimeoutCancellationTokenSource( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions, + global::System.Threading.CancellationToken cancellationToken) + { + var timeout = requestOptions?.Timeout ?? clientOptions.Timeout; + if (!timeout.HasValue || timeout.Value <= global::System.TimeSpan.Zero) + { + return null; + } + + var cancellationTokenSource = global::System.Threading.CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + cancellationTokenSource.CancelAfter(timeout.Value); + return cancellationTokenSource; + } + + internal static int GetMaxAttempts( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions, + bool supportsRetry) + { + if (!supportsRetry) + { + return 1; + } + + var maxAttempts = requestOptions?.Retry?.MaxAttempts ?? + clientOptions.Retry?.MaxAttempts ?? + 1; + return maxAttempts < 1 ? 1 : maxAttempts; + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions, + global::System.Threading.CancellationToken cancellationToken) + { + var delay = requestOptions?.Retry?.Delay ?? + clientOptions.Retry?.Delay; + if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + { + return; + } + + await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + } + + internal static bool ShouldRetryStatusCode( + global::System.Net.HttpStatusCode statusCode) + { + return (int)statusCode switch + { + 408 => true, + 429 => true, + 500 => true, + 502 => true, + 503 => true, + 504 => true, + _ => false, + }; + } + + internal static string AppendQueryParameters( + string path, + global::System.Collections.Generic.Dictionary clientParameters, + global::System.Collections.Generic.Dictionary? requestParameters) + { + var hasClientParameters = clientParameters != null && clientParameters.Count > 0; + var hasRequestParameters = requestParameters != null && requestParameters.Count > 0; + if (!hasClientParameters && !hasRequestParameters) + { + return path; + } + + var builder = new global::System.Text.StringBuilder(path ?? string.Empty); + var hasQuery = builder.ToString().Contains("?", global::System.StringComparison.Ordinal); + AppendParameters(builder, clientParameters, ref hasQuery); + AppendParameters(builder, requestParameters, ref hasQuery); + return builder.ToString(); + } + + internal static void ApplyHeaders( + global::System.Net.Http.HttpRequestMessage request, + global::System.Collections.Generic.Dictionary clientHeaders, + global::System.Collections.Generic.Dictionary? requestHeaders) + { + ApplyHeadersCore(request, clientHeaders); + ApplyHeadersCore(request, requestHeaders); + } + + private static void AppendParameters( + global::System.Text.StringBuilder builder, + global::System.Collections.Generic.Dictionary? parameters, + ref bool hasQuery) + { + if (parameters == null || parameters.Count == 0) + { + return; + } + + foreach (var parameter in parameters) + { + builder.Append(hasQuery ? '&' : '?'); + builder.Append(global::System.Uri.EscapeDataString(parameter.Key)); + builder.Append('='); + builder.Append(global::System.Uri.EscapeDataString(parameter.Value ?? string.Empty)); + hasQuery = true; + } + } + + private static void ApplyHeadersCore( + global::System.Net.Http.HttpRequestMessage request, + global::System.Collections.Generic.Dictionary? headers) + { + if (headers == null || headers.Count == 0) + { + return; + } + + foreach (var header in headers) + { + request.Headers.Remove(header.Key); + request.Content?.Headers.Remove(header.Key); + + if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty) && + request.Content != null) + { + request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty); + } + } + } + + private static async global::System.Threading.Tasks.Task InvokeHooksAsync( + global::ScrapeGraphAI.AutoSDKClientOptions clientOptions, + global::System.Func callback, + global::ScrapeGraphAI.AutoSDKHookContext context) + { + if (clientOptions.Hooks == null || clientOptions.Hooks.Count == 0) + { + return; + } + + foreach (var hook in clientOptions.Hooks) + { + if (hook == null) + { + continue; + } + + await callback(hook, context).ConfigureAwait(false); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost.g.cs new file mode 100644 index 0000000..1bc2345 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost.g.cs @@ -0,0 +1,417 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + public partial class OrthogonalClient + { + + + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPostSecurityRequirement0 = + new global::ScrapeGraphAI.EndPointSecurityRequirement + { + Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] + { new global::ScrapeGraphAI.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", + Location = "Header", + Name = "SGAI-APIKEY", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPostSecurityRequirements = + new global::ScrapeGraphAI.EndPointSecurityRequirement[] + { s_ProxyX402PathPostSecurityRequirement0, + }; + partial void PrepareProxyX402PathPostArguments( + global::System.Net.Http.HttpClient httpClient, + ref string path); + partial void PrepareProxyX402PathPostRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string path); + partial void ProcessProxyX402PathPostResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessProxyX402PathPostResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ProxyX402PathPostAsync( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareProxyX402PathPostArguments( + httpClient: HttpClient, + path: ref path); + + + var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ProxyX402PathPostSecurityRequirements, + operationName: "ProxyX402PathPostAsync"); + + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/x402/{path}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareProxyX402PathPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + path: path); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost", + methodName: "ProxyX402PathPostAsync", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost", + methodName: "ProxyX402PathPostAsync", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost", + methodName: "ProxyX402PathPostAsync", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessProxyX402PathPostResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost", + methodName: "ProxyX402PathPostAsync", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost", + methodName: "ProxyX402PathPostAsync", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessProxyX402PathPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost2.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost2.g.cs new file mode 100644 index 0000000..46dd227 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost2.g.cs @@ -0,0 +1,417 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + public partial class OrthogonalClient + { + + + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPost2SecurityRequirement0 = + new global::ScrapeGraphAI.EndPointSecurityRequirement + { + Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] + { new global::ScrapeGraphAI.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", + Location = "Header", + Name = "SGAI-APIKEY", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPost2SecurityRequirements = + new global::ScrapeGraphAI.EndPointSecurityRequirement[] + { s_ProxyX402PathPost2SecurityRequirement0, + }; + partial void PrepareProxyX402PathPost2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string path); + partial void PrepareProxyX402PathPost2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string path); + partial void ProcessProxyX402PathPost2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessProxyX402PathPost2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ProxyX402PathPost2Async( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareProxyX402PathPost2Arguments( + httpClient: HttpClient, + path: ref path); + + + var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ProxyX402PathPost2SecurityRequirements, + operationName: "ProxyX402PathPost2Async"); + + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/x402/{path}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareProxyX402PathPost2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + path: path); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost2", + methodName: "ProxyX402PathPost2Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost2", + methodName: "ProxyX402PathPost2Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost2", + methodName: "ProxyX402PathPost2Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessProxyX402PathPost2Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost2", + methodName: "ProxyX402PathPost2Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost2", + methodName: "ProxyX402PathPost2Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessProxyX402PathPost2ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost3.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost3.g.cs new file mode 100644 index 0000000..d73ad13 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost3.g.cs @@ -0,0 +1,417 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + public partial class OrthogonalClient + { + + + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPost3SecurityRequirement0 = + new global::ScrapeGraphAI.EndPointSecurityRequirement + { + Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] + { new global::ScrapeGraphAI.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", + Location = "Header", + Name = "SGAI-APIKEY", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPost3SecurityRequirements = + new global::ScrapeGraphAI.EndPointSecurityRequirement[] + { s_ProxyX402PathPost3SecurityRequirement0, + }; + partial void PrepareProxyX402PathPost3Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string path); + partial void PrepareProxyX402PathPost3Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string path); + partial void ProcessProxyX402PathPost3Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessProxyX402PathPost3ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ProxyX402PathPost3Async( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareProxyX402PathPost3Arguments( + httpClient: HttpClient, + path: ref path); + + + var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ProxyX402PathPost3SecurityRequirements, + operationName: "ProxyX402PathPost3Async"); + + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/x402/{path}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareProxyX402PathPost3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + path: path); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost3", + methodName: "ProxyX402PathPost3Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost3", + methodName: "ProxyX402PathPost3Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost3", + methodName: "ProxyX402PathPost3Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessProxyX402PathPost3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost3", + methodName: "ProxyX402PathPost3Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost3", + methodName: "ProxyX402PathPost3Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessProxyX402PathPost3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost4.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost4.g.cs new file mode 100644 index 0000000..7c5e4b4 --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost4.g.cs @@ -0,0 +1,417 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + public partial class OrthogonalClient + { + + + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPost4SecurityRequirement0 = + new global::ScrapeGraphAI.EndPointSecurityRequirement + { + Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] + { new global::ScrapeGraphAI.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", + Location = "Header", + Name = "SGAI-APIKEY", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPost4SecurityRequirements = + new global::ScrapeGraphAI.EndPointSecurityRequirement[] + { s_ProxyX402PathPost4SecurityRequirement0, + }; + partial void PrepareProxyX402PathPost4Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string path); + partial void PrepareProxyX402PathPost4Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string path); + partial void ProcessProxyX402PathPost4Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessProxyX402PathPost4ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ProxyX402PathPost4Async( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareProxyX402PathPost4Arguments( + httpClient: HttpClient, + path: ref path); + + + var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ProxyX402PathPost4SecurityRequirements, + operationName: "ProxyX402PathPost4Async"); + + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/x402/{path}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareProxyX402PathPost4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + path: path); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost4", + methodName: "ProxyX402PathPost4Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost4", + methodName: "ProxyX402PathPost4Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost4", + methodName: "ProxyX402PathPost4Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessProxyX402PathPost4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost4", + methodName: "ProxyX402PathPost4Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost4", + methodName: "ProxyX402PathPost4Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessProxyX402PathPost4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost5.g.cs new file mode 100644 index 0000000..6367c6e --- /dev/null +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPost5.g.cs @@ -0,0 +1,417 @@ + +#nullable enable + +namespace ScrapeGraphAI +{ + public partial class OrthogonalClient + { + + + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPost5SecurityRequirement0 = + new global::ScrapeGraphAI.EndPointSecurityRequirement + { + Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] + { new global::ScrapeGraphAI.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", + Location = "Header", + Name = "SGAI-APIKEY", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPost5SecurityRequirements = + new global::ScrapeGraphAI.EndPointSecurityRequirement[] + { s_ProxyX402PathPost5SecurityRequirement0, + }; + partial void PrepareProxyX402PathPost5Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string path); + partial void PrepareProxyX402PathPost5Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string path); + partial void ProcessProxyX402PathPost5Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessProxyX402PathPost5ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Proxy
+ /// Proxy endpoint for Orthogonal API integration.
+ /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ProxyX402PathPost5Async( + string path, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareProxyX402PathPost5Arguments( + httpClient: HttpClient, + path: ref path); + + + var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ProxyX402PathPost5SecurityRequirements, + operationName: "ProxyX402PathPost5Async"); + + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/x402/{path}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Put, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareProxyX402PathPost5Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + path: path); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost5", + methodName: "ProxyX402PathPost5Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost5", + methodName: "ProxyX402PathPost5Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost5", + methodName: "ProxyX402PathPost5Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessProxyX402PathPost5Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost5", + methodName: "ProxyX402PathPost5Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ProxyX402PathPost5", + methodName: "ProxyX402PathPost5Async", + pathTemplate: "$\"/x402/{path}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessProxyX402PathPost5ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut.g.cs deleted file mode 100644 index 0e62799..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut.g.cs +++ /dev/null @@ -1,234 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - public partial class OrthogonalClient - { - - - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPutSecurityRequirement0 = - new global::ScrapeGraphAI.EndPointSecurityRequirement - { - Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] - { new global::ScrapeGraphAI.EndPointAuthorizationRequirement - { - Type = "ApiKey", - Location = "Header", - Name = "SGAI-APIKEY", - FriendlyName = "ApiKeyInHeader", - }, - }, - }; - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPutSecurityRequirements = - new global::ScrapeGraphAI.EndPointSecurityRequirement[] - { s_ProxyX402PathPutSecurityRequirement0, - }; - partial void PrepareProxyX402PathPutArguments( - global::System.Net.Http.HttpClient httpClient, - ref string path); - partial void PrepareProxyX402PathPutRequest( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string path); - partial void ProcessProxyX402PathPutResponse( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessProxyX402PathPutResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ProxyX402PathPutAsync( - string path, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareProxyX402PathPutArguments( - httpClient: HttpClient, - path: ref path); - - - var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_ProxyX402PathPutSecurityRequirements, - operationName: "ProxyX402PathPutAsync"); - - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/x402/{path}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Put, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in __authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareProxyX402PathPutRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - path: path); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessProxyX402PathPutResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - else - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessProxyX402PathPutResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::ScrapeGraphAI.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), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } - - throw new global::ScrapeGraphAI.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), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut2.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut2.g.cs deleted file mode 100644 index 49e9f76..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut2.g.cs +++ /dev/null @@ -1,234 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - public partial class OrthogonalClient - { - - - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPut2SecurityRequirement0 = - new global::ScrapeGraphAI.EndPointSecurityRequirement - { - Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] - { new global::ScrapeGraphAI.EndPointAuthorizationRequirement - { - Type = "ApiKey", - Location = "Header", - Name = "SGAI-APIKEY", - FriendlyName = "ApiKeyInHeader", - }, - }, - }; - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPut2SecurityRequirements = - new global::ScrapeGraphAI.EndPointSecurityRequirement[] - { s_ProxyX402PathPut2SecurityRequirement0, - }; - partial void PrepareProxyX402PathPut2Arguments( - global::System.Net.Http.HttpClient httpClient, - ref string path); - partial void PrepareProxyX402PathPut2Request( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string path); - partial void ProcessProxyX402PathPut2Response( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessProxyX402PathPut2ResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ProxyX402PathPut2Async( - string path, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareProxyX402PathPut2Arguments( - httpClient: HttpClient, - path: ref path); - - - var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_ProxyX402PathPut2SecurityRequirements, - operationName: "ProxyX402PathPut2Async"); - - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/x402/{path}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in __authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareProxyX402PathPut2Request( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - path: path); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessProxyX402PathPut2Response( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - else - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessProxyX402PathPut2ResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::ScrapeGraphAI.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), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } - - throw new global::ScrapeGraphAI.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), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut3.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut3.g.cs deleted file mode 100644 index 46ce5bb..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut3.g.cs +++ /dev/null @@ -1,234 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - public partial class OrthogonalClient - { - - - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPut3SecurityRequirement0 = - new global::ScrapeGraphAI.EndPointSecurityRequirement - { - Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] - { new global::ScrapeGraphAI.EndPointAuthorizationRequirement - { - Type = "ApiKey", - Location = "Header", - Name = "SGAI-APIKEY", - FriendlyName = "ApiKeyInHeader", - }, - }, - }; - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPut3SecurityRequirements = - new global::ScrapeGraphAI.EndPointSecurityRequirement[] - { s_ProxyX402PathPut3SecurityRequirement0, - }; - partial void PrepareProxyX402PathPut3Arguments( - global::System.Net.Http.HttpClient httpClient, - ref string path); - partial void PrepareProxyX402PathPut3Request( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string path); - partial void ProcessProxyX402PathPut3Response( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessProxyX402PathPut3ResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ProxyX402PathPut3Async( - string path, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareProxyX402PathPut3Arguments( - httpClient: HttpClient, - path: ref path); - - - var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_ProxyX402PathPut3SecurityRequirements, - operationName: "ProxyX402PathPut3Async"); - - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/x402/{path}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in __authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareProxyX402PathPut3Request( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - path: path); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessProxyX402PathPut3Response( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - else - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessProxyX402PathPut3ResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::ScrapeGraphAI.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), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } - - throw new global::ScrapeGraphAI.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), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut4.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut4.g.cs deleted file mode 100644 index 2a3478d..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut4.g.cs +++ /dev/null @@ -1,234 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - public partial class OrthogonalClient - { - - - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPut4SecurityRequirement0 = - new global::ScrapeGraphAI.EndPointSecurityRequirement - { - Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] - { new global::ScrapeGraphAI.EndPointAuthorizationRequirement - { - Type = "ApiKey", - Location = "Header", - Name = "SGAI-APIKEY", - FriendlyName = "ApiKeyInHeader", - }, - }, - }; - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPut4SecurityRequirements = - new global::ScrapeGraphAI.EndPointSecurityRequirement[] - { s_ProxyX402PathPut4SecurityRequirement0, - }; - partial void PrepareProxyX402PathPut4Arguments( - global::System.Net.Http.HttpClient httpClient, - ref string path); - partial void PrepareProxyX402PathPut4Request( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string path); - partial void ProcessProxyX402PathPut4Response( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessProxyX402PathPut4ResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ProxyX402PathPut4Async( - string path, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareProxyX402PathPut4Arguments( - httpClient: HttpClient, - path: ref path); - - - var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_ProxyX402PathPut4SecurityRequirements, - operationName: "ProxyX402PathPut4Async"); - - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/x402/{path}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in __authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareProxyX402PathPut4Request( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - path: path); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessProxyX402PathPut4Response( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - else - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessProxyX402PathPut4ResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::ScrapeGraphAI.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), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } - - throw new global::ScrapeGraphAI.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), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut5.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut5.g.cs deleted file mode 100644 index 280f635..0000000 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.ProxyX402PathPut5.g.cs +++ /dev/null @@ -1,234 +0,0 @@ - -#nullable enable - -namespace ScrapeGraphAI -{ - public partial class OrthogonalClient - { - - - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement s_ProxyX402PathPut5SecurityRequirement0 = - new global::ScrapeGraphAI.EndPointSecurityRequirement - { - Authorizations = new global::ScrapeGraphAI.EndPointAuthorizationRequirement[] - { new global::ScrapeGraphAI.EndPointAuthorizationRequirement - { - Type = "ApiKey", - Location = "Header", - Name = "SGAI-APIKEY", - FriendlyName = "ApiKeyInHeader", - }, - }, - }; - private static readonly global::ScrapeGraphAI.EndPointSecurityRequirement[] s_ProxyX402PathPut5SecurityRequirements = - new global::ScrapeGraphAI.EndPointSecurityRequirement[] - { s_ProxyX402PathPut5SecurityRequirement0, - }; - partial void PrepareProxyX402PathPut5Arguments( - global::System.Net.Http.HttpClient httpClient, - ref string path); - partial void PrepareProxyX402PathPut5Request( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string path); - partial void ProcessProxyX402PathPut5Response( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage); - - partial void ProcessProxyX402PathPut5ResponseContent( - global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); - - /// - /// Proxy
- /// Proxy endpoint for Orthogonal API integration.
- /// Forwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path} - ///
- /// - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task ProxyX402PathPut5Async( - string path, - global::System.Threading.CancellationToken cancellationToken = default) - { - PrepareArguments( - client: HttpClient); - PrepareProxyX402PathPut5Arguments( - httpClient: HttpClient, - path: ref path); - - - var __authorizations = global::ScrapeGraphAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_ProxyX402PathPut5SecurityRequirements, - operationName: "ProxyX402PathPut5Async"); - - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/x402/{path}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: new global::System.Net.Http.HttpMethod("PATCH"), - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); -#if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; -#endif - - foreach (var __authorization in __authorizations) - { - if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") - { - __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: __authorization.Name, - parameter: __authorization.Value); - } - else if (__authorization.Type == "ApiKey" && - __authorization.Location == "Header") - { - __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } - } - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareProxyX402PathPut5Request( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - path: path); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); - - ProcessResponse( - client: HttpClient, - response: __response); - ProcessProxyX402PathPut5Response( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) - { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try - { - if (ReadResponseAsString) - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - else - { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_422 = __ex; - } - - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessProxyX402PathPut5ResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return __content; - } - catch (global::System.Exception __ex) - { - throw new global::ScrapeGraphAI.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), - }; - } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } - - throw new global::ScrapeGraphAI.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), - }; - } - } - } - } -} \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.g.cs index dd5e607..e0fcfbb 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.OrthogonalClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class OrthogonalClient : global::ScrapeGraphAI.IOrthogonal #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public OrthogonalClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the OrthogonalClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public OrthogonalClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.PathBuilder.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.PathBuilder.g.cs index a2c2220..ffc6b52 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.PathBuilder.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.PathBuilder.g.cs @@ -275,6 +275,11 @@ public class EndPointAuthorization ///
public string Type { get; set; } = string.Empty; + /// + /// + /// + public string SchemeId { get; set; } = string.Empty; + /// /// /// diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs index 7a30fb6..3d862a4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.CreateScheduledJobV1ScheduledJobsPost.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,11 +46,13 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( /// Create a new scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateScheduledJobV1ScheduledJobsPostAsync( global::ScrapeGraphAI.ScheduledJobCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -66,22 +69,43 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( securityRequirements: s_CreateScheduledJobV1ScheduledJobsPostSecurityRequirements, operationName: "CreateScheduledJobV1ScheduledJobsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/scheduled-jobs", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/scheduled-jobs", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -91,156 +115,315 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateScheduledJobV1ScheduledJobsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateScheduledJobV1ScheduledJobsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessCreateScheduledJobV1ScheduledJobsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateScheduledJobV1ScheduledJobsPost", + methodName: "CreateScheduledJobV1ScheduledJobsPostAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateScheduledJobV1ScheduledJobsPost", + methodName: "CreateScheduledJobV1ScheduledJobsPostAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateScheduledJobV1ScheduledJobsPost", + methodName: "CreateScheduledJobV1ScheduledJobsPostAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( + response: __response); + ProcessCreateScheduledJobV1ScheduledJobsPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateScheduledJobV1ScheduledJobsPost", + methodName: "CreateScheduledJobV1ScheduledJobsPostAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateScheduledJobV1ScheduledJobsPost", + methodName: "CreateScheduledJobV1ScheduledJobsPostAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Create Scheduled Job
@@ -265,6 +448,7 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateScheduledJobV1ScheduledJobsPostAsync( @@ -274,6 +458,7 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( object jobConfig, bool? isActive = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.ScheduledJobCreate @@ -288,6 +473,7 @@ partial void ProcessCreateScheduledJobV1ScheduledJobsPostResponseContent( return await CreateScheduledJobV1ScheduledJobsPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs index d5f1e43..4f37350 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.DeleteScheduledJobV1ScheduledJobsJobIdDelete.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponseContent( /// Delete a scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponseContent( securityRequirements: s_DeleteScheduledJobV1ScheduledJobsJobIdDeleteSecurityRequirements, operationName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,146 +112,305 @@ partial void ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareDeleteScheduledJobV1ScheduledJobsJobIdDeleteRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteScheduledJobV1ScheduledJobsJobIdDeleteRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteScheduledJobV1ScheduledJobsJobIdDelete", + methodName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteScheduledJobV1ScheduledJobsJobIdDelete", + methodName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteScheduledJobV1ScheduledJobsJobIdDelete", + methodName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponseContent( + response: __response); + ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteScheduledJobV1ScheduledJobsJobIdDelete", + methodName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteScheduledJobV1ScheduledJobsJobIdDelete", + methodName: "DeleteScheduledJobV1ScheduledJobsJobIdDeleteAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeleteScheduledJobV1ScheduledJobsJobIdDeleteResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs index 6be4221..f30e1aa 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.FetchScheduledJobsV1ScheduledJobsGet.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -64,6 +65,7 @@ partial void ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( /// /// Filter by active status /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task FetchScheduledJobsV1ScheduledJobsGetAsync( @@ -71,6 +73,7 @@ partial void ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( int? pageSize = default, global::ScrapeGraphAI.ServiceType? serviceType = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -88,28 +91,49 @@ partial void ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( securityRequirements: s_FetchScheduledJobsV1ScheduledJobsGetSecurityRequirements, operationName: "FetchScheduledJobsV1ScheduledJobsGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/scheduled-jobs", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - .AddOptionalParameter("service_type", serviceType?.ToString()) - .AddOptionalParameter("is_active", isActive?.ToString().ToLowerInvariant()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/scheduled-jobs", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + .AddOptionalParameter("service_type", serviceType?.ToString()) + .AddOptionalParameter("is_active", isActive?.ToString().ToLowerInvariant()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -119,153 +143,312 @@ partial void ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareFetchScheduledJobsV1ScheduledJobsGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - serviceType: serviceType, - isActive: isActive); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareFetchScheduledJobsV1ScheduledJobsGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + serviceType: serviceType, + isActive: isActive); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessFetchScheduledJobsV1ScheduledJobsGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "FetchScheduledJobsV1ScheduledJobsGet", + methodName: "FetchScheduledJobsV1ScheduledJobsGetAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "FetchScheduledJobsV1ScheduledJobsGet", + methodName: "FetchScheduledJobsV1ScheduledJobsGetAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "FetchScheduledJobsV1ScheduledJobsGet", + methodName: "FetchScheduledJobsV1ScheduledJobsGetAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( + response: __response); + ProcessFetchScheduledJobsV1ScheduledJobsGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScheduledJobListResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "FetchScheduledJobsV1ScheduledJobsGet", + methodName: "FetchScheduledJobsV1ScheduledJobsGetAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "FetchScheduledJobsV1ScheduledJobsGet", + methodName: "FetchScheduledJobsV1ScheduledJobsGetAsync", + pathTemplate: "\"/v1/scheduled-jobs\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScheduledJobListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessFetchScheduledJobsV1ScheduledJobsGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScheduledJobListResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScheduledJobListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs index 6c05f69..49d1781 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -62,6 +63,7 @@ partial void ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseCon /// /// Filter by execution status /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync( @@ -69,6 +71,7 @@ partial void ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseCon int? page = default, int? pageSize = default, string? status = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -86,27 +89,48 @@ partial void ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseCon securityRequirements: s_GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetSecurityRequirements, operationName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}/executions", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - .AddOptionalParameter("status", status) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}/executions", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + .AddOptionalParameter("status", status) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -116,153 +140,312 @@ partial void ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseCon __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId, - page: page, - pageSize: pageSize, - status: status); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId, + page: page, + pageSize: pageSize, + status: status); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet", + methodName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/executions\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet", + methodName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/executions\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet", + methodName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/executions\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseContent( + response: __response); + ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.JobExecutionListResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet", + methodName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/executions\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGet", + methodName: "GetJobExecutionsV1ScheduledJobsJobIdExecutionsGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/executions\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.JobExecutionListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetJobExecutionsV1ScheduledJobsJobIdExecutionsGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.JobExecutionListResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.JobExecutionListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs index a25eceb..b5ecd14 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.GetScheduledJobV1ScheduledJobsJobIdGet.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponseContent( /// Get a specific scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetScheduledJobV1ScheduledJobsJobIdGetAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponseContent( securityRequirements: s_GetScheduledJobV1ScheduledJobsJobIdGetSecurityRequirements, operationName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,150 +112,309 @@ partial void ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetScheduledJobV1ScheduledJobsJobIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetScheduledJobV1ScheduledJobsJobIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScheduledJobV1ScheduledJobsJobIdGet", + methodName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScheduledJobV1ScheduledJobsJobIdGet", + methodName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScheduledJobV1ScheduledJobsJobIdGet", + methodName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponseContent( + response: __response); + ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScheduledJobV1ScheduledJobsJobIdGet", + methodName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetScheduledJobV1ScheduledJobsJobIdGet", + methodName: "GetScheduledJobV1ScheduledJobsJobIdGetAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetScheduledJobV1ScheduledJobsJobIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs index 93dc0c0..636ec52 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.PauseScheduledJobV1ScheduledJobsJobIdPausePost.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponseConten /// Pause Scheduled Job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync( global::System.Guid jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponseConten securityRequirements: s_PauseScheduledJobV1ScheduledJobsJobIdPausePostSecurityRequirements, operationName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}/pause", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}/pause", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponseConten __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PreparePauseScheduledJobV1ScheduledJobsJobIdPausePostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePauseScheduledJobV1ScheduledJobsJobIdPausePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PauseScheduledJobV1ScheduledJobsJobIdPausePost", + methodName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/pause\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PauseScheduledJobV1ScheduledJobsJobIdPausePost", + methodName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/pause\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PauseScheduledJobV1ScheduledJobsJobIdPausePost", + methodName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/pause\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponseContent( + response: __response); + ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PauseScheduledJobV1ScheduledJobsJobIdPausePost", + methodName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/pause\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PauseScheduledJobV1ScheduledJobsJobIdPausePost", + methodName: "PauseScheduledJobV1ScheduledJobsJobIdPausePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/pause\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPauseScheduledJobV1ScheduledJobsJobIdPausePostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs index 85fe0bb..37e5a95 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ReplaceScheduledJobV1ScheduledJobsJobIdPut.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -47,12 +48,14 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( ///
/// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync( string jobId, global::ScrapeGraphAI.ScheduledJobCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -70,22 +73,43 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( securityRequirements: s_ReplaceScheduledJobV1ScheduledJobsJobIdPutSecurityRequirements, operationName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: global::System.Net.Http.HttpMethod.Put, - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Put, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -95,157 +119,316 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareReplaceScheduledJobV1ScheduledJobsJobIdPutRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareReplaceScheduledJobV1ScheduledJobsJobIdPutRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ReplaceScheduledJobV1ScheduledJobsJobIdPut", + methodName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ReplaceScheduledJobV1ScheduledJobsJobIdPut", + methodName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ReplaceScheduledJobV1ScheduledJobsJobIdPut", + methodName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( + response: __response); + ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ReplaceScheduledJobV1ScheduledJobsJobIdPut", + methodName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ReplaceScheduledJobV1ScheduledJobsJobIdPut", + methodName: "ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PUT", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Replace Scheduled Job @@ -270,6 +453,7 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( /// /// Webhook URL to send the job result to /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync( @@ -280,6 +464,7 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( object jobConfig, bool? isActive = default, string? webhookUrl = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.ScheduledJobCreate @@ -295,6 +480,7 @@ partial void ProcessReplaceScheduledJobV1ScheduledJobsJobIdPutResponseContent( return await ReplaceScheduledJobV1ScheduledJobsJobIdPutAsync( jobId: jobId, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs index be4612e..99802d4 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.ResumeScheduledJobV1ScheduledJobsJobIdResumePost.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponseCont /// Resume Scheduled Job /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponseCont securityRequirements: s_ResumeScheduledJobV1ScheduledJobsJobIdResumePostSecurityRequirements, operationName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}/resume", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}/resume", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponseCont __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareResumeScheduledJobV1ScheduledJobsJobIdResumePostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareResumeScheduledJobV1ScheduledJobsJobIdResumePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ResumeScheduledJobV1ScheduledJobsJobIdResumePost", + methodName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/resume\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ResumeScheduledJobV1ScheduledJobsJobIdResumePost", + methodName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/resume\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ResumeScheduledJobV1ScheduledJobsJobIdResumePost", + methodName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/resume\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponseContent( + response: __response); + ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ResumeScheduledJobV1ScheduledJobsJobIdResumePost", + methodName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/resume\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ResumeScheduledJobV1ScheduledJobsJobIdResumePost", + methodName: "ResumeScheduledJobV1ScheduledJobsJobIdResumePostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/resume\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessResumeScheduledJobV1ScheduledJobsJobIdResumePostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs index e71b795..53376ca 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -46,10 +47,12 @@ partial void ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponseCon /// Rate limited to 10 triggers per minute per user to prevent abuse. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -64,22 +67,43 @@ partial void ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponseCon securityRequirements: s_TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostSecurityRequirements, operationName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}/trigger", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}/trigger", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -89,150 +113,309 @@ partial void ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponseCon __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost", + methodName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/trigger\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost", + methodName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/trigger\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost", + methodName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/trigger\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponseContent( + response: __response); + ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.JobTriggerResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost", + methodName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/trigger\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPost", + methodName: "TriggerJobManuallyV1ScheduledJobsJobIdTriggerPostAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}/trigger\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.JobTriggerResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessTriggerJobManuallyV1ScheduledJobsJobIdTriggerPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.JobTriggerResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.JobTriggerResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs index 248be35..d4d0f97 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.UpdateScheduledJobV1ScheduledJobsJobIdPatch.g.cs @@ -14,6 +14,7 @@ public partial class ScheduledJobsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -48,12 +49,14 @@ partial void ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( ///
/// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync( string jobId, object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -71,22 +74,43 @@ partial void ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( securityRequirements: s_UpdateScheduledJobV1ScheduledJobsJobIdPatchSecurityRequirements, operationName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/scheduled-jobs/{jobId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: new global::System.Net.Http.HttpMethod("PATCH"), - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/scheduled-jobs/{jobId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -96,167 +120,328 @@ partial void ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareUpdateScheduledJobV1ScheduledJobsJobIdPatchRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - jobId: jobId, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUpdateScheduledJobV1ScheduledJobsJobIdPatchRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + jobId: jobId, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateScheduledJobV1ScheduledJobsJobIdPatch", + methodName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateScheduledJobV1ScheduledJobsJobIdPatch", + methodName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateScheduledJobV1ScheduledJobsJobIdPatch", + methodName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( + response: __response); + ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateScheduledJobV1ScheduledJobsJobIdPatch", + methodName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateScheduledJobV1ScheduledJobsJobIdPatch", + methodName: "UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync", + pathTemplate: "$\"/v1/scheduled-jobs/{jobId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ScheduledJobResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ScheduledJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Update Scheduled Job
/// Update a scheduled job ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync( string jobId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -266,6 +451,7 @@ partial void ProcessUpdateScheduledJobV1ScheduledJobsJobIdPatchResponseContent( return await UpdateScheduledJobV1ScheduledJobsJobIdPatchAsync( jobId: jobId, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.g.cs index f9935fa..74c404f 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScheduledJobsClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class ScheduledJobsClient : global::ScrapeGraphAI.ISchedul #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public ScheduledJobsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ScheduledJobsClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ScheduledJobsClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs index 6422644..3c0d46e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet.g.cs @@ -14,6 +14,7 @@ public partial class SchemaGeneratorClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponseC /// Get Generate Schema Status ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponseC securityRequirements: s_GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetSecurityRequirements, operationName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/generate_schema/{requestId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/generate_schema/{requestId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponseC __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - requestId: requestId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + requestId: requestId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet", + methodName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync", + pathTemplate: "$\"/v1/generate_schema/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet", + methodName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync", + pathTemplate: "$\"/v1/generate_schema/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet", + methodName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync", + pathTemplate: "$\"/v1/generate_schema/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponseContent( + response: __response); + ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet", + methodName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync", + pathTemplate: "$\"/v1/generate_schema/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGet", + methodName: "GetGenerateSchemaStatusV1GenerateSchemaRequestIdGetAsync", + pathTemplate: "$\"/v1/generate_schema/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetGenerateSchemaStatusV1GenerateSchemaRequestIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs index 409b56e..b98ee1a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.StartGenerateSchemaV1GenerateSchemaPost.g.cs @@ -14,6 +14,7 @@ public partial class SchemaGeneratorClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -46,11 +47,13 @@ partial void ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( /// Optionally modify an existing schema to better fit the current search query. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartGenerateSchemaV1GenerateSchemaPostAsync( global::ScrapeGraphAI.SchemaGenerationRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -67,22 +70,43 @@ partial void ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( securityRequirements: s_StartGenerateSchemaV1GenerateSchemaPostSecurityRequirements, operationName: "StartGenerateSchemaV1GenerateSchemaPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/generate_schema", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/generate_schema", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -92,156 +116,315 @@ partial void ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStartGenerateSchemaV1GenerateSchemaPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStartGenerateSchemaV1GenerateSchemaPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStartGenerateSchemaV1GenerateSchemaPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartGenerateSchemaV1GenerateSchemaPost", + methodName: "StartGenerateSchemaV1GenerateSchemaPostAsync", + pathTemplate: "\"/v1/generate_schema\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartGenerateSchemaV1GenerateSchemaPost", + methodName: "StartGenerateSchemaV1GenerateSchemaPostAsync", + pathTemplate: "\"/v1/generate_schema\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartGenerateSchemaV1GenerateSchemaPost", + methodName: "StartGenerateSchemaV1GenerateSchemaPostAsync", + pathTemplate: "\"/v1/generate_schema\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( + response: __response); + ProcessStartGenerateSchemaV1GenerateSchemaPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SchemaGenerationResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartGenerateSchemaV1GenerateSchemaPost", + methodName: "StartGenerateSchemaV1GenerateSchemaPostAsync", + pathTemplate: "\"/v1/generate_schema\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartGenerateSchemaV1GenerateSchemaPost", + methodName: "StartGenerateSchemaV1GenerateSchemaPostAsync", + pathTemplate: "\"/v1/generate_schema\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SchemaGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SchemaGenerationResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SchemaGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Generate or modify a JSON schema based on a search query
@@ -254,11 +437,13 @@ partial void ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( /// /// Optional existing JSON schema to modify/extend /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartGenerateSchemaV1GenerateSchemaPostAsync( string userPrompt, object? existingSchema = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SchemaGenerationRequest @@ -269,6 +454,7 @@ partial void ProcessStartGenerateSchemaV1GenerateSchemaPostResponseContent( return await StartGenerateSchemaV1GenerateSchemaPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.g.cs index 7a30184..5c97eae 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SchemaGeneratorClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class SchemaGeneratorClient : global::ScrapeGraphAI.ISchem #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public SchemaGeneratorClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SchemaGeneratorClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SchemaGeneratorClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.ScrapeV1ScrapePost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.ScrapeV1ScrapePost.g.cs index 5cbdd3c..907948e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.ScrapeV1ScrapePost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.ScrapeV1ScrapePost.g.cs @@ -14,6 +14,7 @@ public partial class ScrapeClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessScrapeV1ScrapePostResponseContent( /// Scrape ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ScrapeV1ScrapePostAsync( global::ScrapeGraphAI.ScrapeRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessScrapeV1ScrapePostResponseContent( securityRequirements: s_ScrapeV1ScrapePostSecurityRequirements, operationName: "ScrapeV1ScrapePostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/scrape", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/scrape", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,152 +114,311 @@ partial void ProcessScrapeV1ScrapePostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareScrapeV1ScrapePostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareScrapeV1ScrapePostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessScrapeV1ScrapePostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ScrapeV1ScrapePost", + methodName: "ScrapeV1ScrapePostAsync", + pathTemplate: "\"/v1/scrape\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ScrapeV1ScrapePost", + methodName: "ScrapeV1ScrapePostAsync", + pathTemplate: "\"/v1/scrape\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ScrapeV1ScrapePost", + methodName: "ScrapeV1ScrapePostAsync", + pathTemplate: "\"/v1/scrape\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessScrapeV1ScrapePostResponseContent( + response: __response); + ProcessScrapeV1ScrapePostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ScrapeV1ScrapePost", + methodName: "ScrapeV1ScrapePostAsync", + pathTemplate: "\"/v1/scrape\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ScrapeV1ScrapePost", + methodName: "ScrapeV1ScrapePostAsync", + pathTemplate: "\"/v1/scrape\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessScrapeV1ScrapePostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Scrape @@ -267,6 +450,7 @@ partial void ProcessScrapeV1ScrapePostResponseContent( /// The number of milliseconds to wait before scraping the website
/// Default Value: 3000 /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ScrapeV1ScrapePostAsync( @@ -278,6 +462,7 @@ partial void ProcessScrapeV1ScrapePostResponseContent( bool? stream = default, string? countryCode = default, int? waitMs = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.ScrapeRequest @@ -294,6 +479,7 @@ partial void ProcessScrapeV1ScrapePostResponseContent( return await ScrapeV1ScrapePostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.g.cs index 4474b83..1b7c0e3 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class ScrapeClient : global::ScrapeGraphAI.IScrapeClient, #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public ScrapeClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ScrapeClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ScrapeClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.Authorizations.ApiKeyInHeader.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.Authorizations.ApiKeyInHeader.g.cs index ec7a386..f66954c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.Authorizations.ApiKeyInHeader.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.Authorizations.ApiKeyInHeader.g.cs @@ -26,6 +26,7 @@ public void AuthorizeUsingApiKeyInHeader( Authorizations.Add(new global::ScrapeGraphAI.EndPointAuthorization { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", Value = apiKey, diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.g.cs index 00db505..13ed448 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ScrapeGraphAIClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -39,7 +42,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public AdminClient Admin => new AdminClient(HttpClient, authorizations: Authorizations) + public AdminClient Admin => new AdminClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -48,7 +51,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public AgenticScrapperClient AgenticScrapper => new AgenticScrapperClient(HttpClient, authorizations: Authorizations) + public AgenticScrapperClient AgenticScrapper => new AgenticScrapperClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -57,7 +60,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public CrawlerClient Crawler => new CrawlerClient(HttpClient, authorizations: Authorizations) + public CrawlerClient Crawler => new CrawlerClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -66,7 +69,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public EndpointPocClient EndpointPoc => new EndpointPocClient(HttpClient, authorizations: Authorizations) + public EndpointPocClient EndpointPoc => new EndpointPocClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -75,7 +78,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public HealthClient Health => new HealthClient(HttpClient, authorizations: Authorizations) + public HealthClient Health => new HealthClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -84,7 +87,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public HistoryClient History => new HistoryClient(HttpClient, authorizations: Authorizations) + public HistoryClient History => new HistoryClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -93,7 +96,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public MarkdownifyClient Markdownify => new MarkdownifyClient(HttpClient, authorizations: Authorizations) + public MarkdownifyClient Markdownify => new MarkdownifyClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -102,7 +105,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public OrthogonalClient Orthogonal => new OrthogonalClient(HttpClient, authorizations: Authorizations) + public OrthogonalClient Orthogonal => new OrthogonalClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -111,7 +114,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public ScheduledJobsClient ScheduledJobs => new ScheduledJobsClient(HttpClient, authorizations: Authorizations) + public ScheduledJobsClient ScheduledJobs => new ScheduledJobsClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -120,7 +123,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public SchemaGeneratorClient SchemaGenerator => new SchemaGeneratorClient(HttpClient, authorizations: Authorizations) + public SchemaGeneratorClient SchemaGenerator => new SchemaGeneratorClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -129,7 +132,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public ScrapeClient Scrape => new ScrapeClient(HttpClient, authorizations: Authorizations) + public ScrapeClient Scrape => new ScrapeClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -138,7 +141,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public SearchScraperClient SearchScraper => new SearchScraperClient(HttpClient, authorizations: Authorizations) + public SearchScraperClient SearchScraper => new SearchScraperClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -147,7 +150,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public SiteMonitorsClient SiteMonitors => new SiteMonitorsClient(HttpClient, authorizations: Authorizations) + public SiteMonitorsClient SiteMonitors => new SiteMonitorsClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -156,7 +159,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public SitemapClient Sitemap => new SitemapClient(HttpClient, authorizations: Authorizations) + public SitemapClient Sitemap => new SitemapClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -165,7 +168,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public SmartScraperClient SmartScraper => new SmartScraperClient(HttpClient, authorizations: Authorizations) + public SmartScraperClient SmartScraper => new SmartScraperClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -174,7 +177,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public ToonifyClient Toonify => new ToonifyClient(HttpClient, authorizations: Authorizations) + public ToonifyClient Toonify => new ToonifyClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -183,7 +186,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public UsageClient Usage => new UsageClient(HttpClient, authorizations: Authorizations) + public UsageClient Usage => new UsageClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -192,7 +195,7 @@ public sealed partial class ScrapeGraphAIClient : global::ScrapeGraphAI.IScrapeG /// /// /// - public UserClient User => new UserClient(HttpClient, authorizations: Authorizations) + public UserClient User => new UserClient(HttpClient, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -211,11 +214,37 @@ public ScrapeGraphAIClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ScrapeGraphAIClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ScrapeGraphAIClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs index f456f0d..639ad7f 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.GetSearchscraperStatusV1SearchscraperRequestIdGet.g.cs @@ -14,6 +14,7 @@ public partial class SearchScraperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponseCon /// Get Searchscraper Status ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSearchscraperStatusV1SearchscraperRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponseCon securityRequirements: s_GetSearchscraperStatusV1SearchscraperRequestIdGetSecurityRequirements, operationName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/searchscraper/{requestId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/searchscraper/{requestId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponseCon __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSearchscraperStatusV1SearchscraperRequestIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - requestId: requestId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSearchscraperStatusV1SearchscraperRequestIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + requestId: requestId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperStatusV1SearchscraperRequestIdGet", + methodName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/searchscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperStatusV1SearchscraperRequestIdGet", + methodName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/searchscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperStatusV1SearchscraperRequestIdGet", + methodName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/searchscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponseContent( + response: __response); + ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperStatusV1SearchscraperRequestIdGet", + methodName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/searchscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSearchscraperStatusV1SearchscraperRequestIdGet", + methodName: "GetSearchscraperStatusV1SearchscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/searchscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSearchscraperStatusV1SearchscraperRequestIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs index be07a45..3f52a3a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.StartSearchscraperV1SearchscraperPost.g.cs @@ -14,6 +14,7 @@ public partial class SearchScraperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( /// Start Searchscraper ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartSearchscraperV1SearchscraperPostAsync( global::ScrapeGraphAI.SearchScraperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( securityRequirements: s_StartSearchscraperV1SearchscraperPostSecurityRequirements, operationName: "StartSearchscraperV1SearchscraperPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/searchscraper", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/searchscraper", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStartSearchscraperV1SearchscraperPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStartSearchscraperV1SearchscraperPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStartSearchscraperV1SearchscraperPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSearchscraperV1SearchscraperPost", + methodName: "StartSearchscraperV1SearchscraperPostAsync", + pathTemplate: "\"/v1/searchscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSearchscraperV1SearchscraperPost", + methodName: "StartSearchscraperV1SearchscraperPostAsync", + pathTemplate: "\"/v1/searchscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSearchscraperV1SearchscraperPost", + methodName: "StartSearchscraperV1SearchscraperPostAsync", + pathTemplate: "\"/v1/searchscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStartSearchscraperV1SearchscraperPostResponseContent( + response: __response); + ProcessStartSearchscraperV1SearchscraperPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.CompletedSearchScraperResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSearchscraperV1SearchscraperPost", + methodName: "StartSearchscraperV1SearchscraperPostAsync", + pathTemplate: "\"/v1/searchscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSearchscraperV1SearchscraperPost", + methodName: "StartSearchscraperV1SearchscraperPostAsync", + pathTemplate: "\"/v1/searchscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.CompletedSearchScraperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStartSearchscraperV1SearchscraperPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.CompletedSearchScraperResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.CompletedSearchScraperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Start Searchscraper @@ -285,6 +468,7 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( /// /// The date range to search in /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartSearchscraperV1SearchscraperPostAsync( @@ -300,6 +484,7 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( string? webhookUrl = default, string? locationGeoCode = default, global::ScrapeGraphAI.TimeRange? timeRange = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SearchScraperRequest @@ -320,6 +505,7 @@ partial void ProcessStartSearchscraperV1SearchscraperPostResponseContent( return await StartSearchscraperV1SearchscraperPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.g.cs index 4519e30..c75c0dc 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SearchScraperClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class SearchScraperClient : global::ScrapeGraphAI.ISearchS #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public SearchScraperClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SearchScraperClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SearchScraperClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Security.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Security.g.cs index 0fc7abd..13800ef 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Security.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.Security.g.cs @@ -6,6 +6,8 @@ internal sealed class EndPointAuthorizationRequirement { internal string Type { get; set; } = string.Empty; + internal string SchemeId { get; set; } = string.Empty; + internal string Location { get; set; } = string.Empty; internal string Name { get; set; } = string.Empty; @@ -97,7 +99,18 @@ private static bool Matches( return requiredAuthorization.Type switch { - "OAuth2" => true, + "OAuth2" => string.Equals( + availableAuthorization.SchemeId, + requiredAuthorization.SchemeId, + global::System.StringComparison.Ordinal), + "OpenIdConnect" => string.Equals( + availableAuthorization.SchemeId, + requiredAuthorization.SchemeId, + global::System.StringComparison.Ordinal), + "MutualTLS" => string.Equals( + availableAuthorization.SchemeId, + requiredAuthorization.SchemeId, + global::System.StringComparison.Ordinal), "Http" => string.Equals( availableAuthorization.Name, requiredAuthorization.Name, diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs index bccd953..1cbf290 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.CreateMonitorV1SiteMonitorsPost.g.cs @@ -14,6 +14,7 @@ public partial class SiteMonitorsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,11 +46,13 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( /// Register a website for monitoring. We will check on the given cron schedule and POST webhook events on content change. /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateMonitorV1SiteMonitorsPostAsync( global::ScrapeGraphAI.SiteMonitorCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -66,22 +69,43 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( securityRequirements: s_CreateMonitorV1SiteMonitorsPostSecurityRequirements, operationName: "CreateMonitorV1SiteMonitorsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/site-monitors", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/site-monitors", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -91,156 +115,315 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateMonitorV1SiteMonitorsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateMonitorV1SiteMonitorsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessCreateMonitorV1SiteMonitorsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateMonitorV1SiteMonitorsPost", + methodName: "CreateMonitorV1SiteMonitorsPostAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateMonitorV1SiteMonitorsPost", + methodName: "CreateMonitorV1SiteMonitorsPostAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateMonitorV1SiteMonitorsPost", + methodName: "CreateMonitorV1SiteMonitorsPostAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessCreateMonitorV1SiteMonitorsPostResponseContent( + response: __response); + ProcessCreateMonitorV1SiteMonitorsPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateMonitorV1SiteMonitorsPost", + methodName: "CreateMonitorV1SiteMonitorsPostAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateMonitorV1SiteMonitorsPost", + methodName: "CreateMonitorV1SiteMonitorsPostAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateMonitorV1SiteMonitorsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Create Monitor
@@ -262,6 +445,7 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( /// Optional: user_prompt and output_schema for structured extraction and diff
/// Default Value: {"user_prompt":"Extract all main content and key data as structured JSON."} /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateMonitorV1SiteMonitorsPostAsync( @@ -270,6 +454,7 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( string cronExpression, string? name = default, global::ScrapeGraphAI.SiteMonitorExtractionConfig? extractionConfig = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SiteMonitorCreate @@ -283,6 +468,7 @@ partial void ProcessCreateMonitorV1SiteMonitorsPostResponseContent( return await CreateMonitorV1SiteMonitorsPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs index 647ca57..93429df 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.DeleteMonitorV1SiteMonitorsMonitorIdDelete.g.cs @@ -14,6 +14,7 @@ public partial class SiteMonitorsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponseContent( /// Delete a site monitor and its schedule. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync( string monitorId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponseContent( securityRequirements: s_DeleteMonitorV1SiteMonitorsMonitorIdDeleteSecurityRequirements, operationName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/site-monitors/{monitorId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/site-monitors/{monitorId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,146 +112,305 @@ partial void ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareDeleteMonitorV1SiteMonitorsMonitorIdDeleteRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - monitorId: monitorId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteMonitorV1SiteMonitorsMonitorIdDeleteRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + monitorId: monitorId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteMonitorV1SiteMonitorsMonitorIdDelete", + methodName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteMonitorV1SiteMonitorsMonitorIdDelete", + methodName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteMonitorV1SiteMonitorsMonitorIdDelete", + methodName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponseContent( + response: __response); + ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteMonitorV1SiteMonitorsMonitorIdDelete", + methodName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteMonitorV1SiteMonitorsMonitorIdDelete", + methodName: "DeleteMonitorV1SiteMonitorsMonitorIdDeleteAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeleteMonitorV1SiteMonitorsMonitorIdDeleteResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs index c9cf1e5..ad258a0 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.GetMonitorV1SiteMonitorsMonitorIdGet.g.cs @@ -14,6 +14,7 @@ public partial class SiteMonitorsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -45,10 +46,12 @@ partial void ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponseContent( /// Get a site monitor by id. ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetMonitorV1SiteMonitorsMonitorIdGetAsync( string monitorId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -63,22 +66,43 @@ partial void ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponseContent( securityRequirements: s_GetMonitorV1SiteMonitorsMonitorIdGetSecurityRequirements, operationName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/site-monitors/{monitorId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/site-monitors/{monitorId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -88,150 +112,309 @@ partial void ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetMonitorV1SiteMonitorsMonitorIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - monitorId: monitorId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetMonitorV1SiteMonitorsMonitorIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + monitorId: monitorId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMonitorV1SiteMonitorsMonitorIdGet", + methodName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMonitorV1SiteMonitorsMonitorIdGet", + methodName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMonitorV1SiteMonitorsMonitorIdGet", + methodName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponseContent( + response: __response); + ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMonitorV1SiteMonitorsMonitorIdGet", + methodName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetMonitorV1SiteMonitorsMonitorIdGet", + methodName: "GetMonitorV1SiteMonitorsMonitorIdGetAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetMonitorV1SiteMonitorsMonitorIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs index 21fcadb..a7f7661 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.ListMonitorsV1SiteMonitorsGet.g.cs @@ -14,6 +14,7 @@ public partial class SiteMonitorsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -55,12 +56,14 @@ partial void ProcessListMonitorsV1SiteMonitorsGetResponseContent( /// Default Value: 20 /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ListMonitorsV1SiteMonitorsGetAsync( int? page = default, int? pageSize = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -77,27 +80,48 @@ partial void ProcessListMonitorsV1SiteMonitorsGetResponseContent( securityRequirements: s_ListMonitorsV1SiteMonitorsGetSecurityRequirements, operationName: "ListMonitorsV1SiteMonitorsGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/site-monitors", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("page", page?.ToString()) - .AddOptionalParameter("page_size", pageSize?.ToString()) - .AddOptionalParameter("is_active", isActive?.ToString().ToLowerInvariant()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/site-monitors", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page_size", pageSize?.ToString()) + .AddOptionalParameter("is_active", isActive?.ToString().ToLowerInvariant()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -107,152 +131,311 @@ partial void ProcessListMonitorsV1SiteMonitorsGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareListMonitorsV1SiteMonitorsGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - page: page, - pageSize: pageSize, - isActive: isActive); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListMonitorsV1SiteMonitorsGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + page: page, + pageSize: pageSize, + isActive: isActive); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessListMonitorsV1SiteMonitorsGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListMonitorsV1SiteMonitorsGet", + methodName: "ListMonitorsV1SiteMonitorsGetAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListMonitorsV1SiteMonitorsGet", + methodName: "ListMonitorsV1SiteMonitorsGetAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListMonitorsV1SiteMonitorsGet", + methodName: "ListMonitorsV1SiteMonitorsGetAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessListMonitorsV1SiteMonitorsGetResponseContent( + response: __response); + ProcessListMonitorsV1SiteMonitorsGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SiteMonitorListResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListMonitorsV1SiteMonitorsGet", + methodName: "ListMonitorsV1SiteMonitorsGetAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListMonitorsV1SiteMonitorsGet", + methodName: "ListMonitorsV1SiteMonitorsGetAsync", + pathTemplate: "\"/v1/site-monitors\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SiteMonitorListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListMonitorsV1SiteMonitorsGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SiteMonitorListResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SiteMonitorListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs index a5b4349..20a347c 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.UpdateMonitorV1SiteMonitorsMonitorIdPatch.g.cs @@ -14,6 +14,7 @@ public partial class SiteMonitorsClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -48,12 +49,14 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( ///
/// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync( string monitorId, global::ScrapeGraphAI.SiteMonitorUpdate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -71,22 +74,43 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( securityRequirements: s_UpdateMonitorV1SiteMonitorsMonitorIdPatchSecurityRequirements, operationName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/site-monitors/{monitorId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( - method: new global::System.Net.Http.HttpMethod("PATCH"), - requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/site-monitors/{monitorId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -96,157 +120,316 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareUpdateMonitorV1SiteMonitorsMonitorIdPatchRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - monitorId: monitorId, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUpdateMonitorV1SiteMonitorsMonitorIdPatchRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + monitorId: monitorId, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateMonitorV1SiteMonitorsMonitorIdPatch", + methodName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateMonitorV1SiteMonitorsMonitorIdPatch", + methodName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateMonitorV1SiteMonitorsMonitorIdPatch", + methodName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( + response: __response); + ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateMonitorV1SiteMonitorsMonitorIdPatch", + methodName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateMonitorV1SiteMonitorsMonitorIdPatch", + methodName: "UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync", + pathTemplate: "$\"/v1/site-monitors/{monitorId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SiteMonitorResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SiteMonitorResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Update Monitor
@@ -258,6 +441,7 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync( @@ -267,6 +451,7 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( string? cronExpression = default, global::ScrapeGraphAI.SiteMonitorExtractionConfig? extractionConfig = default, bool? isActive = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SiteMonitorUpdate @@ -281,6 +466,7 @@ partial void ProcessUpdateMonitorV1SiteMonitorsMonitorIdPatchResponseContent( return await UpdateMonitorV1SiteMonitorsMonitorIdPatchAsync( monitorId: monitorId, request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.g.cs index 7f110fd..90872dd 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SiteMonitorsClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class SiteMonitorsClient : global::ScrapeGraphAI.ISiteMoni #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public SiteMonitorsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SiteMonitorsClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SiteMonitorsClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.GenerateSitemapV1SitemapPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.GenerateSitemapV1SitemapPost.g.cs index 43720ba..a92c8b8 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.GenerateSitemapV1SitemapPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.GenerateSitemapV1SitemapPost.g.cs @@ -14,6 +14,7 @@ public partial class SitemapClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessGenerateSitemapV1SitemapPostResponseContent( /// Generate Sitemap ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GenerateSitemapV1SitemapPostAsync( global::ScrapeGraphAI.SitemapRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessGenerateSitemapV1SitemapPostResponseContent( securityRequirements: s_GenerateSitemapV1SitemapPostSecurityRequirements, operationName: "GenerateSitemapV1SitemapPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/sitemap", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/sitemap", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessGenerateSitemapV1SitemapPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGenerateSitemapV1SitemapPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGenerateSitemapV1SitemapPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGenerateSitemapV1SitemapPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateSitemapV1SitemapPost", + methodName: "GenerateSitemapV1SitemapPostAsync", + pathTemplate: "\"/v1/sitemap\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateSitemapV1SitemapPost", + methodName: "GenerateSitemapV1SitemapPostAsync", + pathTemplate: "\"/v1/sitemap\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateSitemapV1SitemapPost", + methodName: "GenerateSitemapV1SitemapPostAsync", + pathTemplate: "\"/v1/sitemap\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGenerateSitemapV1SitemapPostResponseContent( + response: __response); + ProcessGenerateSitemapV1SitemapPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.SitemapResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateSitemapV1SitemapPost", + methodName: "GenerateSitemapV1SitemapPostAsync", + pathTemplate: "\"/v1/sitemap\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GenerateSitemapV1SitemapPost", + methodName: "GenerateSitemapV1SitemapPostAsync", + pathTemplate: "\"/v1/sitemap\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.SitemapResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGenerateSitemapV1SitemapPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.SitemapResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.SitemapResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Generate Sitemap @@ -251,11 +434,13 @@ partial void ProcessGenerateSitemapV1SitemapPostResponseContent( /// Whether to return streaming response
/// Default Value: false /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GenerateSitemapV1SitemapPostAsync( string websiteUrl, bool? stream = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SitemapRequest @@ -266,6 +451,7 @@ partial void ProcessGenerateSitemapV1SitemapPostResponseContent( return await GenerateSitemapV1SitemapPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.g.cs index d640d4c..0ab4eed 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SitemapClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class SitemapClient : global::ScrapeGraphAI.ISitemapClient #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public SitemapClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SitemapClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SitemapClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs index 3f6583d..a6da27d 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.GetSmartscraperStatusV1SmartscraperRequestIdGet.g.cs @@ -14,6 +14,7 @@ public partial class SmartScraperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,10 +45,12 @@ partial void ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponseConte /// Get Smartscraper Status ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetSmartscraperStatusV1SmartscraperRequestIdGetAsync( string requestId, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -62,22 +65,43 @@ partial void ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponseConte securityRequirements: s_GetSmartscraperStatusV1SmartscraperRequestIdGetSecurityRequirements, operationName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: $"/v1/smartscraper/{requestId}", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: $"/v1/smartscraper/{requestId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -87,146 +111,305 @@ partial void ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponseConte __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetSmartscraperStatusV1SmartscraperRequestIdGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - requestId: requestId); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSmartscraperStatusV1SmartscraperRequestIdGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + requestId: requestId); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperStatusV1SmartscraperRequestIdGet", + methodName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/smartscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperStatusV1SmartscraperRequestIdGet", + methodName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/smartscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperStatusV1SmartscraperRequestIdGet", + methodName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/smartscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponseContent( + response: __response); + ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperStatusV1SmartscraperRequestIdGet", + methodName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/smartscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSmartscraperStatusV1SmartscraperRequestIdGet", + methodName: "GetSmartscraperStatusV1SmartscraperRequestIdGetAsync", + pathTemplate: "$\"/v1/smartscraper/{requestId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSmartscraperStatusV1SmartscraperRequestIdGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs index bbaea3d..ea19267 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.StartSmartscraperV1SmartscraperPost.g.cs @@ -14,6 +14,7 @@ public partial class SmartScraperClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( /// Start Smartscraper ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartSmartscraperV1SmartscraperPostAsync( global::ScrapeGraphAI.SmartscraperRequest request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( securityRequirements: s_StartSmartscraperV1SmartscraperPostSecurityRequirements, operationName: "StartSmartscraperV1SmartscraperPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/smartscraper", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/smartscraper", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareStartSmartscraperV1SmartscraperPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareStartSmartscraperV1SmartscraperPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessStartSmartscraperV1SmartscraperPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSmartscraperV1SmartscraperPost", + methodName: "StartSmartscraperV1SmartscraperPostAsync", + pathTemplate: "\"/v1/smartscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSmartscraperV1SmartscraperPost", + methodName: "StartSmartscraperV1SmartscraperPostAsync", + pathTemplate: "\"/v1/smartscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSmartscraperV1SmartscraperPost", + methodName: "StartSmartscraperV1SmartscraperPostAsync", + pathTemplate: "\"/v1/smartscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessStartSmartscraperV1SmartscraperPostResponseContent( + response: __response); + ProcessStartSmartscraperV1SmartscraperPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.CompletedSmartscraperResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSmartscraperV1SmartscraperPost", + methodName: "StartSmartscraperV1SmartscraperPostAsync", + pathTemplate: "\"/v1/smartscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "StartSmartscraperV1SmartscraperPost", + methodName: "StartSmartscraperV1SmartscraperPostAsync", + pathTemplate: "\"/v1/smartscraper\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.CompletedSmartscraperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessStartSmartscraperV1SmartscraperPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.CompletedSmartscraperResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.CompletedSmartscraperResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Start Smartscraper @@ -317,6 +500,7 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( /// Whether this is a multi-page child request
/// Default Value: false /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task StartSmartscraperV1SmartscraperPostAsync( @@ -341,6 +525,7 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( string? webhookUrl = default, int? offset = default, bool? isMultipageChild = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.SmartscraperRequest @@ -370,6 +555,7 @@ partial void ProcessStartSmartscraperV1SmartscraperPostResponseContent( return await StartSmartscraperV1SmartscraperPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.g.cs index 13ed7ba..ac9e910 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.SmartScraperClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class SmartScraperClient : global::ScrapeGraphAI.ISmartScr #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public SmartScraperClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SmartScraperClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SmartScraperClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.ToonifyV1ToonifyPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.ToonifyV1ToonifyPost.g.cs index f59d2e5..db629cd 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.ToonifyV1ToonifyPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.ToonifyV1ToonifyPost.g.cs @@ -14,6 +14,7 @@ public partial class ToonifyClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessToonifyV1ToonifyPostResponseContent( /// Toonify ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ToonifyV1ToonifyPostAsync( object request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessToonifyV1ToonifyPostResponseContent( securityRequirements: s_ToonifyV1ToonifyPostSecurityRequirements, operationName: "ToonifyV1ToonifyPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/toonify", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/toonify", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,159 +114,320 @@ partial void ProcessToonifyV1ToonifyPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareToonifyV1ToonifyPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareToonifyV1ToonifyPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessToonifyV1ToonifyPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToonifyV1ToonifyPost", + methodName: "ToonifyV1ToonifyPostAsync", + pathTemplate: "\"/v1/toonify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToonifyV1ToonifyPost", + methodName: "ToonifyV1ToonifyPostAsync", + pathTemplate: "\"/v1/toonify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToonifyV1ToonifyPost", + methodName: "ToonifyV1ToonifyPostAsync", + pathTemplate: "\"/v1/toonify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessToonifyV1ToonifyPostResponseContent( + response: __response); + ProcessToonifyV1ToonifyPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return __content; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToonifyV1ToonifyPost", + methodName: "ToonifyV1ToonifyPostAsync", + pathTemplate: "\"/v1/toonify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToonifyV1ToonifyPost", + methodName: "ToonifyV1ToonifyPostAsync", + pathTemplate: "\"/v1/toonify\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return __content; - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessToonifyV1ToonifyPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Toonify /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ToonifyV1ToonifyPostAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new object @@ -251,6 +436,7 @@ partial void ProcessToonifyV1ToonifyPostResponseContent( return await ToonifyV1ToonifyPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.g.cs index 85459da..bd67a4a 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.ToonifyClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class ToonifyClient : global::ScrapeGraphAI.IToonifyClient #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public ToonifyClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ToonifyClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ToonifyClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs index ed2d445..5c44dee 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.GetUsageTimelineV1UsageTimelineGet.g.cs @@ -14,6 +14,7 @@ public partial class UsageClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -47,10 +48,12 @@ partial void ProcessGetUsageTimelineV1UsageTimelineGetResponseContent( /// /// Default Value: all /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetUsageTimelineV1UsageTimelineGetAsync( global::ScrapeGraphAI.GetUsageTimelineV1UsageTimelineGetDays2? days = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -65,25 +68,46 @@ partial void ProcessGetUsageTimelineV1UsageTimelineGetResponseContent( securityRequirements: s_GetUsageTimelineV1UsageTimelineGetSecurityRequirements, operationName: "GetUsageTimelineV1UsageTimelineGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/usage/timeline", - baseUri: HttpClient.BaseAddress); - __pathBuilder - .AddOptionalParameter("days", days?.ToString()) - ; - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/usage/timeline", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("days", days?.ToString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -93,150 +117,309 @@ partial void ProcessGetUsageTimelineV1UsageTimelineGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetUsageTimelineV1UsageTimelineGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - days: days); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetUsageTimelineV1UsageTimelineGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + days: days); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + return __httpRequest; + } - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetUsageTimelineV1UsageTimelineGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetUsageTimelineV1UsageTimelineGet", + methodName: "GetUsageTimelineV1UsageTimelineGetAsync", + pathTemplate: "\"/v1/usage/timeline\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetUsageTimelineV1UsageTimelineGet", + methodName: "GetUsageTimelineV1UsageTimelineGetAsync", + pathTemplate: "\"/v1/usage/timeline\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetUsageTimelineV1UsageTimelineGet", + methodName: "GetUsageTimelineV1UsageTimelineGetAsync", + pathTemplate: "\"/v1/usage/timeline\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessGetUsageTimelineV1UsageTimelineGetResponseContent( + response: __response); + ProcessGetUsageTimelineV1UsageTimelineGetResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.UsageTimelineResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetUsageTimelineV1UsageTimelineGet", + methodName: "GetUsageTimelineV1UsageTimelineGetAsync", + pathTemplate: "\"/v1/usage/timeline\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetUsageTimelineV1UsageTimelineGet", + methodName: "GetUsageTimelineV1UsageTimelineGetAsync", + pathTemplate: "\"/v1/usage/timeline\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.UsageTimelineResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetUsageTimelineV1UsageTimelineGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.UsageTimelineResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.UsageTimelineResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.g.cs index fc042e6..80d679e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UsageClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class UsageClient : global::ScrapeGraphAI.IUsageClient, gl #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public UsageClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the UsageClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public UsageClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.DeductCreditsV1DeductCreditsPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.DeductCreditsV1DeductCreditsPost.g.cs index 573a7ca..fb81bd6 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.DeductCreditsV1DeductCreditsPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.DeductCreditsV1DeductCreditsPost.g.cs @@ -14,6 +14,7 @@ public partial class UserClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessDeductCreditsV1DeductCreditsPostResponseContent( /// Deduct Credits ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task DeductCreditsV1DeductCreditsPostAsync( global::ScrapeGraphAI.DeductCreditsBody request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessDeductCreditsV1DeductCreditsPostResponseContent( securityRequirements: s_DeductCreditsV1DeductCreditsPostSecurityRequirements, operationName: "DeductCreditsV1DeductCreditsPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/deduct-credits", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/deduct-credits", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,165 +114,326 @@ partial void ProcessDeductCreditsV1DeductCreditsPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareDeductCreditsV1DeductCreditsPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeductCreditsV1DeductCreditsPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessDeductCreditsV1DeductCreditsPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeductCreditsV1DeductCreditsPost", + methodName: "DeductCreditsV1DeductCreditsPostAsync", + pathTemplate: "\"/v1/deduct-credits\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeductCreditsV1DeductCreditsPost", + methodName: "DeductCreditsV1DeductCreditsPostAsync", + pathTemplate: "\"/v1/deduct-credits\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeductCreditsV1DeductCreditsPost", + methodName: "DeductCreditsV1DeductCreditsPostAsync", + pathTemplate: "\"/v1/deduct-credits\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessDeductCreditsV1DeductCreditsPostResponseContent( + response: __response); + ProcessDeductCreditsV1DeductCreditsPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.DeductCreditsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeductCreditsV1DeductCreditsPost", + methodName: "DeductCreditsV1DeductCreditsPostAsync", + pathTemplate: "\"/v1/deduct-credits\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeductCreditsV1DeductCreditsPost", + methodName: "DeductCreditsV1DeductCreditsPostAsync", + pathTemplate: "\"/v1/deduct-credits\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.DeductCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeductCreditsV1DeductCreditsPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.DeductCreditsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.DeductCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Deduct Credits /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task DeductCreditsV1DeductCreditsPostAsync( int creditsToDeduct, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.DeductCreditsBody @@ -258,6 +443,7 @@ partial void ProcessDeductCreditsV1DeductCreditsPostResponseContent( return await DeductCreditsV1DeductCreditsPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.GetCreditsV1CreditsGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.GetCreditsV1CreditsGet.g.cs index 833fd5f..663803e 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.GetCreditsV1CreditsGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.GetCreditsV1CreditsGet.g.cs @@ -14,6 +14,7 @@ public partial class UserClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -41,9 +42,11 @@ partial void ProcessGetCreditsV1CreditsGetResponseContent( /// /// Get Credits /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetCreditsV1CreditsGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -57,22 +60,43 @@ partial void ProcessGetCreditsV1CreditsGetResponseContent( securityRequirements: s_GetCreditsV1CreditsGetSecurityRequirements, operationName: "GetCreditsV1CreditsGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/credits", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/credits", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -82,111 +106,270 @@ partial void ProcessGetCreditsV1CreditsGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareGetCreditsV1CreditsGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetCreditsV1CreditsGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessGetCreditsV1CreditsGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); + return __httpRequest; + } - if (ReadResponseAsString) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCreditsV1CreditsGet", + methodName: "GetCreditsV1CreditsGetAsync", + pathTemplate: "\"/v1/credits\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCreditsV1CreditsGet", + methodName: "GetCreditsV1CreditsGetAsync", + pathTemplate: "\"/v1/credits\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetCreditsV1CreditsGetResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - try - { - __response.EnsureSuccessStatusCode(); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCreditsV1CreditsGet", + methodName: "GetCreditsV1CreditsGetAsync", + pathTemplate: "\"/v1/credits\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - return - global::ScrapeGraphAI.CreditsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - throw new global::ScrapeGraphAI.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), - }; + throw new global::System.InvalidOperationException("No response received."); } - } - else - { - try + + using (__response) { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - return - await global::ScrapeGraphAI.CreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetCreditsV1CreditsGetResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCreditsV1CreditsGet", + methodName: "GetCreditsV1CreditsGetAsync", + pathTemplate: "\"/v1/credits\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetCreditsV1CreditsGet", + methodName: "GetCreditsV1CreditsGetAsync", + pathTemplate: "\"/v1/credits\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetCreditsV1CreditsGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.CreditsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.CreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitFeedbackV1FeedbackPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitFeedbackV1FeedbackPost.g.cs index f760451..73b5b49 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitFeedbackV1FeedbackPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitFeedbackV1FeedbackPost.g.cs @@ -14,6 +14,7 @@ public partial class UserClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessSubmitFeedbackV1FeedbackPostResponseContent( /// Submit Feedback ///
/// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SubmitFeedbackV1FeedbackPostAsync( global::ScrapeGraphAI.FeedbackCreate request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessSubmitFeedbackV1FeedbackPostResponseContent( securityRequirements: s_SubmitFeedbackV1FeedbackPostSecurityRequirements, operationName: "SubmitFeedbackV1FeedbackPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/feedback", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/feedback", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessSubmitFeedbackV1FeedbackPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareSubmitFeedbackV1FeedbackPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSubmitFeedbackV1FeedbackPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessSubmitFeedbackV1FeedbackPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitFeedbackV1FeedbackPost", + methodName: "SubmitFeedbackV1FeedbackPostAsync", + pathTemplate: "\"/v1/feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitFeedbackV1FeedbackPost", + methodName: "SubmitFeedbackV1FeedbackPostAsync", + pathTemplate: "\"/v1/feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitFeedbackV1FeedbackPost", + methodName: "SubmitFeedbackV1FeedbackPostAsync", + pathTemplate: "\"/v1/feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessSubmitFeedbackV1FeedbackPostResponseContent( + response: __response); + ProcessSubmitFeedbackV1FeedbackPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.FeedbackResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitFeedbackV1FeedbackPost", + methodName: "SubmitFeedbackV1FeedbackPostAsync", + pathTemplate: "\"/v1/feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitFeedbackV1FeedbackPost", + methodName: "SubmitFeedbackV1FeedbackPostAsync", + pathTemplate: "\"/v1/feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.FeedbackResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessSubmitFeedbackV1FeedbackPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.FeedbackResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.FeedbackResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Submit Feedback @@ -249,12 +432,14 @@ partial void ProcessSubmitFeedbackV1FeedbackPostResponseContent( /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SubmitFeedbackV1FeedbackPostAsync( global::System.Guid requestId, int rating, string? feedbackText = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.FeedbackCreate @@ -266,6 +451,7 @@ partial void ProcessSubmitFeedbackV1FeedbackPostResponseContent( return await SubmitFeedbackV1FeedbackPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs index aed8058..3ea2509 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.SubmitProductFeedbackV1ProductFeedbackPost.g.cs @@ -14,6 +14,7 @@ public partial class UserClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -44,11 +45,13 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( /// Submit Product Feedback /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SubmitProductFeedbackV1ProductFeedbackPostAsync( global::ScrapeGraphAI.ProductFeedback request, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { request = request ?? throw new global::System.ArgumentNullException(nameof(request)); @@ -65,22 +68,43 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( securityRequirements: s_SubmitProductFeedbackV1ProductFeedbackPostSecurityRequirements, operationName: "SubmitProductFeedbackV1ProductFeedbackPostAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/product-feedback", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/product-feedback", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -90,156 +114,315 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } - var __httpRequestContentBody = request.ToJson(JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/json"); - __httpRequest.Content = __httpRequestContent; - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareSubmitProductFeedbackV1ProductFeedbackPostRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest, - request: request); + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSubmitProductFeedbackV1ProductFeedbackPostRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessSubmitProductFeedbackV1ProductFeedbackPostResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - // Validation Error - if ((int)__response.StatusCode == 422) + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - string? __content_422 = null; - global::System.Exception? __exception_422 = null; - global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; - try + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) { - if (ReadResponseAsString) + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitProductFeedbackV1ProductFeedbackPost", + methodName: "SubmitProductFeedbackV1ProductFeedbackPostAsync", + pathTemplate: "\"/v1/product-feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); } - else + catch (global::System.Net.Http.HttpRequestException __exception) { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitProductFeedbackV1ProductFeedbackPost", + methodName: "SubmitProductFeedbackV1ProductFeedbackPostAsync", + pathTemplate: "\"/v1/product-feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitProductFeedbackV1ProductFeedbackPost", + methodName: "SubmitProductFeedbackV1ProductFeedbackPostAsync", + pathTemplate: "\"/v1/product-feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; } + + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - __exception_422 = __ex; + throw new global::System.InvalidOperationException("No response received."); } - throw new global::ScrapeGraphAI.ApiException( - message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_422, - statusCode: __response.StatusCode) + using (__response) { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (ReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - ProcessResponseContent( + ProcessResponse( client: HttpClient, - response: __response, - content: ref __content); - ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( + response: __response); + ProcessSubmitProductFeedbackV1ProductFeedbackPostResponse( httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) { - __response.EnsureSuccessStatusCode(); - - return - global::ScrapeGraphAI.ProductFeedbackResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitProductFeedbackV1ProductFeedbackPost", + methodName: "SubmitProductFeedbackV1ProductFeedbackPostAsync", + pathTemplate: "\"/v1/product-feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - throw new global::ScrapeGraphAI.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), - }; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SubmitProductFeedbackV1ProductFeedbackPost", + methodName: "SubmitProductFeedbackV1ProductFeedbackPostAsync", + pathTemplate: "\"/v1/product-feedback\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - } - else - { - try - { - __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::ScrapeGraphAI.HTTPValidationError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - return - await global::ScrapeGraphAI.ProductFeedbackResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - } - catch (global::System.Exception __ex) - { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + __value_422 = global::ScrapeGraphAI.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::ScrapeGraphAI.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::ScrapeGraphAI.ProductFeedbackResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::ScrapeGraphAI.ProductFeedbackResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } /// /// Submit Product Feedback @@ -261,6 +444,7 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( /// /// /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task SubmitProductFeedbackV1ProductFeedbackPostAsync( @@ -281,6 +465,7 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( string? improvementSuggestions = default, bool? canContact = default, string? contactMethod = default, + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::ScrapeGraphAI.ProductFeedback @@ -306,6 +491,7 @@ partial void ProcessSubmitProductFeedbackV1ProductFeedbackPostResponseContent( return await SubmitProductFeedbackV1ProductFeedbackPostAsync( request: __request, + requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.ValidateApiKeyV1ValidateGet.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.ValidateApiKeyV1ValidateGet.g.cs index 539638e..e56ca61 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.ValidateApiKeyV1ValidateGet.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.ValidateApiKeyV1ValidateGet.g.cs @@ -14,6 +14,7 @@ public partial class UserClient { new global::ScrapeGraphAI.EndPointAuthorizationRequirement { Type = "ApiKey", + SchemeId = "ApikeySgaiApikey", Location = "Header", Name = "SGAI-APIKEY", FriendlyName = "ApiKeyInHeader", @@ -41,9 +42,11 @@ partial void ProcessValidateApiKeyV1ValidateGetResponseContent( /// /// Validate Api Key /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task ValidateApiKeyV1ValidateGetAsync( + global::ScrapeGraphAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( @@ -57,22 +60,43 @@ partial void ProcessValidateApiKeyV1ValidateGetResponseContent( securityRequirements: s_ValidateApiKeyV1ValidateGetSecurityRequirements, operationName: "ValidateApiKeyV1ValidateGetAsync"); - var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( - path: "/v1/validate", - baseUri: HttpClient.BaseAddress); - var __path = __pathBuilder.ToString(); - 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)); + using var __timeoutCancellationTokenSource = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + var __pathBuilder = new global::ScrapeGraphAI.PathBuilder( + path: "/v1/validate", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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)); #if NET6_0_OR_GREATER - __httpRequest.Version = global::System.Net.HttpVersion.Version11; - __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || - __authorization.Type == "OAuth2") + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") { __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( scheme: __authorization.Name, @@ -82,107 +106,266 @@ partial void ProcessValidateApiKeyV1ValidateGetResponseContent( __authorization.Location == "Header") { __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); - } + } } + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareValidateApiKeyV1ValidateGetRequest( - httpClient: HttpClient, - httpRequestMessage: __httpRequest); - - using var __response = await HttpClient.SendAsync( - request: __httpRequest, - completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, - cancellationToken: cancellationToken).ConfigureAwait(false); + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareValidateApiKeyV1ValidateGetRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - ProcessResponse( - client: HttpClient, - response: __response); - ProcessValidateApiKeyV1ValidateGetResponse( - httpClient: HttpClient, - httpResponseMessage: __response); + return __httpRequest; + } - if (ReadResponseAsString) + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try { - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ValidateApiKeyV1ValidateGet", + methodName: "ValidateApiKeyV1ValidateGetAsync", + pathTemplate: "\"/v1/validate\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ValidateApiKeyV1ValidateGet", + methodName: "ValidateApiKeyV1ValidateGetAsync", + pathTemplate: "\"/v1/validate\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessValidateApiKeyV1ValidateGetResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - try - { - __response.EnsureSuccessStatusCode(); + if (__response != null && + __attempt < __maxAttempts && + global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ValidateApiKeyV1ValidateGet", + methodName: "ValidateApiKeyV1ValidateGetAsync", + pathTemplate: "\"/v1/validate\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } - return __content; + break; } - catch (global::System.Exception __ex) + + if (__response == null) { - throw new global::ScrapeGraphAI.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), - }; + throw new global::System.InvalidOperationException("No response received."); } - } - else - { - try + + using (__response) { - __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - return __content; + ProcessResponse( + client: HttpClient, + response: __response); + ProcessValidateApiKeyV1ValidateGetResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ValidateApiKeyV1ValidateGet", + methodName: "ValidateApiKeyV1ValidateGetAsync", + pathTemplate: "\"/v1/validate\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } - catch (global::System.Exception __ex) + else { - string? __content = null; - try - { - __content = await __response.Content.ReadAsStringAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } - catch (global::System.Exception) - { - } + await global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::ScrapeGraphAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ValidateApiKeyV1ValidateGet", + methodName: "ValidateApiKeyV1ValidateGetAsync", + pathTemplate: "\"/v1/validate\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessValidateApiKeyV1ValidateGetResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return __content; + } + catch (global::System.Exception __ex) + { + throw new global::ScrapeGraphAI.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), + }; + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return __content; + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw new global::ScrapeGraphAI.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), + }; + } + } - throw new global::ScrapeGraphAI.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), - }; } } + finally + { + __httpRequest?.Dispose(); + } } } } \ No newline at end of file diff --git a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.g.cs b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.g.cs index c1a3126..a948274 100644 --- a/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.g.cs +++ b/src/libs/ScrapeGraphAI/Generated/ScrapeGraphAI.UserClient.g.cs @@ -30,6 +30,9 @@ public sealed partial class UserClient : global::ScrapeGraphAI.IUserClient, glob #if DEBUG = true; #endif + + /// + public global::ScrapeGraphAI.AutoSDKClientOptions Options { get; } /// /// /// @@ -49,11 +52,37 @@ public UserClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the UserClient. + /// 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. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public UserClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + global::ScrapeGraphAI.AutoSDKClientOptions? options = null, bool disposeHttpClient = true) { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::ScrapeGraphAI.AutoSDKClientOptions(); _disposeHttpClient = disposeHttpClient; Initialized(HttpClient); diff --git a/src/libs/ScrapeGraphAI/openapi.yaml b/src/libs/ScrapeGraphAI/openapi.yaml index bf330f1..351ab1e 100644 --- a/src/libs/ScrapeGraphAI/openapi.yaml +++ b/src/libs/ScrapeGraphAI/openapi.yaml @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/v1/smartscraper":{"post":{"tags":["SmartScraper"],"summary":"Start Smartscraper","operationId":"start_smartscraper_v1_smartscraper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartscraperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedSmartscraperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/smartscraper/{request_id}":{"get":{"tags":["SmartScraper"],"summary":"Get Smartscraper Status","operationId":"get_smartscraper_status_v1_smartscraper__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/markdownify":{"post":{"tags":["Markdownify"],"summary":"Start Markdownify","operationId":"start_markdownify_v1_markdownify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedMarkdownifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/markdownify/{request_id}":{"get":{"tags":["Markdownify"],"summary":"Get Markdownify Status","operationId":"get_markdownify_status_v1_markdownify__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scrape":{"post":{"tags":["Scrape"],"summary":"Scrape","operationId":"scrape_v1_scrape_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/searchscraper":{"post":{"tags":["SearchScraper"],"summary":"Start Searchscraper","operationId":"start_searchscraper_v1_searchscraper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchScraperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedSearchScraperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/searchscraper/{request_id}":{"get":{"tags":["SearchScraper"],"summary":"Get Searchscraper Status","operationId":"get_searchscraper_status_v1_searchscraper__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate_schema":{"post":{"tags":["SchemaGenerator"],"summary":"Generate or modify a JSON schema based on a search query","description":"Generate a refined search prompt and a structured JSON schema for analyzing search results.\n Optionally modify an existing schema to better fit the current search query.","operationId":"start_generate_schema_v1_generate_schema_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGenerationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGenerationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate_schema/{request_id}":{"get":{"tags":["SchemaGenerator"],"summary":"Get Generate Schema Status","operationId":"get_generate_schema_status_v1_generate_schema__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs":{"post":{"tags":["ScheduledJobs"],"summary":"Create Scheduled Job","description":"Create a new scheduled job","operationId":"create_scheduled_job_v1_scheduled_jobs_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["ScheduledJobs"],"summary":"Fetch Scheduled Jobs","description":"Get user's scheduled jobs with pagination","operationId":"fetch_scheduled_jobs_v1_scheduled_jobs_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of jobs per page","default":20,"title":"Page Size"},"description":"Number of jobs per page"},{"name":"service_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ServiceType"},{"type":"null"}],"description":"Filter by service type","title":"Service Type"},"description":"Filter by service type"},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by active status","title":"Is Active"},"description":"Filter by active status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}":{"get":{"tags":["ScheduledJobs"],"summary":"Get Scheduled Job","description":"Get a specific scheduled job","operationId":"get_scheduled_job_v1_scheduled_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["ScheduledJobs"],"summary":"Update Scheduled Job","description":"Update a scheduled job","operationId":"update_scheduled_job_v1_scheduled_jobs__job_id__patch","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Job Update"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["ScheduledJobs"],"summary":"Replace Scheduled Job","operationId":"replace_scheduled_job_v1_scheduled_jobs__job_id__put","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["ScheduledJobs"],"summary":"Delete Scheduled Job","description":"Delete a scheduled job","operationId":"delete_scheduled_job_v1_scheduled_jobs__job_id__delete","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/executions":{"get":{"tags":["ScheduledJobs"],"summary":"Get Job Executions","description":"Get execution history for a scheduled job","operationId":"get_job_executions_v1_scheduled_jobs__job_id__executions_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of executions per page","default":20,"title":"Page Size"},"description":"Number of executions per page"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by execution status","title":"Status"},"description":"Filter by execution status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobExecutionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/pause":{"post":{"tags":["ScheduledJobs"],"summary":"Pause Scheduled Job","operationId":"pause_scheduled_job_v1_scheduled_jobs__job_id__pause_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/resume":{"post":{"tags":["ScheduledJobs"],"summary":"Resume Scheduled Job","operationId":"resume_scheduled_job_v1_scheduled_jobs__job_id__resume_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/trigger":{"post":{"tags":["ScheduledJobs"],"summary":"Trigger Job Manually","description":"Manually trigger a scheduled job\n\nRate limited to 10 triggers per minute per user to prevent abuse.","operationId":"trigger_job_manually_v1_scheduled_jobs__job_id__trigger_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobTriggerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/site-monitors":{"post":{"tags":["SiteMonitors"],"summary":"Create Monitor","description":"Register a website for monitoring. We will check on the given cron schedule and POST webhook events on content change.","operationId":"create_monitor_v1_site_monitors_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["SiteMonitors"],"summary":"List Monitors","description":"List site monitors for the current user.","operationId":"list_monitors_v1_site_monitors_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/site-monitors/{monitor_id}":{"get":{"tags":["SiteMonitors"],"summary":"Get Monitor","description":"Get a site monitor by id.","operationId":"get_monitor_v1_site_monitors__monitor_id__get","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["SiteMonitors"],"summary":"Update Monitor","description":"Update a site monitor. Schedule is updated if cron or config changed.","operationId":"update_monitor_v1_site_monitors__monitor_id__patch","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["SiteMonitors"],"summary":"Delete Monitor","description":"Delete a site monitor and its schedule.","operationId":"delete_monitor_v1_site_monitors__monitor_id__delete","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/healthz":{"get":{"tags":["Health"],"summary":"Health Check","description":"Health check endpoint that includes memory monitoring","operationId":"health_check_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/credits":{"get":{"tags":["User"],"summary":"Get Credits","operationId":"get_credits_v1_credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsResponse"}}}}}}},"/v1/validate":{"get":{"tags":["User"],"summary":"Validate Api Key","operationId":"validate_api_key_v1_validate_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Validate Api Key V1 Validate Get"}}}}}}},"/v1/feedback":{"post":{"tags":["User"],"summary":"Submit Feedback","operationId":"submit_feedback_v1_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/product-feedback":{"post":{"tags":["User"],"summary":"Submit Product Feedback","operationId":"submit_product_feedback_v1_product_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductFeedback"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductFeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/deduct-credits":{"post":{"tags":["User"],"summary":"Deduct Credits","operationId":"deduct_credits_v1_deduct_credits_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeductCreditsBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeductCreditsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/crawl":{"post":{"tags":["Crawler"],"summary":"Start Crawl","description":"Start a new crawl job.","operationId":"start_crawl_v1_crawl_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlJob"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/crawl/{task_id}":{"get":{"tags":["Crawler"],"summary":"Get Crawl Result","description":"Get the result of a crawl job by task ID.","operationId":"get_crawl_result_v1_crawl__task_id__get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhook/logs/{crawler_id}":{"get":{"tags":["Crawler"],"summary":"Get Webhook Logs","description":"Get webhook delivery logs for a crawler job.","operationId":"get_webhook_logs_v1_webhook_logs__crawler_id__get","parameters":[{"name":"crawler_id","in":"path","required":true,"schema":{"type":"string","title":"Crawler Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhook/status/{webhook_id}":{"get":{"tags":["Crawler"],"summary":"Get Webhook Status","description":"Get status of a specific webhook delivery.","operationId":"get_webhook_status_v1_webhook_status__webhook_id__get","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agentic-scrapper":{"post":{"tags":["AgenticScrapper"],"summary":"Agentic Scrapper","operationId":"agentic_scrapper_v1_agentic_scrapper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/get-live-session-url":{"post":{"tags":["AgenticScrapper"],"summary":"Get Live Session Url","operationId":"get_live_session_url_v1_get_live_session_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperLiveSessionUrlRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperLiveSessionUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/stop-session":{"post":{"tags":["AgenticScrapper"],"summary":"Stop Session","operationId":"stop_session_v1_stop_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperStopSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/execute":{"post":{"tags":["AgenticScrapper"],"summary":"Agentic Browser V2","operationId":"agentic_browser_v2_v1_workflows_execute_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDefinition"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowExecutionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/markdownify":{"get":{"tags":["History"],"summary":"Get Markdownify History","description":"Get paginated history of markdownify requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n MarkdownifyHistoryResponse containing the list of requests and next page key","operationId":"get_markdownify_history_v1_history_markdownify_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownifyHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/smartscraper":{"get":{"tags":["History"],"summary":"Get Smartscraper History","description":"Get paginated history of smart scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n SmartscraperHistoryResponse containing the list of requests and next page key","operationId":"get_smartscraper_history_v1_history_smartscraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartscraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/searchscraper":{"get":{"tags":["History"],"summary":"Get Searchscraper History","description":"Get paginated history of search scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n SearchscraperHistoryResponse containing the list of requests and next page key","operationId":"get_searchscraper_history_v1_history_searchscraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchscraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/scrape":{"get":{"tags":["History"],"summary":"Get Scrape History","description":"Get paginated history of scrape requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n ScrapeHistoryResponse containing the list of requests and next page key","operationId":"get_scrape_history_v1_history_scrape_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/crawl":{"get":{"tags":["History"],"summary":"Get Crawler History","description":"Get paginated history of crawler requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n CrawlerHistoryResponse containing the list of requests and next page key","operationId":"get_crawler_history_v1_history_crawl_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlerHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/agentic-scraper":{"get":{"tags":["History"],"summary":"Get Agentic Scraper History","description":"Get paginated history of agentic scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n next_key: Key for pagination (default: None)\n\nReturns:\n AgenticScraperHistoryResponse containing the list of requests and next page key","operationId":"get_agentic_scraper_history_v1_history_agentic_scraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/sitemap":{"get":{"tags":["History"],"summary":"Get Sitemap History","description":"Get sitemap request history for the current API key.","operationId":"get_sitemap_history_v1_history_sitemap_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sitemap":{"post":{"tags":["Sitemap"],"summary":"Generate Sitemap","operationId":"generate_sitemap_v1_sitemap_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/toonify":{"post":{"tags":["Toonify"],"summary":"Toonify","operationId":"toonify_v1_toonify_post","requestBody":{"content":{"application/json":{"schema":{"type":"object","title":"Body"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/timeline":{"get":{"tags":["Usage"],"summary":"Get Usage Timeline","description":"Get usage timeline with only timestamps for chart rendering.","operationId":"get_usage_timeline_v1_usage_timeline_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"anyOf":[{"enum":["7","14","30","all"],"type":"string"},{"type":"null"}],"default":"all","title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageTimelineResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bandcamp/get-sales-feed-items":{"post":{"tags":["EndpointPoc"],"summary":"Get Sales Feed Items","operationId":"get_sales_feed_items_v1_bandcamp_get_sales_feed_items_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/bandcamp/get-item-details/":{"post":{"tags":["EndpointPoc"],"summary":"Get Sales Feed Items Details","operationId":"get_sales_feed_items_details_v1_bandcamp_get_item_details__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/endpoint/get-suggestions":{"post":{"tags":["EndpointPoc"],"summary":"Get Suggestions","operationId":"get_suggestions_v1_endpoint_get_suggestions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/endpoint/save-endpoint":{"post":{"tags":["EndpointPoc"],"summary":"Save Endpoint","operationId":"save_endpoint_v1_endpoint_save_endpoint_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestions"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/endpoint/{endpoint_id}/{full_path}":{"post":{"tags":["EndpointPoc"],"summary":"Execute Endpoint","operationId":"execute_endpoint_v1_endpoint__endpoint_id___full_path__post","parameters":[{"name":"endpoint_id","in":"path","required":true,"schema":{"type":"string","title":"Endpoint Id"}},{"name":"full_path","in":"path","required":true,"schema":{"type":"string","title":"Full Path"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Query Params"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/query_redis_cache_by_pattern":{"post":{"tags":["Admin"],"summary":"Query Redis Cache By Pattern","operationId":"query_redis_cache_by_pattern_v1_admin_query_redis_cache_by_pattern_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryRedisCacheByPatternRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/x402/{path}":{"put":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__put","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__put","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__put","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__put","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__put","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"action"},"action":{"type":"string","title":"Action","description":"Natural language action description (e.g., 'Click login button', 'Fill email with {{email}}')"},"observe_first":{"type":"boolean","title":"Observe First","description":"Whether to observe elements before acting","default":true}},"type":"object","required":["action"],"title":"ActionStep","description":"Perform an action on the page"},"AgenticScraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/AgenticScraperRequestDB"},"type":"array","title":"Requests","description":"List of agentic scraper requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key","description":"Key for next page"}},"type":"object","required":["requests"],"title":"AgenticScraperHistoryResponse"},"AgenticScraperRequestDB":{"properties":{"request_id":{"type":"string","title":"Request Id"},"user_id":{"type":"string","title":"User Id"},"webpage_id":{"type":"string","title":"Webpage Id"},"website_url":{"type":"string","title":"Website Url"},"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"status":{"$ref":"#/components/schemas/AgenticScrapperStatus"},"metadata":{"anyOf":[{},{"type":"null"}],"title":"Metadata"},"result":{"anyOf":[{},{"type":"null"}],"title":"Result"},"total_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Cost","default":0.0},"usage_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usage Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","user_id","webpage_id","website_url","requested_at","status"],"title":"AgenticScraperRequestDB","description":"DynamoDB model for agentic scraper requests."},"AgenticScrapperLiveSessionUrlRequest":{"properties":{"url":{"type":"string","title":"Url"},"timeout":{"type":"integer","title":"Timeout","description":"Timeout for the live session","default":300}},"type":"object","required":["url"],"title":"AgenticScrapperLiveSessionUrlRequest"},"AgenticScrapperLiveSessionUrlResponse":{"properties":{"session_url":{"type":"string","title":"Session Url"},"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_url","session_id"],"title":"AgenticScrapperLiveSessionUrlResponse"},"AgenticScrapperRequest":{"properties":{"url":{"type":"string","title":"Url"},"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt","default":""},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema","default":{}},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps","description":"List of steps to actions to perform on the website","default":[]},"use_session":{"type":"boolean","title":"Use Session","description":"Whether to use a session to scrape the website","default":false},"ai_extraction":{"type":"boolean","title":"Ai Extraction","description":"Whether to use AI extraction to extract the information","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape (e.g. US, GB)"}},"type":"object","required":["url"],"title":"AgenticScrapperRequest"},"AgenticScrapperResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"markdown":{"type":"string","title":"Markdown"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"}},"type":"object","required":["request_id","markdown"],"title":"AgenticScrapperResponse"},"AgenticScrapperStatus":{"type":"string","enum":["queued","processing","processinghtml","processedhtml","completed","failed"],"title":"AgenticScrapperStatus","description":"Status enum for agentic scraper requests."},"AgenticScrapperStopSessionRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_id"],"title":"AgenticScrapperStopSessionRequest"},"CompletedMarkdownifyResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"status":{"$ref":"#/components/schemas/MarkdownifyStatus"},"website_url":{"type":"string","title":"Website Url"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"error":{"type":"string","title":"Error","default":""}},"type":"object","required":["request_id","status","website_url"],"title":"CompletedMarkdownifyResponse"},"CompletedSearchScraperResponse":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"status":{"$ref":"#/components/schemas/SearchScraperStatus"},"user_prompt":{"type":"string","title":"User Prompt"},"num_results":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Results"},"result":{"anyOf":[{"type":"object"},{}],"title":"Result"},"reference_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Reference Urls"},"markdown_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Content","description":"Raw markdown content when extraction_mode is False"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","status","user_prompt","result","reference_urls"],"title":"CompletedSearchScraperResponse"},"CompletedSmartscraperResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"status":{"$ref":"#/components/schemas/SmartscraperStatus"},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"user_prompt":{"type":"string","title":"User Prompt"},"result":{"anyOf":[{"type":"object"},{"type":"string"},{"type":"null"}],"title":"Result"},"error":{"type":"string","title":"Error","default":""}},"type":"object","required":["request_id","status","user_prompt"],"title":"CompletedSmartscraperResponse"},"ConditionalStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"conditional"},"condition":{"type":"string","title":"Condition","description":"Condition to evaluate (e.g., '{{index}} < 10', '{{item}} != null')"},"if_steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"If Steps","description":"Steps to execute if condition is true"},"else_steps":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array"},{"type":"null"}],"title":"Else Steps","description":"Steps to execute if condition is false"}},"type":"object","required":["condition","if_steps"],"title":"ConditionalStep","description":"Conditional execution (if/else)"},"CrawlJob":{"properties":{"url":{"type":"string","title":"Url"},"depth":{"type":"integer","title":"Depth","default":1},"breadth":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Breadth","description":"Maximum number of links to crawl per depth level. If None, unlimited (default). Ignored when sitemap=True."},"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","default":10},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema"},"rules":{"anyOf":[{"$ref":"#/components/schemas/CrawlJobRules"},{"type":"null"}]},"sitemap":{"type":"boolean","title":"Sitemap","default":true},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"extraction_mode":{"type":"boolean","title":"Extraction Mode","default":true},"stealth":{"type":"boolean","title":"Stealth","description":"Enable stealth mode to avoid bot detection","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"reader_mode":{"type":"boolean","title":"Reader Mode","default":false},"wait_ms":{"type":"integer","title":"Wait Ms","default":3000},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for fetching (e.g. US, GB)"}},"type":"object","required":["url"],"title":"CrawlJob"},"CrawlJobRules":{"properties":{"exclude":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Exclude"},"include_paths":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Paths","description":"List of path patterns to include (e.g., ['/products/*', '/blog/*']). If empty, all paths are included."},"exclude_paths":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Exclude Paths","description":"List of path patterns to exclude (e.g., ['/admin/*', '/api/*']). Takes precedence over include_paths."},"same_domain":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Same Domain","default":true}},"type":"object","title":"CrawlJobRules"},"CrawlStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"CrawlStatus"},"CrawlerHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/CrawlerRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"CrawlerHistoryResponse"},"CrawlerRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"url":{"type":"string","title":"Url"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"max_pages":{"type":"integer","title":"Max Pages"},"status":{"$ref":"#/components/schemas/CrawlStatus"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"total_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Cost"},"credits_used":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credits Used"},"pages_processed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pages Processed"},"crawled_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Crawled Urls"},"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"result_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Url"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","user_id","url","max_pages","status","requested_at"],"title":"CrawlerRequestDB","description":"DynamoDB model for crawler requests"},"CreditsResponse":{"properties":{"remaining_credits":{"type":"integer","title":"Remaining Credits"},"total_credits_used":{"type":"integer","title":"Total Credits Used"}},"type":"object","required":["remaining_credits","total_credits_used"],"title":"CreditsResponse"},"DeductCreditsBody":{"properties":{"credits_to_deduct":{"type":"integer","title":"Credits To Deduct"}},"type":"object","required":["credits_to_deduct"],"title":"DeductCreditsBody"},"DeductCreditsResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Credits deducted successfully"}},"type":"object","title":"DeductCreditsResponse"},"EndPointSuggestionRequest":{"properties":{"website_url":{"type":"string","title":"Website Url"},"prompt":{"type":"string","title":"Prompt"}},"type":"object","required":["website_url","prompt"],"title":"EndPointSuggestionRequest"},"EndPointSuggestions":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/EndpointSuggestion"},"type":"array","title":"Suggestions"}},"type":"object","required":["suggestions"],"title":"EndPointSuggestions"},"EndPointSuggestionsResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/EndpointSuggestion"},"type":"array","title":"Suggestions"},"html_with_markdowns":{"title":"Html With Markdowns"}},"type":"object","required":["suggestions","html_with_markdowns"],"title":"EndPointSuggestionsResponse"},"EndpointParameter":{"properties":{"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"location":{"type":"string","title":"Location"},"required":{"type":"boolean","title":"Required"},"description":{"type":"string","title":"Description"},"is_url":{"type":"boolean","title":"Is Url","default":false}},"type":"object","required":["name","type","location","required","description"],"title":"EndpointParameter"},"EndpointSuggestion":{"properties":{"endpoint":{"type":"string","title":"Endpoint"},"method":{"type":"string","title":"Method","default":"POST"},"description":{"type":"string","title":"Description"},"target_url":{"type":"string","title":"Target Url"},"parameters":{"items":{"$ref":"#/components/schemas/EndpointParameter"},"type":"array","title":"Parameters"},"pydantic_schema":{"type":"object","title":"Pydantic Schema"},"extraction_prompt":{"type":"string","title":"Extraction Prompt"},"interaction_steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Interaction Steps"}},"type":"object","required":["endpoint","description","target_url","parameters","pydantic_schema","extraction_prompt"],"title":"EndpointSuggestion"},"ExtractionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"extract"},"instruction":{"type":"string","title":"Instruction","description":"What to extract (e.g., 'Extract all product links from the page')"},"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema","description":"Optional schema for structured extraction"},"save_to":{"type":"string","title":"Save To","description":"Variable name to save extracted data to (e.g., 'product_links')"}},"type":"object","required":["instruction","save_to"],"title":"ExtractionStep","description":"Extract data from the page"},"FeedbackCreate":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id","description":"ID of the request/session this feedback is for"},"rating":{"type":"integer","maximum":5.0,"minimum":0.0,"title":"Rating"},"feedback_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback Text"}},"type":"object","required":["request_id","rating"],"title":"FeedbackCreate"},"FeedbackResponse":{"properties":{"feedback_id":{"type":"string","format":"uuid","title":"Feedback Id"},"request_id":{"type":"string","format":"uuid","title":"Request Id"},"message":{"type":"string","title":"Message","default":"Feedback submitted successfully"},"feedback_timestamp":{"type":"string","format":"date-time","title":"Feedback Timestamp"}},"type":"object","required":["feedback_id","request_id","feedback_timestamp"],"title":"FeedbackResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JobExecutionListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"executions":{"items":{"$ref":"#/components/schemas/JobExecutionResponse"},"type":"array","title":"Executions"}},"type":"object","required":["total","page","page_size","executions"],"title":"JobExecutionListResponse","description":"Paginated response for job executions"},"JobExecutionResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"scheduled_job_id":{"type":"string","format":"uuid","title":"Scheduled Job Id"},"execution_id":{"type":"string","title":"Execution Id"},"status":{"type":"string","title":"Status"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"credits_used":{"type":"integer","title":"Credits Used","default":0}},"type":"object","required":["id","scheduled_job_id","execution_id","status","started_at"],"title":"JobExecutionResponse","description":"Response model for job execution details"},"JobTriggerResponse":{"properties":{"execution_id":{"type":"string","title":"Execution Id"},"message":{"type":"string","title":"Message"},"scheduled_job_id":{"type":"string","format":"uuid","title":"Scheduled Job Id"},"triggered_at":{"type":"string","format":"date-time","title":"Triggered At"}},"type":"object","required":["execution_id","message","scheduled_job_id","triggered_at"],"title":"JobTriggerResponse","description":"Response model for manual job trigger"},"LoopStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"loop"},"iterate_over":{"type":"string","title":"Iterate Over","description":"Variable name containing array to iterate over (e.g., 'product_links')"},"item_name":{"type":"string","title":"Item Name","description":"Variable name for current item in loop (e.g., 'current_link')","default":"item"},"index_name":{"type":"string","title":"Index Name","description":"Variable name for current index (e.g., 'i')","default":"index"},"steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"Steps","description":"Steps to execute for each item"},"max_iterations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Iterations","description":"Maximum number of iterations (safety limit)"}},"type":"object","required":["iterate_over","steps"],"title":"LoopStep","description":"Iterate over an array"},"MarkdownExtractionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"extract_markdown"},"save_to":{"type":"string","title":"Save To","description":"Variable name to save extracted markdown to (e.g., 'markdown')"}},"type":"object","required":["save_to"],"title":"MarkdownExtractionStep","description":"Extract markdown from the page"},"MarkdownifyHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/MarkdownifyRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"MarkdownifyHistoryResponse"},"MarkdownifyRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to scrape"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"}},"type":"object","required":["website_url"],"title":"MarkdownifyRequest"},"MarkdownifyRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id","description":"Unique identifier for the request"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id","description":"ID of the user who made the request"},"webpage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Webpage Id","description":"ID of the associated webpage"},"requested_at":{"type":"string","format":"date-time","title":"Requested At","description":"Timestamp when the request was made"},"status":{"$ref":"#/components/schemas/MarkdownifyRequestStatus","description":"Current status of the request"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if the request failed"},"website_url":{"type":"string","title":"Website Url","description":"URL of the website to be markdownified"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At","description":"Timestamp when the request was completed"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata about the request"},"usage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Usage Id","description":"ID of the associated LLM usage record"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["status","website_url"],"title":"MarkdownifyRequestDB","description":"Pydantic model representing the markdownify_requests database table."},"MarkdownifyRequestStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"MarkdownifyRequestStatus"},"MarkdownifyStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"MarkdownifyStatus"},"NavigationStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"navigate"},"url":{"type":"string","title":"Url","description":"URL to navigate to. Supports variable interpolation: {{variable_name}}"},"wait_for":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wait For","description":"Optional selector to wait for after navigation"}},"type":"object","required":["url"],"title":"NavigationStep","description":"Navigate to a URL"},"ProductFeedback":{"properties":{"feedback_id":{"type":"string","format":"uuid","title":"Feedback Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","examples":["John Doe"]},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","examples":["john@example.com"]},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company","examples":["XYZ Ltd"]},"how_discovered":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"How Discovered","examples":["Twitter"]},"usage_frequency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usage Frequency","examples":["Weekly"]},"use_cases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Use Cases","examples":[["Web scraping","Automation"]]},"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating"},"liked_most":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Liked Most","examples":["Easy setup"]},"disliked":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disliked","examples":["Pagination issues"]},"requested_features":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requested Features","examples":["Scheduler, dashboard analytics"]},"setup_easy":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Setup Easy","examples":[true]},"issues":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issues","examples":["Error saving graphs"]},"recommend_score":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Recommend Score"},"improvement_suggestions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Improvement Suggestions","examples":["Better docs, faster runtime"]},"can_contact":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Can Contact","examples":[true]},"contact_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Method","examples":["Email"]}},"type":"object","title":"ProductFeedback"},"ProductFeedbackResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Product feedback submitted successfully"}},"type":"object","title":"ProductFeedbackResponse"},"QueryRedisCacheByPatternRequest":{"properties":{"cursor":{"type":"integer","title":"Cursor","default":0},"page_size":{"type":"integer","title":"Page Size","default":100},"pattern":{"type":"string","title":"Pattern","default":"providers_order:*"}},"type":"object","title":"QueryRedisCacheByPatternRequest"},"ScheduledJobCreate":{"properties":{"job_name":{"type":"string","maxLength":255,"minLength":1,"title":"Job Name","description":"Human-readable name for the scheduled job","strip_whitespace":true},"service_type":{"$ref":"#/components/schemas/ServiceType","description":"Type of service to run: smartscraper, searchscraper, markdownify, or smartcrawler"},"cron_expression":{"type":"string","title":"Cron Expression","description":"Standard 5-field cron expression (minute hour day month day_of_week) in UTC timezone. All times are interpreted as UTC (e.g., '0 9 * * 1' for 9 AM UTC every Monday)"},"job_config":{"type":"object","title":"Job Config","description":"Service-specific configuration that matches the service's request schema"},"is_active":{"type":"boolean","title":"Is Active","description":"Whether the job is active and should be scheduled","default":true},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"}},"additionalProperties":false,"type":"object","required":["job_name","service_type","cron_expression","job_config"],"title":"ScheduledJobCreate","description":"Model for creating scheduled jobs (required fields enforced)"},"ScheduledJobListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"jobs":{"items":{"$ref":"#/components/schemas/ScheduledJobResponse"},"type":"array","title":"Jobs"}},"type":"object","required":["total","page","page_size","jobs"],"title":"ScheduledJobListResponse","description":"Paginated response for scheduled jobs"},"ScheduledJobResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"job_name":{"type":"string","title":"Job Name"},"service_type":{"$ref":"#/components/schemas/ServiceType"},"cron_expression":{"type":"string","title":"Cron Expression"},"job_config":{"type":"object","title":"Job Config"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"}},"type":"object","required":["id","user_id","job_name","service_type","cron_expression","job_config","is_active","created_at","updated_at"],"title":"ScheduledJobResponse","description":"Response model for scheduled job operations"},"SchemaGenerationRequest":{"properties":{"user_prompt":{"type":"string","title":"User Prompt","description":"The user's search query to be refined"},"existing_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Existing Schema","description":"Optional existing JSON schema to modify/extend"}},"type":"object","required":["user_prompt"],"title":"SchemaGenerationRequest","description":"Request model for schema generation"},"SchemaGenerationResponse":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"status":{"type":"string","title":"Status"},"user_prompt":{"type":"string","title":"User Prompt"},"refined_prompt":{"type":"string","title":"Refined Prompt","description":"The refined search query"},"generated_schema":{"type":"object","title":"Generated Schema","description":"The generated JSON schema"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","status","user_prompt","refined_prompt","generated_schema"],"title":"SchemaGenerationResponse","description":"Response model for schema generation"},"ScrapeHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/ScrapeRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"ScrapeHistoryResponse"},"ScrapeRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to scrape"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","description":"Whether to render heavy JS","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000}},"type":"object","required":["website_url"],"title":"ScrapeRequest"},"ScrapeRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"website_url":{"type":"string","title":"Website Url"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/ScrapeStatus","default":"queued"},"metadata":{"type":"object","title":"Metadata","default":{}},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"requested_at":{"type":"string","format":"date-time","title":"Requested At","default":"2026-04-09T14:29:31.850693"},"cost":{"type":"integer","title":"Cost","default":0},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","website_url"],"title":"ScrapeRequestDB","description":"DynamoDB model for scrape requests."},"ScrapeStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"ScrapeStatus","description":"Status of a scrape request."},"SearchScraperRequest":{"properties":{"user_prompt":{"type":"string","title":"User Prompt","example":"What is the latest version of Python?"},"num_results":{"type":"integer","maximum":20.0,"minimum":3.0,"title":"Num Results","description":"Number of websites to scrape (3-20). Default is 3.","default":3,"example":5},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"extraction_mode":{"type":"boolean","title":"Extraction Mode","description":"True for AI extraction mode, False for markdown conversion only","default":true},"markdown_mode":{"type":"boolean","title":"Markdown Mode","description":"True for markdown conversion mode, False for raw mode","default":true},"stealth":{"type":"boolean","title":"Stealth","description":"Enable stealth mode to avoid bot detection","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"location_geo_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Geo Code","description":"The geo code of the location to search in"},"time_range":{"anyOf":[{"$ref":"#/components/schemas/TimeRange"},{"type":"null"}],"description":"The date range to search in","examples":["past_hour","past_24_hours","past_week","past_month","past_year"]}},"type":"object","required":["user_prompt"],"title":"SearchScraperRequest"},"SearchScraperStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"SearchScraperStatus"},"SearchscraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SearchscraperRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"SearchscraperHistoryResponse"},"SearchscraperRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"user_prompt":{"type":"string","title":"User Prompt"},"search_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Query"},"extraction_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Query"},"references_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"References Urls"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/SearchScraperStatus","default":"queued"},"metadata":{"type":"object","title":"Metadata"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"}},"type":"object","required":["user_prompt"],"title":"SearchscraperRequestDB","description":"Database model for search scraper requests."},"ServiceType":{"type":"string","enum":["smartscraper","searchscraper","markdownify","smartcrawler","agenticscrapper","site_monitor"],"title":"ServiceType"},"SiteMonitorCreate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name","description":"Human-readable name for the monitor"},"website_url":{"type":"string","title":"Website Url","description":"URL to monitor"},"webhook_url":{"type":"string","title":"Webhook Url","description":"URL to POST webhook events to"},"cron_expression":{"type":"string","title":"Cron Expression","description":"Cron schedule (5 fields, UTC), e.g. '*/15 * * * *' for every 15 min"},"extraction_config":{"anyOf":[{"$ref":"#/components/schemas/SiteMonitorExtractionConfig"},{"type":"null"}],"description":"Optional: user_prompt and output_schema for structured extraction and diff","default":{"user_prompt":"Extract all main content and key data as structured JSON."}}},"additionalProperties":false,"type":"object","required":["website_url","webhook_url","cron_expression"],"title":"SiteMonitorCreate","description":"Request body for registering a new site monitor."},"SiteMonitorExtractionConfig":{"properties":{"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt","description":"Prompt for extracting structured data from the page"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema","description":"JSON schema for extracted fields (enables structured diff)"}},"additionalProperties":false,"type":"object","title":"SiteMonitorExtractionConfig","description":"Optional extraction config for monitored page (smartscraper-style)."},"SiteMonitorListResponse":{"properties":{"monitors":{"items":{"$ref":"#/components/schemas/SiteMonitorResponse"},"type":"array","title":"Monitors"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["monitors","total","page","page_size"],"title":"SiteMonitorListResponse","description":"Paginated list of site monitors."},"SiteMonitorResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"api_key_id":{"type":"string","format":"uuid","title":"Api Key Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"website_url":{"type":"string","title":"Website Url"},"webhook_url":{"type":"string","title":"Webhook Url"},"cron_expression":{"type":"string","title":"Cron Expression"},"extraction_config":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Extraction Config"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"}},"type":"object","required":["id","user_id","api_key_id","website_url","webhook_url","cron_expression","is_active","created_at","updated_at"],"title":"SiteMonitorResponse","description":"Response for a single site monitor."},"SiteMonitorUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"cron_expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron Expression"},"extraction_config":{"anyOf":[{"$ref":"#/components/schemas/SiteMonitorExtractionConfig"},{"type":"null"}]},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"additionalProperties":false,"type":"object","title":"SiteMonitorUpdate","description":"Request body for updating a site monitor (partial)."},"SitemapHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SitemapRequestDB"},"type":"array","title":"Requests","description":"List of sitemap requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key","description":"Key for next page"}},"type":"object","required":["requests"],"title":"SitemapHistoryResponse"},"SitemapRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to generate a sitemap for"},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false}},"type":"object","required":["website_url"],"title":"SitemapRequest"},"SitemapRequestDB":{"properties":{"request_id":{"type":"string","title":"Request Id"},"website_url":{"type":"string","title":"Website Url"},"api_key_id":{"type":"string","format":"uuid","title":"Api Key Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"status":{"type":"string","title":"Status"},"urls_count":{"type":"integer","title":"Urls Count"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["request_id","website_url","api_key_id","user_id","requested_at","status","urls_count"],"title":"SitemapRequestDB","description":"Model for storing sitemap request history in DynamoDB."},"SitemapResponse":{"properties":{"urls":{"items":{"type":"string"},"type":"array","title":"Urls","description":"The URLs found in the sitemap"},"request_id":{"type":"string","title":"Request Id","description":"The ID of the sitemap request for tracking"}},"type":"object","required":["urls","request_id"],"title":"SitemapResponse"},"SmartscraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SmartscraperRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"SmartscraperHistoryResponse"},"SmartscraperRequest":{"properties":{"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url","description":"The URL of the website to scrape (optional for Smartscraper)"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","description":"Whether to render heavy JS","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000},"user_prompt":{"type":"string","title":"User Prompt","example":"Extract info about the company"},"website_html":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Html","description":"HTML content, maximum size 2MB","example":"

Title

Content

"},"website_markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Markdown","description":"Markdown content, maximum size 2MB","example":"# Title\n\nThis is some content in markdown format."},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"number_of_scrolls":{"type":"integer","maximum":100.0,"minimum":0.0,"title":"Number Of Scrolls","description":"Number of scroll operations to perform for infinite scrolling (0 = disabled, range: 1-100). Values between 1-9 will be automatically set to 10.","default":0},"total_pages":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Total Pages","description":"Total number of pages to scrape if pagination enabled","default":1},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps","description":"List of steps to actions to perform on the website"},"cookies":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Cookies","description":"Cookies to send with the request","default":{}},"plain_text":{"type":"boolean","title":"Plain Text","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"offset":{"type":"integer","title":"Offset","description":"Offset to start scraping from","default":0},"is_multipage_child":{"type":"boolean","title":"Is Multipage Child","description":"Whether this is a multi-page child request","default":false}},"type":"object","required":["user_prompt"],"title":"SmartscraperRequest"},"SmartscraperRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"webpage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Webpage Id"},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"user_prompt":{"type":"string","title":"User Prompt"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"result":{"anyOf":[{"type":"object"},{},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/SmartscraperStatus","default":"processing"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","user_prompt","requested_at"],"title":"SmartscraperRequestDB","description":"Database model for smart scraper requests."},"SmartscraperStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"SmartscraperStatus"},"StepResult":{"properties":{"step_index":{"type":"integer","title":"Step Index"},"step_type":{"$ref":"#/components/schemas/StepType"},"success":{"type":"boolean","title":"Success"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"duration_seconds":{"type":"number","title":"Duration Seconds"}},"type":"object","required":["step_index","step_type","success","duration_seconds"],"title":"StepResult","description":"Result of a single step execution"},"StepType":{"type":"string","enum":["navigate","action","extract","loop","conditional","subworkflow","wait","extract_markdown"],"title":"StepType","description":"Types of workflow steps"},"SubWorkflowStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"subworkflow"},"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id","description":"ID of saved workflow to execute"},"workflow":{"anyOf":[{"$ref":"#/components/schemas/WorkflowDefinition"},{"type":"null"}],"description":"Inline workflow definition"},"input_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Mapping","description":"Map parent context variables to subworkflow variables (e.g., {'url': '{{current_link}}'})"},"output_mapping":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Output Mapping","description":"Map subworkflow output variables back to parent context"}},"type":"object","title":"SubWorkflowStep","description":"Execute a subworkflow"},"TimeRange":{"type":"string","enum":["past_hour","past_24_hours","past_week","past_month","past_year"],"title":"TimeRange"},"TimelineEntry":{"properties":{"service":{"type":"string","title":"Service"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["service","timestamp"],"title":"TimelineEntry"},"UsageTimelineResponse":{"properties":{"timeline":{"items":{"$ref":"#/components/schemas/TimelineEntry"},"type":"array","title":"Timeline"}},"type":"object","required":["timeline"],"title":"UsageTimelineResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WaitStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"wait"},"duration":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration","description":"Seconds to wait"},"for_selector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"For Selector","description":"CSS selector to wait for"},"for_condition":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"For Condition","description":"JavaScript condition to wait for"}},"type":"object","title":"WaitStep","description":"Wait for a condition or time"},"WorkflowDefinition":{"properties":{"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id","description":"Unique workflow identifier"},"name":{"type":"string","title":"Name","description":"Human-readable workflow name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Workflow description"},"start_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Url","description":"Initial URL to navigate to (can be overridden)"},"use_session":{"type":"boolean","title":"Use Session","description":"Whether to use persistent browser session","default":false},"steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"Steps","description":"Ordered list of workflow steps"},"initial_context":{"type":"object","title":"Initial Context","description":"Initial variables/context (e.g., {'email': 'user@example.com', 'password': 'secret'})"},"output_variables":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Output Variables","description":"List of variables to include in final output"}},"type":"object","required":["name","steps"],"title":"WorkflowDefinition","description":"Main workflow definition"},"WorkflowExecutionResult":{"properties":{"request_id":{"type":"string","title":"Request Id"},"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id"},"success":{"type":"boolean","title":"Success"},"steps_executed":{"items":{"$ref":"#/components/schemas/StepResult"},"type":"array","title":"Steps Executed"},"total_duration_seconds":{"type":"number","title":"Total Duration Seconds"},"final_context":{"type":"object","title":"Final Context","description":"Final workflow context with all variables"},"output":{"type":"object","title":"Output","description":"Filtered output based on output_variables"},"final_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Url"},"final_html":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Html"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","workflow_id","success","steps_executed","total_duration_seconds"],"title":"WorkflowExecutionResult","description":"Result of workflow execution"}}}} \ No newline at end of file +{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/v1/smartscraper":{"post":{"tags":["SmartScraper"],"summary":"Start Smartscraper","operationId":"start_smartscraper_v1_smartscraper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartscraperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedSmartscraperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/smartscraper/{request_id}":{"get":{"tags":["SmartScraper"],"summary":"Get Smartscraper Status","operationId":"get_smartscraper_status_v1_smartscraper__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/markdownify":{"post":{"tags":["Markdownify"],"summary":"Start Markdownify","operationId":"start_markdownify_v1_markdownify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedMarkdownifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/markdownify/{request_id}":{"get":{"tags":["Markdownify"],"summary":"Get Markdownify Status","operationId":"get_markdownify_status_v1_markdownify__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scrape":{"post":{"tags":["Scrape"],"summary":"Scrape","operationId":"scrape_v1_scrape_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/searchscraper":{"post":{"tags":["SearchScraper"],"summary":"Start Searchscraper","operationId":"start_searchscraper_v1_searchscraper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchScraperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedSearchScraperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/searchscraper/{request_id}":{"get":{"tags":["SearchScraper"],"summary":"Get Searchscraper Status","operationId":"get_searchscraper_status_v1_searchscraper__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate_schema":{"post":{"tags":["SchemaGenerator"],"summary":"Generate or modify a JSON schema based on a search query","description":"Generate a refined search prompt and a structured JSON schema for analyzing search results.\n Optionally modify an existing schema to better fit the current search query.","operationId":"start_generate_schema_v1_generate_schema_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGenerationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGenerationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate_schema/{request_id}":{"get":{"tags":["SchemaGenerator"],"summary":"Get Generate Schema Status","operationId":"get_generate_schema_status_v1_generate_schema__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs":{"post":{"tags":["ScheduledJobs"],"summary":"Create Scheduled Job","description":"Create a new scheduled job","operationId":"create_scheduled_job_v1_scheduled_jobs_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["ScheduledJobs"],"summary":"Fetch Scheduled Jobs","description":"Get user's scheduled jobs with pagination","operationId":"fetch_scheduled_jobs_v1_scheduled_jobs_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of jobs per page","default":20,"title":"Page Size"},"description":"Number of jobs per page"},{"name":"service_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ServiceType"},{"type":"null"}],"description":"Filter by service type","title":"Service Type"},"description":"Filter by service type"},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by active status","title":"Is Active"},"description":"Filter by active status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}":{"get":{"tags":["ScheduledJobs"],"summary":"Get Scheduled Job","description":"Get a specific scheduled job","operationId":"get_scheduled_job_v1_scheduled_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["ScheduledJobs"],"summary":"Update Scheduled Job","description":"Update a scheduled job","operationId":"update_scheduled_job_v1_scheduled_jobs__job_id__patch","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Job Update"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["ScheduledJobs"],"summary":"Replace Scheduled Job","operationId":"replace_scheduled_job_v1_scheduled_jobs__job_id__put","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["ScheduledJobs"],"summary":"Delete Scheduled Job","description":"Delete a scheduled job","operationId":"delete_scheduled_job_v1_scheduled_jobs__job_id__delete","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/executions":{"get":{"tags":["ScheduledJobs"],"summary":"Get Job Executions","description":"Get execution history for a scheduled job","operationId":"get_job_executions_v1_scheduled_jobs__job_id__executions_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"Page number","default":1,"title":"Page"},"description":"Page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Number of executions per page","default":20,"title":"Page Size"},"description":"Number of executions per page"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by execution status","title":"Status"},"description":"Filter by execution status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobExecutionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/pause":{"post":{"tags":["ScheduledJobs"],"summary":"Pause Scheduled Job","operationId":"pause_scheduled_job_v1_scheduled_jobs__job_id__pause_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/resume":{"post":{"tags":["ScheduledJobs"],"summary":"Resume Scheduled Job","operationId":"resume_scheduled_job_v1_scheduled_jobs__job_id__resume_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/scheduled-jobs/{job_id}/trigger":{"post":{"tags":["ScheduledJobs"],"summary":"Trigger Job Manually","description":"Manually trigger a scheduled job\n\nRate limited to 10 triggers per minute per user to prevent abuse.","operationId":"trigger_job_manually_v1_scheduled_jobs__job_id__trigger_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobTriggerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/site-monitors":{"post":{"tags":["SiteMonitors"],"summary":"Create Monitor","description":"Register a website for monitoring. We will check on the given cron schedule and POST webhook events on content change.","operationId":"create_monitor_v1_site_monitors_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["SiteMonitors"],"summary":"List Monitors","description":"List site monitors for the current user.","operationId":"list_monitors_v1_site_monitors_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/site-monitors/{monitor_id}":{"get":{"tags":["SiteMonitors"],"summary":"Get Monitor","description":"Get a site monitor by id.","operationId":"get_monitor_v1_site_monitors__monitor_id__get","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["SiteMonitors"],"summary":"Update Monitor","description":"Update a site monitor. Schedule is updated if cron or config changed.","operationId":"update_monitor_v1_site_monitors__monitor_id__patch","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMonitorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["SiteMonitors"],"summary":"Delete Monitor","description":"Delete a site monitor and its schedule.","operationId":"delete_monitor_v1_site_monitors__monitor_id__delete","parameters":[{"name":"monitor_id","in":"path","required":true,"schema":{"type":"string","title":"Monitor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/healthz":{"get":{"tags":["Health"],"summary":"Health Check","description":"Health check endpoint that includes memory monitoring","operationId":"health_check_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/credits":{"get":{"tags":["User"],"summary":"Get Credits","operationId":"get_credits_v1_credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsResponse"}}}}}}},"/v1/validate":{"get":{"tags":["User"],"summary":"Validate Api Key","operationId":"validate_api_key_v1_validate_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Validate Api Key V1 Validate Get"}}}}}}},"/v1/feedback":{"post":{"tags":["User"],"summary":"Submit Feedback","operationId":"submit_feedback_v1_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/product-feedback":{"post":{"tags":["User"],"summary":"Submit Product Feedback","operationId":"submit_product_feedback_v1_product_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductFeedback"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductFeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/deduct-credits":{"post":{"tags":["User"],"summary":"Deduct Credits","operationId":"deduct_credits_v1_deduct_credits_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeductCreditsBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeductCreditsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/crawl":{"post":{"tags":["Crawler"],"summary":"Start Crawl","description":"Start a new crawl job.","operationId":"start_crawl_v1_crawl_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlJob"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/crawl/{task_id}":{"get":{"tags":["Crawler"],"summary":"Get Crawl Result","description":"Get the result of a crawl job by task ID.","operationId":"get_crawl_result_v1_crawl__task_id__get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhook/logs/{crawler_id}":{"get":{"tags":["Crawler"],"summary":"Get Webhook Logs","description":"Get webhook delivery logs for a crawler job.","operationId":"get_webhook_logs_v1_webhook_logs__crawler_id__get","parameters":[{"name":"crawler_id","in":"path","required":true,"schema":{"type":"string","title":"Crawler Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhook/status/{webhook_id}":{"get":{"tags":["Crawler"],"summary":"Get Webhook Status","description":"Get status of a specific webhook delivery.","operationId":"get_webhook_status_v1_webhook_status__webhook_id__get","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agentic-scrapper":{"post":{"tags":["AgenticScrapper"],"summary":"Agentic Scrapper","operationId":"agentic_scrapper_v1_agentic_scrapper_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/get-live-session-url":{"post":{"tags":["AgenticScrapper"],"summary":"Get Live Session Url","operationId":"get_live_session_url_v1_get_live_session_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperLiveSessionUrlRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperLiveSessionUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/stop-session":{"post":{"tags":["AgenticScrapper"],"summary":"Stop Session","operationId":"stop_session_v1_stop_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScrapperStopSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/execute":{"post":{"tags":["AgenticScrapper"],"summary":"Agentic Browser V2","operationId":"agentic_browser_v2_v1_workflows_execute_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDefinition"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowExecutionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/markdownify":{"get":{"tags":["History"],"summary":"Get Markdownify History","description":"Get paginated history of markdownify requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n MarkdownifyHistoryResponse containing the list of requests and next page key","operationId":"get_markdownify_history_v1_history_markdownify_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkdownifyHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/smartscraper":{"get":{"tags":["History"],"summary":"Get Smartscraper History","description":"Get paginated history of smart scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n SmartscraperHistoryResponse containing the list of requests and next page key","operationId":"get_smartscraper_history_v1_history_smartscraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartscraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/searchscraper":{"get":{"tags":["History"],"summary":"Get Searchscraper History","description":"Get paginated history of search scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n SearchscraperHistoryResponse containing the list of requests and next page key","operationId":"get_searchscraper_history_v1_history_searchscraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchscraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/scrape":{"get":{"tags":["History"],"summary":"Get Scrape History","description":"Get paginated history of scrape requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n ScrapeHistoryResponse containing the list of requests and next page key","operationId":"get_scrape_history_v1_history_scrape_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/crawl":{"get":{"tags":["History"],"summary":"Get Crawler History","description":"Get paginated history of crawler requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n\nReturns:\n CrawlerHistoryResponse containing the list of requests and next page key","operationId":"get_crawler_history_v1_history_crawl_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlerHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/agentic-scraper":{"get":{"tags":["History"],"summary":"Get Agentic Scraper History","description":"Get paginated history of agentic scraper requests.\n\nArgs:\n request: The FastAPI request object\n page: Page number (default: 1)\n page_size: Number of items per page (default: 10)\n next_key: Key for pagination (default: None)\n\nReturns:\n AgenticScraperHistoryResponse containing the list of requests and next page key","operationId":"get_agentic_scraper_history_v1_history_agentic_scraper_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgenticScraperHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/history/sitemap":{"get":{"tags":["History"],"summary":"Get Sitemap History","description":"Get sitemap request history for the current API key.","operationId":"get_sitemap_history_v1_history_sitemap_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Page Size"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sitemap":{"post":{"tags":["Sitemap"],"summary":"Generate Sitemap","operationId":"generate_sitemap_v1_sitemap_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SitemapResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/toonify":{"post":{"tags":["Toonify"],"summary":"Toonify","operationId":"toonify_v1_toonify_post","requestBody":{"content":{"application/json":{"schema":{"type":"object","title":"Body"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/timeline":{"get":{"tags":["Usage"],"summary":"Get Usage Timeline","description":"Get usage timeline with only timestamps for chart rendering.","operationId":"get_usage_timeline_v1_usage_timeline_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"anyOf":[{"enum":["7","14","30","all"],"type":"string"},{"type":"null"}],"default":"all","title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageTimelineResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bandcamp/get-sales-feed-items":{"post":{"tags":["EndpointPoc"],"summary":"Get Sales Feed Items","operationId":"get_sales_feed_items_v1_bandcamp_get_sales_feed_items_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/bandcamp/get-item-details/":{"post":{"tags":["EndpointPoc"],"summary":"Get Sales Feed Items Details","operationId":"get_sales_feed_items_details_v1_bandcamp_get_item_details__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/endpoint/get-suggestions":{"post":{"tags":["EndpointPoc"],"summary":"Get Suggestions","operationId":"get_suggestions_v1_endpoint_get_suggestions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/endpoint/save-endpoint":{"post":{"tags":["EndpointPoc"],"summary":"Save Endpoint","operationId":"save_endpoint_v1_endpoint_save_endpoint_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndPointSuggestions"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/endpoint/{endpoint_id}/{full_path}":{"post":{"tags":["EndpointPoc"],"summary":"Execute Endpoint","operationId":"execute_endpoint_v1_endpoint__endpoint_id___full_path__post","parameters":[{"name":"endpoint_id","in":"path","required":true,"schema":{"type":"string","title":"Endpoint Id"}},{"name":"full_path","in":"path","required":true,"schema":{"type":"string","title":"Full Path"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Query Params"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/query_redis_cache_by_pattern":{"post":{"tags":["Admin"],"summary":"Query Redis Cache By Pattern","operationId":"query_redis_cache_by_pattern_v1_admin_query_redis_cache_by_pattern_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryRedisCacheByPatternRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/x402/{path}":{"post":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__post","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__post","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__post","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__post","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Orthogonal"],"summary":"Proxy","description":"Proxy endpoint for Orthogonal API integration.\nForwards requests to https://api.orth.sh/pay/{ORTHOGONHAL_API_KEY}/{path}","operationId":"proxy_x402__path__post","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"action"},"action":{"type":"string","title":"Action","description":"Natural language action description (e.g., 'Click login button', 'Fill email with {{email}}')"},"observe_first":{"type":"boolean","title":"Observe First","description":"Whether to observe elements before acting","default":true}},"type":"object","required":["action"],"title":"ActionStep","description":"Perform an action on the page"},"AgenticScraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/AgenticScraperRequestDB"},"type":"array","title":"Requests","description":"List of agentic scraper requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key","description":"Key for next page"}},"type":"object","required":["requests"],"title":"AgenticScraperHistoryResponse"},"AgenticScraperRequestDB":{"properties":{"request_id":{"type":"string","title":"Request Id"},"user_id":{"type":"string","title":"User Id"},"webpage_id":{"type":"string","title":"Webpage Id"},"website_url":{"type":"string","title":"Website Url"},"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"status":{"$ref":"#/components/schemas/AgenticScrapperStatus"},"metadata":{"anyOf":[{},{"type":"null"}],"title":"Metadata"},"result":{"anyOf":[{},{"type":"null"}],"title":"Result"},"total_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Cost","default":0.0},"usage_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usage Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","user_id","webpage_id","website_url","requested_at","status"],"title":"AgenticScraperRequestDB","description":"DynamoDB model for agentic scraper requests."},"AgenticScrapperLiveSessionUrlRequest":{"properties":{"url":{"type":"string","title":"Url"},"timeout":{"type":"integer","title":"Timeout","description":"Timeout for the live session","default":300}},"type":"object","required":["url"],"title":"AgenticScrapperLiveSessionUrlRequest"},"AgenticScrapperLiveSessionUrlResponse":{"properties":{"session_url":{"type":"string","title":"Session Url"},"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_url","session_id"],"title":"AgenticScrapperLiveSessionUrlResponse"},"AgenticScrapperRequest":{"properties":{"url":{"type":"string","title":"Url"},"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt","default":""},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema","default":{}},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps","description":"List of steps to actions to perform on the website","default":[]},"use_session":{"type":"boolean","title":"Use Session","description":"Whether to use a session to scrape the website","default":false},"ai_extraction":{"type":"boolean","title":"Ai Extraction","description":"Whether to use AI extraction to extract the information","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape (e.g. US, GB)"}},"type":"object","required":["url"],"title":"AgenticScrapperRequest"},"AgenticScrapperResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"markdown":{"type":"string","title":"Markdown"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"}},"type":"object","required":["request_id","markdown"],"title":"AgenticScrapperResponse"},"AgenticScrapperStatus":{"type":"string","enum":["queued","processing","processinghtml","processedhtml","completed","failed"],"title":"AgenticScrapperStatus","description":"Status enum for agentic scraper requests."},"AgenticScrapperStopSessionRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_id"],"title":"AgenticScrapperStopSessionRequest"},"CompletedMarkdownifyResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"status":{"$ref":"#/components/schemas/MarkdownifyStatus"},"website_url":{"type":"string","title":"Website Url"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"error":{"type":"string","title":"Error","default":""}},"type":"object","required":["request_id","status","website_url"],"title":"CompletedMarkdownifyResponse"},"CompletedSearchScraperResponse":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"status":{"$ref":"#/components/schemas/SearchScraperStatus"},"user_prompt":{"type":"string","title":"User Prompt"},"num_results":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Results"},"result":{"anyOf":[{"type":"object"},{}],"title":"Result"},"reference_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Reference Urls"},"markdown_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown Content","description":"Raw markdown content when extraction_mode is False"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","status","user_prompt","result","reference_urls"],"title":"CompletedSearchScraperResponse"},"CompletedSmartscraperResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"status":{"$ref":"#/components/schemas/SmartscraperStatus"},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"user_prompt":{"type":"string","title":"User Prompt"},"result":{"anyOf":[{"type":"object"},{"type":"string"},{"type":"null"}],"title":"Result"},"error":{"type":"string","title":"Error","default":""}},"type":"object","required":["request_id","status","user_prompt"],"title":"CompletedSmartscraperResponse"},"ConditionalStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"conditional"},"condition":{"type":"string","title":"Condition","description":"Condition to evaluate (e.g., '{{index}} < 10', '{{item}} != null')"},"if_steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"If Steps","description":"Steps to execute if condition is true"},"else_steps":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array"},{"type":"null"}],"title":"Else Steps","description":"Steps to execute if condition is false"}},"type":"object","required":["condition","if_steps"],"title":"ConditionalStep","description":"Conditional execution (if/else)"},"CrawlJob":{"properties":{"url":{"type":"string","title":"Url"},"depth":{"type":"integer","title":"Depth","default":1},"breadth":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Breadth","description":"Maximum number of links to crawl per depth level. If None, unlimited (default). Ignored when sitemap=True."},"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","default":10},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema"},"rules":{"anyOf":[{"$ref":"#/components/schemas/CrawlJobRules"},{"type":"null"}]},"sitemap":{"type":"boolean","title":"Sitemap","default":true},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"extraction_mode":{"type":"boolean","title":"Extraction Mode","default":true},"stealth":{"type":"boolean","title":"Stealth","description":"Enable stealth mode to avoid bot detection","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"reader_mode":{"type":"boolean","title":"Reader Mode","default":false},"wait_ms":{"type":"integer","title":"Wait Ms","default":3000},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for fetching (e.g. US, GB)"}},"type":"object","required":["url"],"title":"CrawlJob"},"CrawlJobRules":{"properties":{"exclude":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Exclude"},"include_paths":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Paths","description":"List of path patterns to include (e.g., ['/products/*', '/blog/*']). If empty, all paths are included."},"exclude_paths":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Exclude Paths","description":"List of path patterns to exclude (e.g., ['/admin/*', '/api/*']). Takes precedence over include_paths."},"same_domain":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Same Domain","default":true}},"type":"object","title":"CrawlJobRules"},"CrawlStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"CrawlStatus"},"CrawlerHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/CrawlerRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"CrawlerHistoryResponse"},"CrawlerRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"url":{"type":"string","title":"Url"},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt"},"max_pages":{"type":"integer","title":"Max Pages"},"status":{"$ref":"#/components/schemas/CrawlStatus"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"total_cost":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Cost"},"credits_used":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credits Used"},"pages_processed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pages Processed"},"crawled_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Crawled Urls"},"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"result_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Url"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","user_id","url","max_pages","status","requested_at"],"title":"CrawlerRequestDB","description":"DynamoDB model for crawler requests"},"CreditsResponse":{"properties":{"remaining_credits":{"type":"integer","title":"Remaining Credits"},"total_credits_used":{"type":"integer","title":"Total Credits Used"}},"type":"object","required":["remaining_credits","total_credits_used"],"title":"CreditsResponse"},"DeductCreditsBody":{"properties":{"credits_to_deduct":{"type":"integer","title":"Credits To Deduct"}},"type":"object","required":["credits_to_deduct"],"title":"DeductCreditsBody"},"DeductCreditsResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Credits deducted successfully"}},"type":"object","title":"DeductCreditsResponse"},"EndPointSuggestionRequest":{"properties":{"website_url":{"type":"string","title":"Website Url"},"prompt":{"type":"string","title":"Prompt"}},"type":"object","required":["website_url","prompt"],"title":"EndPointSuggestionRequest"},"EndPointSuggestions":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/EndpointSuggestion"},"type":"array","title":"Suggestions"}},"type":"object","required":["suggestions"],"title":"EndPointSuggestions"},"EndPointSuggestionsResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/EndpointSuggestion"},"type":"array","title":"Suggestions"},"html_with_markdowns":{"title":"Html With Markdowns"}},"type":"object","required":["suggestions","html_with_markdowns"],"title":"EndPointSuggestionsResponse"},"EndpointParameter":{"properties":{"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"location":{"type":"string","title":"Location"},"required":{"type":"boolean","title":"Required"},"description":{"type":"string","title":"Description"},"is_url":{"type":"boolean","title":"Is Url","default":false}},"type":"object","required":["name","type","location","required","description"],"title":"EndpointParameter"},"EndpointSuggestion":{"properties":{"endpoint":{"type":"string","title":"Endpoint"},"method":{"type":"string","title":"Method","default":"POST"},"description":{"type":"string","title":"Description"},"target_url":{"type":"string","title":"Target Url"},"parameters":{"items":{"$ref":"#/components/schemas/EndpointParameter"},"type":"array","title":"Parameters"},"pydantic_schema":{"type":"object","title":"Pydantic Schema"},"extraction_prompt":{"type":"string","title":"Extraction Prompt"},"interaction_steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Interaction Steps"}},"type":"object","required":["endpoint","description","target_url","parameters","pydantic_schema","extraction_prompt"],"title":"EndpointSuggestion"},"ExtractionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"extract"},"instruction":{"type":"string","title":"Instruction","description":"What to extract (e.g., 'Extract all product links from the page')"},"schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema","description":"Optional schema for structured extraction"},"save_to":{"type":"string","title":"Save To","description":"Variable name to save extracted data to (e.g., 'product_links')"}},"type":"object","required":["instruction","save_to"],"title":"ExtractionStep","description":"Extract data from the page"},"FeedbackCreate":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id","description":"ID of the request/session this feedback is for"},"rating":{"type":"integer","maximum":5.0,"minimum":0.0,"title":"Rating"},"feedback_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback Text"}},"type":"object","required":["request_id","rating"],"title":"FeedbackCreate"},"FeedbackResponse":{"properties":{"feedback_id":{"type":"string","format":"uuid","title":"Feedback Id"},"request_id":{"type":"string","format":"uuid","title":"Request Id"},"message":{"type":"string","title":"Message","default":"Feedback submitted successfully"},"feedback_timestamp":{"type":"string","format":"date-time","title":"Feedback Timestamp"}},"type":"object","required":["feedback_id","request_id","feedback_timestamp"],"title":"FeedbackResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JobExecutionListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"executions":{"items":{"$ref":"#/components/schemas/JobExecutionResponse"},"type":"array","title":"Executions"}},"type":"object","required":["total","page","page_size","executions"],"title":"JobExecutionListResponse","description":"Paginated response for job executions"},"JobExecutionResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"scheduled_job_id":{"type":"string","format":"uuid","title":"Scheduled Job Id"},"execution_id":{"type":"string","title":"Execution Id"},"status":{"type":"string","title":"Status"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"credits_used":{"type":"integer","title":"Credits Used","default":0}},"type":"object","required":["id","scheduled_job_id","execution_id","status","started_at"],"title":"JobExecutionResponse","description":"Response model for job execution details"},"JobTriggerResponse":{"properties":{"execution_id":{"type":"string","title":"Execution Id"},"message":{"type":"string","title":"Message"},"scheduled_job_id":{"type":"string","format":"uuid","title":"Scheduled Job Id"},"triggered_at":{"type":"string","format":"date-time","title":"Triggered At"}},"type":"object","required":["execution_id","message","scheduled_job_id","triggered_at"],"title":"JobTriggerResponse","description":"Response model for manual job trigger"},"LoopStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"loop"},"iterate_over":{"type":"string","title":"Iterate Over","description":"Variable name containing array to iterate over (e.g., 'product_links')"},"item_name":{"type":"string","title":"Item Name","description":"Variable name for current item in loop (e.g., 'current_link')","default":"item"},"index_name":{"type":"string","title":"Index Name","description":"Variable name for current index (e.g., 'i')","default":"index"},"steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"Steps","description":"Steps to execute for each item"},"max_iterations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Iterations","description":"Maximum number of iterations (safety limit)"}},"type":"object","required":["iterate_over","steps"],"title":"LoopStep","description":"Iterate over an array"},"MarkdownExtractionStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"extract_markdown"},"save_to":{"type":"string","title":"Save To","description":"Variable name to save extracted markdown to (e.g., 'markdown')"}},"type":"object","required":["save_to"],"title":"MarkdownExtractionStep","description":"Extract markdown from the page"},"MarkdownifyHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/MarkdownifyRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"MarkdownifyHistoryResponse"},"MarkdownifyRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to scrape"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"}},"type":"object","required":["website_url"],"title":"MarkdownifyRequest"},"MarkdownifyRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id","description":"Unique identifier for the request"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id","description":"ID of the user who made the request"},"webpage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Webpage Id","description":"ID of the associated webpage"},"requested_at":{"type":"string","format":"date-time","title":"Requested At","description":"Timestamp when the request was made"},"status":{"$ref":"#/components/schemas/MarkdownifyRequestStatus","description":"Current status of the request"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if the request failed"},"website_url":{"type":"string","title":"Website Url","description":"URL of the website to be markdownified"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At","description":"Timestamp when the request was completed"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata about the request"},"usage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Usage Id","description":"ID of the associated LLM usage record"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["status","website_url"],"title":"MarkdownifyRequestDB","description":"Pydantic model representing the markdownify_requests database table."},"MarkdownifyRequestStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"MarkdownifyRequestStatus"},"MarkdownifyStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"MarkdownifyStatus"},"NavigationStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"navigate"},"url":{"type":"string","title":"Url","description":"URL to navigate to. Supports variable interpolation: {{variable_name}}"},"wait_for":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wait For","description":"Optional selector to wait for after navigation"}},"type":"object","required":["url"],"title":"NavigationStep","description":"Navigate to a URL"},"ProductFeedback":{"properties":{"feedback_id":{"type":"string","format":"uuid","title":"Feedback Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","examples":["John Doe"]},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","examples":["john@example.com"]},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company","examples":["XYZ Ltd"]},"how_discovered":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"How Discovered","examples":["Twitter"]},"usage_frequency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usage Frequency","examples":["Weekly"]},"use_cases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Use Cases","examples":[["Web scraping","Automation"]]},"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating"},"liked_most":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Liked Most","examples":["Easy setup"]},"disliked":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disliked","examples":["Pagination issues"]},"requested_features":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requested Features","examples":["Scheduler, dashboard analytics"]},"setup_easy":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Setup Easy","examples":[true]},"issues":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issues","examples":["Error saving graphs"]},"recommend_score":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Recommend Score"},"improvement_suggestions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Improvement Suggestions","examples":["Better docs, faster runtime"]},"can_contact":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Can Contact","examples":[true]},"contact_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Method","examples":["Email"]}},"type":"object","title":"ProductFeedback"},"ProductFeedbackResponse":{"properties":{"message":{"type":"string","title":"Message","default":"Product feedback submitted successfully"}},"type":"object","title":"ProductFeedbackResponse"},"QueryRedisCacheByPatternRequest":{"properties":{"cursor":{"type":"integer","title":"Cursor","default":0},"page_size":{"type":"integer","title":"Page Size","default":100},"pattern":{"type":"string","title":"Pattern","default":"providers_order:*"}},"type":"object","title":"QueryRedisCacheByPatternRequest"},"ScheduledJobCreate":{"properties":{"job_name":{"type":"string","maxLength":255,"minLength":1,"title":"Job Name","description":"Human-readable name for the scheduled job","strip_whitespace":true},"service_type":{"$ref":"#/components/schemas/ServiceType","description":"Type of service to run: smartscraper, searchscraper, markdownify, or smartcrawler"},"cron_expression":{"type":"string","title":"Cron Expression","description":"Standard 5-field cron expression (minute hour day month day_of_week) in UTC timezone. All times are interpreted as UTC (e.g., '0 9 * * 1' for 9 AM UTC every Monday)"},"job_config":{"type":"object","title":"Job Config","description":"Service-specific configuration that matches the service's request schema"},"is_active":{"type":"boolean","title":"Is Active","description":"Whether the job is active and should be scheduled","default":true},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"}},"additionalProperties":false,"type":"object","required":["job_name","service_type","cron_expression","job_config"],"title":"ScheduledJobCreate","description":"Model for creating scheduled jobs (required fields enforced)"},"ScheduledJobListResponse":{"properties":{"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"jobs":{"items":{"$ref":"#/components/schemas/ScheduledJobResponse"},"type":"array","title":"Jobs"}},"type":"object","required":["total","page","page_size","jobs"],"title":"ScheduledJobListResponse","description":"Paginated response for scheduled jobs"},"ScheduledJobResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"job_name":{"type":"string","title":"Job Name"},"service_type":{"$ref":"#/components/schemas/ServiceType"},"cron_expression":{"type":"string","title":"Cron Expression"},"job_config":{"type":"object","title":"Job Config"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"}},"type":"object","required":["id","user_id","job_name","service_type","cron_expression","job_config","is_active","created_at","updated_at"],"title":"ScheduledJobResponse","description":"Response model for scheduled job operations"},"SchemaGenerationRequest":{"properties":{"user_prompt":{"type":"string","title":"User Prompt","description":"The user's search query to be refined"},"existing_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Existing Schema","description":"Optional existing JSON schema to modify/extend"}},"type":"object","required":["user_prompt"],"title":"SchemaGenerationRequest","description":"Request model for schema generation"},"SchemaGenerationResponse":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"status":{"type":"string","title":"Status"},"user_prompt":{"type":"string","title":"User Prompt"},"refined_prompt":{"type":"string","title":"Refined Prompt","description":"The refined search query"},"generated_schema":{"type":"object","title":"Generated Schema","description":"The generated JSON schema"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","status","user_prompt","refined_prompt","generated_schema"],"title":"SchemaGenerationResponse","description":"Response model for schema generation"},"ScrapeHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/ScrapeRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"ScrapeHistoryResponse"},"ScrapeRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to scrape"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","description":"Whether to render heavy JS","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000}},"type":"object","required":["website_url"],"title":"ScrapeRequest"},"ScrapeRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"website_url":{"type":"string","title":"Website Url"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","default":false},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/ScrapeStatus","default":"queued"},"metadata":{"type":"object","title":"Metadata","default":{}},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"requested_at":{"type":"string","format":"date-time","title":"Requested At","default":"2026-04-09T14:29:31.520007"},"cost":{"type":"integer","title":"Cost","default":0},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","website_url"],"title":"ScrapeRequestDB","description":"DynamoDB model for scrape requests."},"ScrapeStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"ScrapeStatus","description":"Status of a scrape request."},"SearchScraperRequest":{"properties":{"user_prompt":{"type":"string","title":"User Prompt","example":"What is the latest version of Python?"},"num_results":{"type":"integer","maximum":20.0,"minimum":3.0,"title":"Num Results","description":"Number of websites to scrape (3-20). Default is 3.","default":3,"example":5},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"extraction_mode":{"type":"boolean","title":"Extraction Mode","description":"True for AI extraction mode, False for markdown conversion only","default":true},"markdown_mode":{"type":"boolean","title":"Markdown Mode","description":"True for markdown conversion mode, False for raw mode","default":true},"stealth":{"type":"boolean","title":"Stealth","description":"Enable stealth mode to avoid bot detection","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"location_geo_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Geo Code","description":"The geo code of the location to search in"},"time_range":{"anyOf":[{"$ref":"#/components/schemas/TimeRange"},{"type":"null"}],"description":"The date range to search in","examples":["past_hour","past_24_hours","past_week","past_month","past_year"]}},"type":"object","required":["user_prompt"],"title":"SearchScraperRequest"},"SearchScraperStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"SearchScraperStatus"},"SearchscraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SearchscraperRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"SearchscraperHistoryResponse"},"SearchscraperRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"user_prompt":{"type":"string","title":"User Prompt"},"search_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Query"},"extraction_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Extraction Query"},"references_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"References Urls"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"result":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/SearchScraperStatus","default":"queued"},"metadata":{"type":"object","title":"Metadata"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"}},"type":"object","required":["user_prompt"],"title":"SearchscraperRequestDB","description":"Database model for search scraper requests."},"ServiceType":{"type":"string","enum":["smartscraper","searchscraper","markdownify","smartcrawler","agenticscrapper","site_monitor"],"title":"ServiceType"},"SiteMonitorCreate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name","description":"Human-readable name for the monitor"},"website_url":{"type":"string","title":"Website Url","description":"URL to monitor"},"webhook_url":{"type":"string","title":"Webhook Url","description":"URL to POST webhook events to"},"cron_expression":{"type":"string","title":"Cron Expression","description":"Cron schedule (5 fields, UTC), e.g. '*/15 * * * *' for every 15 min"},"extraction_config":{"anyOf":[{"$ref":"#/components/schemas/SiteMonitorExtractionConfig"},{"type":"null"}],"description":"Optional: user_prompt and output_schema for structured extraction and diff","default":{"user_prompt":"Extract all main content and key data as structured JSON."}}},"additionalProperties":false,"type":"object","required":["website_url","webhook_url","cron_expression"],"title":"SiteMonitorCreate","description":"Request body for registering a new site monitor."},"SiteMonitorExtractionConfig":{"properties":{"user_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Prompt","description":"Prompt for extracting structured data from the page"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema","description":"JSON schema for extracted fields (enables structured diff)"}},"additionalProperties":false,"type":"object","title":"SiteMonitorExtractionConfig","description":"Optional extraction config for monitored page (smartscraper-style)."},"SiteMonitorListResponse":{"properties":{"monitors":{"items":{"$ref":"#/components/schemas/SiteMonitorResponse"},"type":"array","title":"Monitors"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["monitors","total","page","page_size"],"title":"SiteMonitorListResponse","description":"Paginated list of site monitors."},"SiteMonitorResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"api_key_id":{"type":"string","format":"uuid","title":"Api Key Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"website_url":{"type":"string","title":"Website Url"},"webhook_url":{"type":"string","title":"Webhook Url"},"cron_expression":{"type":"string","title":"Cron Expression"},"extraction_config":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Extraction Config"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"}},"type":"object","required":["id","user_id","api_key_id","website_url","webhook_url","cron_expression","is_active","created_at","updated_at"],"title":"SiteMonitorResponse","description":"Response for a single site monitor."},"SiteMonitorUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"cron_expression":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron Expression"},"extraction_config":{"anyOf":[{"$ref":"#/components/schemas/SiteMonitorExtractionConfig"},{"type":"null"}]},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"additionalProperties":false,"type":"object","title":"SiteMonitorUpdate","description":"Request body for updating a site monitor (partial)."},"SitemapHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SitemapRequestDB"},"type":"array","title":"Requests","description":"List of sitemap requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key","description":"Key for next page"}},"type":"object","required":["requests"],"title":"SitemapHistoryResponse"},"SitemapRequest":{"properties":{"website_url":{"type":"string","title":"Website Url","description":"The URL of the website to generate a sitemap for"},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false}},"type":"object","required":["website_url"],"title":"SitemapRequest"},"SitemapRequestDB":{"properties":{"request_id":{"type":"string","title":"Request Id"},"website_url":{"type":"string","title":"Website Url"},"api_key_id":{"type":"string","format":"uuid","title":"Api Key Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"status":{"type":"string","title":"Status"},"urls_count":{"type":"integer","title":"Urls Count"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["request_id","website_url","api_key_id","user_id","requested_at","status","urls_count"],"title":"SitemapRequestDB","description":"Model for storing sitemap request history in DynamoDB."},"SitemapResponse":{"properties":{"urls":{"items":{"type":"string"},"type":"array","title":"Urls","description":"The URLs found in the sitemap"},"request_id":{"type":"string","title":"Request Id","description":"The ID of the sitemap request for tracking"}},"type":"object","required":["urls","request_id"],"title":"SitemapResponse"},"SmartscraperHistoryResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/SmartscraperRequestDB"},"type":"array","title":"Requests"},"next_key":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Next Key"}},"type":"object","required":["requests","next_key"],"title":"SmartscraperHistoryResponse"},"SmartscraperRequest":{"properties":{"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url","description":"The URL of the website to scrape (optional for Smartscraper)"},"render_heavy_js":{"type":"boolean","title":"Render Heavy Js","description":"Whether to render heavy JS","default":false},"mock":{"type":"boolean","title":"Mock","default":false},"stealth":{"type":"boolean","title":"Stealth","default":false},"branding":{"type":"boolean","title":"Branding","default":false},"stream":{"type":"boolean","title":"Stream","description":"Whether to return streaming response","default":false},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code","description":"The country code to use for the scrape"},"wait_ms":{"type":"integer","title":"Wait Ms","description":"The number of milliseconds to wait before scraping the website","default":3000},"user_prompt":{"type":"string","title":"User Prompt","example":"Extract info about the company"},"website_html":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Html","description":"HTML content, maximum size 2MB","example":"

Title

Content

"},"website_markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Markdown","description":"Markdown content, maximum size 2MB","example":"# Title\n\nThis is some content in markdown format."},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Optional headers to send with the request, including cookies and user agent","example":{"Cookie":"cookie1=value1; cookie2=value2","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}},"number_of_scrolls":{"type":"integer","maximum":100.0,"minimum":0.0,"title":"Number Of Scrolls","description":"Number of scroll operations to perform for infinite scrolling (0 = disabled, range: 1-100). Values between 1-9 will be automatically set to 10.","default":0},"total_pages":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Total Pages","description":"Total number of pages to scrape if pagination enabled","default":1},"steps":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Steps","description":"List of steps to actions to perform on the website"},"cookies":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Cookies","description":"Cookies to send with the request","default":{}},"plain_text":{"type":"boolean","title":"Plain Text","default":false},"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url","description":"Webhook URL to send the job result to"},"offset":{"type":"integer","title":"Offset","description":"Offset to start scraping from","default":0},"is_multipage_child":{"type":"boolean","title":"Is Multipage Child","description":"Whether this is a multi-page child request","default":false}},"type":"object","required":["user_prompt"],"title":"SmartscraperRequest"},"SmartscraperRequestDB":{"properties":{"request_id":{"type":"string","format":"uuid","title":"Request Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"webpage_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Webpage Id"},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"user_prompt":{"type":"string","title":"User Prompt"},"output_schema":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Output Schema"},"result":{"anyOf":[{"type":"object"},{},{"type":"null"}],"title":"Result"},"status":{"$ref":"#/components/schemas/SmartscraperStatus","default":"processing"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"request_params":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Request Params"}},"type":"object","required":["request_id","user_prompt","requested_at"],"title":"SmartscraperRequestDB","description":"Database model for smart scraper requests."},"SmartscraperStatus":{"type":"string","enum":["queued","processing","completed","failed"],"title":"SmartscraperStatus"},"StepResult":{"properties":{"step_index":{"type":"integer","title":"Step Index"},"step_type":{"$ref":"#/components/schemas/StepType"},"success":{"type":"boolean","title":"Success"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Data"},"duration_seconds":{"type":"number","title":"Duration Seconds"}},"type":"object","required":["step_index","step_type","success","duration_seconds"],"title":"StepResult","description":"Result of a single step execution"},"StepType":{"type":"string","enum":["navigate","action","extract","loop","conditional","subworkflow","wait","extract_markdown"],"title":"StepType","description":"Types of workflow steps"},"SubWorkflowStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"subworkflow"},"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id","description":"ID of saved workflow to execute"},"workflow":{"anyOf":[{"$ref":"#/components/schemas/WorkflowDefinition"},{"type":"null"}],"description":"Inline workflow definition"},"input_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Mapping","description":"Map parent context variables to subworkflow variables (e.g., {'url': '{{current_link}}'})"},"output_mapping":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Output Mapping","description":"Map subworkflow output variables back to parent context"}},"type":"object","title":"SubWorkflowStep","description":"Execute a subworkflow"},"TimeRange":{"type":"string","enum":["past_hour","past_24_hours","past_week","past_month","past_year"],"title":"TimeRange"},"TimelineEntry":{"properties":{"service":{"type":"string","title":"Service"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["service","timestamp"],"title":"TimelineEntry"},"UsageTimelineResponse":{"properties":{"timeline":{"items":{"$ref":"#/components/schemas/TimelineEntry"},"type":"array","title":"Timeline"}},"type":"object","required":["timeline"],"title":"UsageTimelineResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WaitStep":{"properties":{"type":{"$ref":"#/components/schemas/StepType","default":"wait"},"duration":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration","description":"Seconds to wait"},"for_selector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"For Selector","description":"CSS selector to wait for"},"for_condition":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"For Condition","description":"JavaScript condition to wait for"}},"type":"object","title":"WaitStep","description":"Wait for a condition or time"},"WorkflowDefinition":{"properties":{"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id","description":"Unique workflow identifier"},"name":{"type":"string","title":"Name","description":"Human-readable workflow name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Workflow description"},"start_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Url","description":"Initial URL to navigate to (can be overridden)"},"use_session":{"type":"boolean","title":"Use Session","description":"Whether to use persistent browser session","default":false},"steps":{"items":{"anyOf":[{"$ref":"#/components/schemas/NavigationStep"},{"$ref":"#/components/schemas/ActionStep"},{"$ref":"#/components/schemas/ExtractionStep"},{"$ref":"#/components/schemas/MarkdownExtractionStep"},{"$ref":"#/components/schemas/LoopStep"},{"$ref":"#/components/schemas/ConditionalStep"},{"$ref":"#/components/schemas/SubWorkflowStep"},{"$ref":"#/components/schemas/WaitStep"}]},"type":"array","title":"Steps","description":"Ordered list of workflow steps"},"initial_context":{"type":"object","title":"Initial Context","description":"Initial variables/context (e.g., {'email': 'user@example.com', 'password': 'secret'})"},"output_variables":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Output Variables","description":"List of variables to include in final output"}},"type":"object","required":["name","steps"],"title":"WorkflowDefinition","description":"Main workflow definition"},"WorkflowExecutionResult":{"properties":{"request_id":{"type":"string","title":"Request Id"},"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id"},"success":{"type":"boolean","title":"Success"},"steps_executed":{"items":{"$ref":"#/components/schemas/StepResult"},"type":"array","title":"Steps Executed"},"total_duration_seconds":{"type":"number","title":"Total Duration Seconds"},"final_context":{"type":"object","title":"Final Context","description":"Final workflow context with all variables"},"output":{"type":"object","title":"Output","description":"Filtered output based on output_variables"},"final_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Url"},"final_html":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Final Html"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["request_id","workflow_id","success","steps_executed","total_duration_seconds"],"title":"WorkflowExecutionResult","description":"Result of workflow execution"}}}} \ No newline at end of file