diff --git a/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs b/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs index dbc51e3..bd2ea16 100644 --- a/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs +++ b/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs @@ -146,186 +146,5 @@ public partial interface ISubpackageDeepfakeDetectionClient bool? zeroRetentionMode = default, global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Create a batch deepfake detection job
- /// Submit up to 50 files in a single request and process them as a single logical
- /// group. Returns HTTP 202 with a batch UUID; each file is analyzed in the
- /// background and individual results are available via `GET /detect/{uuid}` for
- /// each entry in `detect_uuids`.
- /// Two intake methods:
- /// - **Multiple media files** — repeated `files[]` form fields.
- /// - **Single zip archive** — a single `file` form field whose value is a `.zip`
- /// containing the media files. Non-media entries are skipped.
- /// Provide one of `files[]` or `file=<...>.zip` per request. Synchronous mode
- /// (`Prefer: wait`) is not supported and returns 400 if sent.
- /// Constraints:
- /// - Maximum 50 files per batch.
- /// - Maximum 500 MB total upload size across all files.
- /// - Allowed file types match `POST /detect`'s direct-upload allowlist.
- /// - All-or-nothing billing: if the team's wallet cannot cover the projected cost
- /// for every file, the request is rejected with 402 and no detects are created. - ///
- /// - /// One or more media files. Repeat the `files[]` field for each file. Mutually exclusive with `file`. - /// - /// - /// Optional file names to use for the multipart 'files[]' file parts. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// POST destination invoked when the batch reaches a terminal state. - /// - /// - /// Run multimodal intelligence on every file in the batch.
- /// Default Value: false - /// - /// - /// Run identity search against the team's saved identities (audio/video only).
- /// Default Value: false - /// - /// - /// Generate visualization artifacts.
- /// Default Value: true - /// - /// - /// Enable audio source tracing on each audio file.
- /// Default Value: false - /// - /// - /// Window size in seconds (audio/video). - /// - /// - /// Start of segment to analyze (seconds). - /// - /// - /// End of segment to analyze (seconds). - /// - /// - /// Cap processed video duration. - /// - /// - /// Use LLM-assisted video analysis. - /// - /// - /// Enable Zero Retention Mode for every file in the batch.
- /// Default Value: false - /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task CreateDetectBatchAsync( - global::System.Collections.Generic.IReadOnlyList? files = default, - global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, - global::System.IO.Stream? file = default, - string? filename = default, - string? callbackUrl = default, - bool? intelligence = default, - bool? searchIdentity = default, - bool? visualize = default, - bool? audioSourceTracingEnabled = default, - int? frameLength = default, - double? startRegion = default, - double? endRegion = default, - double? maxVideoSecs = default, - bool? useLlm = default, - bool? zeroRetentionMode = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); - /// - /// Create a batch deepfake detection job
- /// Submit up to 50 files in a single request and process them as a single logical
- /// group. Returns HTTP 202 with a batch UUID; each file is analyzed in the
- /// background and individual results are available via `GET /detect/{uuid}` for
- /// each entry in `detect_uuids`.
- /// Two intake methods:
- /// - **Multiple media files** — repeated `files[]` form fields.
- /// - **Single zip archive** — a single `file` form field whose value is a `.zip`
- /// containing the media files. Non-media entries are skipped.
- /// Provide one of `files[]` or `file=<...>.zip` per request. Synchronous mode
- /// (`Prefer: wait`) is not supported and returns 400 if sent.
- /// Constraints:
- /// - Maximum 50 files per batch.
- /// - Maximum 500 MB total upload size across all files.
- /// - Allowed file types match `POST /detect`'s direct-upload allowlist.
- /// - All-or-nothing billing: if the team's wallet cannot cover the projected cost
- /// for every file, the request is rejected with 402 and no detects are created. - ///
- /// - /// One or more media files. Repeat the `files[]` field for each file. Mutually exclusive with `file`. - /// - /// - /// Optional file names to use for the multipart 'files[]' file parts. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// POST destination invoked when the batch reaches a terminal state. - /// - /// - /// Run multimodal intelligence on every file in the batch.
- /// Default Value: false - /// - /// - /// Run identity search against the team's saved identities (audio/video only).
- /// Default Value: false - /// - /// - /// Generate visualization artifacts.
- /// Default Value: true - /// - /// - /// Enable audio source tracing on each audio file.
- /// Default Value: false - /// - /// - /// Window size in seconds (audio/video). - /// - /// - /// Start of segment to analyze (seconds). - /// - /// - /// End of segment to analyze (seconds). - /// - /// - /// Cap processed video duration. - /// - /// - /// Use LLM-assisted video analysis. - /// - /// - /// Enable Zero Retention Mode for every file in the batch.
- /// Default Value: false - /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task> CreateDetectBatchAsResponseAsync( - global::System.Collections.Generic.IReadOnlyList? files = default, - global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, - global::System.IO.Stream? file = default, - string? filename = default, - string? callbackUrl = default, - bool? intelligence = default, - bool? searchIdentity = default, - bool? visualize = default, - bool? audioSourceTracingEnabled = default, - int? frameLength = default, - double? startRegion = default, - double? endRegion = default, - double? maxVideoSecs = default, - bool? useLlm = default, - bool? zeroRetentionMode = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageSpeechToTextClient.CreateTranscript.g.cs b/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageSpeechToTextClient.CreateTranscript.g.cs index 6c3809c..cf8be5e 100644 --- a/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageSpeechToTextClient.CreateTranscript.g.cs +++ b/src/libs/ResembleAI/Generated/ResembleAI.ISubpackageSpeechToTextClient.CreateTranscript.g.cs @@ -52,50 +52,5 @@ public partial interface ISubpackageSpeechToTextClient string? query = default, global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); - - /// - /// Create transcript job
- /// Submit audio or video for transcription - ///
- /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Optional intelligence question to evaluate after transcription - /// - /// 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 CreateTranscriptAsync( - global::System.IO.Stream? file = default, - string? filename = default, - string? query = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); - /// - /// Create transcript job
- /// Submit audio or video for transcription - ///
- /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Optional intelligence question to evaluate after transcription - /// - /// 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> CreateTranscriptAsResponseAsync( - global::System.IO.Stream? file = default, - string? filename = default, - string? query = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/ResembleAI/Generated/ResembleAI.OptionsSupport.g.cs b/src/libs/ResembleAI/Generated/ResembleAI.OptionsSupport.g.cs index 9a9a9e7..394e3e2 100644 --- a/src/libs/ResembleAI/Generated/ResembleAI.OptionsSupport.g.cs +++ b/src/libs/ResembleAI/Generated/ResembleAI.OptionsSupport.g.cs @@ -150,6 +150,84 @@ public interface IAutoSDKAuthorizationProvider global::ResembleAI.AutoSDKHookContext context); } + /// + /// Marker keys stamped onto outgoing + /// instances so consumer s — and any + /// other transport-layer code that runs after AutoSDK's send pipeline — can observe whether + /// the resolved Authorization is call-scoped and opt out of overwriting it with a + /// rotation-aware account-level credential. + /// + public static class AutoSDKHttpRequestOptions + { + /// + /// Key under which records the marker. Exposed + /// for handlers that target frameworks older than .NET 5 and need to read the value + /// through the legacy HttpRequestMessage.Properties bag. + /// + public const string AuthorizationOverrideKey = "AutoSDK.AuthorizationOverride"; + +#if NET5_0_OR_GREATER + /// + /// Strongly-typed for + /// the call-scoped Authorization marker on .NET 5+ targets. Consumers should prefer this + /// over the legacy HttpRequestMessage.Properties bag where available. + /// + public static readonly global::System.Net.Http.HttpRequestOptionsKey AuthorizationOverride = + new global::System.Net.Http.HttpRequestOptionsKey(AuthorizationOverrideKey); +#endif + + /// + /// Stamps the call-scoped Authorization marker on . AutoSDK's + /// built-in calls this whenever the + /// resolved auth came from a per-request override or a client-level + /// . Hand-written SDK extensions that set a + /// non-default Authorization header (e.g. a session-scoped bearer returned by an + /// upstream poll) should call this too so downstream rotation handlers know to skip the + /// overwrite. + /// + /// + public static void StampAuthorizationOverride( + global::System.Net.Http.HttpRequestMessage? request) + { + if (request is null) + { + return; + } + +#if NET5_0_OR_GREATER + request.Options.Set(AuthorizationOverride, true); +#else +#pragma warning disable CS0618 // HttpRequestMessage.Properties is obsolete in NET5+, but the only option below it. + request.Properties[AuthorizationOverrideKey] = true; +#pragma warning restore CS0618 +#endif + } + + /// + /// Returns true when previously marked the + /// request as carrying a call-scoped Authorization. + /// + /// + public static bool HasAuthorizationOverride( + global::System.Net.Http.HttpRequestMessage? request) + { + if (request is null) + { + return false; + } + +#if NET5_0_OR_GREATER + return request.Options.TryGetValue(AuthorizationOverride, out var value) && value; +#else +#pragma warning disable CS0618 + return request.Properties.TryGetValue(AuthorizationOverrideKey, out var raw) && + raw is bool flag && + flag; +#pragma warning restore CS0618 +#endif + } + } + /// /// Built-in that consults /// before every outgoing @@ -176,6 +254,7 @@ public sealed class AutoSDKAuthorizationProviderHook : global::ResembleAI.AutoSD ApplyAuthorization(context.Request, perRequest[index]); } + global::ResembleAI.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); return; } @@ -195,6 +274,8 @@ public sealed class AutoSDKAuthorizationProviderHook : global::ResembleAI.AutoSD { ApplyAuthorization(context.Request, resolved[index]); } + + global::ResembleAI.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); } private static void ApplyAuthorization( diff --git a/src/libs/ResembleAI/Generated/ResembleAI.SubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs b/src/libs/ResembleAI/Generated/ResembleAI.SubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs index 845e3ef..2fa9cbd 100644 --- a/src/libs/ResembleAI/Generated/ResembleAI.SubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs +++ b/src/libs/ResembleAI/Generated/ResembleAI.SubpackageDeepfakeDetectionClient.CreateDetectBatch.g.cs @@ -853,1520 +853,5 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } - - /// - /// Create a batch deepfake detection job
- /// Submit up to 50 files in a single request and process them as a single logical
- /// group. Returns HTTP 202 with a batch UUID; each file is analyzed in the
- /// background and individual results are available via `GET /detect/{uuid}` for
- /// each entry in `detect_uuids`.
- /// Two intake methods:
- /// - **Multiple media files** — repeated `files[]` form fields.
- /// - **Single zip archive** — a single `file` form field whose value is a `.zip`
- /// containing the media files. Non-media entries are skipped.
- /// Provide one of `files[]` or `file=<...>.zip` per request. Synchronous mode
- /// (`Prefer: wait`) is not supported and returns 400 if sent.
- /// Constraints:
- /// - Maximum 50 files per batch.
- /// - Maximum 500 MB total upload size across all files.
- /// - Allowed file types match `POST /detect`'s direct-upload allowlist.
- /// - All-or-nothing billing: if the team's wallet cannot cover the projected cost
- /// for every file, the request is rejected with 402 and no detects are created. - ///
- /// - /// One or more media files. Repeat the `files[]` field for each file. Mutually exclusive with `file`. - /// - /// - /// Optional file names to use for the multipart 'files[]' file parts. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// POST destination invoked when the batch reaches a terminal state. - /// - /// - /// Run multimodal intelligence on every file in the batch.
- /// Default Value: false - /// - /// - /// Run identity search against the team's saved identities (audio/video only).
- /// Default Value: false - /// - /// - /// Generate visualization artifacts.
- /// Default Value: true - /// - /// - /// Enable audio source tracing on each audio file.
- /// Default Value: false - /// - /// - /// Window size in seconds (audio/video). - /// - /// - /// Start of segment to analyze (seconds). - /// - /// - /// End of segment to analyze (seconds). - /// - /// - /// Cap processed video duration. - /// - /// - /// Use LLM-assisted video analysis. - /// - /// - /// Enable Zero Retention Mode for every file in the batch.
- /// Default Value: false - /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task CreateDetectBatchAsync( - global::System.Collections.Generic.IReadOnlyList? files = default, - global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, - global::System.IO.Stream? file = default, - string? filename = default, - string? callbackUrl = default, - bool? intelligence = default, - bool? searchIdentity = default, - bool? visualize = default, - bool? audioSourceTracingEnabled = default, - int? frameLength = default, - double? startRegion = default, - double? endRegion = default, - double? maxVideoSecs = default, - bool? useLlm = default, - bool? zeroRetentionMode = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - - var request = new global::ResembleAI.CreateDetectBatchRequest - { - Files = new global::System.Collections.Generic.List(), - File = global::System.Array.Empty(), - Filename = filename, - CallbackUrl = callbackUrl, - Intelligence = intelligence, - SearchIdentity = searchIdentity, - Visualize = visualize, - AudioSourceTracingEnabled = audioSourceTracingEnabled, - FrameLength = frameLength, - StartRegion = startRegion, - EndRegion = endRegion, - MaxVideoSecs = maxVideoSecs, - UseLlm = useLlm, - ZeroRetentionMode = zeroRetentionMode, - }; - PrepareArguments( - client: HttpClient); - PrepareCreateDetectBatchArguments( - httpClient: HttpClient, - request: request); - - - var __authorizations = global::ResembleAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_CreateDetectBatchSecurityRequirements, - operationName: "CreateDetectBatchAsync"); - - using var __timeoutCancellationTokenSource = global::ResembleAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( - clientOptions: Options, - requestOptions: requestOptions, - cancellationToken: cancellationToken); - var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; - var __effectiveReadResponseAsString = global::ResembleAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( - clientOptions: Options, - requestOptions: requestOptions, - fallbackValue: ReadResponseAsString); - var __maxAttempts = global::ResembleAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( - clientOptions: Options, - requestOptions: requestOptions, - supportsRetry: false); - - global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() - { - - var __pathBuilder = new global::ResembleAI.PathBuilder( - path: "/detect/batch", - baseUri: ResolveBaseUri( - servers: s_CreateDetectBatchServers, - defaultBaseUrl: "https://f.cluster.resemble.ai/")); - var __path = __pathBuilder.ToString(); - __path = global::ResembleAI.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(); - if (files != default) - { - - for (var __iFiles = 0; __iFiles < files.Count; __iFiles++) - { - var __fileNameFiles = filesFileNames != null && - __iFiles < filesFileNames.Count && - filesFileNames[__iFiles] != null - ? filesFileNames[__iFiles] - : $"file{__iFiles}.bin"; - var __contentFiles = new global::System.Net.Http.StreamContent(files[__iFiles]); - __contentFiles.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - __fileNameFiles is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(__fileNameFiles) ?? 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: __contentFiles, - name: "\"files[]\"", - fileName: $"\"{__fileNameFiles}\""); - if (__contentFiles.Headers.ContentDisposition != null) - { - __contentFiles.Headers.ContentDisposition.FileNameStar = null; - } - } - - } - if (file != default) - { - - var __contentFile = new global::System.Net.Http.StreamContent(file); - __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - request.Filename is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch - { - ".aac" => "audio/aac", - ".flac" => "audio/flac", - ".gif" => "image/gif", - ".jpeg" => "image/jpeg", - ".jpg" => "image/jpeg", - ".json" => "application/json", - ".m4a" => "audio/mp4", - ".mp3" => "audio/mpeg", - ".mp4" => "video/mp4", - ".mpeg" => "audio/mpeg", - ".mpga" => "audio/mpeg", - ".oga" => "audio/ogg", - ".ogg" => "audio/ogg", - ".opus" => "audio/ogg", - ".pdf" => "application/pdf", - ".png" => "image/png", - ".txt" => "text/plain", - ".wav" => "audio/wav", - ".weba" => "audio/webm", - ".webm" => "video/webm", - ".webp" => "image/webp", - _ => "application/octet-stream", - }); - __httpRequestContent.Add( - content: __contentFile, - name: "\"file\"", - fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); - if (__contentFile.Headers.ContentDisposition != null) - { - __contentFile.Headers.ContentDisposition.FileNameStar = null; - } - - } - if (request.CallbackUrl != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.CallbackUrl ?? string.Empty), - name: "\"callback_url\""); - - } - if (request.Intelligence != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Intelligence, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"intelligence\""); - - } - if (request.SearchIdentity != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.SearchIdentity, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"search_identity\""); - - } - if (request.Visualize != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Visualize, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"visualize\""); - - } - if (request.AudioSourceTracingEnabled != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.AudioSourceTracingEnabled, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"audio_source_tracing_enabled\""); - - } - if (request.FrameLength != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.FrameLength, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"frame_length\""); - - } - if (request.StartRegion != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.StartRegion, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"start_region\""); - - } - if (request.EndRegion != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.EndRegion, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"end_region\""); - - } - if (request.MaxVideoSecs != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.MaxVideoSecs, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"max_video_secs\""); - - } - if (request.UseLlm != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.UseLlm, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"use_llm\""); - - } - if (request.ZeroRetentionMode != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.ZeroRetentionMode, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"zero_retention_mode\""); - - } - - __httpRequest.Content = __httpRequestContent; - - global::ResembleAI.AutoSDKRequestOptionsSupport.ApplyHeaders( - request: __httpRequest, - clientHeaders: Options.Headers, - requestHeaders: requestOptions?.Headers); - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateDetectBatchRequest( - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: null, - attempt: __attempt); - var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - retryDelay: __retryDelay, - cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); - continue; - } - - if (__response != null && - __attempt < __maxAttempts && - global::ResembleAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) - { - var __retryDelay = global::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: __response, - attempt: __attempt); - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.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); - ProcessCreateDetectBatchResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - if (__response.IsSuccessStatusCode) - { - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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); - } - // Invalid batch request (missing files, both file and files[] supplied, file count or size exceeded, unsupported file type, or `Prefer: wait` header sent) - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::ResembleAI.Error? __value_400 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - else - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Insufficient balance for the projected batch cost. Response `details` includes per-file estimates. - if ((int)__response.StatusCode == 402) - { - string? __content_402 = null; - global::System.Exception? __exception_402 = null; - global::ResembleAI.Error? __value_402 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_402 = global::ResembleAI.Error.FromJson(__content_402, JsonSerializerContext); - } - else - { - __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_402 = global::ResembleAI.Error.FromJson(__content_402, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_402 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseObject = __value_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Intelligence detect limit reached (Default plan). - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::ResembleAI.Error? __value_403 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_403 = global::ResembleAI.Error.FromJson(__content_403, JsonSerializerContext); - } - else - { - __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_403 = global::ResembleAI.Error.FromJson(__content_403, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (__effectiveReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( - #if NET5_0_OR_GREATER - __effectiveCancellationToken - #endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessCreateDetectBatchResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::ResembleAI.DeepfakeDetectionCreateDetectBatchResponse202.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::ResembleAI.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::ResembleAI.DeepfakeDetectionCreateDetectBatchResponse202.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::ResembleAI.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - - } - } - finally - { - __httpRequest?.Dispose(); - } - } - /// - /// Create a batch deepfake detection job
- /// Submit up to 50 files in a single request and process them as a single logical
- /// group. Returns HTTP 202 with a batch UUID; each file is analyzed in the
- /// background and individual results are available via `GET /detect/{uuid}` for
- /// each entry in `detect_uuids`.
- /// Two intake methods:
- /// - **Multiple media files** — repeated `files[]` form fields.
- /// - **Single zip archive** — a single `file` form field whose value is a `.zip`
- /// containing the media files. Non-media entries are skipped.
- /// Provide one of `files[]` or `file=<...>.zip` per request. Synchronous mode
- /// (`Prefer: wait`) is not supported and returns 400 if sent.
- /// Constraints:
- /// - Maximum 50 files per batch.
- /// - Maximum 500 MB total upload size across all files.
- /// - Allowed file types match `POST /detect`'s direct-upload allowlist.
- /// - All-or-nothing billing: if the team's wallet cannot cover the projected cost
- /// for every file, the request is rejected with 402 and no detects are created. - ///
- /// - /// One or more media files. Repeat the `files[]` field for each file. Mutually exclusive with `file`. - /// - /// - /// Optional file names to use for the multipart 'files[]' file parts. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// A single `.zip` archive containing media files. Mutually exclusive with `files[]`. - /// - /// - /// POST destination invoked when the batch reaches a terminal state. - /// - /// - /// Run multimodal intelligence on every file in the batch.
- /// Default Value: false - /// - /// - /// Run identity search against the team's saved identities (audio/video only).
- /// Default Value: false - /// - /// - /// Generate visualization artifacts.
- /// Default Value: true - /// - /// - /// Enable audio source tracing on each audio file.
- /// Default Value: false - /// - /// - /// Window size in seconds (audio/video). - /// - /// - /// Start of segment to analyze (seconds). - /// - /// - /// End of segment to analyze (seconds). - /// - /// - /// Cap processed video duration. - /// - /// - /// Use LLM-assisted video analysis. - /// - /// - /// Enable Zero Retention Mode for every file in the batch.
- /// Default Value: false - /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - public async global::System.Threading.Tasks.Task> CreateDetectBatchAsResponseAsync( - global::System.Collections.Generic.IReadOnlyList? files = default, - global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, - global::System.IO.Stream? file = default, - string? filename = default, - string? callbackUrl = default, - bool? intelligence = default, - bool? searchIdentity = default, - bool? visualize = default, - bool? audioSourceTracingEnabled = default, - int? frameLength = default, - double? startRegion = default, - double? endRegion = default, - double? maxVideoSecs = default, - bool? useLlm = default, - bool? zeroRetentionMode = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - - var request = new global::ResembleAI.CreateDetectBatchRequest - { - Files = new global::System.Collections.Generic.List(), - File = global::System.Array.Empty(), - Filename = filename, - CallbackUrl = callbackUrl, - Intelligence = intelligence, - SearchIdentity = searchIdentity, - Visualize = visualize, - AudioSourceTracingEnabled = audioSourceTracingEnabled, - FrameLength = frameLength, - StartRegion = startRegion, - EndRegion = endRegion, - MaxVideoSecs = maxVideoSecs, - UseLlm = useLlm, - ZeroRetentionMode = zeroRetentionMode, - }; - PrepareArguments( - client: HttpClient); - PrepareCreateDetectBatchArguments( - httpClient: HttpClient, - request: request); - - - var __authorizations = global::ResembleAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_CreateDetectBatchSecurityRequirements, - operationName: "CreateDetectBatchAsync"); - - using var __timeoutCancellationTokenSource = global::ResembleAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( - clientOptions: Options, - requestOptions: requestOptions, - cancellationToken: cancellationToken); - var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; - var __effectiveReadResponseAsString = global::ResembleAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( - clientOptions: Options, - requestOptions: requestOptions, - fallbackValue: ReadResponseAsString); - var __maxAttempts = global::ResembleAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( - clientOptions: Options, - requestOptions: requestOptions, - supportsRetry: false); - - global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() - { - - var __pathBuilder = new global::ResembleAI.PathBuilder( - path: "/detect/batch", - baseUri: ResolveBaseUri( - servers: s_CreateDetectBatchServers, - defaultBaseUrl: "https://f.cluster.resemble.ai/")); - var __path = __pathBuilder.ToString(); - __path = global::ResembleAI.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(); - if (files != default) - { - - for (var __iFiles = 0; __iFiles < files.Count; __iFiles++) - { - var __fileNameFiles = filesFileNames != null && - __iFiles < filesFileNames.Count && - filesFileNames[__iFiles] != null - ? filesFileNames[__iFiles] - : $"file{__iFiles}.bin"; - var __contentFiles = new global::System.Net.Http.StreamContent(files[__iFiles]); - __contentFiles.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - __fileNameFiles is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(__fileNameFiles) ?? 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: __contentFiles, - name: "\"files[]\"", - fileName: $"\"{__fileNameFiles}\""); - if (__contentFiles.Headers.ContentDisposition != null) - { - __contentFiles.Headers.ContentDisposition.FileNameStar = null; - } - } - - } - if (file != default) - { - - var __contentFile = new global::System.Net.Http.StreamContent(file); - __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - request.Filename is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch - { - ".aac" => "audio/aac", - ".flac" => "audio/flac", - ".gif" => "image/gif", - ".jpeg" => "image/jpeg", - ".jpg" => "image/jpeg", - ".json" => "application/json", - ".m4a" => "audio/mp4", - ".mp3" => "audio/mpeg", - ".mp4" => "video/mp4", - ".mpeg" => "audio/mpeg", - ".mpga" => "audio/mpeg", - ".oga" => "audio/ogg", - ".ogg" => "audio/ogg", - ".opus" => "audio/ogg", - ".pdf" => "application/pdf", - ".png" => "image/png", - ".txt" => "text/plain", - ".wav" => "audio/wav", - ".weba" => "audio/webm", - ".webm" => "video/webm", - ".webp" => "image/webp", - _ => "application/octet-stream", - }); - __httpRequestContent.Add( - content: __contentFile, - name: "\"file\"", - fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); - if (__contentFile.Headers.ContentDisposition != null) - { - __contentFile.Headers.ContentDisposition.FileNameStar = null; - } - - } - if (request.CallbackUrl != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.CallbackUrl ?? string.Empty), - name: "\"callback_url\""); - - } - if (request.Intelligence != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Intelligence, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"intelligence\""); - - } - if (request.SearchIdentity != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.SearchIdentity, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"search_identity\""); - - } - if (request.Visualize != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Visualize, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"visualize\""); - - } - if (request.AudioSourceTracingEnabled != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.AudioSourceTracingEnabled, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"audio_source_tracing_enabled\""); - - } - if (request.FrameLength != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.FrameLength, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"frame_length\""); - - } - if (request.StartRegion != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.StartRegion, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"start_region\""); - - } - if (request.EndRegion != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.EndRegion, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"end_region\""); - - } - if (request.MaxVideoSecs != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.MaxVideoSecs, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"max_video_secs\""); - - } - if (request.UseLlm != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.UseLlm, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"use_llm\""); - - } - if (request.ZeroRetentionMode != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.ZeroRetentionMode, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), - name: "\"zero_retention_mode\""); - - } - - __httpRequest.Content = __httpRequestContent; - - global::ResembleAI.AutoSDKRequestOptionsSupport.ApplyHeaders( - request: __httpRequest, - clientHeaders: Options.Headers, - requestHeaders: requestOptions?.Headers); - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateDetectBatchRequest( - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: null, - attempt: __attempt); - var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - retryDelay: __retryDelay, - cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); - continue; - } - - if (__response != null && - __attempt < __maxAttempts && - global::ResembleAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) - { - var __retryDelay = global::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: __response, - attempt: __attempt); - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.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); - ProcessCreateDetectBatchResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - if (__response.IsSuccessStatusCode) - { - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateDetectBatch", - methodName: "CreateDetectBatchAsync", - pathTemplate: "\"/detect/batch\"", - 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); - } - // Invalid batch request (missing files, both file and files[] supplied, file count or size exceeded, unsupported file type, or `Prefer: wait` header sent) - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::ResembleAI.Error? __value_400 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - else - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Insufficient balance for the projected batch cost. Response `details` includes per-file estimates. - if ((int)__response.StatusCode == 402) - { - string? __content_402 = null; - global::System.Exception? __exception_402 = null; - global::ResembleAI.Error? __value_402 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_402 = global::ResembleAI.Error.FromJson(__content_402, JsonSerializerContext); - } - else - { - __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_402 = global::ResembleAI.Error.FromJson(__content_402, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_402 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseObject = __value_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - // Intelligence detect limit reached (Default plan). - if ((int)__response.StatusCode == 403) - { - string? __content_403 = null; - global::System.Exception? __exception_403 = null; - global::ResembleAI.Error? __value_403 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_403 = global::ResembleAI.Error.FromJson(__content_403, JsonSerializerContext); - } - else - { - __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_403 = global::ResembleAI.Error.FromJson(__content_403, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_403 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseObject = __value_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - if (__effectiveReadResponseAsString) - { - var __content = await __response.Content.ReadAsStringAsync( - #if NET5_0_OR_GREATER - __effectiveCancellationToken - #endif - ).ConfigureAwait(false); - - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessCreateDetectBatchResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - var __value = global::ResembleAI.DeepfakeDetectionCreateDetectBatchResponse202.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - return new global::ResembleAI.AutoSDKHttpResponse( - statusCode: __response.StatusCode, - headers: global::ResembleAI.AutoSDKHttpResponse.CreateHeaders(__response), - requestUri: __response.RequestMessage?.RequestUri, - body: __value); - } - catch (global::System.Exception __ex) - { - throw new global::ResembleAI.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::ResembleAI.DeepfakeDetectionCreateDetectBatchResponse202.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - return new global::ResembleAI.AutoSDKHttpResponse( - statusCode: __response.StatusCode, - headers: global::ResembleAI.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::ResembleAI.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/ResembleAI/Generated/ResembleAI.SubpackageSpeechToTextClient.CreateTranscript.g.cs b/src/libs/ResembleAI/Generated/ResembleAI.SubpackageSpeechToTextClient.CreateTranscript.g.cs index c60e50a..8302dc5 100644 --- a/src/libs/ResembleAI/Generated/ResembleAI.SubpackageSpeechToTextClient.CreateTranscript.g.cs +++ b/src/libs/ResembleAI/Generated/ResembleAI.SubpackageSpeechToTextClient.CreateTranscript.g.cs @@ -574,950 +574,5 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } - - /// - /// Create transcript job
- /// Submit audio or video for transcription - ///
- /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Optional intelligence question to evaluate after transcription - /// - /// 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 CreateTranscriptAsync( - global::System.IO.Stream? file = default, - string? filename = default, - string? query = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - - var request = new global::ResembleAI.CreateTranscriptRequest - { - File = global::System.Array.Empty(), - Filename = filename, - Query = query, - }; - PrepareArguments( - client: HttpClient); - PrepareCreateTranscriptArguments( - httpClient: HttpClient, - request: request); - - - var __authorizations = global::ResembleAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_CreateTranscriptSecurityRequirements, - operationName: "CreateTranscriptAsync"); - - using var __timeoutCancellationTokenSource = global::ResembleAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( - clientOptions: Options, - requestOptions: requestOptions, - cancellationToken: cancellationToken); - var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; - var __effectiveReadResponseAsString = global::ResembleAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( - clientOptions: Options, - requestOptions: requestOptions, - fallbackValue: ReadResponseAsString); - var __maxAttempts = global::ResembleAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( - clientOptions: Options, - requestOptions: requestOptions, - supportsRetry: false); - - global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() - { - - var __pathBuilder = new global::ResembleAI.PathBuilder( - path: "/speech-to-text", - baseUri: ResolveBaseUri( - servers: s_CreateTranscriptServers, - defaultBaseUrl: "https://f.cluster.resemble.ai/")); - var __path = __pathBuilder.ToString(); - __path = global::ResembleAI.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(); - if (file != default) - { - - var __contentFile = new global::System.Net.Http.StreamContent(file); - __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - request.Filename is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch - { - ".aac" => "audio/aac", - ".flac" => "audio/flac", - ".gif" => "image/gif", - ".jpeg" => "image/jpeg", - ".jpg" => "image/jpeg", - ".json" => "application/json", - ".m4a" => "audio/mp4", - ".mp3" => "audio/mpeg", - ".mp4" => "video/mp4", - ".mpeg" => "audio/mpeg", - ".mpga" => "audio/mpeg", - ".oga" => "audio/ogg", - ".ogg" => "audio/ogg", - ".opus" => "audio/ogg", - ".pdf" => "application/pdf", - ".png" => "image/png", - ".txt" => "text/plain", - ".wav" => "audio/wav", - ".weba" => "audio/webm", - ".webm" => "video/webm", - ".webp" => "image/webp", - _ => "application/octet-stream", - }); - __httpRequestContent.Add( - content: __contentFile, - name: "\"file\"", - fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); - if (__contentFile.Headers.ContentDisposition != null) - { - __contentFile.Headers.ContentDisposition.FileNameStar = null; - } - - } - if (request.Query != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Query ?? string.Empty), - name: "\"query\""); - - } - - __httpRequest.Content = __httpRequestContent; - - global::ResembleAI.AutoSDKRequestOptionsSupport.ApplyHeaders( - request: __httpRequest, - clientHeaders: Options.Headers, - requestHeaders: requestOptions?.Headers); - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateTranscriptRequest( - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: null, - attempt: __attempt); - var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - retryDelay: __retryDelay, - cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); - continue; - } - - if (__response != null && - __attempt < __maxAttempts && - global::ResembleAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) - { - var __retryDelay = global::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: __response, - attempt: __attempt); - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.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); - ProcessCreateTranscriptResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - if (__response.IsSuccessStatusCode) - { - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - httpMethod: "POST", - baseUri: BaseUri, - request: __httpRequest!, - response: __response, - exception: null, - clientOptions: Options, - requestOptions: requestOptions, - attempt: __attemptNumber, - maxAttempts: __maxAttempts, - willRetry: false, - retryDelay: null, - retryReason: global::System.String.Empty, - cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); - } - // Bad request - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::ResembleAI.Error? __value_400 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - else - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - 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); - ProcessCreateTranscriptResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - return - global::ResembleAI.SpeechToTextCreateTranscriptResponse200.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - } - catch (global::System.Exception __ex) - { - throw new global::ResembleAI.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::ResembleAI.SpeechToTextCreateTranscriptResponse200.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::ResembleAI.ApiException( - message: __content ?? __response.ReasonPhrase ?? string.Empty, - innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - } - - } - } - finally - { - __httpRequest?.Dispose(); - } - } - /// - /// Create transcript job
- /// Submit audio or video for transcription - ///
- /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Audio or video file (max 500 MB, 20 minutes) - /// - /// - /// Optional intelligence question to evaluate after transcription - /// - /// 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> CreateTranscriptAsResponseAsync( - global::System.IO.Stream? file = default, - string? filename = default, - string? query = default, - global::ResembleAI.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default) - { - - var request = new global::ResembleAI.CreateTranscriptRequest - { - File = global::System.Array.Empty(), - Filename = filename, - Query = query, - }; - PrepareArguments( - client: HttpClient); - PrepareCreateTranscriptArguments( - httpClient: HttpClient, - request: request); - - - var __authorizations = global::ResembleAI.EndPointSecurityResolver.ResolveAuthorizations( - availableAuthorizations: Authorizations, - securityRequirements: s_CreateTranscriptSecurityRequirements, - operationName: "CreateTranscriptAsync"); - - using var __timeoutCancellationTokenSource = global::ResembleAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( - clientOptions: Options, - requestOptions: requestOptions, - cancellationToken: cancellationToken); - var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; - var __effectiveReadResponseAsString = global::ResembleAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString( - clientOptions: Options, - requestOptions: requestOptions, - fallbackValue: ReadResponseAsString); - var __maxAttempts = global::ResembleAI.AutoSDKRequestOptionsSupport.GetMaxAttempts( - clientOptions: Options, - requestOptions: requestOptions, - supportsRetry: false); - - global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() - { - - var __pathBuilder = new global::ResembleAI.PathBuilder( - path: "/speech-to-text", - baseUri: ResolveBaseUri( - servers: s_CreateTranscriptServers, - defaultBaseUrl: "https://f.cluster.resemble.ai/")); - var __path = __pathBuilder.ToString(); - __path = global::ResembleAI.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(); - if (file != default) - { - - var __contentFile = new global::System.Net.Http.StreamContent(file); - __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( - request.Filename is null - ? "application/octet-stream" - : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch - { - ".aac" => "audio/aac", - ".flac" => "audio/flac", - ".gif" => "image/gif", - ".jpeg" => "image/jpeg", - ".jpg" => "image/jpeg", - ".json" => "application/json", - ".m4a" => "audio/mp4", - ".mp3" => "audio/mpeg", - ".mp4" => "video/mp4", - ".mpeg" => "audio/mpeg", - ".mpga" => "audio/mpeg", - ".oga" => "audio/ogg", - ".ogg" => "audio/ogg", - ".opus" => "audio/ogg", - ".pdf" => "application/pdf", - ".png" => "image/png", - ".txt" => "text/plain", - ".wav" => "audio/wav", - ".weba" => "audio/webm", - ".webm" => "video/webm", - ".webp" => "image/webp", - _ => "application/octet-stream", - }); - __httpRequestContent.Add( - content: __contentFile, - name: "\"file\"", - fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty); - if (__contentFile.Headers.ContentDisposition != null) - { - __contentFile.Headers.ContentDisposition.FileNameStar = null; - } - - } - if (request.Query != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Query ?? string.Empty), - name: "\"query\""); - - } - - __httpRequest.Content = __httpRequestContent; - - global::ResembleAI.AutoSDKRequestOptionsSupport.ApplyHeaders( - request: __httpRequest, - clientHeaders: Options.Headers, - requestHeaders: requestOptions?.Headers); - - PrepareRequest( - client: HttpClient, - request: __httpRequest); - PrepareCreateTranscriptRequest( - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: null, - attempt: __attempt); - var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - retryDelay: __retryDelay, - cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); - continue; - } - - if (__response != null && - __attempt < __maxAttempts && - global::ResembleAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) - { - var __retryDelay = global::ResembleAI.AutoSDKRequestOptionsSupport.GetRetryDelay( - clientOptions: Options, - requestOptions: requestOptions, - response: __response, - attempt: __attempt); - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.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); - ProcessCreateTranscriptResponse( - httpClient: HttpClient, - httpResponseMessage: __response); - if (__response.IsSuccessStatusCode) - { - await global::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - 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::ResembleAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( - clientOptions: Options, - context: global::ResembleAI.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "CreateTranscript", - methodName: "CreateTranscriptAsync", - pathTemplate: "\"/speech-to-text\"", - httpMethod: "POST", - baseUri: BaseUri, - request: __httpRequest!, - response: __response, - exception: null, - clientOptions: Options, - requestOptions: requestOptions, - attempt: __attemptNumber, - maxAttempts: __maxAttempts, - willRetry: false, - retryDelay: null, - retryReason: global::System.String.Empty, - cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); - } - // Bad request - if ((int)__response.StatusCode == 400) - { - string? __content_400 = null; - global::System.Exception? __exception_400 = null; - global::ResembleAI.Error? __value_400 = null; - try - { - if (__effectiveReadResponseAsString) - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - else - { - __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - - __value_400 = global::ResembleAI.Error.FromJson(__content_400, JsonSerializerContext); - } - } - catch (global::System.Exception __ex) - { - __exception_400 = __ex; - } - - throw new global::ResembleAI.ApiException( - message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, - innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( - __response.Headers, - h => h.Key, - h => h.Value), - }; - } - - 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); - ProcessCreateTranscriptResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); - - try - { - __response.EnsureSuccessStatusCode(); - - var __value = global::ResembleAI.SpeechToTextCreateTranscriptResponse200.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - return new global::ResembleAI.AutoSDKHttpResponse( - statusCode: __response.StatusCode, - headers: global::ResembleAI.AutoSDKHttpResponse.CreateHeaders(__response), - requestUri: __response.RequestMessage?.RequestUri, - body: __value); - } - catch (global::System.Exception __ex) - { - throw new global::ResembleAI.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::ResembleAI.SpeechToTextCreateTranscriptResponse200.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); - return new global::ResembleAI.AutoSDKHttpResponse( - statusCode: __response.StatusCode, - headers: global::ResembleAI.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::ResembleAI.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