From 1df7669e056dda1d34a91bc313719b8e36757e05 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 5 May 2026 13:49:49 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../MiniMax.AutoSDKHttpResponse.g.cs | 121 +++ .../MiniMax.FilesClient.DeleteFile.g.cs | 66 +- .../MiniMax.FilesClient.ListFiles.g.cs | 69 +- .../MiniMax.FilesClient.RetrieveFile.g.cs | 69 +- .../MiniMax.FilesClient.UploadFile.g.cs | 933 +++++++++++++++++- .../Generated/MiniMax.FilesClient.g.cs | 8 +- .../MiniMax.IFilesClient.DeleteFile.g.cs | 13 + .../MiniMax.IFilesClient.ListFiles.g.cs | 13 + .../MiniMax.IFilesClient.RetrieveFile.g.cs | 13 + .../MiniMax.IFilesClient.UploadFile.g.cs | 66 ++ ...ax.IMusicClient.CreateMusicGeneration.g.cs | 16 + ...iMax.ISpeechClient.CreateTextToSpeech.g.cs | 16 + ...iniMax.ISpeechClient.CreateVoiceClone.g.cs | 16 + ...VideoClient.CreateVideoGenerationTask.g.cs | 17 + ...x.IVideoClient.GetVideoGenerationTask.g.cs | 15 + .../Generated/MiniMax.MiniMaxClient.g.cs | 16 +- ...Max.MusicClient.CreateMusicGeneration.g.cs | 71 +- .../Generated/MiniMax.MusicClient.g.cs | 8 +- .../Generated/MiniMax.OptionsSupport.g.cs | 231 ++++- ...niMax.SpeechClient.CreateTextToSpeech.g.cs | 71 +- ...MiniMax.SpeechClient.CreateVoiceClone.g.cs | 69 +- .../Generated/MiniMax.SpeechClient.g.cs | 8 +- ...VideoClient.CreateVideoGenerationTask.g.cs | 70 +- ...ax.VideoClient.GetVideoGenerationTask.g.cs | 71 +- .../Generated/MiniMax.VideoClient.g.cs | 8 +- 25 files changed, 1963 insertions(+), 111 deletions(-) create mode 100644 src/libs/MiniMax/Generated/MiniMax.AutoSDKHttpResponse.g.cs diff --git a/src/libs/MiniMax/Generated/MiniMax.AutoSDKHttpResponse.g.cs b/src/libs/MiniMax/Generated/MiniMax.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..33e0b34 --- /dev/null +++ b/src/libs/MiniMax/Generated/MiniMax.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace MiniMax +{ + /// + /// 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/MiniMax/Generated/MiniMax.FilesClient.DeleteFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.FilesClient.DeleteFile.g.cs index a455edb..a69b306 100644 --- a/src/libs/MiniMax/Generated/MiniMax.FilesClient.DeleteFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.FilesClient.DeleteFile.g.cs @@ -64,6 +64,29 @@ partial void ProcessDeleteFileResponseContent( /// public async global::System.Threading.Tasks.Task DeleteFileAsync( + global::MiniMax.FileDeleteRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteFileAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a file.
+ /// Deletes a previously uploaded 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> DeleteFileAsResponseAsync( + global::MiniMax.FileDeleteRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -98,6 +121,7 @@ partial void ProcessDeleteFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/files/delete", baseUri: ResolveBaseUri( @@ -179,6 +203,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -189,6 +215,11 @@ partial void ProcessDeleteFileResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -206,6 +237,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -215,8 +248,7 @@ partial void ProcessDeleteFileResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -225,6 +257,11 @@ partial void ProcessDeleteFileResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -241,14 +278,15 @@ partial void ProcessDeleteFileResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -288,6 +326,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -308,6 +348,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -332,9 +374,13 @@ partial void ProcessDeleteFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.FileDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.FileDeleteResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -362,9 +408,13 @@ partial void ProcessDeleteFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.FileDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.FileDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.FilesClient.ListFiles.g.cs b/src/libs/MiniMax/Generated/MiniMax.FilesClient.ListFiles.g.cs index 7f925a3..7350cc6 100644 --- a/src/libs/MiniMax/Generated/MiniMax.FilesClient.ListFiles.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.FilesClient.ListFiles.g.cs @@ -67,6 +67,28 @@ partial void ProcessListFilesResponseContent( string? purpose = default, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListFilesAsResponseAsync( + purpose: purpose, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List files.
+ /// Lists files previously uploaded or generated by the account,
+ /// optionally filtered by purpose. + ///
+ /// + /// 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> ListFilesAsResponseAsync( + string? purpose = default, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +118,14 @@ partial void ProcessListFilesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/files/list", baseUri: ResolveBaseUri( servers: s_ListFilesServers, - defaultBaseUrl: "https://api.minimax.io/")); + defaultBaseUrl: "https://api.minimax.io/")); __pathBuilder - .AddOptionalParameter("purpose", purpose) + .AddOptionalParameter("purpose", purpose) ; var __path = __pathBuilder.ToString(); __path = global::MiniMax.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -174,6 +197,8 @@ partial void ProcessListFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +209,11 @@ partial void ProcessListFilesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -201,6 +231,8 @@ partial void ProcessListFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +242,7 @@ partial void ProcessListFilesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +251,11 @@ partial void ProcessListFilesResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -236,14 +272,15 @@ partial void ProcessListFilesResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -283,6 +320,8 @@ partial void ProcessListFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +342,8 @@ partial void ProcessListFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -327,9 +368,13 @@ partial void ProcessListFilesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.FileListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.FileListResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -357,9 +402,13 @@ partial void ProcessListFilesResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.FileListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.FileListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.FilesClient.RetrieveFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.FilesClient.RetrieveFile.g.cs index 987f7e6..2ab8e4c 100644 --- a/src/libs/MiniMax/Generated/MiniMax.FilesClient.RetrieveFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.FilesClient.RetrieveFile.g.cs @@ -67,6 +67,28 @@ partial void ProcessRetrieveFileResponseContent( string fileId, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveFileAsResponseAsync( + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve a file.
+ /// Fetches metadata (including a temporary `download_url`) for a
+ /// previously uploaded or generated 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> RetrieveFileAsResponseAsync( + string fileId, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +118,14 @@ partial void ProcessRetrieveFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/files/retrieve", baseUri: ResolveBaseUri( servers: s_RetrieveFileServers, - defaultBaseUrl: "https://api.minimax.io/")); + defaultBaseUrl: "https://api.minimax.io/")); __pathBuilder - .AddRequiredParameter("file_id", fileId) + .AddRequiredParameter("file_id", fileId) ; var __path = __pathBuilder.ToString(); __path = global::MiniMax.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -174,6 +197,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +209,11 @@ partial void ProcessRetrieveFileResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -201,6 +231,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +242,7 @@ partial void ProcessRetrieveFileResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +251,11 @@ partial void ProcessRetrieveFileResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -236,14 +272,15 @@ partial void ProcessRetrieveFileResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -283,6 +320,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +342,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -327,9 +368,13 @@ partial void ProcessRetrieveFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.FileRetrieveResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.FileRetrieveResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -357,9 +402,13 @@ partial void ProcessRetrieveFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.FileRetrieveResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.FileRetrieveResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.FilesClient.UploadFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.FilesClient.UploadFile.g.cs index da8bc46..e02f276 100644 --- a/src/libs/MiniMax/Generated/MiniMax.FilesClient.UploadFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.FilesClient.UploadFile.g.cs @@ -66,6 +66,31 @@ partial void ProcessUploadFileResponseContent( /// public async global::System.Threading.Tasks.Task UploadFileAsync( + global::MiniMax.FileUploadRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadFileAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
+ /// + /// 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> UploadFileAsResponseAsync( + global::MiniMax.FileUploadRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -96,10 +121,11 @@ partial void ProcessUploadFileResponseContent( var __maxAttempts = global::MiniMax.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/files/upload", baseUri: ResolveBaseUri( @@ -134,10 +160,12 @@ partial void ProcessUploadFileResponseContent( __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.Purpose ?? string.Empty), name: "\"purpose\""); + 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 @@ -175,7 +203,9 @@ request.Filename is null { __contentFile.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::MiniMax.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -217,6 +247,8 @@ request.Filename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -227,6 +259,11 @@ request.Filename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -244,6 +281,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) { @@ -253,8 +292,7 @@ request.Filename is null __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -263,6 +301,11 @@ request.Filename is null __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -279,14 +322,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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -326,6 +370,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -346,6 +392,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -370,9 +418,13 @@ request.Filename is null { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.FileUploadResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.FileUploadResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -400,9 +452,13 @@ request.Filename is null #endif ).ConfigureAwait(false); - return - await global::MiniMax.FileUploadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.FileUploadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -478,5 +534,864 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
+ /// + /// File purpose — `voice_clone`, `prompt_audio`, `retrieval`,
+ /// `fine-tune`, `fine-tune-results`. + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// 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 UploadFileAsync( + string purpose, + global::System.IO.Stream file, + string filename, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::MiniMax.FileUploadRequest + { + Purpose = purpose, + File = global::System.Array.Empty(), + Filename = filename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadFileArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::MiniMax.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadFileSecurityRequirements, + operationName: "UploadFileAsync"); + + using var __timeoutCancellationTokenSource = global::MiniMax.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::MiniMax.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::MiniMax.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::MiniMax.PathBuilder( + path: "/v1/files/upload", + baseUri: ResolveBaseUri( + servers: s_UploadFileServers, + defaultBaseUrl: "https://api.minimax.io/")); + var __path = __pathBuilder.ToString(); + __path = global::MiniMax.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.Purpose ?? string.Empty), + name: "\"purpose\""); + + 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; + } + + __httpRequest.Content = __httpRequestContent; + + global::MiniMax.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadFileRequest( + 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::MiniMax.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.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); + ProcessUploadFileResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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 (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadFileResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::MiniMax.FileUploadResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::MiniMax.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::MiniMax.FileUploadResponse.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::MiniMax.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 a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
+ /// + /// File purpose — `voice_clone`, `prompt_audio`, `retrieval`,
+ /// `fine-tune`, `fine-tune-results`. + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// 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> UploadFileAsResponseAsync( + string purpose, + global::System.IO.Stream file, + string filename, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + file = file ?? throw new global::System.ArgumentNullException(nameof(file)); + var request = new global::MiniMax.FileUploadRequest + { + Purpose = purpose, + File = global::System.Array.Empty(), + Filename = filename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadFileArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::MiniMax.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadFileSecurityRequirements, + operationName: "UploadFileAsync"); + + using var __timeoutCancellationTokenSource = global::MiniMax.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::MiniMax.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::MiniMax.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::MiniMax.PathBuilder( + path: "/v1/files/upload", + baseUri: ResolveBaseUri( + servers: s_UploadFileServers, + defaultBaseUrl: "https://api.minimax.io/")); + var __path = __pathBuilder.ToString(); + __path = global::MiniMax.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.Purpose ?? string.Empty), + name: "\"purpose\""); + + 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; + } + + __httpRequest.Content = __httpRequestContent; + + global::MiniMax.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadFileRequest( + 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::MiniMax.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.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); + ProcessUploadFileResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/v1/files/upload\"", + 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 (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadFileResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::MiniMax.FileUploadResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::MiniMax.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::MiniMax.FileUploadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.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::MiniMax.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/MiniMax/Generated/MiniMax.FilesClient.g.cs b/src/libs/MiniMax/Generated/MiniMax.FilesClient.g.cs index 01477b5..f0ce2ee 100644 --- a/src/libs/MiniMax/Generated/MiniMax.FilesClient.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.FilesClient.g.cs @@ -104,10 +104,10 @@ public FilesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public FilesClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::MiniMax.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::MiniMax.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.DeleteFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.DeleteFile.g.cs index d702367..617ffa9 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.DeleteFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.DeleteFile.g.cs @@ -21,6 +21,19 @@ public partial interface IFilesClient /// Delete a file.
/// Deletes a previously uploaded 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> DeleteFileAsResponseAsync( + + global::MiniMax.FileDeleteRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a file.
+ /// Deletes a previously uploaded file. + ///
/// /// File ID to delete. /// diff --git a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.ListFiles.g.cs b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.ListFiles.g.cs index bc1a302..8a8cfea 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.ListFiles.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.ListFiles.g.cs @@ -17,5 +17,18 @@ public partial interface IFilesClient string? purpose = default, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List files.
+ /// Lists files previously uploaded or generated by the account,
+ /// optionally filtered by purpose. + ///
+ /// + /// 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> ListFilesAsResponseAsync( + string? purpose = default, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.RetrieveFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.RetrieveFile.g.cs index c3a26f8..062af7f 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.RetrieveFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.RetrieveFile.g.cs @@ -17,5 +17,18 @@ public partial interface IFilesClient string fileId, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve a file.
+ /// Fetches metadata (including a temporary `download_url`) for a
+ /// previously uploaded or generated 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> RetrieveFileAsResponseAsync( + string fileId, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.UploadFile.g.cs b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.UploadFile.g.cs index 4e8520b..d51ea19 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IFilesClient.UploadFile.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IFilesClient.UploadFile.g.cs @@ -25,6 +25,21 @@ public partial interface IFilesClient /// voice-clone, music-cover, or video-generation workflows. Returns a
/// `file_id` that can be referenced in other endpoints. /// + /// + /// 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> UploadFileAsResponseAsync( + + global::MiniMax.FileUploadRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
/// /// File purpose — `voice_clone`, `prompt_audio`, `retrieval`,
/// `fine-tune`, `fine-tune-results`. @@ -44,5 +59,56 @@ public partial interface IFilesClient string filename, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
+ /// + /// File purpose — `voice_clone`, `prompt_audio`, `retrieval`,
+ /// `fine-tune`, `fine-tune-results`. + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// 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 UploadFileAsync( + string purpose, + global::System.IO.Stream file, + string filename, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload a file.
+ /// Uploads a file (audio, image, or video) for subsequent use in
+ /// voice-clone, music-cover, or video-generation workflows. Returns a
+ /// `file_id` that can be referenced in other endpoints. + ///
+ /// + /// File purpose — `voice_clone`, `prompt_audio`, `retrieval`,
+ /// `fine-tune`, `fine-tune-results`. + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// + /// The file to upload (MP3, M4A, WAV, image, video, etc.). + /// + /// 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> UploadFileAsResponseAsync( + string purpose, + global::System.IO.Stream file, + string filename, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/MiniMax/Generated/MiniMax.IMusicClient.CreateMusicGeneration.g.cs b/src/libs/MiniMax/Generated/MiniMax.IMusicClient.CreateMusicGeneration.g.cs index f15c624..2ae9553 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IMusicClient.CreateMusicGeneration.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IMusicClient.CreateMusicGeneration.g.cs @@ -27,6 +27,22 @@ public partial interface IMusicClient /// hex-encoded audio (`output_format=hex`, default) or a downloadable URL
/// (`output_format=url`). /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateMusicGenerationAsResponseAsync( + + global::MiniMax.MusicGenerationRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate music.
+ /// Generates music using MiniMax music models (`music-2.6`, `music-cover`,
+ /// `music-2.6-free`, `music-cover-free`). The response contains either
+ /// hex-encoded audio (`output_format=hex`, default) or a downloadable URL
+ /// (`output_format=url`). + ///
/// /// Music model. Supported values:
/// `music-2.6`, `music-cover`, `music-2.6-free`, `music-cover-free`,
diff --git a/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateTextToSpeech.g.cs b/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateTextToSpeech.g.cs index 8ea6d21..94732b2 100644 --- a/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateTextToSpeech.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateTextToSpeech.g.cs @@ -27,6 +27,22 @@ public partial interface ISpeechClient /// `speech-2.6-turbo`, `speech-02-hd`, `speech-02-turbo`). Supports up
/// to 10,000 characters, 40 languages, and 7 emotional tones. /// + /// + /// 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> CreateTextToSpeechAsResponseAsync( + + global::MiniMax.TextToSpeechRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Synthesize speech (T2A v2).
+ /// Converts text to speech using MiniMax TTS models
+ /// (`speech-2.8-hd`, `speech-2.8-turbo`, `speech-2.6-hd`,
+ /// `speech-2.6-turbo`, `speech-02-hd`, `speech-02-turbo`). Supports up
+ /// to 10,000 characters, 40 languages, and 7 emotional tones. + ///
/// /// TTS model version: `speech-2.8-hd`, `speech-2.8-turbo`,
/// `speech-2.6-hd`, `speech-2.6-turbo`, `speech-02-hd`,
diff --git a/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateVoiceClone.g.cs b/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateVoiceClone.g.cs index 31b8be2..e76bf97 100644 --- a/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateVoiceClone.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.ISpeechClient.CreateVoiceClone.g.cs @@ -27,6 +27,22 @@ public partial interface ISpeechClient /// speech) via `POST /v1/files/upload` with `purpose=voice_clone`, then
/// pass the returned `file_id` here. /// + /// + /// 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> CreateVoiceCloneAsResponseAsync( + + global::MiniMax.VoiceCloneRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a voice clone.
+ /// Creates a custom voice clone from a previously uploaded reference
+ /// audio file. First upload an MP3/M4A/WAV file (10s-5min, clear
+ /// speech) via `POST /v1/files/upload` with `purpose=voice_clone`, then
+ /// pass the returned `file_id` here. + ///
/// /// File ID returned from `POST /v1/files/upload` with `purpose=voice_clone`. /// diff --git a/src/libs/MiniMax/Generated/MiniMax.IVideoClient.CreateVideoGenerationTask.g.cs b/src/libs/MiniMax/Generated/MiniMax.IVideoClient.CreateVideoGenerationTask.g.cs index 33ceba2..8453531 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IVideoClient.CreateVideoGenerationTask.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IVideoClient.CreateVideoGenerationTask.g.cs @@ -29,6 +29,23 @@ public partial interface IVideoClient /// Once complete, the resulting file is retrieved via
/// `GET /v1/files/retrieve`. /// + /// + /// 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> CreateVideoGenerationTaskAsResponseAsync( + + global::MiniMax.VideoGenerationRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a video generation task.
+ /// Creates an asynchronous video generation task using Hailuo video
+ /// models. Returns a `task_id` that must be polled via
+ /// `GET /v1/query/video_generation` until the task succeeds or fails.
+ /// Once complete, the resulting file is retrieved via
+ /// `GET /v1/files/retrieve`. + ///
/// /// Model identifier. Popular choices:
/// `MiniMax-Hailuo-2.3`, `MiniMax-Hailuo-2.3-Fast`,
diff --git a/src/libs/MiniMax/Generated/MiniMax.IVideoClient.GetVideoGenerationTask.g.cs b/src/libs/MiniMax/Generated/MiniMax.IVideoClient.GetVideoGenerationTask.g.cs index aece157..606a22d 100644 --- a/src/libs/MiniMax/Generated/MiniMax.IVideoClient.GetVideoGenerationTask.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.IVideoClient.GetVideoGenerationTask.g.cs @@ -19,5 +19,20 @@ public partial interface IVideoClient string taskId, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Query a video generation task.
+ /// Polls a video generation task by `task_id`. The response `status`
+ /// progresses through `Preparing`, `Queueing`, `Processing`,
+ /// `Success`, `Fail`. When `Success`, `file_id` can be used with
+ /// `GET /v1/files/retrieve`. + ///
+ /// + /// 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> GetVideoGenerationTaskAsResponseAsync( + string taskId, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/MiniMax/Generated/MiniMax.MiniMaxClient.g.cs b/src/libs/MiniMax/Generated/MiniMax.MiniMaxClient.g.cs index 112730d..04463f2 100644 --- a/src/libs/MiniMax/Generated/MiniMax.MiniMaxClient.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.MiniMaxClient.g.cs @@ -56,7 +56,7 @@ public sealed partial class MiniMaxClient : global::MiniMax.IMiniMaxClient, glob /// /// File upload/retrieval for assets used by video, music, and voice-clone endpoints. /// - public FilesClient Files => new FilesClient(HttpClient, authorizations: Authorizations, options: Options) + public FilesClient Files => new FilesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -66,7 +66,7 @@ public sealed partial class MiniMaxClient : global::MiniMax.IMiniMaxClient, glob /// /// Music generation (text-to-music, music cover) — returns hex-encoded or URL audio. /// - public MusicClient Music => new MusicClient(HttpClient, authorizations: Authorizations, options: Options) + public MusicClient Music => new MusicClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -76,7 +76,7 @@ public sealed partial class MiniMaxClient : global::MiniMax.IMiniMaxClient, glob /// /// Text-to-speech synthesis (T2A v2) and voice cloning. /// - public SpeechClient Speech => new SpeechClient(HttpClient, authorizations: Authorizations, options: Options) + public SpeechClient Speech => new SpeechClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -86,7 +86,7 @@ public sealed partial class MiniMaxClient : global::MiniMax.IMiniMaxClient, glob /// /// Video generation via Hailuo models (text-to-video, image-to-video, subject reference) with async task polling. /// - public VideoClient Video => new VideoClient(HttpClient, authorizations: Authorizations, options: Options) + public VideoClient Video => new VideoClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -154,10 +154,10 @@ public MiniMaxClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public MiniMaxClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::MiniMax.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::MiniMax.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/MiniMax/Generated/MiniMax.MusicClient.CreateMusicGeneration.g.cs b/src/libs/MiniMax/Generated/MiniMax.MusicClient.CreateMusicGeneration.g.cs index f93e140..2bb9747 100644 --- a/src/libs/MiniMax/Generated/MiniMax.MusicClient.CreateMusicGeneration.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.MusicClient.CreateMusicGeneration.g.cs @@ -67,6 +67,32 @@ partial void ProcessCreateMusicGenerationResponseContent( /// public async global::System.Threading.Tasks.Task CreateMusicGenerationAsync( + global::MiniMax.MusicGenerationRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateMusicGenerationAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate music.
+ /// Generates music using MiniMax music models (`music-2.6`, `music-cover`,
+ /// `music-2.6-free`, `music-cover-free`). The response contains either
+ /// hex-encoded audio (`output_format=hex`, default) or a downloadable URL
+ /// (`output_format=url`). + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateMusicGenerationAsResponseAsync( + global::MiniMax.MusicGenerationRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -97,10 +123,11 @@ partial void ProcessCreateMusicGenerationResponseContent( var __maxAttempts = global::MiniMax.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/music_generation", baseUri: ResolveBaseUri( @@ -182,6 +209,8 @@ partial void ProcessCreateMusicGenerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +221,11 @@ partial void ProcessCreateMusicGenerationResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -209,6 +243,8 @@ partial void ProcessCreateMusicGenerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +254,7 @@ partial void ProcessCreateMusicGenerationResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +263,11 @@ partial void ProcessCreateMusicGenerationResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -244,14 +284,15 @@ partial void ProcessCreateMusicGenerationResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -291,6 +332,8 @@ partial void ProcessCreateMusicGenerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +354,8 @@ partial void ProcessCreateMusicGenerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +380,13 @@ partial void ProcessCreateMusicGenerationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.MusicGenerationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.MusicGenerationResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -365,9 +414,13 @@ partial void ProcessCreateMusicGenerationResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.MusicGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.MusicGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.MusicClient.g.cs b/src/libs/MiniMax/Generated/MiniMax.MusicClient.g.cs index b2621d6..57229ca 100644 --- a/src/libs/MiniMax/Generated/MiniMax.MusicClient.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.MusicClient.g.cs @@ -104,10 +104,10 @@ public MusicClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public MusicClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::MiniMax.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::MiniMax.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/MiniMax/Generated/MiniMax.OptionsSupport.g.cs b/src/libs/MiniMax/Generated/MiniMax.OptionsSupport.g.cs index 3a32640..27b384f 100644 --- a/src/libs/MiniMax/Generated/MiniMax.OptionsSupport.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.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::MiniMax.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::MiniMax.AutoSDKClientOptions clientOptions, global::MiniMax.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::MiniMax.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::MiniMax.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/MiniMax/Generated/MiniMax.SpeechClient.CreateTextToSpeech.g.cs b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateTextToSpeech.g.cs index 41e6709..f88cb84 100644 --- a/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateTextToSpeech.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateTextToSpeech.g.cs @@ -67,6 +67,32 @@ partial void ProcessCreateTextToSpeechResponseContent( /// public async global::System.Threading.Tasks.Task CreateTextToSpeechAsync( + global::MiniMax.TextToSpeechRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateTextToSpeechAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Synthesize speech (T2A v2).
+ /// Converts text to speech using MiniMax TTS models
+ /// (`speech-2.8-hd`, `speech-2.8-turbo`, `speech-2.6-hd`,
+ /// `speech-2.6-turbo`, `speech-02-hd`, `speech-02-turbo`). Supports up
+ /// to 10,000 characters, 40 languages, and 7 emotional tones. + ///
+ /// + /// 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> CreateTextToSpeechAsResponseAsync( + global::MiniMax.TextToSpeechRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -97,10 +123,11 @@ partial void ProcessCreateTextToSpeechResponseContent( var __maxAttempts = global::MiniMax.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/t2a_v2", baseUri: ResolveBaseUri( @@ -182,6 +209,8 @@ partial void ProcessCreateTextToSpeechResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +221,11 @@ partial void ProcessCreateTextToSpeechResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -209,6 +243,8 @@ partial void ProcessCreateTextToSpeechResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +254,7 @@ partial void ProcessCreateTextToSpeechResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +263,11 @@ partial void ProcessCreateTextToSpeechResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -244,14 +284,15 @@ partial void ProcessCreateTextToSpeechResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -291,6 +332,8 @@ partial void ProcessCreateTextToSpeechResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +354,8 @@ partial void ProcessCreateTextToSpeechResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +380,13 @@ partial void ProcessCreateTextToSpeechResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.TextToSpeechResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.TextToSpeechResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -365,9 +414,13 @@ partial void ProcessCreateTextToSpeechResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.TextToSpeechResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.TextToSpeechResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateVoiceClone.g.cs b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateVoiceClone.g.cs index 80823de..9d9d563 100644 --- a/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateVoiceClone.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.CreateVoiceClone.g.cs @@ -67,6 +67,32 @@ partial void ProcessCreateVoiceCloneResponseContent( /// public async global::System.Threading.Tasks.Task CreateVoiceCloneAsync( + global::MiniMax.VoiceCloneRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVoiceCloneAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a voice clone.
+ /// Creates a custom voice clone from a previously uploaded reference
+ /// audio file. First upload an MP3/M4A/WAV file (10s-5min, clear
+ /// speech) via `POST /v1/files/upload` with `purpose=voice_clone`, then
+ /// pass the returned `file_id` here. + ///
+ /// + /// 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> CreateVoiceCloneAsResponseAsync( + global::MiniMax.VoiceCloneRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -101,6 +127,7 @@ partial void ProcessCreateVoiceCloneResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/voice_clone", baseUri: ResolveBaseUri( @@ -182,6 +209,8 @@ partial void ProcessCreateVoiceCloneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +221,11 @@ partial void ProcessCreateVoiceCloneResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -209,6 +243,8 @@ partial void ProcessCreateVoiceCloneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +254,7 @@ partial void ProcessCreateVoiceCloneResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +263,11 @@ partial void ProcessCreateVoiceCloneResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -244,14 +284,15 @@ partial void ProcessCreateVoiceCloneResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -291,6 +332,8 @@ partial void ProcessCreateVoiceCloneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +354,8 @@ partial void ProcessCreateVoiceCloneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +380,13 @@ partial void ProcessCreateVoiceCloneResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.VoiceCloneResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.VoiceCloneResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -365,9 +414,13 @@ partial void ProcessCreateVoiceCloneResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.VoiceCloneResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.VoiceCloneResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.SpeechClient.g.cs b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.g.cs index 35a224a..99afaa2 100644 --- a/src/libs/MiniMax/Generated/MiniMax.SpeechClient.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.SpeechClient.g.cs @@ -104,10 +104,10 @@ public SpeechClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public SpeechClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::MiniMax.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::MiniMax.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/MiniMax/Generated/MiniMax.VideoClient.CreateVideoGenerationTask.g.cs b/src/libs/MiniMax/Generated/MiniMax.VideoClient.CreateVideoGenerationTask.g.cs index 89139bf..3b82ad6 100644 --- a/src/libs/MiniMax/Generated/MiniMax.VideoClient.CreateVideoGenerationTask.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.VideoClient.CreateVideoGenerationTask.g.cs @@ -68,6 +68,33 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoGenerationTaskAsync( + global::MiniMax.VideoGenerationRequest request, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoGenerationTaskAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a video generation task.
+ /// Creates an asynchronous video generation task using Hailuo video
+ /// models. Returns a `task_id` that must be polled via
+ /// `GET /v1/query/video_generation` until the task succeeds or fails.
+ /// Once complete, the resulting file is retrieved via
+ /// `GET /v1/files/retrieve`. + ///
+ /// + /// 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> CreateVideoGenerationTaskAsResponseAsync( + global::MiniMax.VideoGenerationRequest request, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -102,6 +129,7 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/video_generation", baseUri: ResolveBaseUri( @@ -183,6 +211,8 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +223,11 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -210,6 +245,8 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +256,7 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +265,11 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -245,14 +286,15 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -292,6 +334,8 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +356,8 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -336,9 +382,13 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.VideoGenerationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.VideoGenerationResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -366,9 +416,13 @@ partial void ProcessCreateVideoGenerationTaskResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.VideoGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.VideoGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.VideoClient.GetVideoGenerationTask.g.cs b/src/libs/MiniMax/Generated/MiniMax.VideoClient.GetVideoGenerationTask.g.cs index 7357ab3..bfc62e9 100644 --- a/src/libs/MiniMax/Generated/MiniMax.VideoClient.GetVideoGenerationTask.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.VideoClient.GetVideoGenerationTask.g.cs @@ -69,6 +69,30 @@ partial void ProcessGetVideoGenerationTaskResponseContent( string taskId, global::MiniMax.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetVideoGenerationTaskAsResponseAsync( + taskId: taskId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Query a video generation task.
+ /// Polls a video generation task by `task_id`. The response `status`
+ /// progresses through `Preparing`, `Queueing`, `Processing`,
+ /// `Success`, `Fail`. When `Success`, `file_id` can be used with
+ /// `GET /v1/files/retrieve`. + ///
+ /// + /// 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> GetVideoGenerationTaskAsResponseAsync( + string taskId, + global::MiniMax.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -98,13 +122,14 @@ partial void ProcessGetVideoGenerationTaskResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::MiniMax.PathBuilder( path: "/v1/query/video_generation", baseUri: ResolveBaseUri( servers: s_GetVideoGenerationTaskServers, - defaultBaseUrl: "https://api.minimax.io/")); + defaultBaseUrl: "https://api.minimax.io/")); __pathBuilder - .AddRequiredParameter("task_id", taskId) + .AddRequiredParameter("task_id", taskId) ; var __path = __pathBuilder.ToString(); __path = global::MiniMax.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -176,6 +201,8 @@ partial void ProcessGetVideoGenerationTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -186,6 +213,11 @@ partial void ProcessGetVideoGenerationTaskResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -203,6 +235,8 @@ partial void ProcessGetVideoGenerationTaskResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -212,8 +246,7 @@ partial void ProcessGetVideoGenerationTaskResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -222,6 +255,11 @@ partial void ProcessGetVideoGenerationTaskResponseContent( __attempt < __maxAttempts && global::MiniMax.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::MiniMax.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::MiniMax.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::MiniMax.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -238,14 +276,15 @@ partial void ProcessGetVideoGenerationTaskResponseContent( 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::MiniMax.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -285,6 +324,8 @@ partial void ProcessGetVideoGenerationTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -305,6 +346,8 @@ partial void ProcessGetVideoGenerationTaskResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -329,9 +372,13 @@ partial void ProcessGetVideoGenerationTaskResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::MiniMax.VideoTaskStatusResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::MiniMax.VideoTaskStatusResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -359,9 +406,13 @@ partial void ProcessGetVideoGenerationTaskResponseContent( #endif ).ConfigureAwait(false); - return - await global::MiniMax.VideoTaskStatusResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::MiniMax.VideoTaskStatusResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::MiniMax.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::MiniMax.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/MiniMax/Generated/MiniMax.VideoClient.g.cs b/src/libs/MiniMax/Generated/MiniMax.VideoClient.g.cs index 8aa04aa..0621425 100644 --- a/src/libs/MiniMax/Generated/MiniMax.VideoClient.g.cs +++ b/src/libs/MiniMax/Generated/MiniMax.VideoClient.g.cs @@ -104,10 +104,10 @@ public VideoClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public VideoClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::MiniMax.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::MiniMax.AutoSDKClientOptions? options, bool disposeHttpClient = true) {