From 703832899c5491ee07732f592a10fdf1da841c19 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 16:29:42 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- src/libs/Anam/Generated/Anam.AnamClient.g.cs | 26 +- .../Anam.AuthClient.CreateSessionToken.g.cs | 66 +- src/libs/Anam/Generated/Anam.AuthClient.g.cs | 8 +- .../Generated/Anam.AutoSDKHttpResponse.g.cs | 121 ++ .../Anam.AvatarsClient.CreateAvatar.g.cs | 1289 ++++++++++++++++- .../Anam.AvatarsClient.DeleteAvatar.g.cs | 54 +- .../Anam.AvatarsClient.GetAvatar.g.cs | 64 +- .../Anam.AvatarsClient.ListAvatars.g.cs | 83 +- .../Anam.AvatarsClient.UpdateAvatar.g.cs | 69 +- .../Anam/Generated/Anam.AvatarsClient.g.cs | 8 +- .../Anam.IAuthClient.CreateSessionToken.g.cs | 13 + .../Anam.IAvatarsClient.CreateAvatar.g.cs | 66 + .../Anam.IAvatarsClient.DeleteAvatar.g.cs | 12 + .../Anam.IAvatarsClient.GetAvatar.g.cs | 12 + .../Anam.IAvatarsClient.ListAvatars.g.cs | 24 + .../Anam.IAvatarsClient.UpdateAvatar.g.cs | 15 + ...IKnowledgeClient.CreateKnowledgeGroup.g.cs | 13 + ...owledgeClient.DeleteKnowledgeDocument.g.cs | 12 + ...IKnowledgeClient.DeleteKnowledgeGroup.g.cs | 12 + ...IKnowledgeClient.GetKnowledgeDocument.g.cs | 12 + ...geClient.GetKnowledgeDocumentDownload.g.cs | 12 + ...am.IKnowledgeClient.GetKnowledgeGroup.g.cs | 12 + ...dgeClient.ListKnowledgeGroupDocuments.g.cs | 12 + ....IKnowledgeClient.ListKnowledgeGroups.g.cs | 10 + ...IKnowledgeClient.SearchKnowledgeGroup.g.cs | 15 + ...owledgeClient.UpdateKnowledgeDocument.g.cs | 15 + ...IKnowledgeClient.UpdateKnowledgeGroup.g.cs | 15 + ...geClient.UploadKnowledgeGroupDocument.g.cs | 72 + .../Generated/Anam.ILLMsClient.CreateLlm.g.cs | 13 + .../Generated/Anam.ILLMsClient.DeleteLlm.g.cs | 12 + .../Generated/Anam.ILLMsClient.GetLlm.g.cs | 12 + .../Generated/Anam.ILLMsClient.ListLlms.g.cs | 18 + .../Generated/Anam.ILLMsClient.UpdateLlm.g.cs | 15 + .../Anam.IPersonasClient.CreatePersona.g.cs | 13 + .../Anam.IPersonasClient.DeletePersona.g.cs | 12 + .../Anam.IPersonasClient.GetPersona.g.cs | 12 + .../Anam.IPersonasClient.ListPersonas.g.cs | 20 + .../Anam.IPersonasClient.UpdatePersona.g.cs | 15 + .../Anam.ISessionsClient.GetSession.g.cs | 12 + ...m.ISessionsClient.GetSessionRecording.g.cs | 12 + ....ISessionsClient.GetSessionTranscript.g.cs | 12 + .../Anam.ISessionsClient.ListSessions.g.cs | 24 + ...nam.IShareLinksClient.CreateShareLink.g.cs | 13 + ...nam.IShareLinksClient.DeleteShareLink.g.cs | 12 + .../Anam.IShareLinksClient.GetShareLink.g.cs | 12 + ...Anam.IShareLinksClient.ListShareLinks.g.cs | 22 + ...nam.IShareLinksClient.UpdateShareLink.g.cs | 15 + .../Anam.IToolsClient.CreateTool.g.cs | 13 + .../Anam.IToolsClient.DeleteTool.g.cs | 12 + .../Generated/Anam.IToolsClient.GetTool.g.cs | 12 + .../Anam.IToolsClient.ListTools.g.cs | 20 + .../Anam.IToolsClient.UpdateTool.g.cs | 15 + .../Anam.IVoicesClient.CreateVoice.g.cs | 86 ++ .../Anam.IVoicesClient.DeleteVoice.g.cs | 12 + .../Anam.IVoicesClient.GetVoice.g.cs | 12 + .../Anam.IVoicesClient.ListVoices.g.cs | 20 + .../Anam.IVoicesClient.UpdateVoice.g.cs | 15 + ....KnowledgeClient.CreateKnowledgeGroup.g.cs | 66 +- ...owledgeClient.DeleteKnowledgeDocument.g.cs | 54 +- ....KnowledgeClient.DeleteKnowledgeGroup.g.cs | 54 +- ....KnowledgeClient.GetKnowledgeDocument.g.cs | 64 +- ...geClient.GetKnowledgeDocumentDownload.g.cs | 64 +- ...nam.KnowledgeClient.GetKnowledgeGroup.g.cs | 64 +- ...dgeClient.ListKnowledgeGroupDocuments.g.cs | 64 +- ...m.KnowledgeClient.ListKnowledgeGroups.g.cs | 61 +- ....KnowledgeClient.SearchKnowledgeGroup.g.cs | 69 +- ...owledgeClient.UpdateKnowledgeDocument.g.cs | 69 +- ....KnowledgeClient.UpdateKnowledgeGroup.g.cs | 69 +- ...geClient.UploadKnowledgeGroupDocument.g.cs | 1245 +++++++++++++++- .../Anam/Generated/Anam.KnowledgeClient.g.cs | 8 +- .../Generated/Anam.LLMsClient.CreateLlm.g.cs | 66 +- .../Generated/Anam.LLMsClient.DeleteLlm.g.cs | 54 +- .../Generated/Anam.LLMsClient.GetLlm.g.cs | 64 +- .../Generated/Anam.LLMsClient.ListLlms.g.cs | 77 +- .../Generated/Anam.LLMsClient.UpdateLlm.g.cs | 69 +- src/libs/Anam/Generated/Anam.LLMsClient.g.cs | 8 +- .../Anam/Generated/Anam.OptionsSupport.g.cs | 231 ++- .../Anam.PersonasClient.CreatePersona.g.cs | 66 +- .../Anam.PersonasClient.DeletePersona.g.cs | 54 +- .../Anam.PersonasClient.GetPersona.g.cs | 64 +- .../Anam.PersonasClient.ListPersonas.g.cs | 78 +- .../Anam.PersonasClient.UpdatePersona.g.cs | 69 +- .../Anam/Generated/Anam.PersonasClient.g.cs | 8 +- .../Anam.SessionsClient.GetSession.g.cs | 64 +- ...am.SessionsClient.GetSessionRecording.g.cs | 64 +- ...m.SessionsClient.GetSessionTranscript.g.cs | 64 +- .../Anam.SessionsClient.ListSessions.g.cs | 84 +- .../Anam/Generated/Anam.SessionsClient.g.cs | 8 +- ...Anam.ShareLinksClient.CreateShareLink.g.cs | 66 +- ...Anam.ShareLinksClient.DeleteShareLink.g.cs | 54 +- .../Anam.ShareLinksClient.GetShareLink.g.cs | 64 +- .../Anam.ShareLinksClient.ListShareLinks.g.cs | 81 +- ...Anam.ShareLinksClient.UpdateShareLink.g.cs | 69 +- .../Anam/Generated/Anam.ShareLinksClient.g.cs | 8 +- .../Anam.ToolsClient.CreateTool.g.cs | 66 +- .../Anam.ToolsClient.DeleteTool.g.cs | 54 +- .../Generated/Anam.ToolsClient.GetTool.g.cs | 64 +- .../Generated/Anam.ToolsClient.ListTools.g.cs | 78 +- .../Anam.ToolsClient.UpdateTool.g.cs | 69 +- src/libs/Anam/Generated/Anam.ToolsClient.g.cs | 8 +- .../Anam.VoicesClient.CreateVoice.g.cs | 1277 +++++++++++++++- .../Anam.VoicesClient.DeleteVoice.g.cs | 54 +- .../Generated/Anam.VoicesClient.GetVoice.g.cs | 64 +- .../Anam.VoicesClient.ListVoices.g.cs | 78 +- .../Anam.VoicesClient.UpdateVoice.g.cs | 69 +- .../Anam/Generated/Anam.VoicesClient.g.cs | 8 +- 106 files changed, 7589 insertions(+), 420 deletions(-) create mode 100644 src/libs/Anam/Generated/Anam.AutoSDKHttpResponse.g.cs diff --git a/src/libs/Anam/Generated/Anam.AnamClient.g.cs b/src/libs/Anam/Generated/Anam.AnamClient.g.cs index 6b59c11..3724fc2 100644 --- a/src/libs/Anam/Generated/Anam.AnamClient.g.cs +++ b/src/libs/Anam/Generated/Anam.AnamClient.g.cs @@ -43,7 +43,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public AuthClient Auth => new AuthClient(HttpClient, authorizations: Authorizations, options: Options) + public AuthClient Auth => new AuthClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -52,7 +52,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public AvatarsClient Avatars => new AvatarsClient(HttpClient, authorizations: Authorizations, options: Options) + public AvatarsClient Avatars => new AvatarsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -61,7 +61,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - 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, @@ -70,7 +70,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public LLMsClient LLMs => new LLMsClient(HttpClient, authorizations: Authorizations, options: Options) + public LLMsClient LLMs => new LLMsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -79,7 +79,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public PersonasClient Personas => new PersonasClient(HttpClient, authorizations: Authorizations, options: Options) + public PersonasClient Personas => new PersonasClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -88,7 +88,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public SessionsClient Sessions => new SessionsClient(HttpClient, authorizations: Authorizations, options: Options) + public SessionsClient Sessions => new SessionsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -97,7 +97,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public ShareLinksClient ShareLinks => new ShareLinksClient(HttpClient, authorizations: Authorizations, options: Options) + public ShareLinksClient ShareLinks => new ShareLinksClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -106,7 +106,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - public ToolsClient Tools => new ToolsClient(HttpClient, authorizations: Authorizations, options: Options) + public ToolsClient Tools => new ToolsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -115,7 +115,7 @@ public sealed partial class AnamClient : global::Anam.IAnamClient, global::Syste /// /// /// - 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, @@ -154,10 +154,10 @@ public AnamClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AnamClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.AuthClient.CreateSessionToken.g.cs b/src/libs/Anam/Generated/Anam.AuthClient.CreateSessionToken.g.cs index 6256d26..78f45d6 100644 --- a/src/libs/Anam/Generated/Anam.AuthClient.CreateSessionToken.g.cs +++ b/src/libs/Anam/Generated/Anam.AuthClient.CreateSessionToken.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateSessionTokenResponseContent( /// public async global::System.Threading.Tasks.Task CreateSessionTokenAsync( + global::Anam.CreateSessionTokenRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSessionTokenAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create session token
+ /// Creates a temporary session token for client-side use. The session token is valid for 1 hour. + ///
+ /// + /// 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> CreateSessionTokenAsResponseAsync( + global::Anam.CreateSessionTokenRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateSessionTokenResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/auth/session-token", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateSessionTokenResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateSessionTokenResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateSessionTokenResponseContent( 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 ProcessCreateSessionTokenResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateSessionTokenResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateSessionTokenResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateSessionTokenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateSessionTokenResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -416,9 +458,13 @@ partial void ProcessCreateSessionTokenResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.CreateSessionTokenResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.CreateSessionTokenResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +492,13 @@ partial void ProcessCreateSessionTokenResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.CreateSessionTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.CreateSessionTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.AuthClient.g.cs b/src/libs/Anam/Generated/Anam.AuthClient.g.cs index 28e95db..877f934 100644 --- a/src/libs/Anam/Generated/Anam.AuthClient.g.cs +++ b/src/libs/Anam/Generated/Anam.AuthClient.g.cs @@ -72,10 +72,10 @@ public AuthClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AuthClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.AutoSDKHttpResponse.g.cs b/src/libs/Anam/Generated/Anam.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..48484e9 --- /dev/null +++ b/src/libs/Anam/Generated/Anam.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace Anam +{ + /// + /// 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/Anam/Generated/Anam.AvatarsClient.CreateAvatar.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.CreateAvatar.g.cs index 1cbc18e..741d673 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.CreateAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.CreateAvatar.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateAvatarResponseContent( /// public async global::System.Threading.Tasks.Task CreateAvatarAsync( + global::Anam.CreateAvatarRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateAvatarAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create avatar
+ /// Create a new custom avatar from an image. + ///
+ /// + /// 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> CreateAvatarAsResponseAsync( + global::Anam.CreateAvatarRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -81,10 +104,11 @@ partial void ProcessCreateAvatarResponseContent( var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/avatars", baseUri: HttpClient.BaseAddress); @@ -117,10 +141,12 @@ partial void ProcessCreateAvatarResponseContent( __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.DisplayName ?? string.Empty), name: "\"displayName\""); + if (request.ImageFile != default) { @@ -161,15 +187,19 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.ImageUrl != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ImageUrl ?? string.Empty), name: "\"imageUrl\""); + } + __httpRequest.Content = __httpRequestContent; + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -211,6 +241,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -221,6 +253,11 @@ request.ImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -238,6 +275,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -247,8 +286,7 @@ request.ImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +295,11 @@ request.ImageFilename is null __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -273,14 +316,15 @@ request.ImageFilename 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -320,6 +364,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -340,6 +386,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -529,9 +577,13 @@ request.ImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -559,9 +611,13 @@ request.ImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -639,5 +695,1218 @@ request.ImageFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Create avatar
+ /// Create a new custom avatar from an image. + ///
+ /// + /// Display name for the avatar (3-50 characters). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image URL (JPEG, PNG, WebP; max 4.5MB). + /// + /// 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 CreateAvatarAsync( + string displayName, + global::System.IO.Stream? imageFile = default, + string? imageFilename = default, + string? imageUrl = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + var request = new global::Anam.CreateAvatarRequest + { + DisplayName = displayName, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + ImageUrl = imageUrl, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateAvatarArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateAvatarSecurityRequirements, + operationName: "CreateAvatarAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: "/v1/avatars", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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.DisplayName ?? string.Empty), + name: "\"displayName\""); + + if (imageFile != default) + { + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"imageFile\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.ImageUrl != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageUrl ?? string.Empty), + name: "\"imageUrl\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateAvatarRequest( + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.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); + ProcessCreateAvatarResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + statusCode: __response.StatusCode) + { + ResponseBody = __content_403, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessCreateAvatarResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.Avatar.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::Anam.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 avatar
+ /// Create a new custom avatar from an image. + ///
+ /// + /// Display name for the avatar (3-50 characters). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image URL (JPEG, PNG, WebP; max 4.5MB). + /// + /// 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> CreateAvatarAsResponseAsync( + string displayName, + global::System.IO.Stream? imageFile = default, + string? imageFilename = default, + string? imageUrl = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + var request = new global::Anam.CreateAvatarRequest + { + DisplayName = displayName, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + ImageUrl = imageUrl, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateAvatarArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateAvatarSecurityRequirements, + operationName: "CreateAvatarAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: "/v1/avatars", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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.DisplayName ?? string.Empty), + name: "\"displayName\""); + + if (imageFile != default) + { + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"imageFile\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.ImageUrl != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageUrl ?? string.Empty), + name: "\"imageUrl\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateAvatarRequest( + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.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); + ProcessCreateAvatarResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateAvatar", + methodName: "CreateAvatarAsync", + pathTemplate: "\"/v1/avatars\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + statusCode: __response.StatusCode) + { + ResponseBody = __content_403, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessCreateAvatarResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.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::Anam.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/Anam/Generated/Anam.AvatarsClient.DeleteAvatar.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.DeleteAvatar.g.cs index cf80760..ba3d239 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.DeleteAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.DeleteAvatar.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteAvatarResponse( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteAvatarAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete avatar
+ /// Delete an avatar by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteAvatarAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteAvatarResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/avatars/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteAvatarResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteAvatarResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteAvatarResponse( 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 ProcessDeleteAvatarResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteAvatarResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteAvatarResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteAvatarResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteAvatarResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -431,6 +469,10 @@ partial void ProcessDeleteAvatarResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -452,6 +494,10 @@ partial void ProcessDeleteAvatarResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.AvatarsClient.GetAvatar.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.GetAvatar.g.cs index 0ccc98b..f82a5ea 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.GetAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.GetAvatar.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetAvatarResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAvatarAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get avatar
+ /// Returns an avatar by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetAvatarAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetAvatarResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/avatars/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetAvatarResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetAvatarResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetAvatarResponseContent( 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 ProcessGetAvatarResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetAvatarResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetAvatarResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetAvatarResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetAvatarResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetAvatarResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetAvatarResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.AvatarsClient.ListAvatars.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.ListAvatars.g.cs index e081a4e..a01de22 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.ListAvatars.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.ListAvatars.g.cs @@ -71,6 +71,42 @@ partial void ProcessListAvatarsResponseContent( bool? onlyOneShot = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListAvatarsAsResponseAsync( + page: page, + perPage: perPage, + search: search, + onlyOneShot: onlyOneShot, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List avatars
+ /// Returns a paginated list of all avatars. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// + /// 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> ListAvatarsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + bool? onlyOneShot = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -103,14 +139,15 @@ partial void ProcessListAvatarsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/avatars", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) .AddOptionalParameter("search", search) - .AddOptionalParameter("onlyOneShot", onlyOneShot?.ToString().ToLowerInvariant()) + .AddOptionalParameter("onlyOneShot", onlyOneShot?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -185,6 +222,8 @@ partial void ProcessListAvatarsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -195,6 +234,11 @@ partial void ProcessListAvatarsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -212,6 +256,8 @@ partial void ProcessListAvatarsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -221,8 +267,7 @@ partial void ProcessListAvatarsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -231,6 +276,11 @@ partial void ProcessListAvatarsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -247,14 +297,15 @@ partial void ProcessListAvatarsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -294,6 +345,8 @@ partial void ProcessListAvatarsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -314,6 +367,8 @@ partial void ProcessListAvatarsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -404,9 +459,13 @@ partial void ProcessListAvatarsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListAvatarsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListAvatarsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -434,9 +493,13 @@ partial void ProcessListAvatarsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListAvatarsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListAvatarsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.AvatarsClient.UpdateAvatar.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.UpdateAvatar.g.cs index c61b432..c7d9331 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.UpdateAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.UpdateAvatar.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateAvatarResponseContent( public async global::System.Threading.Tasks.Task UpdateAvatarAsync( global::System.Guid id, + global::Anam.UpdateAvatarRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateAvatarAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update avatar
+ /// Update an avatar by ID (only display name can be updated). + ///
+ /// + /// + /// 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> UpdateAvatarAsResponseAsync( + global::System.Guid id, + global::Anam.UpdateAvatarRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateAvatarResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/avatars/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateAvatarResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateAvatarResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateAvatarResponseContent( 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 ProcessUpdateAvatarResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateAvatarResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateAvatarResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateAvatarResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateAvatarResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessUpdateAvatarResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Avatar.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdateAvatarResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Avatar.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.AvatarsClient.g.cs b/src/libs/Anam/Generated/Anam.AvatarsClient.g.cs index cc18b01..31db031 100644 --- a/src/libs/Anam/Generated/Anam.AvatarsClient.g.cs +++ b/src/libs/Anam/Generated/Anam.AvatarsClient.g.cs @@ -72,10 +72,10 @@ public AvatarsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AvatarsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.IAuthClient.CreateSessionToken.g.cs b/src/libs/Anam/Generated/Anam.IAuthClient.CreateSessionToken.g.cs index 107154c..77f468b 100644 --- a/src/libs/Anam/Generated/Anam.IAuthClient.CreateSessionToken.g.cs +++ b/src/libs/Anam/Generated/Anam.IAuthClient.CreateSessionToken.g.cs @@ -21,6 +21,19 @@ public partial interface IAuthClient /// Create session token
/// Creates a temporary session token for client-side use. The session token is valid for 1 hour. /// + /// + /// 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> CreateSessionTokenAsResponseAsync( + + global::Anam.CreateSessionTokenRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create session token
+ /// Creates a temporary session token for client-side use. The session token is valid for 1 hour. + ///
/// /// Identifier for the session. /// diff --git a/src/libs/Anam/Generated/Anam.IAvatarsClient.CreateAvatar.g.cs b/src/libs/Anam/Generated/Anam.IAvatarsClient.CreateAvatar.g.cs index b14e14b..acd17c7 100644 --- a/src/libs/Anam/Generated/Anam.IAvatarsClient.CreateAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.IAvatarsClient.CreateAvatar.g.cs @@ -21,6 +21,19 @@ public partial interface IAvatarsClient /// Create avatar
/// Create a new custom avatar from an image. /// + /// + /// 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> CreateAvatarAsResponseAsync( + + global::Anam.CreateAvatarRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create avatar
+ /// Create a new custom avatar from an image. + ///
/// /// Display name for the avatar (3-50 characters). /// @@ -43,5 +56,58 @@ public partial interface IAvatarsClient string? imageUrl = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create avatar
+ /// Create a new custom avatar from an image. + ///
+ /// + /// Display name for the avatar (3-50 characters). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image URL (JPEG, PNG, WebP; max 4.5MB). + /// + /// 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 CreateAvatarAsync( + string displayName, + global::System.IO.Stream? imageFile = default, + string? imageFilename = default, + string? imageUrl = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create avatar
+ /// Create a new custom avatar from an image. + ///
+ /// + /// Display name for the avatar (3-50 characters). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image file (JPEG, PNG, WebP; max 4.5MB). + /// + /// + /// Image URL (JPEG, PNG, WebP; max 4.5MB). + /// + /// 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> CreateAvatarAsResponseAsync( + string displayName, + global::System.IO.Stream? imageFile = default, + string? imageFilename = default, + string? imageUrl = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IAvatarsClient.DeleteAvatar.g.cs b/src/libs/Anam/Generated/Anam.IAvatarsClient.DeleteAvatar.g.cs index d7d4c4a..5538e98 100644 --- a/src/libs/Anam/Generated/Anam.IAvatarsClient.DeleteAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.IAvatarsClient.DeleteAvatar.g.cs @@ -16,5 +16,17 @@ public partial interface IAvatarsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete avatar
+ /// Delete an avatar by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAvatarAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IAvatarsClient.GetAvatar.g.cs b/src/libs/Anam/Generated/Anam.IAvatarsClient.GetAvatar.g.cs index a73c206..4d9dacb 100644 --- a/src/libs/Anam/Generated/Anam.IAvatarsClient.GetAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.IAvatarsClient.GetAvatar.g.cs @@ -16,5 +16,17 @@ public partial interface IAvatarsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get avatar
+ /// Returns an avatar by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAvatarAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IAvatarsClient.ListAvatars.g.cs b/src/libs/Anam/Generated/Anam.IAvatarsClient.ListAvatars.g.cs index 6daaa28..c204445 100644 --- a/src/libs/Anam/Generated/Anam.IAvatarsClient.ListAvatars.g.cs +++ b/src/libs/Anam/Generated/Anam.IAvatarsClient.ListAvatars.g.cs @@ -28,5 +28,29 @@ public partial interface IAvatarsClient bool? onlyOneShot = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List avatars
+ /// Returns a paginated list of all avatars. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// + /// 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> ListAvatarsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + bool? onlyOneShot = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IAvatarsClient.UpdateAvatar.g.cs b/src/libs/Anam/Generated/Anam.IAvatarsClient.UpdateAvatar.g.cs index 37ef559..13f338a 100644 --- a/src/libs/Anam/Generated/Anam.IAvatarsClient.UpdateAvatar.g.cs +++ b/src/libs/Anam/Generated/Anam.IAvatarsClient.UpdateAvatar.g.cs @@ -24,6 +24,21 @@ public partial interface IAvatarsClient /// Update an avatar by ID (only display name can be updated). /// /// + /// + /// 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> UpdateAvatarAsResponseAsync( + global::System.Guid id, + + global::Anam.UpdateAvatarRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update avatar
+ /// Update an avatar by ID (only display name can be updated). + ///
+ /// /// /// New display name for the avatar. /// diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.CreateKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.CreateKnowledgeGroup.g.cs index b7b94d4..153718a 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.CreateKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.CreateKnowledgeGroup.g.cs @@ -21,6 +21,19 @@ public partial interface IKnowledgeClient /// Create knowledge group
/// Create a new knowledge group for RAG. /// + /// + /// 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> CreateKnowledgeGroupAsResponseAsync( + + global::Anam.CreateKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create knowledge group
+ /// Create a new knowledge group for RAG. + ///
/// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeDocument.g.cs index 064dbbe..433dad4 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeDocument.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete knowledge document
+ /// Delete a document from a knowledge group. + ///
+ /// + /// 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 id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeGroup.g.cs index 80d8837..9c612e2 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.DeleteKnowledgeGroup.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete knowledge group
+ /// Delete a knowledge group. + ///
+ /// + /// 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 DeleteKnowledgeGroupAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocument.g.cs index 66185c8..c3f2bbf 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocument.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get knowledge document
+ /// Get a single document by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetKnowledgeDocumentAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocumentDownload.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocumentDownload.g.cs index f5eed2b..386afc0 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocumentDownload.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeDocumentDownload.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get knowledge document download
+ /// Get a presigned download URL for a knowledge document. + ///
+ /// + /// 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> GetKnowledgeDocumentDownloadAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeGroup.g.cs index f70b7dc..48dcfe6 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.GetKnowledgeGroup.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get knowledge group
+ /// Get a single knowledge group by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetKnowledgeGroupAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroupDocuments.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroupDocuments.g.cs index c443c2c..6ebe61f 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroupDocuments.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroupDocuments.g.cs @@ -16,5 +16,17 @@ public partial interface IKnowledgeClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List knowledge group documents
+ /// Get all documents in a knowledge group. + ///
+ /// + /// 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> ListKnowledgeGroupDocumentsAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroups.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroups.g.cs index 8d09473..8680a30 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroups.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.ListKnowledgeGroups.g.cs @@ -14,5 +14,15 @@ public partial interface IKnowledgeClient global::System.Threading.Tasks.Task ListKnowledgeGroupsAsync( global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List knowledge groups
+ /// Returns a list of all knowledge groups for the organization. + ///
+ /// 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> ListKnowledgeGroupsAsResponseAsync( + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.SearchKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.SearchKnowledgeGroup.g.cs index b6af928..f5e6d6c 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.SearchKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.SearchKnowledgeGroup.g.cs @@ -24,6 +24,21 @@ public partial interface IKnowledgeClient /// Search for similar content in a knowledge group using vector similarity. /// /// + /// + /// 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> SearchKnowledgeGroupAsResponseAsync( + string id, + + global::Anam.SearchKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Search knowledge group
+ /// Search for similar content in a knowledge group using vector similarity. + ///
+ /// /// /// /// Default Value: 5 diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeDocument.g.cs index b07bd72..b418e3a 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeDocument.g.cs @@ -24,6 +24,21 @@ public partial interface IKnowledgeClient /// Update a document (rename). /// /// + /// + /// 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 id, + + global::Anam.UpdateKnowledgeDocumentRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update knowledge document
+ /// Update a document (rename). + ///
+ /// /// /// New filename for the document. /// diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeGroup.g.cs index d933cbc..518f761 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UpdateKnowledgeGroup.g.cs @@ -24,6 +24,21 @@ public partial interface IKnowledgeClient /// Update a knowledge group. /// /// + /// + /// 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> UpdateKnowledgeGroupAsResponseAsync( + string id, + + global::Anam.UpdateKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update knowledge group
+ /// Update a knowledge group. + ///
+ /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UploadKnowledgeGroupDocument.g.cs b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UploadKnowledgeGroupDocument.g.cs index b736860..0c472c1 100644 --- a/src/libs/Anam/Generated/Anam.IKnowledgeClient.UploadKnowledgeGroupDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.IKnowledgeClient.UploadKnowledgeGroupDocument.g.cs @@ -24,6 +24,21 @@ public partial interface IKnowledgeClient /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). /// /// + /// + /// 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> UploadKnowledgeGroupDocumentAsResponseAsync( + string id, + + global::Anam.UploadKnowledgeGroupDocumentRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// /// /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). /// @@ -47,5 +62,62 @@ public partial interface IKnowledgeClient int? chunkOverlap = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Default Value: 1000 + /// + /// + /// Default Value: 200 + /// + /// 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 UploadKnowledgeGroupDocumentAsync( + string id, + global::System.IO.Stream file, + string filename, + int? chunkSize = default, + int? chunkOverlap = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Default Value: 1000 + /// + /// + /// Default Value: 200 + /// + /// 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> UploadKnowledgeGroupDocumentAsResponseAsync( + string id, + global::System.IO.Stream file, + string filename, + int? chunkSize = default, + int? chunkOverlap = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ILLMsClient.CreateLlm.g.cs b/src/libs/Anam/Generated/Anam.ILLMsClient.CreateLlm.g.cs index 5b76653..52d7cc7 100644 --- a/src/libs/Anam/Generated/Anam.ILLMsClient.CreateLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.ILLMsClient.CreateLlm.g.cs @@ -21,6 +21,19 @@ public partial interface ILLMsClient /// Create LLM
/// Create a new LLM configuration. /// + /// + /// 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> CreateLlmAsResponseAsync( + + global::Anam.CreateLlmRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create LLM
+ /// Create a new LLM configuration. + ///
/// /// /// diff --git a/src/libs/Anam/Generated/Anam.ILLMsClient.DeleteLlm.g.cs b/src/libs/Anam/Generated/Anam.ILLMsClient.DeleteLlm.g.cs index 97ef889..705d461 100644 --- a/src/libs/Anam/Generated/Anam.ILLMsClient.DeleteLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.ILLMsClient.DeleteLlm.g.cs @@ -16,5 +16,17 @@ public partial interface ILLMsClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete LLM
+ /// Delete an LLM configuration. + ///
+ /// + /// 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 DeleteLlmAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ILLMsClient.GetLlm.g.cs b/src/libs/Anam/Generated/Anam.ILLMsClient.GetLlm.g.cs index eeb1888..140893e 100644 --- a/src/libs/Anam/Generated/Anam.ILLMsClient.GetLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.ILLMsClient.GetLlm.g.cs @@ -16,5 +16,17 @@ public partial interface ILLMsClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get LLM
+ /// Get a specific LLM by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetLlmAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ILLMsClient.ListLlms.g.cs b/src/libs/Anam/Generated/Anam.ILLMsClient.ListLlms.g.cs index 05ab5c1..73cef2d 100644 --- a/src/libs/Anam/Generated/Anam.ILLMsClient.ListLlms.g.cs +++ b/src/libs/Anam/Generated/Anam.ILLMsClient.ListLlms.g.cs @@ -22,5 +22,23 @@ public partial interface ILLMsClient bool? includeDefaults = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List LLMs
+ /// Returns a list of all LLMs available to the organization. + ///
+ /// + /// + /// + /// + /// 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> ListLlmsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + bool? includeDefaults = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ILLMsClient.UpdateLlm.g.cs b/src/libs/Anam/Generated/Anam.ILLMsClient.UpdateLlm.g.cs index 3a9ec93..16ee4f4 100644 --- a/src/libs/Anam/Generated/Anam.ILLMsClient.UpdateLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.ILLMsClient.UpdateLlm.g.cs @@ -24,6 +24,21 @@ public partial interface ILLMsClient /// Update an LLM configuration. /// /// + /// + /// 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> UpdateLlmAsResponseAsync( + string id, + + global::Anam.UpdateLlmRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update LLM
+ /// Update an LLM configuration. + ///
+ /// /// /// /// diff --git a/src/libs/Anam/Generated/Anam.IPersonasClient.CreatePersona.g.cs b/src/libs/Anam/Generated/Anam.IPersonasClient.CreatePersona.g.cs index dd9d50b..6a4e85e 100644 --- a/src/libs/Anam/Generated/Anam.IPersonasClient.CreatePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.IPersonasClient.CreatePersona.g.cs @@ -21,6 +21,19 @@ public partial interface IPersonasClient /// Create persona
/// Create a new persona with avatar, voice, LLM, and system prompt configuration. /// + /// + /// 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> CreatePersonaAsResponseAsync( + + global::Anam.PersonaConfig request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create persona
+ /// Create a new persona with avatar, voice, LLM, and system prompt configuration. + ///
/// /// Unique identifier for the persona. /// diff --git a/src/libs/Anam/Generated/Anam.IPersonasClient.DeletePersona.g.cs b/src/libs/Anam/Generated/Anam.IPersonasClient.DeletePersona.g.cs index 18cba2b..993e951 100644 --- a/src/libs/Anam/Generated/Anam.IPersonasClient.DeletePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.IPersonasClient.DeletePersona.g.cs @@ -16,5 +16,17 @@ public partial interface IPersonasClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete persona
+ /// Delete a persona by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeletePersonaAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IPersonasClient.GetPersona.g.cs b/src/libs/Anam/Generated/Anam.IPersonasClient.GetPersona.g.cs index 4ba62d2..8f21a27 100644 --- a/src/libs/Anam/Generated/Anam.IPersonasClient.GetPersona.g.cs +++ b/src/libs/Anam/Generated/Anam.IPersonasClient.GetPersona.g.cs @@ -16,5 +16,17 @@ public partial interface IPersonasClient string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get persona
+ /// Returns a persona by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetPersonaAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IPersonasClient.ListPersonas.g.cs b/src/libs/Anam/Generated/Anam.IPersonasClient.ListPersonas.g.cs index c48c2cd..9895338 100644 --- a/src/libs/Anam/Generated/Anam.IPersonasClient.ListPersonas.g.cs +++ b/src/libs/Anam/Generated/Anam.IPersonasClient.ListPersonas.g.cs @@ -24,5 +24,25 @@ public partial interface IPersonasClient string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List personas
+ /// Returns a paginated list of all personas. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListPersonasAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IPersonasClient.UpdatePersona.g.cs b/src/libs/Anam/Generated/Anam.IPersonasClient.UpdatePersona.g.cs index 2f494fb..4bfbaba 100644 --- a/src/libs/Anam/Generated/Anam.IPersonasClient.UpdatePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.IPersonasClient.UpdatePersona.g.cs @@ -24,6 +24,21 @@ public partial interface IPersonasClient /// Update a persona by ID. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdatePersonaAsResponseAsync( + string id, + + global::Anam.PersonaConfig request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update persona
+ /// Update a persona by ID. + ///
+ /// /// /// Unique identifier for the persona. /// diff --git a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSession.g.cs b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSession.g.cs index 27aa044..7040c59 100644 --- a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSession.g.cs +++ b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSession.g.cs @@ -16,5 +16,17 @@ public partial interface ISessionsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get session
+ /// Returns a session by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSessionAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionRecording.g.cs b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionRecording.g.cs index 314a104..56c732a 100644 --- a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionRecording.g.cs +++ b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionRecording.g.cs @@ -16,5 +16,17 @@ public partial interface ISessionsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get session recording
+ /// Returns a presigned URL to download the session recording. + ///
+ /// + /// 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> GetSessionRecordingAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionTranscript.g.cs b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionTranscript.g.cs index f628981..6af2903 100644 --- a/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionTranscript.g.cs +++ b/src/libs/Anam/Generated/Anam.ISessionsClient.GetSessionTranscript.g.cs @@ -16,5 +16,17 @@ public partial interface ISessionsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get session transcript
+ /// Returns the conversation transcript for a session. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSessionTranscriptAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.ISessionsClient.ListSessions.g.cs b/src/libs/Anam/Generated/Anam.ISessionsClient.ListSessions.g.cs index d4e8362..caf13e0 100644 --- a/src/libs/Anam/Generated/Anam.ISessionsClient.ListSessions.g.cs +++ b/src/libs/Anam/Generated/Anam.ISessionsClient.ListSessions.g.cs @@ -28,5 +28,29 @@ public partial interface ISessionsClient global::System.Guid? personaId = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List sessions
+ /// Returns a paginated list of all sessions for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListSessionsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::System.Guid? apiKeyId = default, + global::System.Guid? personaId = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IShareLinksClient.CreateShareLink.g.cs b/src/libs/Anam/Generated/Anam.IShareLinksClient.CreateShareLink.g.cs index daef542..0ec3991 100644 --- a/src/libs/Anam/Generated/Anam.IShareLinksClient.CreateShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.IShareLinksClient.CreateShareLink.g.cs @@ -21,6 +21,19 @@ public partial interface IShareLinksClient /// Create share link
/// Create a new share link. /// + /// + /// 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> CreateShareLinkAsResponseAsync( + + global::Anam.CreateShareLinkRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create share link
+ /// Create a new share link. + ///
/// /// /// Default Value: 168 diff --git a/src/libs/Anam/Generated/Anam.IShareLinksClient.DeleteShareLink.g.cs b/src/libs/Anam/Generated/Anam.IShareLinksClient.DeleteShareLink.g.cs index 53c1eaa..ad83486 100644 --- a/src/libs/Anam/Generated/Anam.IShareLinksClient.DeleteShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.IShareLinksClient.DeleteShareLink.g.cs @@ -16,5 +16,17 @@ public partial interface IShareLinksClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete share link
+ /// Delete a share link by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteShareLinkAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IShareLinksClient.GetShareLink.g.cs b/src/libs/Anam/Generated/Anam.IShareLinksClient.GetShareLink.g.cs index 05aae0e..174b350 100644 --- a/src/libs/Anam/Generated/Anam.IShareLinksClient.GetShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.IShareLinksClient.GetShareLink.g.cs @@ -16,5 +16,17 @@ public partial interface IShareLinksClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get share link
+ /// Returns a share link by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetShareLinkAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IShareLinksClient.ListShareLinks.g.cs b/src/libs/Anam/Generated/Anam.IShareLinksClient.ListShareLinks.g.cs index f9f42dc..8031a44 100644 --- a/src/libs/Anam/Generated/Anam.IShareLinksClient.ListShareLinks.g.cs +++ b/src/libs/Anam/Generated/Anam.IShareLinksClient.ListShareLinks.g.cs @@ -26,5 +26,27 @@ public partial interface IShareLinksClient global::System.Guid? personaId = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List share links
+ /// Returns a list of all share links for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 20 + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListShareLinksAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::System.Guid? personaId = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IShareLinksClient.UpdateShareLink.g.cs b/src/libs/Anam/Generated/Anam.IShareLinksClient.UpdateShareLink.g.cs index 59ac835..5e24c8d 100644 --- a/src/libs/Anam/Generated/Anam.IShareLinksClient.UpdateShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.IShareLinksClient.UpdateShareLink.g.cs @@ -24,6 +24,21 @@ public partial interface IShareLinksClient /// Update a share link by ID. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateShareLinkAsResponseAsync( + global::System.Guid id, + + global::Anam.UpdateShareLinkRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update share link
+ /// Update a share link by ID. + ///
+ /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/Anam/Generated/Anam.IToolsClient.CreateTool.g.cs b/src/libs/Anam/Generated/Anam.IToolsClient.CreateTool.g.cs index 327d5f1..1327830 100644 --- a/src/libs/Anam/Generated/Anam.IToolsClient.CreateTool.g.cs +++ b/src/libs/Anam/Generated/Anam.IToolsClient.CreateTool.g.cs @@ -21,6 +21,19 @@ public partial interface IToolsClient /// Create tool
/// Create a new tool for function calling in persona sessions. /// + /// + /// 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> CreateToolAsResponseAsync( + + global::Anam.CreateToolRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create tool
+ /// Create a new tool for function calling in persona sessions. + ///
/// /// Unique name for the tool (pattern [a-zA-Z0-9_.-]+). /// diff --git a/src/libs/Anam/Generated/Anam.IToolsClient.DeleteTool.g.cs b/src/libs/Anam/Generated/Anam.IToolsClient.DeleteTool.g.cs index c986ae7..01ce048 100644 --- a/src/libs/Anam/Generated/Anam.IToolsClient.DeleteTool.g.cs +++ b/src/libs/Anam/Generated/Anam.IToolsClient.DeleteTool.g.cs @@ -16,5 +16,17 @@ public partial interface IToolsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete tool
+ /// Delete a tool (soft-deleted). + ///
+ /// + /// 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 DeleteToolAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IToolsClient.GetTool.g.cs b/src/libs/Anam/Generated/Anam.IToolsClient.GetTool.g.cs index 24b2cb0..2e6efa4 100644 --- a/src/libs/Anam/Generated/Anam.IToolsClient.GetTool.g.cs +++ b/src/libs/Anam/Generated/Anam.IToolsClient.GetTool.g.cs @@ -16,5 +16,17 @@ public partial interface IToolsClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get tool
+ /// Get a tool by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetToolAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IToolsClient.ListTools.g.cs b/src/libs/Anam/Generated/Anam.IToolsClient.ListTools.g.cs index 88c8047..f55b5c0 100644 --- a/src/libs/Anam/Generated/Anam.IToolsClient.ListTools.g.cs +++ b/src/libs/Anam/Generated/Anam.IToolsClient.ListTools.g.cs @@ -24,5 +24,25 @@ public partial interface IToolsClient string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List tools
+ /// Returns a list of all tools for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListToolsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IToolsClient.UpdateTool.g.cs b/src/libs/Anam/Generated/Anam.IToolsClient.UpdateTool.g.cs index 3ea703c..66538dc 100644 --- a/src/libs/Anam/Generated/Anam.IToolsClient.UpdateTool.g.cs +++ b/src/libs/Anam/Generated/Anam.IToolsClient.UpdateTool.g.cs @@ -24,6 +24,21 @@ public partial interface IToolsClient /// Update an existing tool. /// /// + /// + /// 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> UpdateToolAsResponseAsync( + global::System.Guid id, + + global::Anam.UpdateToolRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update tool
+ /// Update an existing tool. + ///
+ /// /// /// Updated name for the tool. /// diff --git a/src/libs/Anam/Generated/Anam.IVoicesClient.CreateVoice.g.cs b/src/libs/Anam/Generated/Anam.IVoicesClient.CreateVoice.g.cs index 468e366..6ea4a54 100644 --- a/src/libs/Anam/Generated/Anam.IVoicesClient.CreateVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.IVoicesClient.CreateVoice.g.cs @@ -21,6 +21,19 @@ public partial interface IVoicesClient /// Create voice
/// Create a new voice by cloning from an audio file. /// + /// + /// 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> CreateVoiceAsResponseAsync( + + global::Anam.CreateVoiceRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create voice
+ /// Create a new voice by cloning from an audio file. + ///
/// /// Display name for the cloned voice. /// @@ -53,5 +66,78 @@ public partial interface IVoicesClient bool? enhance = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create voice
+ /// Create a new voice by cloning from an audio file. + ///
+ /// + /// Display name for the cloned voice. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Optional description of the voice. + /// + /// + /// Language code for the voice.
+ /// Default Value: en + /// + /// + /// Whether to enhance the voice quality.
+ /// Default Value: true + /// + /// 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 CreateVoiceAsync( + string name, + global::System.IO.Stream audioFile, + string audioFilename, + string? description = default, + string? language = default, + bool? enhance = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create voice
+ /// Create a new voice by cloning from an audio file. + ///
+ /// + /// Display name for the cloned voice. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Optional description of the voice. + /// + /// + /// Language code for the voice.
+ /// Default Value: en + /// + /// + /// Whether to enhance the voice quality.
+ /// Default Value: true + /// + /// 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> CreateVoiceAsResponseAsync( + string name, + global::System.IO.Stream audioFile, + string audioFilename, + string? description = default, + string? language = default, + bool? enhance = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IVoicesClient.DeleteVoice.g.cs b/src/libs/Anam/Generated/Anam.IVoicesClient.DeleteVoice.g.cs index a688a6b..0e339d0 100644 --- a/src/libs/Anam/Generated/Anam.IVoicesClient.DeleteVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.IVoicesClient.DeleteVoice.g.cs @@ -16,5 +16,17 @@ public partial interface IVoicesClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete voice
+ /// Delete a voice by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteVoiceAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IVoicesClient.GetVoice.g.cs b/src/libs/Anam/Generated/Anam.IVoicesClient.GetVoice.g.cs index b281809..7c3fba5 100644 --- a/src/libs/Anam/Generated/Anam.IVoicesClient.GetVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.IVoicesClient.GetVoice.g.cs @@ -16,5 +16,17 @@ public partial interface IVoicesClient global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get voice
+ /// Returns a voice by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetVoiceAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IVoicesClient.ListVoices.g.cs b/src/libs/Anam/Generated/Anam.IVoicesClient.ListVoices.g.cs index 3c8741a..d7721c1 100644 --- a/src/libs/Anam/Generated/Anam.IVoicesClient.ListVoices.g.cs +++ b/src/libs/Anam/Generated/Anam.IVoicesClient.ListVoices.g.cs @@ -24,5 +24,25 @@ public partial interface IVoicesClient string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List voices
+ /// Returns a paginated list of all voices. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListVoicesAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Anam/Generated/Anam.IVoicesClient.UpdateVoice.g.cs b/src/libs/Anam/Generated/Anam.IVoicesClient.UpdateVoice.g.cs index cc7c124..0cd41c4 100644 --- a/src/libs/Anam/Generated/Anam.IVoicesClient.UpdateVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.IVoicesClient.UpdateVoice.g.cs @@ -24,6 +24,21 @@ public partial interface IVoicesClient /// Update a voice by ID. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateVoiceAsResponseAsync( + global::System.Guid id, + + global::Anam.UpdateVoiceRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update voice
+ /// Update a voice by ID. + ///
+ /// /// /// New display name for the voice. /// diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.CreateKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.CreateKnowledgeGroup.g.cs index ccb6d76..26ed8cb 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.CreateKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.CreateKnowledgeGroup.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateKnowledgeGroupResponseContent( /// public async global::System.Threading.Tasks.Task CreateKnowledgeGroupAsync( + global::Anam.CreateKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateKnowledgeGroupAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create knowledge group
+ /// Create a new knowledge group for RAG. + ///
+ /// + /// 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> CreateKnowledgeGroupAsResponseAsync( + global::Anam.CreateKnowledgeGroupRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateKnowledgeGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/knowledge/groups", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateKnowledgeGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateKnowledgeGroupResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateKnowledgeGroupResponseContent( 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 ProcessCreateKnowledgeGroupResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateKnowledgeGroupResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateKnowledgeGroupResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -416,9 +458,13 @@ partial void ProcessCreateKnowledgeGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +492,13 @@ partial void ProcessCreateKnowledgeGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeDocument.g.cs index 5601997..0a37f77 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeDocument.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteKnowledgeDocumentResponse( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteKnowledgeDocumentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete knowledge document
+ /// Delete a document from a knowledge group. + ///
+ /// + /// 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 id, + global::Anam.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::Anam.PathBuilder( path: $"/v1/knowledge/documents/{id}", 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteKnowledgeDocumentResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.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::Anam.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); } // @@ -398,6 +436,10 @@ partial void ProcessDeleteKnowledgeDocumentResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -419,6 +461,10 @@ partial void ProcessDeleteKnowledgeDocumentResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeGroup.g.cs index 2b6ffef..af8696e 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.DeleteKnowledgeGroup.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteKnowledgeGroupResponse( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteKnowledgeGroupAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete knowledge group
+ /// Delete a knowledge group. + ///
+ /// + /// 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 DeleteKnowledgeGroupAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteKnowledgeGroupResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteKnowledgeGroupResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteKnowledgeGroupResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteKnowledgeGroupResponse( 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 ProcessDeleteKnowledgeGroupResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteKnowledgeGroupResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteKnowledgeGroupResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteKnowledgeGroupResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteKnowledgeGroupResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -398,6 +436,10 @@ partial void ProcessDeleteKnowledgeGroupResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -419,6 +461,10 @@ partial void ProcessDeleteKnowledgeGroupResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocument.g.cs index 4f837cc..6c5ec3a 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocument.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetKnowledgeDocumentResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetKnowledgeDocumentAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get knowledge document
+ /// Get a single document by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetKnowledgeDocumentAsResponseAsync( + string id, + global::Anam.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::Anam.PathBuilder( path: $"/v1/knowledge/documents/{id}", 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetKnowledgeDocumentResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.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::Anam.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); } // @@ -407,9 +447,13 @@ partial void ProcessGetKnowledgeDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetKnowledgeDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocumentDownload.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocumentDownload.g.cs index 042f72f..b469c08 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocumentDownload.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeDocumentDownload.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetKnowledgeDocumentDownloadAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get knowledge document download
+ /// Get a presigned download URL for a knowledge document. + ///
+ /// + /// 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> GetKnowledgeDocumentDownloadAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/documents/{id}/download", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( 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 ProcessGetKnowledgeDocumentDownloadResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.GetKnowledgeDocumentDownloadResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.GetKnowledgeDocumentDownloadResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetKnowledgeDocumentDownloadResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.GetKnowledgeDocumentDownloadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.GetKnowledgeDocumentDownloadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeGroup.g.cs index a638efd..f219f48 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.GetKnowledgeGroup.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetKnowledgeGroupResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetKnowledgeGroupAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get knowledge group
+ /// Get a single knowledge group by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetKnowledgeGroupAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetKnowledgeGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetKnowledgeGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetKnowledgeGroupResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetKnowledgeGroupResponseContent( 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 ProcessGetKnowledgeGroupResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetKnowledgeGroupResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetKnowledgeGroupResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessGetKnowledgeGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetKnowledgeGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroupDocuments.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroupDocuments.g.cs index 593fa02..3e7e267 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroupDocuments.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroupDocuments.g.cs @@ -53,6 +53,27 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListKnowledgeGroupDocumentsAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List knowledge group documents
+ /// Get all documents in a knowledge group. + ///
+ /// + /// 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> ListKnowledgeGroupDocumentsAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}/documents", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( 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 ProcessListKnowledgeGroupDocumentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListKnowledgeGroupDocumentsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListKnowledgeGroupDocumentsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessListKnowledgeGroupDocumentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListKnowledgeGroupDocumentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListKnowledgeGroupDocumentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroups.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroups.g.cs index 000973a..9332e72 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroups.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.ListKnowledgeGroups.g.cs @@ -49,6 +49,24 @@ partial void ProcessListKnowledgeGroupsResponseContent( public async global::System.Threading.Tasks.Task ListKnowledgeGroupsAsync( global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListKnowledgeGroupsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List knowledge groups
+ /// Returns a list of all knowledge groups for the organization. + ///
+ /// 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> ListKnowledgeGroupsAsResponseAsync( + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessListKnowledgeGroupsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/knowledge/groups", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessListKnowledgeGroupsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessListKnowledgeGroupsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessListKnowledgeGroupsResponseContent( 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 ProcessListKnowledgeGroupsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessListKnowledgeGroupsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessListKnowledgeGroupsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessListKnowledgeGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessListKnowledgeGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -368,9 +405,13 @@ partial void ProcessListKnowledgeGroupsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListKnowledgeGroupsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListKnowledgeGroupsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -398,9 +439,13 @@ partial void ProcessListKnowledgeGroupsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListKnowledgeGroupsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListKnowledgeGroupsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.SearchKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.SearchKnowledgeGroup.g.cs index c3cc81d..fb592a0 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.SearchKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.SearchKnowledgeGroup.g.cs @@ -55,6 +55,32 @@ partial void ProcessSearchKnowledgeGroupResponseContent( public async global::System.Threading.Tasks.Task SearchKnowledgeGroupAsync( string id, + global::Anam.SearchKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SearchKnowledgeGroupAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Search knowledge group
+ /// Search for similar content in a knowledge group using vector similarity. + ///
+ /// + /// + /// 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> SearchKnowledgeGroupAsResponseAsync( + string id, + global::Anam.SearchKnowledgeGroupRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessSearchKnowledgeGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}/search", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessSearchKnowledgeGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessSearchKnowledgeGroupResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessSearchKnowledgeGroupResponseContent( 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 ProcessSearchKnowledgeGroupResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessSearchKnowledgeGroupResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessSearchKnowledgeGroupResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessSearchKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessSearchKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessSearchKnowledgeGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.SearchKnowledgeGroupResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.SearchKnowledgeGroupResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessSearchKnowledgeGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.SearchKnowledgeGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.SearchKnowledgeGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeDocument.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeDocument.g.cs index de99f44..5d0712d 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeDocument.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( public async global::System.Threading.Tasks.Task UpdateKnowledgeDocumentAsync( string id, + global::Anam.UpdateKnowledgeDocumentRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateKnowledgeDocumentAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update knowledge document
+ /// Update a document (rename). + ///
+ /// + /// + /// 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 id, + global::Anam.UpdateKnowledgeDocumentRequest request, global::Anam.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::Anam.PathBuilder( path: $"/v1/knowledge/documents/{id}", 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.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::Anam.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); } // @@ -455,9 +500,13 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdateKnowledgeDocumentResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeGroup.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeGroup.g.cs index 86bd6d6..21291a7 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeGroup.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.UpdateKnowledgeGroup.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( public async global::System.Threading.Tasks.Task UpdateKnowledgeGroupAsync( string id, + global::Anam.UpdateKnowledgeGroupRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateKnowledgeGroupAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update knowledge group
+ /// Update a knowledge group. + ///
+ /// + /// + /// 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> UpdateKnowledgeGroupAsResponseAsync( + string id, + global::Anam.UpdateKnowledgeGroupRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( 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 ProcessUpdateKnowledgeGroupResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeGroup.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdateKnowledgeGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.KnowledgeClient.UploadKnowledgeGroupDocument.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.UploadKnowledgeGroupDocument.g.cs index 60fd35b..dcd214d 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.UploadKnowledgeGroupDocument.g.cs +++ b/src/libs/Anam/Generated/Anam.KnowledgeClient.UploadKnowledgeGroupDocument.g.cs @@ -55,6 +55,32 @@ partial void ProcessUploadKnowledgeGroupDocumentResponseContent( public async global::System.Threading.Tasks.Task UploadKnowledgeGroupDocumentAsync( string id, + global::Anam.UploadKnowledgeGroupDocumentRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadKnowledgeGroupDocumentAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// + /// + /// 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> UploadKnowledgeGroupDocumentAsResponseAsync( + string id, + global::Anam.UploadKnowledgeGroupDocumentRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -86,10 +112,11 @@ partial void ProcessUploadKnowledgeGroupDocumentResponseContent( var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/knowledge/groups/{id}/documents", baseUri: HttpClient.BaseAddress); @@ -122,10 +149,12 @@ partial void ProcessUploadKnowledgeGroupDocumentResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(id ?? string.Empty), name: "\"id\""); + 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 @@ -163,21 +192,26 @@ request.Filename is null { __contentFile.Headers.ContentDisposition.FileNameStar = null; } + if (request.ChunkSize != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkSize, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"chunkSize\""); - } + + } if (request.ChunkOverlap != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkOverlap, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"chunkOverlap\""); + } + __httpRequest.Content = __httpRequestContent; + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -220,6 +254,8 @@ request.Filename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -230,6 +266,11 @@ request.Filename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -247,6 +288,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) { @@ -256,8 +299,7 @@ request.Filename is null __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +308,11 @@ request.Filename is null __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -282,14 +329,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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -329,6 +377,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -349,6 +399,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -505,9 +557,13 @@ request.Filename is null { __response.EnsureSuccessStatusCode(); - return - global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -535,9 +591,13 @@ request.Filename is null #endif ).ConfigureAwait(false); - return - await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -618,5 +678,1170 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Default Value: 1000 + /// + /// + /// Default Value: 200 + /// + /// 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 UploadKnowledgeGroupDocumentAsync( + string id, + global::System.IO.Stream file, + string filename, + int? chunkSize = default, + int? chunkOverlap = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::Anam.UploadKnowledgeGroupDocumentRequest + { + File = global::System.Array.Empty(), + Filename = filename, + ChunkSize = chunkSize, + ChunkOverlap = chunkOverlap, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadKnowledgeGroupDocumentArguments( + httpClient: HttpClient, + id: ref id, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadKnowledgeGroupDocumentSecurityRequirements, + operationName: "UploadKnowledgeGroupDocumentAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: $"/v1/knowledge/groups/{id}/documents", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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(id ?? string.Empty), + name: "\"id\""); + + 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.ChunkSize != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkSize, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"chunkSize\""); + + } + if (request.ChunkOverlap != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkOverlap, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"chunkOverlap\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadKnowledgeGroupDocumentRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + id: id!, + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.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); + ProcessUploadKnowledgeGroupDocumentResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + statusCode: __response.StatusCode) + { + ResponseBody = __content_404, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessUploadKnowledgeGroupDocumentResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.KnowledgeDocument.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::Anam.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(); + } + } + /// + /// Upload knowledge group document
+ /// Upload a document to a knowledge group (PDF, TXT, MD, DOCX, CSV up to 50MB). + ///
+ /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB). + /// + /// + /// Default Value: 1000 + /// + /// + /// Default Value: 200 + /// + /// 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> UploadKnowledgeGroupDocumentAsResponseAsync( + string id, + global::System.IO.Stream file, + string filename, + int? chunkSize = default, + int? chunkOverlap = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::Anam.UploadKnowledgeGroupDocumentRequest + { + File = global::System.Array.Empty(), + Filename = filename, + ChunkSize = chunkSize, + ChunkOverlap = chunkOverlap, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadKnowledgeGroupDocumentArguments( + httpClient: HttpClient, + id: ref id, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadKnowledgeGroupDocumentSecurityRequirements, + operationName: "UploadKnowledgeGroupDocumentAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: $"/v1/knowledge/groups/{id}/documents", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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(id ?? string.Empty), + name: "\"id\""); + + 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.ChunkSize != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkSize, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"chunkSize\""); + + } + if (request.ChunkOverlap != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ChunkOverlap, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"chunkOverlap\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadKnowledgeGroupDocumentRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + id: id!, + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.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); + ProcessUploadKnowledgeGroupDocumentResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadKnowledgeGroupDocument", + methodName: "UploadKnowledgeGroupDocumentAsync", + pathTemplate: "$\"/v1/knowledge/groups/{id}/documents\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + statusCode: __response.StatusCode) + { + ResponseBody = __content_404, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessUploadKnowledgeGroupDocumentResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Anam.KnowledgeDocument.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.KnowledgeDocument.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.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::Anam.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/Anam/Generated/Anam.KnowledgeClient.g.cs b/src/libs/Anam/Generated/Anam.KnowledgeClient.g.cs index 651d46b..79c2dfe 100644 --- a/src/libs/Anam/Generated/Anam.KnowledgeClient.g.cs +++ b/src/libs/Anam/Generated/Anam.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::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.CreateLlm.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.CreateLlm.g.cs index 010c44b..74bd710 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.CreateLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.CreateLlm.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateLlmResponseContent( /// public async global::System.Threading.Tasks.Task CreateLlmAsync( + global::Anam.CreateLlmRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateLlmAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create LLM
+ /// Create a new LLM configuration. + ///
+ /// + /// 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> CreateLlmAsResponseAsync( + global::Anam.CreateLlmRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateLlmResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/llms", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateLlmResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateLlmResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateLlmResponseContent( 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 ProcessCreateLlmResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateLlmResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateLlmResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -416,9 +458,13 @@ partial void ProcessCreateLlmResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +492,13 @@ partial void ProcessCreateLlmResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.DeleteLlm.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.DeleteLlm.g.cs index 76468e0..202cffa 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.DeleteLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.DeleteLlm.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteLlmResponse( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteLlmAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete LLM
+ /// Delete an LLM configuration. + ///
+ /// + /// 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 DeleteLlmAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteLlmResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/llms/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteLlmResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteLlmResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteLlmResponse( 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 ProcessDeleteLlmResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteLlmResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteLlmResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteLlmResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteLlmResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -431,6 +469,10 @@ partial void ProcessDeleteLlmResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -452,6 +494,10 @@ partial void ProcessDeleteLlmResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.GetLlm.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.GetLlm.g.cs index 236be72..fff21c8 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.GetLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.GetLlm.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetLlmResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetLlmAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get LLM
+ /// Get a specific LLM by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetLlmAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetLlmResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/llms/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetLlmResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetLlmResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetLlmResponseContent( 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 ProcessGetLlmResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetLlmResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetLlmResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessGetLlmResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetLlmResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.ListLlms.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.ListLlms.g.cs index a899832..680db29 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.ListLlms.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.ListLlms.g.cs @@ -65,6 +65,36 @@ partial void ProcessListLlmsResponseContent( bool? includeDefaults = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListLlmsAsResponseAsync( + page: page, + perPage: perPage, + search: search, + includeDefaults: includeDefaults, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List LLMs
+ /// Returns a list of all LLMs available to the organization. + ///
+ /// + /// + /// + /// + /// 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> ListLlmsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + bool? includeDefaults = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -97,14 +127,15 @@ partial void ProcessListLlmsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/llms", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) .AddOptionalParameter("search", search) - .AddOptionalParameter("includeDefaults", includeDefaults?.ToString().ToLowerInvariant()) + .AddOptionalParameter("includeDefaults", includeDefaults?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -179,6 +210,8 @@ partial void ProcessListLlmsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -189,6 +222,11 @@ partial void ProcessListLlmsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -206,6 +244,8 @@ partial void ProcessListLlmsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -215,8 +255,7 @@ partial void ProcessListLlmsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -225,6 +264,11 @@ partial void ProcessListLlmsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -241,14 +285,15 @@ partial void ProcessListLlmsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -288,6 +333,8 @@ partial void ProcessListLlmsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -308,6 +355,8 @@ partial void ProcessListLlmsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -398,9 +447,13 @@ partial void ProcessListLlmsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListLlmsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListLlmsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -428,9 +481,13 @@ partial void ProcessListLlmsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListLlmsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListLlmsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.UpdateLlm.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.UpdateLlm.g.cs index a6b6d92..5d1c2e9 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.UpdateLlm.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.UpdateLlm.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateLlmResponseContent( public async global::System.Threading.Tasks.Task UpdateLlmAsync( string id, + global::Anam.UpdateLlmRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateLlmAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update LLM
+ /// Update an LLM configuration. + ///
+ /// + /// + /// 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> UpdateLlmAsResponseAsync( + string id, + global::Anam.UpdateLlmRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateLlmResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/llms/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateLlmResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateLlmResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateLlmResponseContent( 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 ProcessUpdateLlmResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateLlmResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateLlmResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateLlmResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -488,9 +533,13 @@ partial void ProcessUpdateLlmResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Llm.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -518,9 +567,13 @@ partial void ProcessUpdateLlmResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Llm.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.LLMsClient.g.cs b/src/libs/Anam/Generated/Anam.LLMsClient.g.cs index 277ac06..272a7b9 100644 --- a/src/libs/Anam/Generated/Anam.LLMsClient.g.cs +++ b/src/libs/Anam/Generated/Anam.LLMsClient.g.cs @@ -72,10 +72,10 @@ public LLMsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public LLMsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.OptionsSupport.g.cs b/src/libs/Anam/Generated/Anam.OptionsSupport.g.cs index 7dee67a..cd3cfe2 100644 --- a/src/libs/Anam/Generated/Anam.OptionsSupport.g.cs +++ b/src/libs/Anam/Generated/Anam.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::Anam.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::Anam.AutoSDKClientOptions clientOptions, global::Anam.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Anam.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::Anam.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/Anam/Generated/Anam.PersonasClient.CreatePersona.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.CreatePersona.g.cs index 7ebc622..b184805 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.CreatePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.CreatePersona.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreatePersonaResponseContent( /// public async global::System.Threading.Tasks.Task CreatePersonaAsync( + global::Anam.PersonaConfig request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreatePersonaAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create persona
+ /// Create a new persona with avatar, voice, LLM, and system prompt configuration. + ///
+ /// + /// 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> CreatePersonaAsResponseAsync( + global::Anam.PersonaConfig request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreatePersonaResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/personas", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreatePersonaResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreatePersonaResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreatePersonaResponseContent( 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 ProcessCreatePersonaResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreatePersonaResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreatePersonaResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreatePersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreatePersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -416,9 +458,13 @@ partial void ProcessCreatePersonaResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +492,13 @@ partial void ProcessCreatePersonaResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.PersonasClient.DeletePersona.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.DeletePersona.g.cs index f0132d1..3b2d26b 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.DeletePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.DeletePersona.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeletePersonaResponse( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeletePersonaAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete persona
+ /// Delete a persona by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeletePersonaAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeletePersonaResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/personas/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeletePersonaResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeletePersonaResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeletePersonaResponse( 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 ProcessDeletePersonaResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeletePersonaResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeletePersonaResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeletePersonaResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeletePersonaResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -398,6 +436,10 @@ partial void ProcessDeletePersonaResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -419,6 +461,10 @@ partial void ProcessDeletePersonaResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.PersonasClient.GetPersona.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.GetPersona.g.cs index 2609474..bd4a9f1 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.GetPersona.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.GetPersona.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetPersonaResponseContent( string id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetPersonaAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get persona
+ /// Returns a persona by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetPersonaAsResponseAsync( + string id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetPersonaResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/personas/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetPersonaResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetPersonaResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetPersonaResponseContent( 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 ProcessGetPersonaResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetPersonaResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetPersonaResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetPersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetPersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessGetPersonaResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetPersonaResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.PersonasClient.ListPersonas.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.ListPersonas.g.cs index 1fa87c6..dfbab01 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.ListPersonas.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.ListPersonas.g.cs @@ -65,6 +65,37 @@ partial void ProcessListPersonasResponseContent( string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListPersonasAsResponseAsync( + page: page, + perPage: perPage, + search: search, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List personas
+ /// Returns a paginated list of all personas. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListPersonasAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +127,14 @@ partial void ProcessListPersonasResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/personas", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) - .AddOptionalParameter("search", search) + .AddOptionalParameter("search", search) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -176,6 +208,8 @@ partial void ProcessListPersonasResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -186,6 +220,11 @@ partial void ProcessListPersonasResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -203,6 +242,8 @@ partial void ProcessListPersonasResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -212,8 +253,7 @@ partial void ProcessListPersonasResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -222,6 +262,11 @@ partial void ProcessListPersonasResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -238,14 +283,15 @@ partial void ProcessListPersonasResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -285,6 +331,8 @@ partial void ProcessListPersonasResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -305,6 +353,8 @@ partial void ProcessListPersonasResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -395,9 +445,13 @@ partial void ProcessListPersonasResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListPersonasResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListPersonasResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -425,9 +479,13 @@ partial void ProcessListPersonasResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListPersonasResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListPersonasResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.PersonasClient.UpdatePersona.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.UpdatePersona.g.cs index 2bec4fb..dd19fce 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.UpdatePersona.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.UpdatePersona.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdatePersonaResponseContent( public async global::System.Threading.Tasks.Task UpdatePersonaAsync( string id, + global::Anam.PersonaConfig request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdatePersonaAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update persona
+ /// Update a persona by ID. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdatePersonaAsResponseAsync( + string id, + global::Anam.PersonaConfig request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdatePersonaResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/personas/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdatePersonaResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdatePersonaResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdatePersonaResponseContent( 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 ProcessUpdatePersonaResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdatePersonaResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdatePersonaResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdatePersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdatePersonaResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessUpdatePersonaResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.PersonaConfig.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdatePersonaResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.PersonaConfig.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.PersonasClient.g.cs b/src/libs/Anam/Generated/Anam.PersonasClient.g.cs index 1b12dad..aa27b04 100644 --- a/src/libs/Anam/Generated/Anam.PersonasClient.g.cs +++ b/src/libs/Anam/Generated/Anam.PersonasClient.g.cs @@ -72,10 +72,10 @@ public PersonasClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public PersonasClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.SessionsClient.GetSession.g.cs b/src/libs/Anam/Generated/Anam.SessionsClient.GetSession.g.cs index dc976a8..54e1698 100644 --- a/src/libs/Anam/Generated/Anam.SessionsClient.GetSession.g.cs +++ b/src/libs/Anam/Generated/Anam.SessionsClient.GetSession.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetSessionResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSessionAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get session
+ /// Returns a session by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetSessionAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetSessionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/sessions/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetSessionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetSessionResponseContent( 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 ProcessGetSessionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetSessionResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetSessionResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetSessionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Session.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Session.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetSessionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Session.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Session.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionRecording.g.cs b/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionRecording.g.cs index 6edb7e4..0bd8782 100644 --- a/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionRecording.g.cs +++ b/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionRecording.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetSessionRecordingResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSessionRecordingAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get session recording
+ /// Returns a presigned URL to download the session recording. + ///
+ /// + /// 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> GetSessionRecordingAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetSessionRecordingResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/sessions/{id}/recording", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetSessionRecordingResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetSessionRecordingResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetSessionRecordingResponseContent( 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 ProcessGetSessionRecordingResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetSessionRecordingResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetSessionRecordingResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetSessionRecordingResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetSessionRecordingResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetSessionRecordingResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.GetSessionRecordingResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.GetSessionRecordingResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetSessionRecordingResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.GetSessionRecordingResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.GetSessionRecordingResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionTranscript.g.cs b/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionTranscript.g.cs index 285bbb5..76d5a87 100644 --- a/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionTranscript.g.cs +++ b/src/libs/Anam/Generated/Anam.SessionsClient.GetSessionTranscript.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetSessionTranscriptResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSessionTranscriptAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get session transcript
+ /// Returns the conversation transcript for a session. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetSessionTranscriptAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetSessionTranscriptResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/sessions/{id}/transcript", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetSessionTranscriptResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetSessionTranscriptResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetSessionTranscriptResponseContent( 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 ProcessGetSessionTranscriptResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetSessionTranscriptResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetSessionTranscriptResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetSessionTranscriptResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetSessionTranscriptResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetSessionTranscriptResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.SessionTranscript.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.SessionTranscript.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetSessionTranscriptResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.SessionTranscript.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.SessionTranscript.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.SessionsClient.ListSessions.g.cs b/src/libs/Anam/Generated/Anam.SessionsClient.ListSessions.g.cs index e3e1ee4..0087717 100644 --- a/src/libs/Anam/Generated/Anam.SessionsClient.ListSessions.g.cs +++ b/src/libs/Anam/Generated/Anam.SessionsClient.ListSessions.g.cs @@ -73,6 +73,43 @@ partial void ProcessListSessionsResponseContent( global::System.Guid? personaId = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListSessionsAsResponseAsync( + page: page, + perPage: perPage, + search: search, + apiKeyId: apiKeyId, + personaId: personaId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List sessions
+ /// Returns a paginated list of all sessions for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListSessionsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::System.Guid? apiKeyId = default, + global::System.Guid? personaId = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -106,15 +143,16 @@ partial void ProcessListSessionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/sessions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) .AddOptionalParameter("search", search) .AddOptionalParameter("apiKeyId", apiKeyId?.ToString()) - .AddOptionalParameter("personaId", personaId?.ToString()) + .AddOptionalParameter("personaId", personaId?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -190,6 +228,8 @@ partial void ProcessListSessionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -200,6 +240,11 @@ partial void ProcessListSessionsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -217,6 +262,8 @@ partial void ProcessListSessionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -226,8 +273,7 @@ partial void ProcessListSessionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -236,6 +282,11 @@ partial void ProcessListSessionsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -252,14 +303,15 @@ partial void ProcessListSessionsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -299,6 +351,8 @@ partial void ProcessListSessionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -319,6 +373,8 @@ partial void ProcessListSessionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -442,9 +498,13 @@ partial void ProcessListSessionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListSessionsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListSessionsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -472,9 +532,13 @@ partial void ProcessListSessionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListSessionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListSessionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.SessionsClient.g.cs b/src/libs/Anam/Generated/Anam.SessionsClient.g.cs index 313f0f3..ef287cd 100644 --- a/src/libs/Anam/Generated/Anam.SessionsClient.g.cs +++ b/src/libs/Anam/Generated/Anam.SessionsClient.g.cs @@ -72,10 +72,10 @@ public SessionsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public SessionsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.CreateShareLink.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.CreateShareLink.g.cs index 4cff2d0..d59792c 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.CreateShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.CreateShareLink.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateShareLinkResponseContent( /// public async global::System.Threading.Tasks.Task CreateShareLinkAsync( + global::Anam.CreateShareLinkRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateShareLinkAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create share link
+ /// Create a new share link. + ///
+ /// + /// 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> CreateShareLinkAsResponseAsync( + global::Anam.CreateShareLinkRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateShareLinkResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/share-links", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateShareLinkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateShareLinkResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateShareLinkResponseContent( 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 ProcessCreateShareLinkResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateShareLinkResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateShareLinkResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -449,9 +491,13 @@ partial void ProcessCreateShareLinkResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -479,9 +525,13 @@ partial void ProcessCreateShareLinkResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.DeleteShareLink.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.DeleteShareLink.g.cs index b606311..d0f9aba 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.DeleteShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.DeleteShareLink.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteShareLinkResponse( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteShareLinkAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete share link
+ /// Delete a share link by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteShareLinkAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteShareLinkResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/share-links/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteShareLinkResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteShareLinkResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteShareLinkResponse( 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 ProcessDeleteShareLinkResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteShareLinkResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteShareLinkResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteShareLinkResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteShareLinkResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -431,6 +469,10 @@ partial void ProcessDeleteShareLinkResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -452,6 +494,10 @@ partial void ProcessDeleteShareLinkResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.GetShareLink.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.GetShareLink.g.cs index 3744598..5e6d2ea 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.GetShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.GetShareLink.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetShareLinkResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetShareLinkAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get share link
+ /// Returns a share link by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetShareLinkAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetShareLinkResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/share-links/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetShareLinkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetShareLinkResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetShareLinkResponseContent( 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 ProcessGetShareLinkResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetShareLinkResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetShareLinkResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetShareLinkResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetShareLinkResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.ListShareLinks.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.ListShareLinks.g.cs index 16bbbe5..1325747 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.ListShareLinks.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.ListShareLinks.g.cs @@ -69,6 +69,40 @@ partial void ProcessListShareLinksResponseContent( global::System.Guid? personaId = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListShareLinksAsResponseAsync( + page: page, + perPage: perPage, + search: search, + personaId: personaId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List share links
+ /// Returns a list of all share links for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 20 + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListShareLinksAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::System.Guid? personaId = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,14 +135,15 @@ partial void ProcessListShareLinksResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/share-links", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) .AddOptionalParameter("search", search) - .AddOptionalParameter("personaId", personaId?.ToString()) + .AddOptionalParameter("personaId", personaId?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -183,6 +218,8 @@ partial void ProcessListShareLinksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +230,11 @@ partial void ProcessListShareLinksResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -210,6 +252,8 @@ partial void ProcessListShareLinksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +263,7 @@ partial void ProcessListShareLinksResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +272,11 @@ partial void ProcessListShareLinksResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -245,14 +293,15 @@ partial void ProcessListShareLinksResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -292,6 +341,8 @@ partial void ProcessListShareLinksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +363,8 @@ partial void ProcessListShareLinksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -435,9 +488,13 @@ partial void ProcessListShareLinksResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListShareLinksResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListShareLinksResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -465,9 +522,13 @@ partial void ProcessListShareLinksResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListShareLinksResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListShareLinksResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.UpdateShareLink.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.UpdateShareLink.g.cs index e008650..d0d55d5 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.UpdateShareLink.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.UpdateShareLink.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateShareLinkResponseContent( public async global::System.Threading.Tasks.Task UpdateShareLinkAsync( global::System.Guid id, + global::Anam.UpdateShareLinkRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateShareLinkAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update share link
+ /// Update a share link by ID. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdateShareLinkAsResponseAsync( + global::System.Guid id, + global::Anam.UpdateShareLinkRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateShareLinkResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/share-links/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateShareLinkResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateShareLinkResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateShareLinkResponseContent( 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 ProcessUpdateShareLinkResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateShareLinkResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateShareLinkResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateShareLinkResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessUpdateShareLinkResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ShareLink.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdateShareLinkResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ShareLink.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ShareLinksClient.g.cs b/src/libs/Anam/Generated/Anam.ShareLinksClient.g.cs index 2737b7b..e4eaba5 100644 --- a/src/libs/Anam/Generated/Anam.ShareLinksClient.g.cs +++ b/src/libs/Anam/Generated/Anam.ShareLinksClient.g.cs @@ -72,10 +72,10 @@ public ShareLinksClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ShareLinksClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.CreateTool.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.CreateTool.g.cs index 3dd591c..c032b56 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.CreateTool.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.CreateTool.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateToolResponseContent( /// public async global::System.Threading.Tasks.Task CreateToolAsync( + global::Anam.CreateToolRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateToolAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create tool
+ /// Create a new tool for function calling in persona sessions. + ///
+ /// + /// 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> CreateToolAsResponseAsync( + global::Anam.CreateToolRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateToolResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/tools", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateToolResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateToolResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateToolResponseContent( 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 ProcessCreateToolResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateToolResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateToolResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -416,9 +458,13 @@ partial void ProcessCreateToolResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -446,9 +492,13 @@ partial void ProcessCreateToolResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.DeleteTool.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.DeleteTool.g.cs index b59bb03..1a3bca8 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.DeleteTool.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.DeleteTool.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteToolResponse( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteToolAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete tool
+ /// Delete a tool (soft-deleted). + ///
+ /// + /// 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 DeleteToolAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteToolResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/tools/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteToolResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteToolResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteToolResponse( 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 ProcessDeleteToolResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteToolResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteToolResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteToolResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteToolResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -431,6 +469,10 @@ partial void ProcessDeleteToolResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -452,6 +494,10 @@ partial void ProcessDeleteToolResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.GetTool.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.GetTool.g.cs index c33c7b7..3a5ea28 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.GetTool.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.GetTool.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetToolResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetToolAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get tool
+ /// Get a tool by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetToolAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetToolResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/tools/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetToolResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetToolResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetToolResponseContent( 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 ProcessGetToolResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetToolResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetToolResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -407,9 +447,13 @@ partial void ProcessGetToolResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -437,9 +481,13 @@ partial void ProcessGetToolResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.ListTools.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.ListTools.g.cs index 5b63313..ec34a41 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.ListTools.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.ListTools.g.cs @@ -65,6 +65,37 @@ partial void ProcessListToolsResponseContent( string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListToolsAsResponseAsync( + page: page, + perPage: perPage, + search: search, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List tools
+ /// Returns a list of all tools for the organization. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListToolsAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +127,14 @@ partial void ProcessListToolsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/tools", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) - .AddOptionalParameter("search", search) + .AddOptionalParameter("search", search) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -176,6 +208,8 @@ partial void ProcessListToolsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -186,6 +220,11 @@ partial void ProcessListToolsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -203,6 +242,8 @@ partial void ProcessListToolsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -212,8 +253,7 @@ partial void ProcessListToolsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -222,6 +262,11 @@ partial void ProcessListToolsResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -238,14 +283,15 @@ partial void ProcessListToolsResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -285,6 +331,8 @@ partial void ProcessListToolsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -305,6 +353,8 @@ partial void ProcessListToolsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -395,9 +445,13 @@ partial void ProcessListToolsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListToolsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListToolsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -425,9 +479,13 @@ partial void ProcessListToolsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListToolsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListToolsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.UpdateTool.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.UpdateTool.g.cs index 7f8443c..adf8edb 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.UpdateTool.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.UpdateTool.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateToolResponseContent( public async global::System.Threading.Tasks.Task UpdateToolAsync( global::System.Guid id, + global::Anam.UpdateToolRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateToolAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update tool
+ /// Update an existing tool. + ///
+ /// + /// + /// 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> UpdateToolAsResponseAsync( + global::System.Guid id, + global::Anam.UpdateToolRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateToolResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/tools/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateToolResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateToolResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateToolResponseContent( 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 ProcessUpdateToolResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateToolResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateToolResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateToolResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -488,9 +533,13 @@ partial void ProcessUpdateToolResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Tool.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -518,9 +567,13 @@ partial void ProcessUpdateToolResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Tool.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.ToolsClient.g.cs b/src/libs/Anam/Generated/Anam.ToolsClient.g.cs index c8423ec..b52aec0 100644 --- a/src/libs/Anam/Generated/Anam.ToolsClient.g.cs +++ b/src/libs/Anam/Generated/Anam.ToolsClient.g.cs @@ -72,10 +72,10 @@ public ToolsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ToolsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Anam/Generated/Anam.VoicesClient.CreateVoice.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.CreateVoice.g.cs index 7c7ac36..de11523 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.CreateVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.VoicesClient.CreateVoice.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateVoiceResponseContent( /// public async global::System.Threading.Tasks.Task CreateVoiceAsync( + global::Anam.CreateVoiceRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVoiceAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create voice
+ /// Create a new voice by cloning from an audio file. + ///
+ /// + /// 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> CreateVoiceAsResponseAsync( + global::Anam.CreateVoiceRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -81,10 +104,11 @@ partial void ProcessCreateVoiceResponseContent( var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/voices", baseUri: HttpClient.BaseAddress); @@ -117,10 +141,12 @@ partial void ProcessCreateVoiceResponseContent( __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 __contentAudioFile = new global::System.Net.Http.ByteArrayContent(request.AudioFile ?? global::System.Array.Empty()); __contentAudioFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( request.AudioFilename is null @@ -158,28 +184,34 @@ request.AudioFilename is null { __contentAudioFile.Headers.ContentDisposition.FileNameStar = null; } + if (request.Description != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Description ?? string.Empty), name: "\"description\""); - } + + } if (request.Language != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty), name: "\"language\""); - } + + } if (request.Enhance != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Enhance, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"enhance\""); + } + __httpRequest.Content = __httpRequestContent; + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -221,6 +253,8 @@ request.AudioFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -231,6 +265,11 @@ request.AudioFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -248,6 +287,8 @@ request.AudioFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -257,8 +298,7 @@ request.AudioFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -267,6 +307,11 @@ request.AudioFilename is null __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -283,14 +328,15 @@ request.AudioFilename 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -330,6 +376,8 @@ request.AudioFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -350,6 +398,8 @@ request.AudioFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -506,9 +556,13 @@ request.AudioFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -536,9 +590,13 @@ request.AudioFilename is null #endif ).ConfigureAwait(false); - return - await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -628,5 +686,1202 @@ request.AudioFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Create voice
+ /// Create a new voice by cloning from an audio file. + ///
+ /// + /// Display name for the cloned voice. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Optional description of the voice. + /// + /// + /// Language code for the voice.
+ /// Default Value: en + /// + /// + /// Whether to enhance the voice quality.
+ /// Default Value: true + /// + /// 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 CreateVoiceAsync( + string name, + global::System.IO.Stream audioFile, + string audioFilename, + string? description = default, + string? language = default, + bool? enhance = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + audioFile = audioFile ?? throw new global::System.ArgumentNullException(nameof(audioFile)); + var request = new global::Anam.CreateVoiceRequest + { + Name = name, + AudioFile = global::System.Array.Empty(), + AudioFilename = audioFilename, + Description = description, + Language = language, + Enhance = enhance, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateVoiceArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateVoiceSecurityRequirements, + operationName: "CreateVoiceAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: "/v1/voices", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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 __contentAudioFile = new global::System.Net.Http.StreamContent(audioFile); + __contentAudioFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.AudioFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.AudioFilename) ?? 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: __contentAudioFile, + name: "\"audioFile\"", + fileName: request.AudioFilename != null ? $"\"{request.AudioFilename}\"" : string.Empty); + if (__contentAudioFile.Headers.ContentDisposition != null) + { + __contentAudioFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Description != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Description ?? string.Empty), + name: "\"description\""); + + } + if (request.Language != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty), + name: "\"language\""); + + } + if (request.Enhance != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Enhance, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enhance\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateVoiceRequest( + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.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); + ProcessCreateVoiceResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + statusCode: __response.StatusCode) + { + ResponseBody = __content_403, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessCreateVoiceResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.Voice.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::Anam.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 voice
+ /// Create a new voice by cloning from an audio file. + ///
+ /// + /// Display name for the cloned voice. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Audio file to clone the voice from. + /// + /// + /// Optional description of the voice. + /// + /// + /// Language code for the voice.
+ /// Default Value: en + /// + /// + /// Whether to enhance the voice quality.
+ /// Default Value: true + /// + /// 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> CreateVoiceAsResponseAsync( + string name, + global::System.IO.Stream audioFile, + string audioFilename, + string? description = default, + string? language = default, + bool? enhance = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + audioFile = audioFile ?? throw new global::System.ArgumentNullException(nameof(audioFile)); + var request = new global::Anam.CreateVoiceRequest + { + Name = name, + AudioFile = global::System.Array.Empty(), + AudioFilename = audioFilename, + Description = description, + Language = language, + Enhance = enhance, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateVoiceArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Anam.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateVoiceSecurityRequirements, + operationName: "CreateVoiceAsync"); + + using var __timeoutCancellationTokenSource = global::Anam.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Anam.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Anam.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Anam.PathBuilder( + path: "/v1/voices", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Anam.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 __contentAudioFile = new global::System.Net.Http.StreamContent(audioFile); + __contentAudioFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.AudioFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.AudioFilename) ?? 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: __contentAudioFile, + name: "\"audioFile\"", + fileName: request.AudioFilename != null ? $"\"{request.AudioFilename}\"" : string.Empty); + if (__contentAudioFile.Headers.ContentDisposition != null) + { + __contentAudioFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Description != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Description ?? string.Empty), + name: "\"description\""); + + } + if (request.Language != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty), + name: "\"language\""); + + } + if (request.Enhance != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Enhance, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enhance\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Anam.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateVoiceRequest( + 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::Anam.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.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); + ProcessCreateVoiceResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Anam.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVoice", + methodName: "CreateVoiceAsync", + pathTemplate: "\"/v1/voices\"", + 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); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + statusCode: __response.StatusCode) + { + ResponseBody = __content_403, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + throw new global::Anam.ApiException( + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + statusCode: __response.StatusCode) + { + ResponseBody = __content_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); + ProcessCreateVoiceResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::Anam.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::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.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::Anam.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/Anam/Generated/Anam.VoicesClient.DeleteVoice.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.DeleteVoice.g.cs index 94064cf..67d1a9c 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.DeleteVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.VoicesClient.DeleteVoice.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteVoiceResponse( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteVoiceAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete voice
+ /// Delete a voice by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteVoiceAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteVoiceResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/voices/{id}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteVoiceResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteVoiceResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessDeleteVoiceResponse( 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 ProcessDeleteVoiceResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteVoiceResponse( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessDeleteVoiceResponse( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessDeleteVoiceResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteVoiceResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -431,6 +469,10 @@ partial void ProcessDeleteVoiceResponse( { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -452,6 +494,10 @@ partial void ProcessDeleteVoiceResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.VoicesClient.GetVoice.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.GetVoice.g.cs index 5a4223d..f20b18d 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.GetVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.VoicesClient.GetVoice.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetVoiceResponseContent( global::System.Guid id, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetVoiceAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get voice
+ /// Returns a voice by ID. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetVoiceAsResponseAsync( + global::System.Guid id, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetVoiceResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/voices/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetVoiceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetVoiceResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetVoiceResponseContent( 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 ProcessGetVoiceResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetVoiceResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetVoiceResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -440,9 +480,13 @@ partial void ProcessGetVoiceResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -470,9 +514,13 @@ partial void ProcessGetVoiceResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.VoicesClient.ListVoices.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.ListVoices.g.cs index 7cf5497..0ca8870 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.ListVoices.g.cs +++ b/src/libs/Anam/Generated/Anam.VoicesClient.ListVoices.g.cs @@ -65,6 +65,37 @@ partial void ProcessListVoicesResponseContent( string? search = default, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVoicesAsResponseAsync( + page: page, + perPage: perPage, + search: search, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List voices
+ /// Returns a paginated list of all voices. + ///
+ /// + /// Default Value: 1 + /// + /// + /// Default Value: 10 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListVoicesAsResponseAsync( + int? page = default, + int? perPage = default, + string? search = default, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +127,14 @@ partial void ProcessListVoicesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: "/v1/voices", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page", page?.ToString()) .AddOptionalParameter("perPage", perPage?.ToString()) - .AddOptionalParameter("search", search) + .AddOptionalParameter("search", search) ; var __path = __pathBuilder.ToString(); __path = global::Anam.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -176,6 +208,8 @@ partial void ProcessListVoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -186,6 +220,11 @@ partial void ProcessListVoicesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -203,6 +242,8 @@ partial void ProcessListVoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -212,8 +253,7 @@ partial void ProcessListVoicesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -222,6 +262,11 @@ partial void ProcessListVoicesResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -238,14 +283,15 @@ partial void ProcessListVoicesResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -285,6 +331,8 @@ partial void ProcessListVoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -305,6 +353,8 @@ partial void ProcessListVoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -461,9 +511,13 @@ partial void ProcessListVoicesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.ListVoicesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.ListVoicesResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -491,9 +545,13 @@ partial void ProcessListVoicesResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.ListVoicesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.ListVoicesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.VoicesClient.UpdateVoice.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.UpdateVoice.g.cs index a2d8fb0..f71eddc 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.UpdateVoice.g.cs +++ b/src/libs/Anam/Generated/Anam.VoicesClient.UpdateVoice.g.cs @@ -55,6 +55,32 @@ partial void ProcessUpdateVoiceResponseContent( public async global::System.Threading.Tasks.Task UpdateVoiceAsync( global::System.Guid id, + global::Anam.UpdateVoiceRequest request, + global::Anam.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateVoiceAsResponseAsync( + id: id, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update voice
+ /// Update a voice by ID. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdateVoiceAsResponseAsync( + global::System.Guid id, + global::Anam.UpdateVoiceRequest request, global::Anam.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessUpdateVoiceResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Anam.PathBuilder( path: $"/v1/voices/{id}", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessUpdateVoiceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessUpdateVoiceResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessUpdateVoiceResponseContent( 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 ProcessUpdateVoiceResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessUpdateVoiceResponseContent( __attempt < __maxAttempts && global::Anam.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Anam.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Anam.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Anam.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessUpdateVoiceResponseContent( 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::Anam.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessUpdateVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessUpdateVoiceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -455,9 +500,13 @@ partial void ProcessUpdateVoiceResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Anam.Voice.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -485,9 +534,13 @@ partial void ProcessUpdateVoiceResponseContent( #endif ).ConfigureAwait(false); - return - await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Anam.Voice.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Anam.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Anam.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Anam/Generated/Anam.VoicesClient.g.cs b/src/libs/Anam/Generated/Anam.VoicesClient.g.cs index 77871b9..288ab49 100644 --- a/src/libs/Anam/Generated/Anam.VoicesClient.g.cs +++ b/src/libs/Anam/Generated/Anam.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::Anam.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Anam.AutoSDKClientOptions? options, bool disposeHttpClient = true) {