From 064160d6b5ac115570bd7a481473187c96017000 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 16:19:25 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Generated/Serper.AutoSDKHttpResponse.g.cs | 121 +++++++++ .../Serper.ISerperClient.Autocomplete.g.cs | 13 + .../Serper.ISerperClient.ImageSearch.g.cs | 13 + .../Serper.ISerperClient.NewsSearch.g.cs | 13 + .../Serper.ISerperClient.PatentSearch.g.cs | 13 + .../Serper.ISerperClient.PlacesSearch.g.cs | 13 + .../Serper.ISerperClient.ScholarSearch.g.cs | 14 ++ .../Serper.ISerperClient.Search.g.cs | 14 ++ .../Serper.ISerperClient.ShoppingSearch.g.cs | 13 + .../Serper.ISerperClient.VideoSearch.g.cs | 13 + .../Generated/Serper.OptionsSupport.g.cs | 231 +++++++++++++++++- .../Serper.SerperClient.Autocomplete.g.cs | 66 ++++- .../Serper.SerperClient.ImageSearch.g.cs | 66 ++++- .../Serper.SerperClient.NewsSearch.g.cs | 66 ++++- .../Serper.SerperClient.PatentSearch.g.cs | 66 ++++- .../Serper.SerperClient.PlacesSearch.g.cs | 66 ++++- .../Serper.SerperClient.ScholarSearch.g.cs | 67 ++++- .../Generated/Serper.SerperClient.Search.g.cs | 67 ++++- .../Serper.SerperClient.ShoppingSearch.g.cs | 66 ++++- .../Serper.SerperClient.VideoSearch.g.cs | 66 ++++- .../Serper/Generated/Serper.SerperClient.g.cs | 8 +- 21 files changed, 993 insertions(+), 82 deletions(-) create mode 100644 src/libs/Serper/Generated/Serper.AutoSDKHttpResponse.g.cs diff --git a/src/libs/Serper/Generated/Serper.AutoSDKHttpResponse.g.cs b/src/libs/Serper/Generated/Serper.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..2ea0d92 --- /dev/null +++ b/src/libs/Serper/Generated/Serper.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace Serper +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.Autocomplete.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.Autocomplete.g.cs index 963ec77..791076e 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.Autocomplete.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.Autocomplete.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Autocomplete
/// Get Google autocomplete suggestions for a partial 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> AutocompleteAsResponseAsync( + + global::Serper.AutocompleteRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Autocomplete
+ /// Get Google autocomplete suggestions for a partial query. + ///
/// /// Partial query string for autocomplete suggestions.
/// Example: apple diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.ImageSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.ImageSearch.g.cs index ee3ae58..b5a144a 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.ImageSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.ImageSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Image Search
/// Search Google Images for image results. /// + /// + /// 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> ImageSearchAsResponseAsync( + + global::Serper.ImageSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image Search
+ /// Search Google Images for image results. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.NewsSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.NewsSearch.g.cs index 798376a..81154a1 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.NewsSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.NewsSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// News Search
/// Search Google News for recent articles and stories. /// + /// + /// 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> NewsSearchAsResponseAsync( + + global::Serper.NewsSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// News Search
+ /// Search Google News for recent articles and stories. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.PatentSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.PatentSearch.g.cs index 81b6500..9a1e4e7 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.PatentSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.PatentSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Patent Search
/// Search Google Patents for patent documents and applications. /// + /// + /// 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> PatentSearchAsResponseAsync( + + global::Serper.PatentSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Patent Search
+ /// Search Google Patents for patent documents and applications. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.PlacesSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.PlacesSearch.g.cs index e73036c..4175a84 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.PlacesSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.PlacesSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Places Search
/// Search Google Maps/Places for local businesses and points of interest. /// + /// + /// 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> PlacesSearchAsResponseAsync( + + global::Serper.PlacesSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Places Search
+ /// Search Google Maps/Places for local businesses and points of interest. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.ScholarSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.ScholarSearch.g.cs index 2795aaa..828f99f 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.ScholarSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.ScholarSearch.g.cs @@ -23,6 +23,20 @@ public partial interface ISerperClient /// Search Google Scholar for academic papers, articles, theses, and citations.
/// Supports filtering by year range and finding papers that cite a specific work. /// + /// + /// 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> ScholarSearchAsResponseAsync( + + global::Serper.ScholarSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Scholar Search
+ /// Search Google Scholar for academic papers, articles, theses, and citations.
+ /// Supports filtering by year range and finding papers that cite a specific work. + ///
/// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.Search.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.Search.g.cs index 79dfa84..302f8eb 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.Search.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.Search.g.cs @@ -23,6 +23,20 @@ public partial interface ISerperClient /// Perform a Google web search. Returns organic results, knowledge graph, answer box,
/// people also ask, and related searches. /// + /// + /// 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> SearchAsResponseAsync( + + global::Serper.SearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Google Search
+ /// Perform a Google web search. Returns organic results, knowledge graph, answer box,
+ /// people also ask, and related searches. + ///
/// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.ShoppingSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.ShoppingSearch.g.cs index 711297a..8025913 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.ShoppingSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.ShoppingSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Shopping Search
/// Search Google Shopping for product listings and prices. /// + /// + /// 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> ShoppingSearchAsResponseAsync( + + global::Serper.ShoppingSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Shopping Search
+ /// Search Google Shopping for product listings and prices. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.ISerperClient.VideoSearch.g.cs b/src/libs/Serper/Generated/Serper.ISerperClient.VideoSearch.g.cs index 3e8b4e8..8e0259c 100644 --- a/src/libs/Serper/Generated/Serper.ISerperClient.VideoSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.ISerperClient.VideoSearch.g.cs @@ -21,6 +21,19 @@ public partial interface ISerperClient /// Video Search
/// Search Google for video results from YouTube and other video platforms. /// + /// + /// 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> VideoSearchAsResponseAsync( + + global::Serper.VideoSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Video Search
+ /// Search Google for video results from YouTube and other video platforms. + ///
/// /// Search query string.
/// Example: apple inc diff --git a/src/libs/Serper/Generated/Serper.OptionsSupport.g.cs b/src/libs/Serper/Generated/Serper.OptionsSupport.g.cs index 2478c2c..349ffca 100644 --- a/src/libs/Serper/Generated/Serper.OptionsSupport.g.cs +++ b/src/libs/Serper/Generated/Serper.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::Serper.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::Serper.AutoSDKClientOptions clientOptions, global::Serper.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Serper.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::Serper.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/Serper/Generated/Serper.SerperClient.Autocomplete.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.Autocomplete.g.cs index 78fc31a..4b11a91 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.Autocomplete.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.Autocomplete.g.cs @@ -51,6 +51,29 @@ partial void ProcessAutocompleteResponseContent( /// public async global::System.Threading.Tasks.Task AutocompleteAsync( + global::Serper.AutocompleteRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AutocompleteAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Autocomplete
+ /// Get Google autocomplete suggestions for a partial 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> AutocompleteAsResponseAsync( + global::Serper.AutocompleteRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessAutocompleteResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/autocomplete", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessAutocompleteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessAutocompleteResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessAutocompleteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessAutocompleteResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessAutocompleteResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessAutocompleteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessAutocompleteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessAutocompleteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessAutocompleteResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.AutocompleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.AutocompleteResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -347,9 +393,13 @@ partial void ProcessAutocompleteResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.AutocompleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.AutocompleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.ImageSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.ImageSearch.g.cs index c403685..2c3f3c7 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.ImageSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.ImageSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessImageSearchResponseContent( /// public async global::System.Threading.Tasks.Task ImageSearchAsync( + global::Serper.ImageSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ImageSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Image Search
+ /// Search Google Images for image results. + ///
+ /// + /// 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> ImageSearchAsResponseAsync( + global::Serper.ImageSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessImageSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/images", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessImageSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessImageSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessImageSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessImageSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessImageSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessImageSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessImageSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessImageSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessImageSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.ImageSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.ImageSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessImageSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.ImageSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.ImageSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.NewsSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.NewsSearch.g.cs index e22b9e2..cb35d25 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.NewsSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.NewsSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessNewsSearchResponseContent( /// public async global::System.Threading.Tasks.Task NewsSearchAsync( + global::Serper.NewsSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await NewsSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// News Search
+ /// Search Google News for recent articles and stories. + ///
+ /// + /// 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> NewsSearchAsResponseAsync( + global::Serper.NewsSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessNewsSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/news", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessNewsSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessNewsSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessNewsSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessNewsSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessNewsSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessNewsSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessNewsSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessNewsSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessNewsSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.NewsSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.NewsSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessNewsSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.NewsSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.NewsSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.PatentSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.PatentSearch.g.cs index 9f92540..1e4f8fa 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.PatentSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.PatentSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessPatentSearchResponseContent( /// public async global::System.Threading.Tasks.Task PatentSearchAsync( + global::Serper.PatentSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PatentSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Patent Search
+ /// Search Google Patents for patent documents and applications. + ///
+ /// + /// 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> PatentSearchAsResponseAsync( + global::Serper.PatentSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessPatentSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/patents", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessPatentSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessPatentSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessPatentSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessPatentSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessPatentSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessPatentSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessPatentSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessPatentSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessPatentSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.PatentSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.PatentSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessPatentSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.PatentSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.PatentSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.PlacesSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.PlacesSearch.g.cs index 0b18658..5741ce4 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.PlacesSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.PlacesSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessPlacesSearchResponseContent( /// public async global::System.Threading.Tasks.Task PlacesSearchAsync( + global::Serper.PlacesSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PlacesSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Places Search
+ /// Search Google Maps/Places for local businesses and points of interest. + ///
+ /// + /// 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> PlacesSearchAsResponseAsync( + global::Serper.PlacesSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessPlacesSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/places", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessPlacesSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessPlacesSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessPlacesSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessPlacesSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessPlacesSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessPlacesSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessPlacesSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessPlacesSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessPlacesSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.PlacesSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.PlacesSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessPlacesSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.PlacesSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.PlacesSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.ScholarSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.ScholarSearch.g.cs index 5ed76d2..e072795 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.ScholarSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.ScholarSearch.g.cs @@ -52,6 +52,30 @@ partial void ProcessScholarSearchResponseContent( /// public async global::System.Threading.Tasks.Task ScholarSearchAsync( + global::Serper.ScholarSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ScholarSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Scholar Search
+ /// Search Google Scholar for academic papers, articles, theses, and citations.
+ /// Supports filtering by year range and finding papers that cite a specific work. + ///
+ /// + /// 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> ScholarSearchAsResponseAsync( + global::Serper.ScholarSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +108,7 @@ partial void ProcessScholarSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/scholar", baseUri: HttpClient.BaseAddress); @@ -163,6 +188,8 @@ partial void ProcessScholarSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +200,11 @@ partial void ProcessScholarSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +222,8 @@ partial void ProcessScholarSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +233,7 @@ partial void ProcessScholarSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +242,11 @@ partial void ProcessScholarSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +263,15 @@ partial void ProcessScholarSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +311,8 @@ partial void ProcessScholarSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +333,8 @@ partial void ProcessScholarSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +359,13 @@ partial void ProcessScholarSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.ScholarSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.ScholarSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +393,13 @@ partial void ProcessScholarSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.ScholarSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.ScholarSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.Search.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.Search.g.cs index 0287e92..240f6b3 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.Search.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.Search.g.cs @@ -52,6 +52,30 @@ partial void ProcessSearchResponseContent( /// public async global::System.Threading.Tasks.Task SearchAsync( + global::Serper.SearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Google Search
+ /// Perform a Google web search. Returns organic results, knowledge graph, answer box,
+ /// people also ask, and related searches. + ///
+ /// + /// 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> SearchAsResponseAsync( + global::Serper.SearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +108,7 @@ partial void ProcessSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/search", baseUri: HttpClient.BaseAddress); @@ -163,6 +188,8 @@ partial void ProcessSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +200,11 @@ partial void ProcessSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +222,8 @@ partial void ProcessSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +233,7 @@ partial void ProcessSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +242,11 @@ partial void ProcessSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +263,15 @@ partial void ProcessSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +311,8 @@ partial void ProcessSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +333,8 @@ partial void ProcessSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +359,13 @@ partial void ProcessSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.SearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.SearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +393,13 @@ partial void ProcessSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.SearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.SearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.ShoppingSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.ShoppingSearch.g.cs index 91045c2..1ba714a 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.ShoppingSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.ShoppingSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessShoppingSearchResponseContent( /// public async global::System.Threading.Tasks.Task ShoppingSearchAsync( + global::Serper.ShoppingSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ShoppingSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Shopping Search
+ /// Search Google Shopping for product listings and prices. + ///
+ /// + /// 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> ShoppingSearchAsResponseAsync( + global::Serper.ShoppingSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessShoppingSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/shopping", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessShoppingSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessShoppingSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessShoppingSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessShoppingSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessShoppingSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessShoppingSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessShoppingSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessShoppingSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessShoppingSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.ShoppingSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.ShoppingSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessShoppingSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.ShoppingSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.ShoppingSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.VideoSearch.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.VideoSearch.g.cs index 495ad81..93a3bd2 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.VideoSearch.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.VideoSearch.g.cs @@ -51,6 +51,29 @@ partial void ProcessVideoSearchResponseContent( /// public async global::System.Threading.Tasks.Task VideoSearchAsync( + global::Serper.VideoSearchRequest request, + global::Serper.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await VideoSearchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Video Search
+ /// Search Google for video results from YouTube and other video platforms. + ///
+ /// + /// 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> VideoSearchAsResponseAsync( + global::Serper.VideoSearchRequest request, global::Serper.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,6 +106,7 @@ partial void ProcessVideoSearchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Serper.PathBuilder( path: "/videos", baseUri: HttpClient.BaseAddress); @@ -162,6 +186,8 @@ partial void ProcessVideoSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +198,11 @@ partial void ProcessVideoSearchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -189,6 +220,8 @@ partial void ProcessVideoSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +231,7 @@ partial void ProcessVideoSearchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +240,11 @@ partial void ProcessVideoSearchResponseContent( __attempt < __maxAttempts && global::Serper.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Serper.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Serper.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Serper.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -224,14 +261,15 @@ partial void ProcessVideoSearchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Serper.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +309,8 @@ partial void ProcessVideoSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +331,8 @@ partial void ProcessVideoSearchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +357,13 @@ partial void ProcessVideoSearchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Serper.VideoSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Serper.VideoSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -345,9 +391,13 @@ partial void ProcessVideoSearchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Serper.VideoSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Serper.VideoSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Serper.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Serper.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Serper/Generated/Serper.SerperClient.g.cs b/src/libs/Serper/Generated/Serper.SerperClient.g.cs index eca2333..441af18 100644 --- a/src/libs/Serper/Generated/Serper.SerperClient.g.cs +++ b/src/libs/Serper/Generated/Serper.SerperClient.g.cs @@ -74,10 +74,10 @@ public SerperClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public SerperClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Serper.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Serper.AutoSDKClientOptions? options, bool disposeHttpClient = true) {