diff --git a/src/libs/Shotstack/Generated/Shotstack.EditClient.GetModel.g.cs b/src/libs/Shotstack/Generated/Shotstack.EditClient.GetModel.g.cs new file mode 100644 index 0000000..0f3cb63 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.EditClient.GetModel.g.cs @@ -0,0 +1,447 @@ + +#nullable enable + +namespace Shotstack +{ + public partial class EditClient + { + + + private static readonly global::Shotstack.EndPointSecurityRequirement s_GetModelSecurityRequirement0 = + new global::Shotstack.EndPointSecurityRequirement + { + Authorizations = new global::Shotstack.EndPointAuthorizationRequirement[] + { new global::Shotstack.EndPointAuthorizationRequirement + { + Type = "", + SchemeId = "DeveloperKey", + Location = "", + Name = "", + FriendlyName = "Authorization", + }, + }, + }; + private static readonly global::Shotstack.EndPointSecurityRequirement[] s_GetModelSecurityRequirements = + new global::Shotstack.EndPointSecurityRequirement[] + { s_GetModelSecurityRequirement0, + }; + partial void PrepareGetModelArguments( + global::System.Net.Http.HttpClient httpClient, + ref string id); + partial void PrepareGetModelRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string id); + partial void ProcessGetModelResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetModelResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get Generation Model
+ /// Get one generation model, including the JSON Schema for the options it accepts and
+ /// what it costs in credits.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// + /// 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 GetModelAsync( + string id, + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetModelAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get Generation Model
+ /// Get one generation model, including the JSON Schema for the options it accepts and
+ /// what it costs in credits.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// + /// 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> GetModelAsResponseAsync( + string id, + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetModelArguments( + httpClient: HttpClient, + id: ref id); + + + var __authorizations = global::Shotstack.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetModelSecurityRequirements, + operationName: "GetModelAsync"); + + using var __timeoutCancellationTokenSource = global::Shotstack.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Shotstack.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Shotstack.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Shotstack.PathBuilder( + path: $"/edit/v1/models/{id}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Shotstack.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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 + global::Shotstack.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetModelRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + id: id!); + + global::Shotstack.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest); + + 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::Shotstack.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModel", + methodName: "GetModelAsync", + pathTemplate: "$\"/edit/v1/models/{id}\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModel", + methodName: "GetModelAsync", + pathTemplate: "$\"/edit/v1/models/{id}\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Shotstack.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Shotstack.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModel", + methodName: "GetModelAsync", + pathTemplate: "$\"/edit/v1/models/{id}\"", + httpMethod: "GET", + 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::Shotstack.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); + ProcessGetModelResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModel", + methodName: "GetModelAsync", + pathTemplate: "$\"/edit/v1/models/{id}\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModel", + methodName: "GetModelAsync", + pathTemplate: "$\"/edit/v1/models/{id}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Shotstack.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetModelResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Shotstack.GenerationModel.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Shotstack.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Shotstack.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Shotstack.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + 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::Shotstack.GenerationModel.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Shotstack.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Shotstack.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 global::Shotstack.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + 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/Shotstack/Generated/Shotstack.EditClient.GetModels.g.cs b/src/libs/Shotstack/Generated/Shotstack.EditClient.GetModels.g.cs new file mode 100644 index 0000000..f2cc4b5 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.EditClient.GetModels.g.cs @@ -0,0 +1,416 @@ + +#nullable enable + +namespace Shotstack +{ + public partial class EditClient + { + + + private static readonly global::Shotstack.EndPointSecurityRequirement s_GetModelsSecurityRequirement0 = + new global::Shotstack.EndPointSecurityRequirement + { + Authorizations = new global::Shotstack.EndPointAuthorizationRequirement[] + { new global::Shotstack.EndPointAuthorizationRequirement + { + Type = "", + SchemeId = "DeveloperKey", + Location = "", + Name = "", + FriendlyName = "Authorization", + }, + }, + }; + private static readonly global::Shotstack.EndPointSecurityRequirement[] s_GetModelsSecurityRequirements = + new global::Shotstack.EndPointSecurityRequirement[] + { s_GetModelsSecurityRequirement0, + }; + partial void PrepareGetModelsArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareGetModelsRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessGetModelsResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetModelsResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Generation Models
+ /// List the generation models available for `prompt`-bearing image, video and audio
+ /// assets, with the options each accepts and what it costs in credits.
+ /// Use this to populate a model picker and render its option fields, rather than
+ /// hard coding a model list. A newly launched model appears here without any change
+ /// on your side. Each entry carries the asset type it generates, so filter the list
+ /// client side when a picker only needs one kind.
+ /// Option schemas are omitted by default. Request them with `expand=options`.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// 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 GetModelsAsync( + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetModelsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Generation Models
+ /// List the generation models available for `prompt`-bearing image, video and audio
+ /// assets, with the options each accepts and what it costs in credits.
+ /// Use this to populate a model picker and render its option fields, rather than
+ /// hard coding a model list. A newly launched model appears here without any change
+ /// on your side. Each entry carries the asset type it generates, so filter the list
+ /// client side when a picker only needs one kind.
+ /// Option schemas are omitted by default. Request them with `expand=options`.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// 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> GetModelsAsResponseAsync( + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetModelsArguments( + httpClient: HttpClient); + + + var __authorizations = global::Shotstack.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetModelsSecurityRequirements, + operationName: "GetModelsAsync"); + + using var __timeoutCancellationTokenSource = global::Shotstack.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Shotstack.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Shotstack.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Shotstack.PathBuilder( + path: "/edit/v1/models", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Shotstack.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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 + global::Shotstack.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetModelsRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); + + global::Shotstack.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest); + + 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::Shotstack.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModels", + methodName: "GetModelsAsync", + pathTemplate: "\"/edit/v1/models\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModels", + methodName: "GetModelsAsync", + pathTemplate: "\"/edit/v1/models\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Shotstack.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Shotstack.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModels", + methodName: "GetModelsAsync", + pathTemplate: "\"/edit/v1/models\"", + httpMethod: "GET", + 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::Shotstack.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); + ProcessGetModelsResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Shotstack.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModels", + methodName: "GetModelsAsync", + pathTemplate: "\"/edit/v1/models\"", + httpMethod: "GET", + 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::Shotstack.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Shotstack.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetModels", + methodName: "GetModelsAsync", + pathTemplate: "\"/edit/v1/models\"", + httpMethod: "GET", + 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); + ProcessGetModelsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Shotstack.GenerationModelListResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Shotstack.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Shotstack.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Shotstack.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + 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::Shotstack.GenerationModelListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Shotstack.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Shotstack.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 global::Shotstack.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + 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/Shotstack/Generated/Shotstack.IEditClient.GetModel.g.cs b/src/libs/Shotstack/Generated/Shotstack.IEditClient.GetModel.g.cs new file mode 100644 index 0000000..cd05409 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.IEditClient.GetModel.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Shotstack +{ + public partial interface IEditClient + { + /// + /// Get Generation Model
+ /// Get one generation model, including the JSON Schema for the options it accepts and
+ /// what it costs in credits.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// + /// 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 GetModelAsync( + string id, + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get Generation Model
+ /// Get one generation model, including the JSON Schema for the options it accepts and
+ /// what it costs in credits.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// + /// 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> GetModelAsResponseAsync( + string id, + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.IEditClient.GetModels.g.cs b/src/libs/Shotstack/Generated/Shotstack.IEditClient.GetModels.g.cs new file mode 100644 index 0000000..6d66aae --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.IEditClient.GetModels.g.cs @@ -0,0 +1,42 @@ +#nullable enable + +namespace Shotstack +{ + public partial interface IEditClient + { + /// + /// List Generation Models
+ /// List the generation models available for `prompt`-bearing image, video and audio
+ /// assets, with the options each accepts and what it costs in credits.
+ /// Use this to populate a model picker and render its option fields, rather than
+ /// hard coding a model list. A newly launched model appears here without any change
+ /// on your side. Each entry carries the asset type it generates, so filter the list
+ /// client side when a picker only needs one kind.
+ /// Option schemas are omitted by default. Request them with `expand=options`.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// 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 GetModelsAsync( + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Generation Models
+ /// List the generation models available for `prompt`-bearing image, video and audio
+ /// assets, with the options each accepts and what it costs in credits.
+ /// Use this to populate a model picker and render its option fields, rather than
+ /// hard coding a model list. A newly launched model appears here without any change
+ /// on your side. Each entry carries the asset type it generates, so filter the list
+ /// client side when a picker only needs one kind.
+ /// Option schemas are omitted by default. Request them with `expand=options`.
+ /// **Base URL:** <a href="#">https://api.shotstack.io/edit/{version}</a> + ///
+ /// 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> GetModelsAsResponseAsync( + global::Shotstack.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnit.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnit.g.cs new file mode 100644 index 0000000..775383d --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnit.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Shotstack.JsonConverters +{ + /// + public sealed class GenerationModelPricingUnitJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Shotstack.GenerationModelPricingUnit Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Shotstack.GenerationModelPricingUnitExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Shotstack.GenerationModelPricingUnit)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Shotstack.GenerationModelPricingUnit); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Shotstack.GenerationModelPricingUnit value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Shotstack.GenerationModelPricingUnitExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnitNullable.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnitNullable.g.cs new file mode 100644 index 0000000..7d37d07 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelPricingUnitNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Shotstack.JsonConverters +{ + /// + public sealed class GenerationModelPricingUnitNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Shotstack.GenerationModelPricingUnit? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Shotstack.GenerationModelPricingUnitExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Shotstack.GenerationModelPricingUnit)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Shotstack.GenerationModelPricingUnit?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Shotstack.GenerationModelPricingUnit? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Shotstack.GenerationModelPricingUnitExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelType.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelType.g.cs new file mode 100644 index 0000000..ff2d7c0 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Shotstack.JsonConverters +{ + /// + public sealed class GenerationModelTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Shotstack.GenerationModelType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Shotstack.GenerationModelTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Shotstack.GenerationModelType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Shotstack.GenerationModelType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Shotstack.GenerationModelType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Shotstack.GenerationModelTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelTypeNullable.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelTypeNullable.g.cs new file mode 100644 index 0000000..c9a7143 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.JsonConverters.GenerationModelTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Shotstack.JsonConverters +{ + /// + public sealed class GenerationModelTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Shotstack.GenerationModelType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Shotstack.GenerationModelTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Shotstack.GenerationModelType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Shotstack.GenerationModelType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Shotstack.GenerationModelType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Shotstack.GenerationModelTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContext.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContext.g.cs index d5e5342..352fccf 100644 --- a/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContext.g.cs +++ b/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContext.g.cs @@ -325,6 +325,14 @@ namespace Shotstack typeof(global::Shotstack.JsonConverters.GenerationResponseStatusNullableJsonConverter), + typeof(global::Shotstack.JsonConverters.GenerationModelPricingUnitJsonConverter), + + typeof(global::Shotstack.JsonConverters.GenerationModelPricingUnitNullableJsonConverter), + + typeof(global::Shotstack.JsonConverters.GenerationModelTypeJsonConverter), + + typeof(global::Shotstack.JsonConverters.GenerationModelTypeNullableJsonConverter), + typeof(global::Shotstack.JsonConverters.AssetJsonConverter), typeof(global::Shotstack.JsonConverters.DestinationsJsonConverter), @@ -363,6 +371,8 @@ namespace Shotstack typeof(global::Shotstack.JsonConverters.OneOfJsonConverter>), + typeof(global::Shotstack.JsonConverters.OneOfJsonConverter), + typeof(global::Shotstack.JsonConverters.OneOfJsonConverter), typeof(global::Shotstack.JsonConverters.UnixTimestampJsonConverter), @@ -606,6 +616,14 @@ namespace Shotstack [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.AzureBlobStorageDestinationOptions))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationResponseStatus), TypeInfoPropertyName = "GenerationResponseStatus2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationModelPricing))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationModelPricingUnit), TypeInfoPropertyName = "GenerationModelPricingUnit2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.OneOf), TypeInfoPropertyName = "OneOfDoubleObject2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationModel))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationModelType), TypeInfoPropertyName = "GenerationModelType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.GenerationModelListResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.PostGenerateRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Shotstack.OneOf), TypeInfoPropertyName = "OneOfImageAssetVideoAssetAudioAsset2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] @@ -624,6 +642,8 @@ namespace Shotstack [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] public sealed partial class SourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext { } diff --git a/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContextTypes.g.cs b/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContextTypes.g.cs index 23faca7..9b1e934 100644 --- a/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContextTypes.g.cs +++ b/src/libs/Shotstack/Generated/Shotstack.JsonSerializerContextTypes.g.cs @@ -980,11 +980,43 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Shotstack.PostGenerateRequest? Type238 { get; set; } + public global::Shotstack.GenerationModelPricing? Type238 { get; set; } /// /// /// - public global::Shotstack.OneOf? Type239 { get; set; } + public global::Shotstack.GenerationModelPricingUnit? Type239 { get; set; } + /// + /// + /// + public global::Shotstack.OneOf? Type240 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type241 { get; set; } + /// + /// + /// + public global::Shotstack.GenerationModel? Type242 { get; set; } + /// + /// + /// + public global::Shotstack.GenerationModelType? Type243 { get; set; } + /// + /// + /// + public global::Shotstack.GenerationModelListResponse? Type244 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type245 { get; set; } + /// + /// + /// + public global::Shotstack.PostGenerateRequest? Type246 { get; set; } + /// + /// + /// + public global::Shotstack.OneOf? Type247 { get; set; } /// /// @@ -1050,5 +1082,13 @@ public sealed partial class JsonSerializerContextTypes /// /// public global::System.Collections.Generic.List? ListType15 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType16 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType17 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.Json.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.Json.g.cs new file mode 100644 index 0000000..0cea974 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Shotstack +{ + public sealed partial class GenerationModel + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Shotstack.GenerationModel? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Shotstack.GenerationModel), + jsonSerializerContext) as global::Shotstack.GenerationModel; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Shotstack.GenerationModel? FromJson( + string json) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Shotstack.GenerationModel? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Shotstack.GenerationModel), + jsonSerializerContext).ConfigureAwait(false)) as global::Shotstack.GenerationModel; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.g.cs new file mode 100644 index 0000000..433d9a3 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModel.g.cs @@ -0,0 +1,88 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts and what it costs. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release. + /// + public sealed partial class GenerationModel + { + /// + /// The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.
+ /// Example: seedance-2.0 + ///
+ /// seedance-2.0 + [global::System.Text.Json.Serialization.JsonPropertyName("model")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Model { get; set; } + + /// + /// The asset type this model generates.
+ /// Example: video + ///
+ /// video + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Shotstack.JsonConverters.GenerationModelTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Shotstack.GenerationModelType Type { get; set; } + + /// + /// What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("pricing")] + public global::Shotstack.GenerationModelPricing? Pricing { get; set; } + + /// + /// JSON Schema for the model's `options` object. Only returned for a single model, or for a list requested with `expand=options`. Values outside this schema are rejected. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("options")] + public object? Options { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.
+ /// Example: seedance-2.0 + /// + /// + /// The asset type this model generates.
+ /// Example: video + /// + /// + /// What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it. + /// + /// + /// JSON Schema for the model's `options` object. Only returned for a single model, or for a list requested with `expand=options`. Values outside this schema are rejected. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerationModel( + string model, + global::Shotstack.GenerationModelType type, + global::Shotstack.GenerationModelPricing? pricing, + object? options) + { + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Type = type; + this.Pricing = pricing; + this.Options = options; + } + + /// + /// Initializes a new instance of the class. + /// + public GenerationModel() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.Json.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.Json.g.cs new file mode 100644 index 0000000..205ec34 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Shotstack +{ + public sealed partial class GenerationModelListResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelListResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Shotstack.GenerationModelListResponse), + jsonSerializerContext) as global::Shotstack.GenerationModelListResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelListResponse? FromJson( + string json) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Shotstack.GenerationModelListResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Shotstack.GenerationModelListResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Shotstack.GenerationModelListResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.g.cs new file mode 100644 index 0000000..9ac9158 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelListResponse.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// The generation models available to this account. + /// + public sealed partial class GenerationModelListResponse + { + /// + /// The available models. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("models")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Models { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The available models. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerationModelListResponse( + global::System.Collections.Generic.IList models) + { + this.Models = models ?? throw new global::System.ArgumentNullException(nameof(models)); + } + + /// + /// Initializes a new instance of the class. + /// + public GenerationModelListResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.Json.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.Json.g.cs new file mode 100644 index 0000000..cc25d51 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Shotstack +{ + public sealed partial class GenerationModelOptions + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelOptions? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Shotstack.GenerationModelOptions), + jsonSerializerContext) as global::Shotstack.GenerationModelOptions; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelOptions? FromJson( + string json) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Shotstack.GenerationModelOptions? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Shotstack.GenerationModelOptions), + jsonSerializerContext).ConfigureAwait(false)) as global::Shotstack.GenerationModelOptions; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.g.cs new file mode 100644 index 0000000..f774109 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelOptions.g.cs @@ -0,0 +1,19 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// JSON Schema for the model's `options` object. Only returned for a single model, or for a list requested with `expand=options`. Values outside this schema are rejected. + /// + public sealed partial class GenerationModelOptions + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.Json.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.Json.g.cs new file mode 100644 index 0000000..ef941e8 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Shotstack +{ + public sealed partial class GenerationModelPricing + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelPricing? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Shotstack.GenerationModelPricing), + jsonSerializerContext) as global::Shotstack.GenerationModelPricing; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelPricing? FromJson( + string json) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Shotstack.GenerationModelPricing? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Shotstack.GenerationModelPricing), + jsonSerializerContext).ConfigureAwait(false)) as global::Shotstack.GenerationModelPricing; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.g.cs new file mode 100644 index 0000000..61a64d1 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricing.g.cs @@ -0,0 +1,110 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it. + /// + public sealed partial class GenerationModelPricing + { + /// + /// What one unit is. `render` means the whole generation counts as one unit, whatever its size.
+ /// Example: second + ///
+ /// second + [global::System.Text.Json.Serialization.JsonPropertyName("unit")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Shotstack.JsonConverters.GenerationModelPricingUnitJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Shotstack.GenerationModelPricingUnit Unit { get; set; } + + /// + /// Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.
+ /// Example: {"480p":0.9375,"720p":1.8962,"1080p":4.2625} + ///
+ /// {"480p":0.9375,"720p":1.8962,"1080p":4.2625} + [global::System.Text.Json.Serialization.JsonPropertyName("credits")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Shotstack.JsonConverters.OneOfJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Shotstack.OneOf Credits { get; set; } + + /// + /// The options whose values select the rate, outermost first. Absent when `credits` is a single number.
+ /// Example: [resolution] + ///
+ /// [resolution] + [global::System.Text.Json.Serialization.JsonPropertyName("tieredBy")] + public global::System.Collections.Generic.IList? TieredBy { get; set; } + + /// + /// The fewest units a generation is charged for, when a model has a minimum charge.
+ /// Example: 0.1F + ///
+ /// 0.1F + [global::System.Text.Json.Serialization.JsonPropertyName("minUnits")] + public double? MinUnits { get; set; } + + /// + /// The date this rate took effect, or `legacy` for a rate that predates dated pricing.
+ /// Example: 2026-08-13 + ///
+ /// 2026-08-13 + [global::System.Text.Json.Serialization.JsonPropertyName("effectiveFrom")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string EffectiveFrom { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// What one unit is. `render` means the whole generation counts as one unit, whatever its size.
+ /// Example: second + /// + /// + /// Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.
+ /// Example: {"480p":0.9375,"720p":1.8962,"1080p":4.2625} + /// + /// + /// The date this rate took effect, or `legacy` for a rate that predates dated pricing.
+ /// Example: 2026-08-13 + /// + /// + /// The options whose values select the rate, outermost first. Absent when `credits` is a single number.
+ /// Example: [resolution] + /// + /// + /// The fewest units a generation is charged for, when a model has a minimum charge.
+ /// Example: 0.1F + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerationModelPricing( + global::Shotstack.GenerationModelPricingUnit unit, + global::Shotstack.OneOf credits, + string effectiveFrom, + global::System.Collections.Generic.IList? tieredBy, + double? minUnits) + { + this.Unit = unit; + this.Credits = credits; + this.TieredBy = tieredBy; + this.MinUnits = minUnits; + this.EffectiveFrom = effectiveFrom ?? throw new global::System.ArgumentNullException(nameof(effectiveFrom)); + } + + /// + /// Initializes a new instance of the class. + /// + public GenerationModelPricing() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.Json.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.Json.g.cs new file mode 100644 index 0000000..455d70d --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Shotstack +{ + public sealed partial class GenerationModelPricingCredits + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelPricingCredits? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Shotstack.GenerationModelPricingCredits), + jsonSerializerContext) as global::Shotstack.GenerationModelPricingCredits; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Shotstack.GenerationModelPricingCredits? FromJson( + string json) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Shotstack.GenerationModelPricingCredits? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Shotstack.GenerationModelPricingCredits), + jsonSerializerContext).ConfigureAwait(false)) as global::Shotstack.GenerationModelPricingCredits; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Shotstack.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.g.cs new file mode 100644 index 0000000..62d1646 --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingCredits.g.cs @@ -0,0 +1,19 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// + /// + public sealed partial class GenerationModelPricingCredits + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingUnit.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingUnit.g.cs new file mode 100644 index 0000000..5dfdcfe --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelPricingUnit.g.cs @@ -0,0 +1,64 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// What one unit is. `render` means the whole generation counts as one unit, whatever its size.
+ /// Example: second + ///
+ public enum GenerationModelPricingUnit + { + /// + /// + /// + Minute, + /// + /// + /// + Render, + /// + /// + /// + Second, + /// + /// + /// + ThousandCharacters, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerationModelPricingUnitExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerationModelPricingUnit value) + { + return value switch + { + GenerationModelPricingUnit.Minute => "minute", + GenerationModelPricingUnit.Render => "render", + GenerationModelPricingUnit.Second => "second", + GenerationModelPricingUnit.ThousandCharacters => "thousandCharacters", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerationModelPricingUnit? ToEnum(string value) + { + return value switch + { + "minute" => GenerationModelPricingUnit.Minute, + "render" => GenerationModelPricingUnit.Render, + "second" => GenerationModelPricingUnit.Second, + "thousandCharacters" => GenerationModelPricingUnit.ThousandCharacters, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelType.g.cs b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelType.g.cs new file mode 100644 index 0000000..ae9984c --- /dev/null +++ b/src/libs/Shotstack/Generated/Shotstack.Models.GenerationModelType.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Shotstack +{ + /// + /// The asset type this model generates.
+ /// Example: video + ///
+ public enum GenerationModelType + { + /// + /// + /// + Audio, + /// + /// + /// + Image, + /// + /// + /// + Video, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerationModelTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerationModelType value) + { + return value switch + { + GenerationModelType.Audio => "audio", + GenerationModelType.Image => "image", + GenerationModelType.Video => "video", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerationModelType? ToEnum(string value) + { + return value switch + { + "audio" => GenerationModelType.Audio, + "image" => GenerationModelType.Image, + "video" => GenerationModelType.Video, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Shotstack/openapi.json b/src/libs/Shotstack/openapi.json index 3541986..f9b4d58 100644 --- a/src/libs/Shotstack/openapi.json +++ b/src/libs/Shotstack/openapi.json @@ -569,6 +569,90 @@ } ] }, + "/edit/v1/models": { + "get": { + "description": "List the generation models available for `prompt`-bearing image, video and audio\nassets, with the options each accepts and what it costs in credits.\n\nUse this to populate a model picker and render its option fields, rather than\nhard coding a model list. A newly launched model appears here without any change\non your side. Each entry carries the asset type it generates, so filter the list\nclient side when a picker only needs one kind.\n\nOption schemas are omitted by default. Request them with `expand=options`.\n\n**Base URL:** https://api.shotstack.io/edit/{version}\n", + "summary": "List Generation Models", + "operationId": "getModels", + "responses": { + "200": { + "description": "The available generation models.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationModelListResponse" + } + } + } + } + }, + "security": [ + { + "DeveloperKey": [] + } + ], + "tags": [ + "Edit" + ] + }, + "parameters": [ + { + "in": "query", + "name": "expand", + "required": false, + "description": "Set to `options` to include each model's option schema in the list. Omitted by default to keep the response small.", + "schema": { + "type": "string", + "enum": [ + "options" + ] + }, + "example": "options" + } + ] + }, + "/edit/v1/models/{id}": { + "get": { + "description": "Get one generation model, including the JSON Schema for the options it accepts and\nwhat it costs in credits.\n\n**Base URL:** https://api.shotstack.io/edit/{version}\n", + "summary": "Get Generation Model", + "operationId": "getModel", + "responses": { + "200": { + "description": "The generation model, with its option schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationModel" + } + } + } + }, + "404": { + "description": "No model exists with that identifier." + } + }, + "security": [ + { + "DeveloperKey": [] + } + ], + "tags": [ + "Edit" + ] + }, + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "description": "The model identifier, as returned by the list endpoint.", + "schema": { + "type": "string" + }, + "example": "seedance-2.0" + } + ] + }, "/serve/v1/assets/{id}": { "get": { "responses": { @@ -5653,6 +5737,115 @@ "id", "status" ] + }, + "GenerationModelPricing": { + "description": "What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.", + "properties": { + "unit": { + "description": "What one unit is. `render` means the whole generation counts as one unit, whatever its size.", + "type": "string", + "enum": [ + "render", + "second", + "minute", + "thousandCharacters" + ], + "example": "second" + }, + "credits": { + "description": "Credits per unit. A number when the rate is flat, or an object keyed by the values of the options named in `tieredBy`.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "object", + "additionalProperties": true + } + ], + "example": { + "480p": 0.9375, + "720p": 1.8962, + "1080p": 4.2625 + } + }, + "tieredBy": { + "description": "The options whose values select the rate, outermost first. Absent when `credits` is a single number.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "resolution" + ] + }, + "minUnits": { + "description": "The fewest units a generation is charged for, when a model has a minimum charge.", + "type": "number", + "example": 0.1 + }, + "effectiveFrom": { + "description": "The date this rate took effect, or `legacy` for a rate that predates dated pricing.", + "type": "string", + "example": "2026-08-13" + } + }, + "required": [ + "unit", + "credits", + "effectiveFrom" + ], + "type": "object" + }, + "GenerationModel": { + "description": "A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts and what it costs. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.", + "properties": { + "model": { + "description": "The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.", + "type": "string", + "example": "seedance-2.0" + }, + "type": { + "description": "The asset type this model generates.", + "type": "string", + "enum": [ + "image", + "video", + "audio" + ], + "example": "video" + }, + "pricing": { + "description": "What one generation with this model costs.", + "$ref": "#/components/schemas/GenerationModelPricing" + }, + "options": { + "description": "JSON Schema for the model's `options` object. Only returned for a single model, or for a list requested with `expand=options`. Values outside this schema are rejected.", + "type": "object", + "additionalProperties": true + } + }, + "required": [ + "model", + "type" + ], + "type": "object" + }, + "GenerationModelListResponse": { + "description": "The generation models available to this account.", + "properties": { + "models": { + "description": "The available models.", + "type": "array", + "items": { + "$ref": "#/components/schemas/GenerationModel" + } + } + }, + "required": [ + "models" + ], + "type": "object" } }, "responses": {},