diff --git a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudienceById.g.cs b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudienceById.g.cs index fe29ade..c017161 100644 --- a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudienceById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudienceById.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetAudienceByIdResponseContent( string id, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAudienceByIdAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get audience by ID
+ /// Retrieve a specific target audience by its unique identifier. + ///
+ /// + /// 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> GetAudienceByIdAsResponseAsync( + string id, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetAudienceByIdResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/audiences/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetAudienceByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetAudienceByIdResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetAudienceByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetAudienceByIdResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetAudienceByIdResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetAudienceByIdResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetAudienceByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetAudienceByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Audience not found. @@ -384,9 +424,13 @@ partial void ProcessGetAudienceByIdResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.AudienceResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.AudienceResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetAudienceByIdResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.AudienceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.AudienceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudiences.g.cs b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudiences.g.cs index 41b5b69..2ef54f7 100644 --- a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudiences.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.GetAudiences.g.cs @@ -49,6 +49,24 @@ partial void ProcessGetAudiencesResponseContent( public async global::System.Threading.Tasks.Task GetAudiencesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAudiencesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List all audiences
+ /// Retrieve all target audiences defined in the workspace. + ///
+ /// 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> GetAudiencesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessGetAudiencesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/audiences", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessGetAudiencesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessGetAudiencesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessGetAudiencesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessGetAudiencesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessGetAudiencesResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessGetAudiencesResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessGetAudiencesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessGetAudiencesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -340,9 +377,13 @@ partial void ProcessGetAudiencesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.AudienceListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.AudienceListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -370,9 +411,13 @@ partial void ProcessGetAudiencesResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.AudienceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.AudienceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.g.cs index cc73673..5472209 100644 --- a/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.AudiencesClient.g.cs @@ -72,10 +72,10 @@ public AudiencesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AudiencesClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.AutoSDKHttpResponse.g.cs b/src/libs/JasperAI/Generated/JasperAI.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..77eeaf1 --- /dev/null +++ b/src/libs/JasperAI/Generated/JasperAI.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace JasperAI +{ + /// + /// 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/JasperAI/Generated/JasperAI.CommandClient.Command.g.cs b/src/libs/JasperAI/Generated/JasperAI.CommandClient.Command.g.cs index e3fb598..0ef0c4c 100644 --- a/src/libs/JasperAI/Generated/JasperAI.CommandClient.Command.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.CommandClient.Command.g.cs @@ -51,6 +51,29 @@ partial void ProcessCommandResponseContent( /// public async global::System.Threading.Tasks.Task CommandAsync( + global::JasperAI.CommandRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CommandAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Run a command
+ /// Run a command to generate AI content. The command endpoint provides a flexible way to generate content by passing in a command (prompt) and context. + ///
+ /// + /// 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> CommandAsResponseAsync( + global::JasperAI.CommandRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCommandResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/command", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCommandResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCommandResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCommandResponseContent( 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 ProcessCommandResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCommandResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCommandResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCommandResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCommandResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -393,9 +435,13 @@ partial void ProcessCommandResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.CommandResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.CommandResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,9 +469,13 @@ partial void ProcessCommandResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.CommandResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.CommandResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.CommandClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.CommandClient.g.cs index 7001619..4d06339 100644 --- a/src/libs/JasperAI/Generated/JasperAI.CommandClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.CommandClient.g.cs @@ -72,10 +72,10 @@ public CommandClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public CommandClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.CreateDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.CreateDocument.g.cs index f353167..17fceb5 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.CreateDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.CreateDocument.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateDocumentResponseContent( /// public async global::System.Threading.Tasks.Task CreateDocumentAsync( + global::JasperAI.DocumentCreateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateDocumentAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create document
+ /// Create a new document in the workspace. + ///
+ /// + /// 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> CreateDocumentAsResponseAsync( + global::JasperAI.DocumentCreateRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateDocumentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/documents", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateDocumentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateDocumentResponseContent( 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 ProcessCreateDocumentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateDocumentResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateDocumentResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -393,9 +435,13 @@ partial void ProcessCreateDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,9 +469,13 @@ partial void ProcessCreateDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.DeleteDocumentById.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.DeleteDocumentById.g.cs index d1b2ec9..74e71ce 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.DeleteDocumentById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.DeleteDocumentById.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteDocumentByIdResponse( string documentId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteDocumentByIdAsResponseAsync( + documentId: documentId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete document by ID
+ /// Delete a document by its unique identifier. + ///
+ /// + /// 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 DeleteDocumentByIdAsResponseAsync( + string documentId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteDocumentByIdResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/documents/{documentId}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteDocumentByIdResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteDocumentByIdResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteDocumentByIdResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessDeleteDocumentByIdResponse( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteDocumentByIdResponse( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteDocumentByIdResponse( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteDocumentByIdResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteDocumentByIdResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Document not found. @@ -375,6 +413,10 @@ partial void ProcessDeleteDocumentByIdResponse( { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -396,6 +438,10 @@ partial void ProcessDeleteDocumentByIdResponse( try { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetAllDocuments.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetAllDocuments.g.cs index 24f24c5..0ca021b 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetAllDocuments.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetAllDocuments.g.cs @@ -85,6 +85,52 @@ partial void ProcessGetAllDocumentsResponseContent( global::System.DateTime? createdAtEnd = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAllDocumentsAsResponseAsync( + userId: userId, + size: size, + page: page, + sort: sort, + name: name, + statuses: statuses, + createdAtStart: createdAtStart, + createdAtEnd: createdAtEnd, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve documents
+ /// Retrieve a paginated list of documents from your workspace. + ///
+ /// + /// + /// Default Value: 50 + /// + /// + /// Default Value: 1 + /// + /// + /// + /// + /// + /// + /// 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> GetAllDocumentsAsResponseAsync( + string? userId = default, + int? size = default, + int? page = default, + global::JasperAI.GetAllDocumentsSort? sort = default, + string? name = default, + string? statuses = default, + global::System.DateTime? createdAtStart = default, + global::System.DateTime? createdAtEnd = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -121,9 +167,10 @@ partial void ProcessGetAllDocumentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/documents", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("userId", userId) .AddOptionalParameter("size", size?.ToString()) @@ -132,7 +179,7 @@ partial void ProcessGetAllDocumentsResponseContent( .AddOptionalParameter("name", name) .AddOptionalParameter("statuses", statuses) .AddOptionalParameter("createdAtStart", createdAtStart?.ToString("yyyy-MM-ddTHH:mm:ssZ")) - .AddOptionalParameter("createdAtEnd", createdAtEnd?.ToString("yyyy-MM-ddTHH:mm:ssZ")) + .AddOptionalParameter("createdAtEnd", createdAtEnd?.ToString("yyyy-MM-ddTHH:mm:ssZ")) ; var __path = __pathBuilder.ToString(); __path = global::JasperAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -211,6 +258,8 @@ partial void ProcessGetAllDocumentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -221,6 +270,11 @@ partial void ProcessGetAllDocumentsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -238,6 +292,8 @@ partial void ProcessGetAllDocumentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -247,8 +303,7 @@ partial void ProcessGetAllDocumentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +312,11 @@ partial void ProcessGetAllDocumentsResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -273,14 +333,15 @@ partial void ProcessGetAllDocumentsResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -320,6 +381,8 @@ partial void ProcessGetAllDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -340,6 +403,8 @@ partial void ProcessGetAllDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -402,9 +467,13 @@ partial void ProcessGetAllDocumentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.DocumentListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.DocumentListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -432,9 +501,13 @@ partial void ProcessGetAllDocumentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.DocumentListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.DocumentListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetDocumentById.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetDocumentById.g.cs index 5be7a2b..011eab3 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetDocumentById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.GetDocumentById.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetDocumentByIdResponseContent( string documentId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetDocumentByIdAsResponseAsync( + documentId: documentId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve document by ID
+ /// Retrieve a specific document by its unique identifier. + ///
+ /// + /// 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> GetDocumentByIdAsResponseAsync( + string documentId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetDocumentByIdResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/documents/{documentId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetDocumentByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetDocumentByIdResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetDocumentByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetDocumentByIdResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetDocumentByIdResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetDocumentByIdResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetDocumentByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetDocumentByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Document not found. @@ -384,9 +424,13 @@ partial void ProcessGetDocumentByIdResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetDocumentByIdResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.UpdateDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.UpdateDocument.g.cs index 8e31a1d..ac7f5d6 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.UpdateDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.UpdateDocument.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateDocumentResponseContent( public async global::System.Threading.Tasks.Task UpdateDocumentAsync( string documentId, + global::JasperAI.DocumentUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateDocumentAsResponseAsync( + documentId: documentId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update document
+ /// Update an existing document by its unique identifier. + ///
+ /// + /// + /// 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> UpdateDocumentAsResponseAsync( + string documentId, + global::JasperAI.DocumentUpdateRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateDocumentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/documents/{documentId}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateDocumentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +242,7 @@ partial void ProcessUpdateDocumentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateDocumentResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateDocumentResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -399,9 +444,13 @@ partial void ProcessUpdateDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.DocumentResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -429,9 +478,13 @@ partial void ProcessUpdateDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.DocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.g.cs index ee526d0..3ccd809 100644 --- a/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.DocumentsClient.g.cs @@ -72,10 +72,10 @@ public DocumentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public DocumentsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudienceById.g.cs b/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudienceById.g.cs index 65a12c0..6c6fcb8 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudienceById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudienceById.g.cs @@ -16,5 +16,17 @@ public partial interface IAudiencesClient string id, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get audience by ID
+ /// Retrieve a specific target audience by its unique identifier. + ///
+ /// + /// 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> GetAudienceByIdAsResponseAsync( + string id, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudiences.g.cs b/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudiences.g.cs index e8b59c9..d51c855 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudiences.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IAudiencesClient.GetAudiences.g.cs @@ -14,5 +14,15 @@ public partial interface IAudiencesClient global::System.Threading.Tasks.Task GetAudiencesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List all audiences
+ /// Retrieve all target audiences defined in the workspace. + ///
+ /// 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> GetAudiencesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.ICommandClient.Command.g.cs b/src/libs/JasperAI/Generated/JasperAI.ICommandClient.Command.g.cs index b3526ee..dc99ae8 100644 --- a/src/libs/JasperAI/Generated/JasperAI.ICommandClient.Command.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.ICommandClient.Command.g.cs @@ -21,6 +21,19 @@ public partial interface ICommandClient /// Run a command
/// Run a command to generate AI content. The command endpoint provides a flexible way to generate content by passing in a command (prompt) and context. /// + /// + /// 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> CommandAsResponseAsync( + + global::JasperAI.CommandRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Run a command
+ /// Run a command to generate AI content. The command endpoint provides a flexible way to generate content by passing in a command (prompt) and context. + ///
/// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.CreateDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.CreateDocument.g.cs index c18d369..a48de22 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.CreateDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.CreateDocument.g.cs @@ -21,6 +21,19 @@ public partial interface IDocumentsClient /// Create document
/// Create a new document in the workspace. /// + /// + /// 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> CreateDocumentAsResponseAsync( + + global::JasperAI.DocumentCreateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create document
+ /// Create a new document in the workspace. + ///
/// /// The ID of the user creating the document. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.DeleteDocumentById.g.cs b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.DeleteDocumentById.g.cs index b212505..601c72f 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.DeleteDocumentById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.DeleteDocumentById.g.cs @@ -16,5 +16,17 @@ public partial interface IDocumentsClient string documentId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete document by ID
+ /// Delete a document by its unique identifier. + ///
+ /// + /// 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 DeleteDocumentByIdAsResponseAsync( + string documentId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetAllDocuments.g.cs b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetAllDocuments.g.cs index ab951bd..092e11f 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetAllDocuments.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetAllDocuments.g.cs @@ -34,5 +34,35 @@ public partial interface IDocumentsClient global::System.DateTime? createdAtEnd = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve documents
+ /// Retrieve a paginated list of documents from your workspace. + ///
+ /// + /// + /// Default Value: 50 + /// + /// + /// Default Value: 1 + /// + /// + /// + /// + /// + /// + /// 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> GetAllDocumentsAsResponseAsync( + string? userId = default, + int? size = default, + int? page = default, + global::JasperAI.GetAllDocumentsSort? sort = default, + string? name = default, + string? statuses = default, + global::System.DateTime? createdAtStart = default, + global::System.DateTime? createdAtEnd = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetDocumentById.g.cs b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetDocumentById.g.cs index 9d0fec8..34ed1fc 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetDocumentById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.GetDocumentById.g.cs @@ -16,5 +16,17 @@ public partial interface IDocumentsClient string documentId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve document by ID
+ /// Retrieve a specific document by its unique identifier. + ///
+ /// + /// 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> GetDocumentByIdAsResponseAsync( + string documentId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.UpdateDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.UpdateDocument.g.cs index 99962c0..b21aa2a 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.UpdateDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IDocumentsClient.UpdateDocument.g.cs @@ -24,6 +24,21 @@ public partial interface IDocumentsClient /// Update an existing document by its unique identifier. /// /// + /// + /// 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> UpdateDocumentAsResponseAsync( + string documentId, + + global::JasperAI.DocumentUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update document
+ /// Update an existing document by its unique identifier. + ///
+ /// /// /// Updated document content. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.DeleteKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.DeleteKnowledgeDocument.g.cs index 3370ddf..99b7a38 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.DeleteKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.DeleteKnowledgeDocument.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string knowledgeId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete knowledge item
+ /// Delete a knowledge item by its unique identifier. + ///
+ /// + /// 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 DeleteKnowledgeDocumentAsResponseAsync( + string knowledgeId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocument.g.cs index d036332..d40bbc9 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocument.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string knowledgeId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve knowledge item by ID
+ /// Retrieve a specific knowledge item by its unique identifier. + ///
+ /// + /// 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> GetKnowledgeDocumentAsResponseAsync( + string knowledgeId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocuments.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocuments.g.cs index 6f907d0..472c0ca 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocuments.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.GetKnowledgeDocuments.g.cs @@ -20,5 +20,21 @@ public partial interface IKnowledgeClient int? page = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve knowledge items
+ /// Retrieve knowledge items with optional search and filtering. + ///
+ /// + /// + /// + /// 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> GetKnowledgeDocumentsAsResponseAsync( + string? search = default, + int? size = default, + int? page = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.SearchKnowledge.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.SearchKnowledge.g.cs index 2dc7e72..507f70f 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.SearchKnowledge.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.SearchKnowledge.g.cs @@ -21,6 +21,19 @@ public partial interface IKnowledgeClient /// Search knowledge base
/// Search the knowledge base using natural language queries. Returns relevant knowledge items with content chunks ranked by relevance. /// + /// + /// 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> SearchKnowledgeAsResponseAsync( + + global::JasperAI.KnowledgeSearchRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Search knowledge base
+ /// Search the knowledge base using natural language queries. Returns relevant knowledge items with content chunks ranked by relevance. + ///
/// /// Natural language search query. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UpdateKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UpdateKnowledgeDocument.g.cs index b103225..e3296bc 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UpdateKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UpdateKnowledgeDocument.g.cs @@ -24,6 +24,21 @@ public partial interface IKnowledgeClient /// Update an existing knowledge item by its 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> UpdateKnowledgeDocumentAsResponseAsync( + string knowledgeId, + + global::JasperAI.KnowledgeUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update knowledge item
+ /// Update an existing knowledge item by its ID. + ///
+ /// /// /// Updated name (max 100 chars). /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UploadKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UploadKnowledgeDocument.g.cs index af6e2fa..2bf75a4 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UploadKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IKnowledgeClient.UploadKnowledgeDocument.g.cs @@ -21,6 +21,19 @@ public partial interface IKnowledgeClient /// Create knowledge item
/// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). /// + /// + /// 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> UploadKnowledgeDocumentAsResponseAsync( + + global::JasperAI.UploadKnowledgeDocumentRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
/// /// Friendly name for the knowledge item. /// @@ -55,5 +68,82 @@ public partial interface IKnowledgeClient global::System.Collections.Generic.IList? tags = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
+ /// + /// Friendly name for the knowledge item. + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// JSON string of key-value metadata pairs. + /// + /// + /// JSON string with appVisibility and autoSummary settings. + /// + /// + /// Manual knowledge item summary. + /// + /// + /// Searchable tags. + /// + /// 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 UploadKnowledgeDocumentAsync( + string name, + global::System.IO.Stream file, + string filename, + string? metadata = default, + string? settings = default, + string? summary = default, + global::System.Collections.Generic.IList? tags = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
+ /// + /// Friendly name for the knowledge item. + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// JSON string of key-value metadata pairs. + /// + /// + /// JSON string with appVisibility and autoSummary settings. + /// + /// + /// Manual knowledge item summary. + /// + /// + /// Searchable tags. + /// + /// 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> UploadKnowledgeDocumentAsResponseAsync( + string name, + global::System.IO.Stream file, + string filename, + string? metadata = default, + string? settings = default, + string? summary = default, + global::System.Collections.Generic.IList? tags = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyleById.g.cs b/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyleById.g.cs index 12dca85..bba841b 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyleById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyleById.g.cs @@ -16,5 +16,17 @@ public partial interface IStylesClient string styleId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve style guide by ID
+ /// Retrieve a specific style guide by its unique identifier. + ///
+ /// + /// 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> GetStyleByIdAsResponseAsync( + string styleId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyles.g.cs b/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyles.g.cs index 3933d48..7803b07 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyles.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IStylesClient.GetStyles.g.cs @@ -14,5 +14,15 @@ public partial interface IStylesClient global::System.Threading.Tasks.Task GetStylesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve all style guides
+ /// Returns a list of style guides available in your workspace, sorted from most recently created. + ///
+ /// 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> GetStylesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.GetTaskById.g.cs b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.GetTaskById.g.cs index 8b6e523..b128c4e 100644 --- a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.GetTaskById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.GetTaskById.g.cs @@ -18,5 +18,19 @@ public partial interface ITasksClient double? version = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get agent task by ID
+ /// Retrieve a specific agent task by its unique identifier. + ///
+ /// + /// + /// 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> GetTaskByIdAsResponseAsync( + string id, + double? version = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.ListTasks.g.cs b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.ListTasks.g.cs index 33becef..c0ed59e 100644 --- a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.ListTasks.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.ListTasks.g.cs @@ -34,5 +34,35 @@ public partial interface ITasksClient string? searchTerm = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List all agent tasks
+ /// Retrieve a paginated list of agent tasks available in your workspace. + ///
+ /// + /// Default Value: 100 + /// + /// + /// Default Value: 1 + /// + /// + /// + /// Default Value: false + /// + /// + /// 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> ListTasksAsResponseAsync( + int? size = default, + int? page = default, + global::JasperAI.ListTasksScope? scope = default, + bool? includeContextItems = default, + bool? includeCategories = default, + string? searchTerm = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.RunTask.g.cs b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.RunTask.g.cs index d9aecf4..7ea6281 100644 --- a/src/libs/JasperAI/Generated/JasperAI.ITasksClient.RunTask.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.ITasksClient.RunTask.g.cs @@ -24,6 +24,21 @@ public partial interface ITasksClient /// Execute an agent task with provided context 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> RunTaskAsResponseAsync( + string id, + + global::JasperAI.TaskRunRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Run an agent task
+ /// Execute an agent task with provided context items. + ///
+ /// /// /// Array of context items for task execution. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IUsageClient.GetUsage.g.cs b/src/libs/JasperAI/Generated/JasperAI.IUsageClient.GetUsage.g.cs index 7b8da4d..2609903 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IUsageClient.GetUsage.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IUsageClient.GetUsage.g.cs @@ -14,5 +14,15 @@ public partial interface IUsageClient global::System.Threading.Tasks.Task GetUsageAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve usage
+ /// Retrieve API usage metrics for your workspace. + ///
+ /// 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> GetUsageAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetAllUsers.g.cs b/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetAllUsers.g.cs index 268c94b..37eb60c 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetAllUsers.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetAllUsers.g.cs @@ -18,5 +18,19 @@ public partial interface IUsersClient int? page = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve users
+ /// Retrieve a paginated list of users in the workspace. + ///
+ /// + /// + /// 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> GetAllUsersAsResponseAsync( + int? limit = default, + int? page = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetUser.g.cs b/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetUser.g.cs index fa6f247..a5b1bf0 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetUser.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IUsersClient.GetUser.g.cs @@ -16,5 +16,17 @@ public partial interface IUsersClient string userId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve user by ID
+ /// Retrieve a specific user by their unique identifier. + ///
+ /// + /// 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> GetUserAsResponseAsync( + string userId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.CreateTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.CreateTone.g.cs index 3e5165a..1087e84 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.CreateTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.CreateTone.g.cs @@ -21,6 +21,19 @@ public partial interface IVoicesClient /// Create a voice
/// Create a new brand voice/tone for content generation. /// + /// + /// 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> CreateToneAsResponseAsync( + + global::JasperAI.VoiceCreateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a voice
+ /// Create a new brand voice/tone for content generation. + ///
/// /// The friendly name of the voice. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.DeleteTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.DeleteTone.g.cs index 0f93a8d..66d69ad 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.DeleteTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.DeleteTone.g.cs @@ -16,5 +16,17 @@ public partial interface IVoicesClient string toneId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete voice by ID
+ /// Delete a brand voice by its unique identifier. + ///
+ /// + /// 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 DeleteToneAsResponseAsync( + string toneId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetAllTones.g.cs b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetAllTones.g.cs index 5f1ad5a..24f4ad3 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetAllTones.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetAllTones.g.cs @@ -14,5 +14,15 @@ public partial interface IVoicesClient global::System.Threading.Tasks.Task GetAllTonesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve all voices
+ /// Retrieve all brand voices/tones available in your workspace. + ///
+ /// 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> GetAllTonesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetTone.g.cs index e05de9f..4a0f7a2 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.GetTone.g.cs @@ -16,5 +16,17 @@ public partial interface IVoicesClient string toneId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve voice by ID
+ /// Retrieve a specific brand voice by its unique identifier. + ///
+ /// + /// 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> GetToneAsResponseAsync( + string toneId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.UpdateTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.UpdateTone.g.cs index 7942373..75acdd7 100644 --- a/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.UpdateTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.IVoicesClient.UpdateTone.g.cs @@ -24,6 +24,21 @@ public partial interface IVoicesClient /// Update an existing brand voice by its unique identifier. /// /// + /// + /// 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> UpdateToneAsResponseAsync( + string toneId, + + global::JasperAI.VoiceUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update voice by ID
+ /// Update an existing brand voice by its unique identifier. + ///
+ /// /// /// Updated voice name. /// diff --git a/src/libs/JasperAI/Generated/JasperAI.JasperAIClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.JasperAIClient.g.cs index b7d5a37..d8bd883 100644 --- a/src/libs/JasperAI/Generated/JasperAI.JasperAIClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.JasperAIClient.g.cs @@ -46,7 +46,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public AudiencesClient Audiences => new AudiencesClient(HttpClient, authorizations: Authorizations, options: Options) + public AudiencesClient Audiences => new AudiencesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -55,7 +55,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public CommandClient Command => new CommandClient(HttpClient, authorizations: Authorizations, options: Options) + public CommandClient Command => new CommandClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -64,7 +64,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public DocumentsClient Documents => new DocumentsClient(HttpClient, authorizations: Authorizations, options: Options) + public DocumentsClient Documents => new DocumentsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -73,7 +73,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public KnowledgeClient Knowledge => new KnowledgeClient(HttpClient, authorizations: Authorizations, options: Options) + public KnowledgeClient Knowledge => new KnowledgeClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -82,7 +82,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public StylesClient Styles => new StylesClient(HttpClient, authorizations: Authorizations, options: Options) + public StylesClient Styles => new StylesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -91,7 +91,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public TasksClient Tasks => new TasksClient(HttpClient, authorizations: Authorizations, options: Options) + public TasksClient Tasks => new TasksClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -100,7 +100,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public UsageClient Usage => new UsageClient(HttpClient, authorizations: Authorizations, options: Options) + public UsageClient Usage => new UsageClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -109,7 +109,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public UsersClient Users => new UsersClient(HttpClient, authorizations: Authorizations, options: Options) + public UsersClient Users => new UsersClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -118,7 +118,7 @@ public sealed partial class JasperAIClient : global::JasperAI.IJasperAIClient, g /// /// /// - public VoicesClient Voices => new VoicesClient(HttpClient, authorizations: Authorizations, options: Options) + public VoicesClient Voices => new VoicesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -157,10 +157,10 @@ public JasperAIClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public JasperAIClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.DeleteKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.DeleteKnowledgeDocument.g.cs index 12ad4d8..673e33d 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.DeleteKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.DeleteKnowledgeDocument.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteKnowledgeDocumentResponse( string knowledgeId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteKnowledgeDocumentAsResponseAsync( + knowledgeId: knowledgeId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete knowledge item
+ /// Delete a knowledge item by its unique identifier. + ///
+ /// + /// 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 DeleteKnowledgeDocumentAsResponseAsync( + string knowledgeId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteKnowledgeDocumentResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/knowledge/{knowledgeId}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteKnowledgeDocumentResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteKnowledgeDocumentResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteKnowledgeDocumentResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessDeleteKnowledgeDocumentResponse( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteKnowledgeDocumentResponse( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteKnowledgeDocumentResponse( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteKnowledgeDocumentResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteKnowledgeDocumentResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Knowledge item not found. @@ -375,6 +413,10 @@ partial void ProcessDeleteKnowledgeDocumentResponse( { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -396,6 +438,10 @@ partial void ProcessDeleteKnowledgeDocumentResponse( try { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocument.g.cs index cd79364..030e182 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocument.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetKnowledgeDocumentResponseContent( string knowledgeId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetKnowledgeDocumentAsResponseAsync( + knowledgeId: knowledgeId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve knowledge item by ID
+ /// Retrieve a specific knowledge item by its unique identifier. + ///
+ /// + /// 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> GetKnowledgeDocumentAsResponseAsync( + string knowledgeId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetKnowledgeDocumentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/knowledge/{knowledgeId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetKnowledgeDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetKnowledgeDocumentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetKnowledgeDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetKnowledgeDocumentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetKnowledgeDocumentResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetKnowledgeDocumentResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetKnowledgeDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetKnowledgeDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Knowledge item not found. @@ -384,9 +424,13 @@ partial void ProcessGetKnowledgeDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.KnowledgeItemResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.KnowledgeItemResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetKnowledgeDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.KnowledgeItemResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.KnowledgeItemResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocuments.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocuments.g.cs index 590b1a9..d52c4f9 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocuments.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.GetKnowledgeDocuments.g.cs @@ -61,6 +61,33 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( int? page = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetKnowledgeDocumentsAsResponseAsync( + search: search, + size: size, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve knowledge items
+ /// Retrieve knowledge items with optional search and filtering. + ///
+ /// + /// + /// + /// 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> GetKnowledgeDocumentsAsResponseAsync( + string? search = default, + int? size = default, + int? page = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -92,13 +119,14 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/knowledge", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("search", search) .AddOptionalParameter("size", size?.ToString()) - .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page", page?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::JasperAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +200,8 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +212,11 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -199,6 +234,8 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +245,7 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +254,11 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -234,14 +275,15 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -281,6 +323,8 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +345,8 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -363,9 +409,13 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -393,9 +443,13 @@ partial void ProcessGetKnowledgeDocumentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.KnowledgeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.KnowledgeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.SearchKnowledge.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.SearchKnowledge.g.cs index 2878c8a..6449809 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.SearchKnowledge.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.SearchKnowledge.g.cs @@ -51,6 +51,29 @@ partial void ProcessSearchKnowledgeResponseContent( /// public async global::System.Threading.Tasks.Task SearchKnowledgeAsync( + global::JasperAI.KnowledgeSearchRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SearchKnowledgeAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Search knowledge base
+ /// Search the knowledge base using natural language queries. Returns relevant knowledge items with content chunks ranked by relevance. + ///
+ /// + /// 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> SearchKnowledgeAsResponseAsync( + global::JasperAI.KnowledgeSearchRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessSearchKnowledgeResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/knowledge/search", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessSearchKnowledgeResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessSearchKnowledgeResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessSearchKnowledgeResponseContent( 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 ProcessSearchKnowledgeResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessSearchKnowledgeResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessSearchKnowledgeResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessSearchKnowledgeResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessSearchKnowledgeResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -393,9 +435,13 @@ partial void ProcessSearchKnowledgeResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.KnowledgeSearchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.KnowledgeSearchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,9 +469,13 @@ partial void ProcessSearchKnowledgeResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.KnowledgeSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.KnowledgeSearchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UpdateKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UpdateKnowledgeDocument.g.cs index de5f6cd..3901fec 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UpdateKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UpdateKnowledgeDocument.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( public async global::System.Threading.Tasks.Task UpdateKnowledgeDocumentAsync( string knowledgeId, + global::JasperAI.KnowledgeUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateKnowledgeDocumentAsResponseAsync( + knowledgeId: knowledgeId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update knowledge item
+ /// Update an existing knowledge item by its 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> UpdateKnowledgeDocumentAsResponseAsync( + string knowledgeId, + global::JasperAI.KnowledgeUpdateRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/knowledge/{knowledgeId}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +242,7 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -399,9 +444,13 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.KnowledgeItemResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.KnowledgeItemResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -429,9 +478,13 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.KnowledgeItemResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.KnowledgeItemResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UploadKnowledgeDocument.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UploadKnowledgeDocument.g.cs index 79c9715..4aa83b2 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UploadKnowledgeDocument.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.UploadKnowledgeDocument.g.cs @@ -51,6 +51,29 @@ partial void ProcessUploadKnowledgeDocumentResponseContent( /// public async global::System.Threading.Tasks.Task UploadKnowledgeDocumentAsync( + global::JasperAI.UploadKnowledgeDocumentRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadKnowledgeDocumentAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
+ /// + /// 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> UploadKnowledgeDocumentAsResponseAsync( + global::JasperAI.UploadKnowledgeDocumentRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -81,10 +104,11 @@ partial void ProcessUploadKnowledgeDocumentResponseContent( var __maxAttempts = global::JasperAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/knowledge", baseUri: HttpClient.BaseAddress); @@ -117,10 +141,12 @@ partial void ProcessUploadKnowledgeDocumentResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), name: "\"name\""); + var __contentFile = new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty()); __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( request.Filename is null @@ -158,35 +184,42 @@ request.Filename is null { __contentFile.Headers.ContentDisposition.FileNameStar = null; } + if (request.Metadata != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Metadata ?? string.Empty), name: "\"metadata\""); - } + + } if (request.Settings != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Settings ?? string.Empty), name: "\"settings\""); - } + + } if (request.Summary != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Summary ?? string.Empty), name: "\"summary\""); - } + + } if (request.Tags != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Tags, x => x))}]"), name: "\"tags\""); + } + __httpRequest.Content = __httpRequestContent; + global::JasperAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -228,6 +261,8 @@ request.Filename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -238,6 +273,11 @@ request.Filename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -255,6 +295,8 @@ request.Filename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -264,8 +306,7 @@ request.Filename is null __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +315,11 @@ request.Filename is null __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -290,14 +336,15 @@ request.Filename is null 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -337,6 +384,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -357,6 +406,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -457,9 +508,13 @@ request.Filename is null { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -487,9 +542,13 @@ request.Filename is null #endif ).ConfigureAwait(false); - return - await global::JasperAI.KnowledgeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.KnowledgeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -582,5 +641,1112 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Create knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
+ /// + /// Friendly name for the knowledge item. + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// JSON string of key-value metadata pairs. + /// + /// + /// JSON string with appVisibility and autoSummary settings. + /// + /// + /// Manual knowledge item summary. + /// + /// + /// Searchable tags. + /// + /// 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 UploadKnowledgeDocumentAsync( + string name, + global::System.IO.Stream file, + string filename, + string? metadata = default, + string? settings = default, + string? summary = default, + global::System.Collections.Generic.IList? tags = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::JasperAI.UploadKnowledgeDocumentRequest + { + Name = name, + File = global::System.Array.Empty(), + Filename = filename, + Metadata = metadata, + Settings = settings, + Summary = summary, + Tags = tags, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadKnowledgeDocumentArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::JasperAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadKnowledgeDocumentSecurityRequirements, + operationName: "UploadKnowledgeDocumentAsync"); + + using var __timeoutCancellationTokenSource = global::JasperAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::JasperAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::JasperAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::JasperAI.PathBuilder( + path: "/knowledge", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::JasperAI.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); + } + } + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), + name: "\"name\""); + + var __contentFile = new global::System.Net.Http.StreamContent(file); + __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Filename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFile, + name: "\"file\"", + fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); + if (__contentFile.Headers.ContentDisposition != null) + { + __contentFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Metadata != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Metadata ?? string.Empty), + name: "\"metadata\""); + + } + if (request.Settings != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Settings ?? string.Empty), + name: "\"settings\""); + + } + if (request.Summary != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Summary ?? string.Empty), + name: "\"summary\""); + + } + if (request.Tags != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Tags, x => x))}]"), + name: "\"tags\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::JasperAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadKnowledgeDocumentRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + 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::JasperAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + 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 __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadKnowledgeDocumentResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Bad request. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + global::JasperAI.ErrorResponse? __value_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_400 = global::JasperAI.ErrorResponse.FromJson(__content_400, JsonSerializerContext); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_400 = global::JasperAI.ErrorResponse.FromJson(__content_400, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::JasperAI.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseObject = __value_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // Internal server error. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + global::JasperAI.ErrorResponse? __value_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_500 = global::JasperAI.ErrorResponse.FromJson(__content_500, JsonSerializerContext); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_500 = global::JasperAI.ErrorResponse.FromJson(__content_500, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::JasperAI.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_500, + ResponseObject = __value_500, + 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); + ProcessUploadKnowledgeDocumentResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::JasperAI.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::JasperAI.KnowledgeResponse.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::JasperAI.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 knowledge item
+ /// Upload a file to create a new knowledge item. Supports txt, pdf, doc, and docx files (max 300MB). + ///
+ /// + /// Friendly name for the knowledge item. + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// File to upload (txt, pdf, doc, docx, max 300MB). + /// + /// + /// JSON string of key-value metadata pairs. + /// + /// + /// JSON string with appVisibility and autoSummary settings. + /// + /// + /// Manual knowledge item summary. + /// + /// + /// Searchable tags. + /// + /// 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> UploadKnowledgeDocumentAsResponseAsync( + string name, + global::System.IO.Stream file, + string filename, + string? metadata = default, + string? settings = default, + string? summary = default, + global::System.Collections.Generic.IList? tags = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::JasperAI.UploadKnowledgeDocumentRequest + { + Name = name, + File = global::System.Array.Empty(), + Filename = filename, + Metadata = metadata, + Settings = settings, + Summary = summary, + Tags = tags, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadKnowledgeDocumentArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::JasperAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadKnowledgeDocumentSecurityRequirements, + operationName: "UploadKnowledgeDocumentAsync"); + + using var __timeoutCancellationTokenSource = global::JasperAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::JasperAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::JasperAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::JasperAI.PathBuilder( + path: "/knowledge", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::JasperAI.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); + } + } + + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), + name: "\"name\""); + + var __contentFile = new global::System.Net.Http.StreamContent(file); + __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Filename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); + __httpRequestContent.Add( + content: __contentFile, + name: "\"file\"", + fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); + if (__contentFile.Headers.ContentDisposition != null) + { + __contentFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Metadata != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Metadata ?? string.Empty), + name: "\"metadata\""); + + } + if (request.Settings != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Settings ?? string.Empty), + name: "\"settings\""); + + } + if (request.Summary != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Summary ?? string.Empty), + name: "\"summary\""); + + } + if (request.Tags != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Tags, x => x))}]"), + name: "\"tags\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::JasperAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadKnowledgeDocumentRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + 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::JasperAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + 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 __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadKnowledgeDocumentResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeDocument", + methodName: "UploadKnowledgeDocumentAsync", + pathTemplate: "\"/knowledge\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Bad request. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + global::JasperAI.ErrorResponse? __value_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_400 = global::JasperAI.ErrorResponse.FromJson(__content_400, JsonSerializerContext); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_400 = global::JasperAI.ErrorResponse.FromJson(__content_400, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::JasperAI.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseObject = __value_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // Internal server error. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + global::JasperAI.ErrorResponse? __value_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_500 = global::JasperAI.ErrorResponse.FromJson(__content_500, JsonSerializerContext); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_500 = global::JasperAI.ErrorResponse.FromJson(__content_500, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::JasperAI.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_500, + ResponseObject = __value_500, + 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); + ProcessUploadKnowledgeDocumentResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::JasperAI.KnowledgeResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::JasperAI.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); + + var __value = await global::JasperAI.KnowledgeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + 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::JasperAI.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/JasperAI/Generated/JasperAI.KnowledgeClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.g.cs index ca933c7..e810082 100644 --- a/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.KnowledgeClient.g.cs @@ -72,10 +72,10 @@ public KnowledgeClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public KnowledgeClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.OptionsSupport.g.cs b/src/libs/JasperAI/Generated/JasperAI.OptionsSupport.g.cs index 7384e0c..82bb3a5 100644 --- a/src/libs/JasperAI/Generated/JasperAI.OptionsSupport.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.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::JasperAI.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::JasperAI.AutoSDKClientOptions clientOptions, global::JasperAI.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::JasperAI.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::JasperAI.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/JasperAI/Generated/JasperAI.StylesClient.GetStyleById.g.cs b/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyleById.g.cs index 7e1d62a..9114dca 100644 --- a/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyleById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyleById.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetStyleByIdResponseContent( string styleId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetStyleByIdAsResponseAsync( + styleId: styleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve style guide by ID
+ /// Retrieve a specific style guide by its unique identifier. + ///
+ /// + /// 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> GetStyleByIdAsResponseAsync( + string styleId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetStyleByIdResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/styles/{styleId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetStyleByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetStyleByIdResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetStyleByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetStyleByIdResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetStyleByIdResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetStyleByIdResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetStyleByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetStyleByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Style guide not found. @@ -384,9 +424,13 @@ partial void ProcessGetStyleByIdResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.StyleGuideResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.StyleGuideResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetStyleByIdResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.StyleGuideResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.StyleGuideResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyles.g.cs b/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyles.g.cs index 7f38597..e1ca7ef 100644 --- a/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyles.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.StylesClient.GetStyles.g.cs @@ -49,6 +49,24 @@ partial void ProcessGetStylesResponseContent( public async global::System.Threading.Tasks.Task GetStylesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetStylesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve all style guides
+ /// Returns a list of style guides available in your workspace, sorted from most recently created. + ///
+ /// 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> GetStylesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessGetStylesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/styles", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessGetStylesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessGetStylesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessGetStylesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessGetStylesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessGetStylesResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessGetStylesResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessGetStylesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessGetStylesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -340,9 +377,13 @@ partial void ProcessGetStylesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.StyleGuideListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.StyleGuideListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -370,9 +411,13 @@ partial void ProcessGetStylesResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.StyleGuideListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.StyleGuideListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.StylesClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.StylesClient.g.cs index cb835cf..2a570ac 100644 --- a/src/libs/JasperAI/Generated/JasperAI.StylesClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.StylesClient.g.cs @@ -72,10 +72,10 @@ public StylesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public StylesClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.TasksClient.GetTaskById.g.cs b/src/libs/JasperAI/Generated/JasperAI.TasksClient.GetTaskById.g.cs index 610d12f..0d62901 100644 --- a/src/libs/JasperAI/Generated/JasperAI.TasksClient.GetTaskById.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.TasksClient.GetTaskById.g.cs @@ -57,6 +57,30 @@ partial void ProcessGetTaskByIdResponseContent( double? version = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetTaskByIdAsResponseAsync( + id: id, + version: version, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get agent task by ID
+ /// Retrieve a specific agent task by its unique identifier. + ///
+ /// + /// + /// 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> GetTaskByIdAsResponseAsync( + string id, + double? version = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -87,11 +111,12 @@ partial void ProcessGetTaskByIdResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/tasks/{id}", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddOptionalParameter("version", version?.ToString()) + .AddOptionalParameter("version", version?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::JasperAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -164,6 +189,8 @@ partial void ProcessGetTaskByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +201,11 @@ partial void ProcessGetTaskByIdResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +223,8 @@ partial void ProcessGetTaskByIdResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +234,7 @@ partial void ProcessGetTaskByIdResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +243,11 @@ partial void ProcessGetTaskByIdResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +264,15 @@ partial void ProcessGetTaskByIdResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +312,8 @@ partial void ProcessGetTaskByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +334,8 @@ partial void ProcessGetTaskByIdResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Agent task not found. @@ -393,9 +436,13 @@ partial void ProcessGetTaskByIdResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.TaskGetResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.TaskGetResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,9 +470,13 @@ partial void ProcessGetTaskByIdResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.TaskGetResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.TaskGetResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.TasksClient.ListTasks.g.cs b/src/libs/JasperAI/Generated/JasperAI.TasksClient.ListTasks.g.cs index faf1af6..de5601f 100644 --- a/src/libs/JasperAI/Generated/JasperAI.TasksClient.ListTasks.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.TasksClient.ListTasks.g.cs @@ -81,6 +81,50 @@ partial void ProcessListTasksResponseContent( string? searchTerm = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListTasksAsResponseAsync( + size: size, + page: page, + scope: scope, + includeContextItems: includeContextItems, + includeCategories: includeCategories, + searchTerm: searchTerm, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List all agent tasks
+ /// Retrieve a paginated list of agent tasks available in your workspace. + ///
+ /// + /// Default Value: 100 + /// + /// + /// Default Value: 1 + /// + /// + /// + /// Default Value: false + /// + /// + /// 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> ListTasksAsResponseAsync( + int? size = default, + int? page = default, + global::JasperAI.ListTasksScope? scope = default, + bool? includeContextItems = default, + bool? includeCategories = default, + string? searchTerm = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -115,16 +159,17 @@ partial void ProcessListTasksResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/tasks", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("size", size?.ToString()) .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("scope", scope?.ToValueString()) .AddOptionalParameter("includeContextItems", includeContextItems?.ToString().ToLowerInvariant()) .AddOptionalParameter("includeCategories", includeCategories?.ToString().ToLowerInvariant()) - .AddOptionalParameter("searchTerm", searchTerm) + .AddOptionalParameter("searchTerm", searchTerm) ; var __path = __pathBuilder.ToString(); __path = global::JasperAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -201,6 +246,8 @@ partial void ProcessListTasksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -211,6 +258,11 @@ partial void ProcessListTasksResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -228,6 +280,8 @@ partial void ProcessListTasksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -237,8 +291,7 @@ partial void ProcessListTasksResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -247,6 +300,11 @@ partial void ProcessListTasksResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -263,14 +321,15 @@ partial void ProcessListTasksResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -310,6 +369,8 @@ partial void ProcessListTasksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -330,6 +391,8 @@ partial void ProcessListTasksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -392,9 +455,13 @@ partial void ProcessListTasksResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.TaskListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.TaskListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -422,9 +489,13 @@ partial void ProcessListTasksResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.TaskListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.TaskListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.TasksClient.RunTask.g.cs b/src/libs/JasperAI/Generated/JasperAI.TasksClient.RunTask.g.cs index c9ed501..e5e986c 100644 --- a/src/libs/JasperAI/Generated/JasperAI.TasksClient.RunTask.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.TasksClient.RunTask.g.cs @@ -55,6 +55,32 @@ partial void ProcessRunTaskResponseContent( public async global::System.Threading.Tasks.Task RunTaskAsync( string id, + global::JasperAI.TaskRunRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RunTaskAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Run an agent task
+ /// Execute an agent task with provided context 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> RunTaskAsResponseAsync( + string id, + global::JasperAI.TaskRunRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessRunTaskResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/tasks/{id}/run", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessRunTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessRunTaskResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessRunTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +242,7 @@ partial void ProcessRunTaskResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessRunTaskResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessRunTaskResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessRunTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessRunTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -437,9 +482,13 @@ partial void ProcessRunTaskResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.TaskRunResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.TaskRunResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -467,9 +516,13 @@ partial void ProcessRunTaskResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.TaskRunResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.TaskRunResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.TasksClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.TasksClient.g.cs index 2a46286..91fb645 100644 --- a/src/libs/JasperAI/Generated/JasperAI.TasksClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.TasksClient.g.cs @@ -72,10 +72,10 @@ public TasksClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public TasksClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.UsageClient.GetUsage.g.cs b/src/libs/JasperAI/Generated/JasperAI.UsageClient.GetUsage.g.cs index e2f323e..7b6d554 100644 --- a/src/libs/JasperAI/Generated/JasperAI.UsageClient.GetUsage.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.UsageClient.GetUsage.g.cs @@ -49,6 +49,24 @@ partial void ProcessGetUsageResponseContent( public async global::System.Threading.Tasks.Task GetUsageAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetUsageAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve usage
+ /// Retrieve API usage metrics for your workspace. + ///
+ /// 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> GetUsageAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessGetUsageResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/usage", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessGetUsageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessGetUsageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessGetUsageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessGetUsageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessGetUsageResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessGetUsageResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessGetUsageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessGetUsageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -340,9 +377,13 @@ partial void ProcessGetUsageResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -370,9 +411,13 @@ partial void ProcessGetUsageResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.UsageClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.UsageClient.g.cs index 20503bd..1dc40df 100644 --- a/src/libs/JasperAI/Generated/JasperAI.UsageClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.UsageClient.g.cs @@ -72,10 +72,10 @@ public UsageClient( /// 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::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetAllUsers.g.cs b/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetAllUsers.g.cs index 7254e4b..0f17af2 100644 --- a/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetAllUsers.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetAllUsers.g.cs @@ -57,6 +57,30 @@ partial void ProcessGetAllUsersResponseContent( int? page = default, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAllUsersAsResponseAsync( + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve users
+ /// Retrieve a paginated list of users in the workspace. + ///
+ /// + /// + /// 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> GetAllUsersAsResponseAsync( + int? limit = default, + int? page = default, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -87,12 +111,13 @@ partial void ProcessGetAllUsersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/users", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page?.ToString()) + .AddOptionalParameter("page", page?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::JasperAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -165,6 +190,8 @@ partial void ProcessGetAllUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +202,11 @@ partial void ProcessGetAllUsersResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +224,8 @@ partial void ProcessGetAllUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +235,7 @@ partial void ProcessGetAllUsersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +244,11 @@ partial void ProcessGetAllUsersResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +265,15 @@ partial void ProcessGetAllUsersResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +313,8 @@ partial void ProcessGetAllUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +335,8 @@ partial void ProcessGetAllUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -356,9 +399,13 @@ partial void ProcessGetAllUsersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.UserListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.UserListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -386,9 +433,13 @@ partial void ProcessGetAllUsersResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.UserListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.UserListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetUser.g.cs b/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetUser.g.cs index 60ed11a..b9af4a0 100644 --- a/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetUser.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.UsersClient.GetUser.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetUserResponseContent( string userId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetUserAsResponseAsync( + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve user by ID
+ /// Retrieve a specific user by their unique identifier. + ///
+ /// + /// 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> GetUserAsResponseAsync( + string userId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetUserResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetUserResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetUserResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetUserResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // User not found. @@ -384,9 +424,13 @@ partial void ProcessGetUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.UserResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.UserResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.UserResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.UserResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.UsersClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.UsersClient.g.cs index 05601cf..1cf25fd 100644 --- a/src/libs/JasperAI/Generated/JasperAI.UsersClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.UsersClient.g.cs @@ -72,10 +72,10 @@ public UsersClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public UsersClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.CreateTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.CreateTone.g.cs index a7293ae..ffd1559 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.CreateTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.CreateTone.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateToneResponseContent( /// public async global::System.Threading.Tasks.Task CreateToneAsync( + global::JasperAI.VoiceCreateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateToneAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a voice
+ /// Create a new brand voice/tone for content generation. + ///
+ /// + /// 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> CreateToneAsResponseAsync( + global::JasperAI.VoiceCreateRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateToneResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/tones", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateToneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateToneResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateToneResponseContent( 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 ProcessCreateToneResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateToneResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateToneResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -393,9 +435,13 @@ partial void ProcessCreateToneResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,9 +469,13 @@ partial void ProcessCreateToneResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.DeleteTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.DeleteTone.g.cs index 1f96ecc..ff0ea8a 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.DeleteTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.DeleteTone.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteToneResponse( string toneId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteToneAsResponseAsync( + toneId: toneId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete voice by ID
+ /// Delete a brand voice by its unique identifier. + ///
+ /// + /// 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 DeleteToneAsResponseAsync( + string toneId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteToneResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/tones/{toneId}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteToneResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteToneResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteToneResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessDeleteToneResponse( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteToneResponse( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteToneResponse( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteToneResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteToneResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Voice not found. @@ -375,6 +413,10 @@ partial void ProcessDeleteToneResponse( { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -396,6 +438,10 @@ partial void ProcessDeleteToneResponse( try { __response.EnsureSuccessStatusCode(); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetAllTones.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetAllTones.g.cs index 80f693f..6f5019f 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetAllTones.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetAllTones.g.cs @@ -49,6 +49,24 @@ partial void ProcessGetAllTonesResponseContent( public async global::System.Threading.Tasks.Task GetAllTonesAsync( global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAllTonesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve all voices
+ /// Retrieve all brand voices/tones available in your workspace. + ///
+ /// 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> GetAllTonesAsResponseAsync( + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessGetAllTonesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: "/tones", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessGetAllTonesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessGetAllTonesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessGetAllTonesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessGetAllTonesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessGetAllTonesResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessGetAllTonesResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessGetAllTonesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessGetAllTonesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Internal server error. @@ -340,9 +377,13 @@ partial void ProcessGetAllTonesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.VoiceListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.VoiceListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -370,9 +411,13 @@ partial void ProcessGetAllTonesResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.VoiceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.VoiceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetTone.g.cs index 56286f2..cd42051 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.GetTone.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetToneResponseContent( string toneId, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetToneAsResponseAsync( + toneId: toneId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve voice by ID
+ /// Retrieve a specific brand voice by its unique identifier. + ///
+ /// + /// 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> GetToneAsResponseAsync( + string toneId, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetToneResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/tones/{toneId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetToneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetToneResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetToneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetToneResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetToneResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetToneResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Voice not found. @@ -384,9 +424,13 @@ partial void ProcessGetToneResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetToneResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.UpdateTone.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.UpdateTone.g.cs index 56bfeeb..5ee9214 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.UpdateTone.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.UpdateTone.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateToneResponseContent( public async global::System.Threading.Tasks.Task UpdateToneAsync( string toneId, + global::JasperAI.VoiceUpdateRequest request, + global::JasperAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateToneAsResponseAsync( + toneId: toneId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update voice by ID
+ /// Update an existing brand voice by its unique identifier. + ///
+ /// + /// + /// 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> UpdateToneAsResponseAsync( + string toneId, + global::JasperAI.VoiceUpdateRequest request, global::JasperAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateToneResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::JasperAI.PathBuilder( path: $"/tones/{toneId}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateToneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateToneResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateToneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +242,7 @@ partial void ProcessUpdateToneResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateToneResponseContent( __attempt < __maxAttempts && global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateToneResponseContent( 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::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateToneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request. @@ -399,9 +444,13 @@ partial void ProcessUpdateToneResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::JasperAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -429,9 +478,13 @@ partial void ProcessUpdateToneResponseContent( #endif ).ConfigureAwait(false); - return - await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::JasperAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::JasperAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.g.cs b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.g.cs index 3731d87..8db4ec4 100644 --- a/src/libs/JasperAI/Generated/JasperAI.VoicesClient.g.cs +++ b/src/libs/JasperAI/Generated/JasperAI.VoicesClient.g.cs @@ -72,10 +72,10 @@ public VoicesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public VoicesClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::JasperAI.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::JasperAI.AutoSDKClientOptions? options, bool disposeHttpClient = true) {