diff --git a/src/libs/PixVerse/Generated/PixVerse.AutoSDKHttpResponse.g.cs b/src/libs/PixVerse/Generated/PixVerse.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..fd235f2 --- /dev/null +++ b/src/libs/PixVerse/Generated/PixVerse.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace PixVerse +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateFusionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateFusionVideo.g.cs index 6f62944..e20fff3 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateFusionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateFusionVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a reference-to-video generation. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateFusionVideoAsResponseAsync( + + global::PixVerse.FusionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a reference-to-video generation. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageTemplate.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageTemplate.g.cs index 4b17ba1..50a1778 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageTemplate.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageTemplate.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create an image from a template. /// + /// + /// 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> CreateImageTemplateAsResponseAsync( + + global::PixVerse.ImageTemplateRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an image from a template. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageToVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageToVideo.g.cs index 9cdae61..aa9ff64 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageToVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateImageToVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create an image-to-video generation. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageToVideoAsResponseAsync( + + global::PixVerse.ImageToVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an image-to-video generation. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateLipSyncVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateLipSyncVideo.g.cs index 533e36d..4fed5e8 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateLipSyncVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateLipSyncVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a lip-sync video. /// + /// + /// 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> CreateLipSyncVideoAsResponseAsync( + + global::PixVerse.LipSyncRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a lip-sync video. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMimicVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMimicVideo.g.cs index 01836af..d0fce31 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMimicVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMimicVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a mimic video generation. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateMimicVideoAsResponseAsync( + + global::PixVerse.MimicVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a mimic video generation. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateModifiedVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateModifiedVideo.g.cs index aba4b70..347351f 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateModifiedVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateModifiedVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Modify an existing video using a prompt. /// + /// + /// 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> CreateModifiedVideoAsResponseAsync( + + global::PixVerse.ModifyVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modify an existing video using a prompt. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMultiTransitionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMultiTransitionVideo.g.cs index 88cf488..016abc1 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMultiTransitionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateMultiTransitionVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a multi-keyframe transition video. /// + /// + /// 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> CreateMultiTransitionVideoAsResponseAsync( + + global::PixVerse.MultiTransitionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a multi-keyframe transition video. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateRestyleVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateRestyleVideo.g.cs index 579de0b..4460014 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateRestyleVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateRestyleVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Restyle a generated or uploaded video. /// + /// + /// 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> CreateRestyleVideoAsResponseAsync( + + global::PixVerse.RestyleVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Restyle a generated or uploaded video. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSoundEffect.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSoundEffect.g.cs index 71c1cd4..5251477 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSoundEffect.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSoundEffect.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Generate sound effects for a video. /// + /// + /// 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> CreateSoundEffectAsResponseAsync( + + global::PixVerse.SoundEffectRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate sound effects for a video. + /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSwapVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSwapVideo.g.cs index 1aa4a12..f150b17 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSwapVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateSwapVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Replace a selected object in a video with an uploaded image. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSwapVideoAsResponseAsync( + + global::PixVerse.SwapVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Replace a selected object in a video with an uploaded image. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTextToVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTextToVideo.g.cs index 137cc9d..b3d0788 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTextToVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTextToVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a text-to-video generation. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateTextToVideoAsResponseAsync( + + global::PixVerse.TextToVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a text-to-video generation. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTransitionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTransitionVideo.g.cs index 7534040..51499d0 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTransitionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateTransitionVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a first-frame to last-frame transition video. /// + /// + /// 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> CreateTransitionVideoAsResponseAsync( + + global::PixVerse.TransitionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a first-frame to last-frame transition video. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoExtension.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoExtension.g.cs index 87da1ba..53bda53 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoExtension.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoExtension.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Extend an existing generated video. /// + /// + /// 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> CreateVideoExtensionAsResponseAsync( + + global::PixVerse.ExtendVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Extend an existing generated video. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoMaskSelection.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoMaskSelection.g.cs index 39ebf92..0aa8841 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoMaskSelection.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.CreateVideoMaskSelection.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Create a mask selection for object replacement. /// + /// + /// 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> CreateVideoMaskSelectionAsResponseAsync( + + global::PixVerse.MaskSelectionRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a mask selection for object replacement. + /// /// /// /// diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetAccountBalance.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetAccountBalance.g.cs index 7b010ea..23e829b 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetAccountBalance.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetAccountBalance.g.cs @@ -13,5 +13,14 @@ public partial interface IPixVerseClient global::System.Threading.Tasks.Task GetAccountBalanceAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get the current PixVerse API account balance. + /// + /// 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> GetAccountBalanceAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetImageResult.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetImageResult.g.cs index e1d3221..ccd1627 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetImageResult.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetImageResult.g.cs @@ -15,5 +15,16 @@ public partial interface IPixVerseClient long imageId, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get image generation status and result URL. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetImageResultAsResponseAsync( + long imageId, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetVideoResult.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetVideoResult.g.cs index f8a06d8..404f11e 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetVideoResult.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.GetVideoResult.g.cs @@ -15,5 +15,16 @@ public partial interface IPixVerseClient long id, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get video generation status and result URL. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetVideoResultAsResponseAsync( + long id, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListLipSyncTtsVoices.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListLipSyncTtsVoices.g.cs index 77c5cdd..89624c9 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListLipSyncTtsVoices.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListLipSyncTtsVoices.g.cs @@ -13,5 +13,14 @@ public partial interface IPixVerseClient global::System.Threading.Tasks.Task ListLipSyncTtsVoicesAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List available lip-sync TTS voices. + /// + /// 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> ListLipSyncTtsVoicesAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListRestyleEffects.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListRestyleEffects.g.cs index 8d974b7..88e69a3 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListRestyleEffects.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.ListRestyleEffects.g.cs @@ -13,5 +13,14 @@ public partial interface IPixVerseClient global::System.Threading.Tasks.Task ListRestyleEffectsAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List supported restyle effects. + /// + /// 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> ListRestyleEffectsAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadImage.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadImage.g.cs index 0df8321..4fac1d1 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadImage.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadImage.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Upload an image for use in generation requests. /// + /// + /// 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> UploadImageAsResponseAsync( + + global::PixVerse.UploadImageRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload an image for use in generation requests. + /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. @@ -29,5 +41,36 @@ public partial interface IPixVerseClient string imagename, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload an image for use in generation requests. + /// + /// + /// The stream to send as the multipart 'image' file part. + /// + /// + /// 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 UploadImageAsync( + global::System.IO.Stream image, + string imagename, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload an image for use in generation requests. + /// + /// + /// The stream to send as the multipart 'image' file part. + /// + /// + /// 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> UploadImageAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadMedia.g.cs b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadMedia.g.cs index 74c16f1..95c2120 100644 --- a/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadMedia.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.IPixVerseClient.UploadMedia.g.cs @@ -19,6 +19,18 @@ public partial interface IPixVerseClient /// /// Upload media for use in generation requests. /// + /// + /// 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> UploadMediaAsResponseAsync( + + global::PixVerse.UploadMediaRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload media for use in generation requests. + /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. @@ -29,5 +41,36 @@ public partial interface IPixVerseClient string medianame, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload media for use in generation requests. + /// + /// + /// The stream to send as the multipart 'media' file part. + /// + /// + /// 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 UploadMediaAsync( + global::System.IO.Stream media, + string medianame, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload media for use in generation requests. + /// + /// + /// The stream to send as the multipart 'media' file part. + /// + /// + /// 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> UploadMediaAsResponseAsync( + global::System.IO.Stream media, + string medianame, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/PixVerse/Generated/PixVerse.OptionsSupport.g.cs b/src/libs/PixVerse/Generated/PixVerse.OptionsSupport.g.cs index f15a61f..e090f90 100644 --- a/src/libs/PixVerse/Generated/PixVerse.OptionsSupport.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::PixVerse.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::PixVerse.AutoSDKClientOptions clientOptions, global::PixVerse.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::PixVerse.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::PixVerse.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateFusionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateFusionVideo.g.cs index c73652d..5d52eb7 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateFusionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateFusionVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateFusionVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateFusionVideoAsync( + global::PixVerse.FusionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateFusionVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a reference-to-video generation. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateFusionVideoAsResponseAsync( + global::PixVerse.FusionVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateFusionVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/fusion/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateFusionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateFusionVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateFusionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateFusionVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateFusionVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateFusionVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateFusionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateFusionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateFusionVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateFusionVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageTemplate.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageTemplate.g.cs index 87840c6..a4dd4b3 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageTemplate.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageTemplate.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateImageTemplateResponseContent( /// public async global::System.Threading.Tasks.Task CreateImageTemplateAsync( + global::PixVerse.ImageTemplateRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateImageTemplateAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an image from a template. + /// + /// + /// 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> CreateImageTemplateAsResponseAsync( + global::PixVerse.ImageTemplateRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateImageTemplateResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/image/template/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateImageTemplateResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateImageTemplateResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateImageTemplateResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateImageTemplateResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateImageTemplateResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateImageTemplateResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateImageTemplateResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateImageTemplateResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateImageTemplateResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.ImageGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.ImageGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateImageTemplateResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.ImageGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.ImageGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageToVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageToVideo.g.cs index 76ecd19..9e4858f 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageToVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateImageToVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateImageToVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateImageToVideoAsync( + global::PixVerse.ImageToVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateImageToVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an image-to-video generation. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateImageToVideoAsResponseAsync( + global::PixVerse.ImageToVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateImageToVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/img/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateImageToVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateImageToVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateImageToVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateImageToVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateImageToVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateImageToVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateImageToVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateImageToVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateImageToVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateImageToVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateLipSyncVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateLipSyncVideo.g.cs index 2cfa3ce..b1ddf34 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateLipSyncVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateLipSyncVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateLipSyncVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateLipSyncVideoAsync( + global::PixVerse.LipSyncRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateLipSyncVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a lip-sync video. + /// + /// + /// 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> CreateLipSyncVideoAsResponseAsync( + global::PixVerse.LipSyncRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateLipSyncVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/lip_sync/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateLipSyncVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateLipSyncVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateLipSyncVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateLipSyncVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateLipSyncVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateLipSyncVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateLipSyncVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateLipSyncVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateLipSyncVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateLipSyncVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMimicVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMimicVideo.g.cs index 7843a2f..9321a18 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMimicVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMimicVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateMimicVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateMimicVideoAsync( + global::PixVerse.MimicVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateMimicVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a mimic video generation. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateMimicVideoAsResponseAsync( + global::PixVerse.MimicVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateMimicVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/mimic/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateMimicVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateMimicVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateMimicVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateMimicVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateMimicVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateMimicVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateMimicVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateMimicVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateMimicVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateMimicVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateModifiedVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateModifiedVideo.g.cs index 347cde9..4884075 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateModifiedVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateModifiedVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateModifiedVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateModifiedVideoAsync( + global::PixVerse.ModifyVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateModifiedVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Modify an existing video using a prompt. + /// + /// + /// 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> CreateModifiedVideoAsResponseAsync( + global::PixVerse.ModifyVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateModifiedVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/modify/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateModifiedVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateModifiedVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateModifiedVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateModifiedVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateModifiedVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateModifiedVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateModifiedVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateModifiedVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateModifiedVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateModifiedVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMultiTransitionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMultiTransitionVideo.g.cs index 81d35e1..572479c 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMultiTransitionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateMultiTransitionVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateMultiTransitionVideoAsync( + global::PixVerse.MultiTransitionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateMultiTransitionVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a multi-keyframe transition video. + /// + /// + /// 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> CreateMultiTransitionVideoAsResponseAsync( + global::PixVerse.MultiTransitionVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/multi_transition/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateMultiTransitionVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateRestyleVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateRestyleVideo.g.cs index 7668768..256bccf 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateRestyleVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateRestyleVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateRestyleVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateRestyleVideoAsync( + global::PixVerse.RestyleVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateRestyleVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Restyle a generated or uploaded video. + /// + /// + /// 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> CreateRestyleVideoAsResponseAsync( + global::PixVerse.RestyleVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateRestyleVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/restyle/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateRestyleVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateRestyleVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateRestyleVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateRestyleVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateRestyleVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateRestyleVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateRestyleVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateRestyleVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateRestyleVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateRestyleVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSoundEffect.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSoundEffect.g.cs index 55aefa8..72a7f88 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSoundEffect.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSoundEffect.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateSoundEffectResponseContent( /// public async global::System.Threading.Tasks.Task CreateSoundEffectAsync( + global::PixVerse.SoundEffectRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSoundEffectAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate sound effects for a video. + /// + /// + /// 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> CreateSoundEffectAsResponseAsync( + global::PixVerse.SoundEffectRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateSoundEffectResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/sound_effect/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateSoundEffectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateSoundEffectResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateSoundEffectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateSoundEffectResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateSoundEffectResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateSoundEffectResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateSoundEffectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateSoundEffectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateSoundEffectResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateSoundEffectResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSwapVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSwapVideo.g.cs index 352ac8e..afc25b3 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSwapVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateSwapVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateSwapVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateSwapVideoAsync( + global::PixVerse.SwapVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSwapVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Replace a selected object in a video with an uploaded image. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateSwapVideoAsResponseAsync( + global::PixVerse.SwapVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateSwapVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/swap/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateSwapVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateSwapVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateSwapVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateSwapVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateSwapVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateSwapVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateSwapVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateSwapVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateSwapVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateSwapVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTextToVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTextToVideo.g.cs index 8d6342c..0e9db1e 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTextToVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTextToVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateTextToVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateTextToVideoAsync( + global::PixVerse.TextToVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateTextToVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a text-to-video generation. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateTextToVideoAsResponseAsync( + global::PixVerse.TextToVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateTextToVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/text/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateTextToVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateTextToVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateTextToVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateTextToVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateTextToVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateTextToVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateTextToVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateTextToVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateTextToVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateTextToVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTransitionVideo.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTransitionVideo.g.cs index f872495..4024c94 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTransitionVideo.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateTransitionVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateTransitionVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateTransitionVideoAsync( + global::PixVerse.TransitionVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateTransitionVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a first-frame to last-frame transition video. + /// + /// + /// 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> CreateTransitionVideoAsResponseAsync( + global::PixVerse.TransitionVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateTransitionVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/transition/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateTransitionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateTransitionVideoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateTransitionVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateTransitionVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateTransitionVideoResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateTransitionVideoResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateTransitionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateTransitionVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateTransitionVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateTransitionVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoExtension.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoExtension.g.cs index 5248987..f05983a 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoExtension.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoExtension.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoExtensionResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoExtensionAsync( + global::PixVerse.ExtendVideoRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoExtensionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Extend an existing generated video. + /// + /// + /// 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> CreateVideoExtensionAsResponseAsync( + global::PixVerse.ExtendVideoRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateVideoExtensionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/extend/generate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateVideoExtensionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateVideoExtensionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateVideoExtensionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateVideoExtensionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateVideoExtensionResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateVideoExtensionResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateVideoExtensionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateVideoExtensionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateVideoExtensionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoGenerationApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateVideoExtensionResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoGenerationApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoMaskSelection.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoMaskSelection.g.cs index 0542a80..fa0d5be 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoMaskSelection.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.CreateVideoMaskSelection.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoMaskSelectionAsync( + global::PixVerse.MaskSelectionRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoMaskSelectionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a mask selection for object replacement. + /// + /// + /// 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> CreateVideoMaskSelectionAsResponseAsync( + global::PixVerse.MaskSelectionRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/mask/selection", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +220,8 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +231,7 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +240,11 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +261,15 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +309,8 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.MaskSelectionApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.MaskSelectionApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -346,9 +391,13 @@ partial void ProcessCreateVideoMaskSelectionResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.MaskSelectionApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.MaskSelectionApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetAccountBalance.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetAccountBalance.g.cs index 126a1aa..6c503fa 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetAccountBalance.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetAccountBalance.g.cs @@ -48,6 +48,23 @@ partial void ProcessGetAccountBalanceResponseContent( public async global::System.Threading.Tasks.Task GetAccountBalanceAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAccountBalanceAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get the current PixVerse API account balance. + /// + /// 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> GetAccountBalanceAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessGetAccountBalanceResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/account/balance", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessGetAccountBalanceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessGetAccountBalanceResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessGetAccountBalanceResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessGetAccountBalanceResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessGetAccountBalanceResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessGetAccountBalanceResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessGetAccountBalanceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessGetAccountBalanceResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -301,9 +337,13 @@ partial void ProcessGetAccountBalanceResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.BalanceApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.BalanceApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -331,9 +371,13 @@ partial void ProcessGetAccountBalanceResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.BalanceApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.BalanceApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetImageResult.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetImageResult.g.cs index 41f5300..abf23da 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetImageResult.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetImageResult.g.cs @@ -52,6 +52,26 @@ partial void ProcessGetImageResultResponseContent( long imageId, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetImageResultAsResponseAsync( + imageId: imageId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get image generation status and result URL. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetImageResultAsResponseAsync( + long imageId, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessGetImageResultResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: $"/image/result/{imageId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessGetImageResultResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessGetImageResultResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -181,6 +209,8 @@ partial void ProcessGetImageResultResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -190,8 +220,7 @@ partial void ProcessGetImageResultResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -200,6 +229,11 @@ partial void ProcessGetImageResultResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -216,14 +250,15 @@ partial void ProcessGetImageResultResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -263,6 +298,8 @@ partial void ProcessGetImageResultResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessGetImageResultResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessGetImageResultResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.ImageResultApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.ImageResultApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -337,9 +380,13 @@ partial void ProcessGetImageResultResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.ImageResultApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.ImageResultApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetVideoResult.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetVideoResult.g.cs index 5bff886..1955208 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetVideoResult.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.GetVideoResult.g.cs @@ -52,6 +52,26 @@ partial void ProcessGetVideoResultResponseContent( long id, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetVideoResultAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get video generation status and result URL. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetVideoResultAsResponseAsync( + long id, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessGetVideoResultResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: $"/video/result/{id}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessGetVideoResultResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessGetVideoResultResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -181,6 +209,8 @@ partial void ProcessGetVideoResultResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -190,8 +220,7 @@ partial void ProcessGetVideoResultResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -200,6 +229,11 @@ partial void ProcessGetVideoResultResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -216,14 +250,15 @@ partial void ProcessGetVideoResultResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -263,6 +298,8 @@ partial void ProcessGetVideoResultResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessGetVideoResultResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessGetVideoResultResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.VideoResultApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.VideoResultApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -337,9 +380,13 @@ partial void ProcessGetVideoResultResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.VideoResultApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.VideoResultApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListLipSyncTtsVoices.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListLipSyncTtsVoices.g.cs index 27adad0..e5a92b6 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListLipSyncTtsVoices.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListLipSyncTtsVoices.g.cs @@ -48,6 +48,23 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( public async global::System.Threading.Tasks.Task ListLipSyncTtsVoicesAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListLipSyncTtsVoicesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List available lip-sync TTS voices. + /// + /// 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> ListLipSyncTtsVoicesAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/lip_sync/tts_list", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -301,9 +337,13 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.LipSyncTtsListApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.LipSyncTtsListApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -331,9 +371,13 @@ partial void ProcessListLipSyncTtsVoicesResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.LipSyncTtsListApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.LipSyncTtsListApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListRestyleEffects.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListRestyleEffects.g.cs index 5a92fc4..d2dd7ee 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListRestyleEffects.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.ListRestyleEffects.g.cs @@ -48,6 +48,23 @@ partial void ProcessListRestyleEffectsResponseContent( public async global::System.Threading.Tasks.Task ListRestyleEffectsAsync( global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListRestyleEffectsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List supported restyle effects. + /// + /// 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> ListRestyleEffectsAsResponseAsync( + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessListRestyleEffectsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/video/restyle/list", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessListRestyleEffectsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessListRestyleEffectsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessListRestyleEffectsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessListRestyleEffectsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessListRestyleEffectsResponseContent( __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessListRestyleEffectsResponseContent( 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::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessListRestyleEffectsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessListRestyleEffectsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -301,9 +337,13 @@ partial void ProcessListRestyleEffectsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.RestyleListApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.RestyleListApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -331,9 +371,13 @@ partial void ProcessListRestyleEffectsResponseContent( #endif ).ConfigureAwait(false); - return - await global::PixVerse.RestyleListApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.RestyleListApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadImage.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadImage.g.cs index 5e4b9d8..f5058e1 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadImage.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadImage.g.cs @@ -50,6 +50,28 @@ partial void ProcessUploadImageResponseContent( /// public async global::System.Threading.Tasks.Task UploadImageAsync( + global::PixVerse.UploadImageRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload an image for use in generation requests. + /// + /// + /// 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> UploadImageAsResponseAsync( + global::PixVerse.UploadImageRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessUploadImageResponseContent( var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/image/upload", baseUri: HttpClient.BaseAddress); @@ -116,6 +139,7 @@ partial void ProcessUploadImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -154,7 +178,9 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -196,6 +222,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -206,6 +234,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -223,6 +256,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -232,8 +267,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -242,6 +276,11 @@ request.Imagename is null __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -258,14 +297,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -305,6 +345,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -325,6 +367,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -349,9 +393,13 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.ImageUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.ImageUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -379,9 +427,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::PixVerse.ImageUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.ImageUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -444,5 +496,830 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload an image for use in generation requests. + /// + /// + /// The stream to send as the multipart 'image' file part. + /// + /// + /// 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 UploadImageAsync( + global::System.IO.Stream image, + string imagename, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::PixVerse.UploadImageRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::PixVerse.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadImageSecurityRequirements, + operationName: "UploadImageAsync"); + + using var __timeoutCancellationTokenSource = global::PixVerse.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::PixVerse.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::PixVerse.PathBuilder( + path: "/image/upload", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::PixVerse.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(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? 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: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadImageRequest( + 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::PixVerse.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.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); + ProcessUploadImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::PixVerse.ImageUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::PixVerse.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::PixVerse.ImageUploadApiResponse.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::PixVerse.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upload an image for use in generation requests. + /// + /// + /// The stream to send as the multipart 'image' file part. + /// + /// + /// 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> UploadImageAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::PixVerse.UploadImageRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::PixVerse.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadImageSecurityRequirements, + operationName: "UploadImageAsync"); + + using var __timeoutCancellationTokenSource = global::PixVerse.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::PixVerse.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::PixVerse.PathBuilder( + path: "/image/upload", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::PixVerse.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(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? 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: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadImageRequest( + 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::PixVerse.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.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); + ProcessUploadImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadImage", + methodName: "UploadImageAsync", + pathTemplate: "\"/image/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::PixVerse.ImageUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::PixVerse.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::PixVerse.ImageUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.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::PixVerse.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/PixVerse/Generated/PixVerse.PixVerseClient.UploadMedia.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadMedia.g.cs index 7c34a70..6a50569 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadMedia.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.UploadMedia.g.cs @@ -50,6 +50,28 @@ partial void ProcessUploadMediaResponseContent( /// public async global::System.Threading.Tasks.Task UploadMediaAsync( + global::PixVerse.UploadMediaRequest request, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadMediaAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload media for use in generation requests. + /// + /// + /// 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> UploadMediaAsResponseAsync( + global::PixVerse.UploadMediaRequest request, global::PixVerse.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessUploadMediaResponseContent( var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::PixVerse.PathBuilder( path: "/media/upload", baseUri: HttpClient.BaseAddress); @@ -116,6 +139,7 @@ partial void ProcessUploadMediaResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentMedia = new global::System.Net.Http.ByteArrayContent(request.Media ?? global::System.Array.Empty()); __contentMedia.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -154,7 +178,9 @@ request.Medianame is null { __contentMedia.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -196,6 +222,8 @@ request.Medianame is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -206,6 +234,11 @@ request.Medianame is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -223,6 +256,8 @@ request.Medianame is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -232,8 +267,7 @@ request.Medianame is null __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -242,6 +276,11 @@ request.Medianame is null __attempt < __maxAttempts && global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -258,14 +297,15 @@ request.Medianame is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -305,6 +345,8 @@ request.Medianame is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -325,6 +367,8 @@ request.Medianame is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -349,9 +393,13 @@ request.Medianame is null { __response.EnsureSuccessStatusCode(); - return - global::PixVerse.MediaUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::PixVerse.MediaUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -379,9 +427,13 @@ request.Medianame is null #endif ).ConfigureAwait(false); - return - await global::PixVerse.MediaUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::PixVerse.MediaUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -444,5 +496,830 @@ request.Medianame is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload media for use in generation requests. + /// + /// + /// The stream to send as the multipart 'media' file part. + /// + /// + /// 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 UploadMediaAsync( + global::System.IO.Stream media, + string medianame, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + media = media ?? throw new global::System.ArgumentNullException(nameof(media)); + var request = new global::PixVerse.UploadMediaRequest + { + Media = global::System.Array.Empty(), + Medianame = medianame, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadMediaArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::PixVerse.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadMediaSecurityRequirements, + operationName: "UploadMediaAsync"); + + using var __timeoutCancellationTokenSource = global::PixVerse.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::PixVerse.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::PixVerse.PathBuilder( + path: "/media/upload", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::PixVerse.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(); + var __contentMedia = new global::System.Net.Http.StreamContent(media); + __contentMedia.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Medianame is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Medianame) ?? 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: __contentMedia, + name: "\"media\"", + fileName: request.Medianame != null ? $"\"{request.Medianame}\"" : string.Empty); + if (__contentMedia.Headers.ContentDisposition != null) + { + __contentMedia.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadMediaRequest( + 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::PixVerse.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.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); + ProcessUploadMediaResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadMediaResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::PixVerse.MediaUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw new global::PixVerse.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::PixVerse.MediaUploadApiResponse.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::PixVerse.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upload media for use in generation requests. + /// + /// + /// The stream to send as the multipart 'media' file part. + /// + /// + /// 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> UploadMediaAsResponseAsync( + global::System.IO.Stream media, + string medianame, + global::PixVerse.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + media = media ?? throw new global::System.ArgumentNullException(nameof(media)); + var request = new global::PixVerse.UploadMediaRequest + { + Media = global::System.Array.Empty(), + Medianame = medianame, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadMediaArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::PixVerse.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadMediaSecurityRequirements, + operationName: "UploadMediaAsync"); + + using var __timeoutCancellationTokenSource = global::PixVerse.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::PixVerse.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::PixVerse.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::PixVerse.PathBuilder( + path: "/media/upload", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::PixVerse.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(); + var __contentMedia = new global::System.Net.Http.StreamContent(media); + __contentMedia.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Medianame is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Medianame) ?? 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: __contentMedia, + name: "\"media\"", + fileName: request.Medianame != null ? $"\"{request.Medianame}\"" : string.Empty); + if (__contentMedia.Headers.ContentDisposition != null) + { + __contentMedia.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::PixVerse.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadMediaRequest( + 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::PixVerse.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::PixVerse.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::PixVerse.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::PixVerse.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); + ProcessUploadMediaResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::PixVerse.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::PixVerse.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadMedia", + methodName: "UploadMediaAsync", + pathTemplate: "\"/media/upload\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadMediaResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::PixVerse.MediaUploadApiResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw new global::PixVerse.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::PixVerse.MediaUploadApiResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::PixVerse.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::PixVerse.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::PixVerse.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/PixVerse/Generated/PixVerse.PixVerseClient.g.cs b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.g.cs index 4188f5f..39f6d67 100644 --- a/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.g.cs +++ b/src/libs/PixVerse/Generated/PixVerse.PixVerseClient.g.cs @@ -73,10 +73,10 @@ public PixVerseClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public PixVerseClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::PixVerse.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::PixVerse.AutoSDKClientOptions? options, bool disposeHttpClient = true) {