diff --git a/src/libs/BlockadeLabs/Generated/BlockadeLabs.ISkyboxesClient.GenerateSkybox.g.cs b/src/libs/BlockadeLabs/Generated/BlockadeLabs.ISkyboxesClient.GenerateSkybox.g.cs
index ea6b9eb..06e6218 100644
--- a/src/libs/BlockadeLabs/Generated/BlockadeLabs.ISkyboxesClient.GenerateSkybox.g.cs
+++ b/src/libs/BlockadeLabs/Generated/BlockadeLabs.ISkyboxesClient.GenerateSkybox.g.cs
@@ -97,140 +97,5 @@ public partial interface ISkyboxesClient
string? webhookUrl = default,
global::BlockadeLabs.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
-
- ///
- /// Generate Skybox
- /// Used for generating skyboxes, skybox remixes and depth maps.
- ///
- ///
- /// Text prompt describing the skybox world you wish to create. Maximum number of characters: 550. If you are using skybox_style_id then the maximum number of characters is defined in the max-char response parameter defined for each style.
- /// Example: dark forest
- ///
- ///
- /// Describe things to avoid in the skybox world you wish to create. Maximum number of characters: 200. If you are using skybox_style_id then the maximum number of characters is defined in the negative-text-max-char response parameter defined for each style.
- ///
- ///
- /// Have an AI automatically improve your prompt to generate pro-level results every time (default: false)
- ///
- ///
- /// Send 0 for a random seed generation. Any other number (1-2147483647) set will be used to "freeze" the image generator and create similar images when run again with the same seed and settings.
- ///
- ///
- /// Predefined styles that influence the overall aesthetic of your skybox generation (Fantasy landscape, Anime art style, etc...).
- ///
- ///
- /// ID of a previously generated skybox
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Model used for the control_image. Currently, the only option is: "scribble".
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Scale to be used as initial influence of the "Init Image" for Skybox generation. The default value is 0, allowed range is between 0 and 0.97, where 0 represents no influence and 0.97 represents lots of influence. Only has an effect when using an init_image parameter.
- ///
- ///
- /// Request for high quality depth map. It will be returned in the depth_map_url parameter. (default: false)
- ///
- ///
- /// Optionally, you may specify a webhook url to specify the destination for progress updates
- ///
- /// 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 GenerateSkyboxAsync(
- string prompt,
- string? negativeText = default,
- bool? enhancePrompt = default,
- int? seed = default,
- int? skyboxStyleId = default,
- int? remixImagineId = default,
- global::System.IO.Stream? controlImage = default,
- string? controlImagename = default,
- string? controlModel = default,
- global::System.IO.Stream? initImage = default,
- string? initImagename = default,
- double? initStrength = default,
- bool? returnDepthHq = default,
- string? webhookUrl = default,
- global::BlockadeLabs.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Generate Skybox
- /// Used for generating skyboxes, skybox remixes and depth maps.
- ///
- ///
- /// Text prompt describing the skybox world you wish to create. Maximum number of characters: 550. If you are using skybox_style_id then the maximum number of characters is defined in the max-char response parameter defined for each style.
- /// Example: dark forest
- ///
- ///
- /// Describe things to avoid in the skybox world you wish to create. Maximum number of characters: 200. If you are using skybox_style_id then the maximum number of characters is defined in the negative-text-max-char response parameter defined for each style.
- ///
- ///
- /// Have an AI automatically improve your prompt to generate pro-level results every time (default: false)
- ///
- ///
- /// Send 0 for a random seed generation. Any other number (1-2147483647) set will be used to "freeze" the image generator and create similar images when run again with the same seed and settings.
- ///
- ///
- /// Predefined styles that influence the overall aesthetic of your skybox generation (Fantasy landscape, Anime art style, etc...).
- ///
- ///
- /// ID of a previously generated skybox
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Model used for the control_image. Currently, the only option is: "scribble".
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Scale to be used as initial influence of the "Init Image" for Skybox generation. The default value is 0, allowed range is between 0 and 0.97, where 0 represents no influence and 0.97 represents lots of influence. Only has an effect when using an init_image parameter.
- ///
- ///
- /// Request for high quality depth map. It will be returned in the depth_map_url parameter. (default: false)
- ///
- ///
- /// Optionally, you may specify a webhook url to specify the destination for progress updates
- ///
- /// 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> GenerateSkyboxAsResponseAsync(
- string prompt,
- string? negativeText = default,
- bool? enhancePrompt = default,
- int? seed = default,
- int? skyboxStyleId = default,
- int? remixImagineId = default,
- global::System.IO.Stream? controlImage = default,
- string? controlImagename = default,
- string? controlModel = default,
- global::System.IO.Stream? initImage = default,
- string? initImagename = default,
- double? initStrength = default,
- bool? returnDepthHq = default,
- string? webhookUrl = default,
- global::BlockadeLabs.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/BlockadeLabs/Generated/BlockadeLabs.OptionsSupport.g.cs b/src/libs/BlockadeLabs/Generated/BlockadeLabs.OptionsSupport.g.cs
index 3a98164..9695a64 100644
--- a/src/libs/BlockadeLabs/Generated/BlockadeLabs.OptionsSupport.g.cs
+++ b/src/libs/BlockadeLabs/Generated/BlockadeLabs.OptionsSupport.g.cs
@@ -150,6 +150,84 @@ public interface IAutoSDKAuthorizationProvider
global::BlockadeLabs.AutoSDKHookContext context);
}
+ ///
+ /// Marker keys stamped onto outgoing
+ /// instances so consumer s — and any
+ /// other transport-layer code that runs after AutoSDK's send pipeline — can observe whether
+ /// the resolved Authorization is call-scoped and opt out of overwriting it with a
+ /// rotation-aware account-level credential.
+ ///
+ public static class AutoSDKHttpRequestOptions
+ {
+ ///
+ /// Key under which records the marker. Exposed
+ /// for handlers that target frameworks older than .NET 5 and need to read the value
+ /// through the legacy HttpRequestMessage.Properties bag.
+ ///
+ public const string AuthorizationOverrideKey = "AutoSDK.AuthorizationOverride";
+
+#if NET5_0_OR_GREATER
+ ///
+ /// Strongly-typed for
+ /// the call-scoped Authorization marker on .NET 5+ targets. Consumers should prefer this
+ /// over the legacy HttpRequestMessage.Properties bag where available.
+ ///
+ public static readonly global::System.Net.Http.HttpRequestOptionsKey AuthorizationOverride =
+ new global::System.Net.Http.HttpRequestOptionsKey(AuthorizationOverrideKey);
+#endif
+
+ ///
+ /// Stamps the call-scoped Authorization marker on . AutoSDK's
+ /// built-in calls this whenever the
+ /// resolved auth came from a per-request override or a client-level
+ /// . Hand-written SDK extensions that set a
+ /// non-default Authorization header (e.g. a session-scoped bearer returned by an
+ /// upstream poll) should call this too so downstream rotation handlers know to skip the
+ /// overwrite.
+ ///
+ ///
+ public static void StampAuthorizationOverride(
+ global::System.Net.Http.HttpRequestMessage? request)
+ {
+ if (request is null)
+ {
+ return;
+ }
+
+#if NET5_0_OR_GREATER
+ request.Options.Set(AuthorizationOverride, true);
+#else
+#pragma warning disable CS0618 // HttpRequestMessage.Properties is obsolete in NET5+, but the only option below it.
+ request.Properties[AuthorizationOverrideKey] = true;
+#pragma warning restore CS0618
+#endif
+ }
+
+ ///
+ /// Returns true when previously marked the
+ /// request as carrying a call-scoped Authorization.
+ ///
+ ///
+ public static bool HasAuthorizationOverride(
+ global::System.Net.Http.HttpRequestMessage? request)
+ {
+ if (request is null)
+ {
+ return false;
+ }
+
+#if NET5_0_OR_GREATER
+ return request.Options.TryGetValue(AuthorizationOverride, out var value) && value;
+#else
+#pragma warning disable CS0618
+ return request.Properties.TryGetValue(AuthorizationOverrideKey, out var raw) &&
+ raw is bool flag &&
+ flag;
+#pragma warning restore CS0618
+#endif
+ }
+ }
+
///
/// Built-in that consults
/// before every outgoing
@@ -176,6 +254,7 @@ public sealed class AutoSDKAuthorizationProviderHook : global::BlockadeLabs.Auto
ApplyAuthorization(context.Request, perRequest[index]);
}
+ global::BlockadeLabs.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request);
return;
}
@@ -195,6 +274,8 @@ public sealed class AutoSDKAuthorizationProviderHook : global::BlockadeLabs.Auto
{
ApplyAuthorization(context.Request, resolved[index]);
}
+
+ global::BlockadeLabs.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request);
}
private static void ApplyAuthorization(
diff --git a/src/libs/BlockadeLabs/Generated/BlockadeLabs.SkyboxesClient.GenerateSkybox.g.cs b/src/libs/BlockadeLabs/Generated/BlockadeLabs.SkyboxesClient.GenerateSkybox.g.cs
index bbfba79..0e8d2bd 100644
--- a/src/libs/BlockadeLabs/Generated/BlockadeLabs.SkyboxesClient.GenerateSkybox.g.cs
+++ b/src/libs/BlockadeLabs/Generated/BlockadeLabs.SkyboxesClient.GenerateSkybox.g.cs
@@ -687,1202 +687,5 @@ request.InitImagename is null
requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
-
- ///
- /// Generate Skybox
- /// Used for generating skyboxes, skybox remixes and depth maps.
- ///
- ///
- /// Text prompt describing the skybox world you wish to create. Maximum number of characters: 550. If you are using skybox_style_id then the maximum number of characters is defined in the max-char response parameter defined for each style.
- /// Example: dark forest
- ///
- ///
- /// Describe things to avoid in the skybox world you wish to create. Maximum number of characters: 200. If you are using skybox_style_id then the maximum number of characters is defined in the negative-text-max-char response parameter defined for each style.
- ///
- ///
- /// Have an AI automatically improve your prompt to generate pro-level results every time (default: false)
- ///
- ///
- /// Send 0 for a random seed generation. Any other number (1-2147483647) set will be used to "freeze" the image generator and create similar images when run again with the same seed and settings.
- ///
- ///
- /// Predefined styles that influence the overall aesthetic of your skybox generation (Fantasy landscape, Anime art style, etc...).
- ///
- ///
- /// ID of a previously generated skybox
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Model used for the control_image. Currently, the only option is: "scribble".
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Scale to be used as initial influence of the "Init Image" for Skybox generation. The default value is 0, allowed range is between 0 and 0.97, where 0 represents no influence and 0.97 represents lots of influence. Only has an effect when using an init_image parameter.
- ///
- ///
- /// Request for high quality depth map. It will be returned in the depth_map_url parameter. (default: false)
- ///
- ///
- /// Optionally, you may specify a webhook url to specify the destination for progress updates
- ///
- /// 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 GenerateSkyboxAsync(
- string prompt,
- string? negativeText = default,
- bool? enhancePrompt = default,
- int? seed = default,
- int? skyboxStyleId = default,
- int? remixImagineId = default,
- global::System.IO.Stream? controlImage = default,
- string? controlImagename = default,
- string? controlModel = default,
- global::System.IO.Stream? initImage = default,
- string? initImagename = default,
- double? initStrength = default,
- bool? returnDepthHq = default,
- string? webhookUrl = default,
- global::BlockadeLabs.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
-
- var request = new global::BlockadeLabs.GenerateSkyboxRequest
- {
- Prompt = prompt,
- NegativeText = negativeText,
- EnhancePrompt = enhancePrompt,
- Seed = seed,
- SkyboxStyleId = skyboxStyleId,
- RemixImagineId = remixImagineId,
- ControlImage = global::System.Array.Empty(),
- ControlImagename = controlImagename,
- ControlModel = controlModel,
- InitImage = global::System.Array.Empty(),
- InitImagename = initImagename,
- InitStrength = initStrength,
- ReturnDepthHq = returnDepthHq,
- WebhookUrl = webhookUrl,
- };
- PrepareArguments(
- client: HttpClient);
- PrepareGenerateSkyboxArguments(
- httpClient: HttpClient,
- request: request);
-
-
- var __authorizations = global::BlockadeLabs.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GenerateSkyboxSecurityRequirements,
- operationName: "GenerateSkyboxAsync");
-
- using var __timeoutCancellationTokenSource = global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: false);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::BlockadeLabs.PathBuilder(
- path: "/api/v1/skybox",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- __path = global::BlockadeLabs.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
- name: "\"prompt\"");
-
- if (request.NegativeText != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.NegativeText ?? string.Empty),
- name: "\"negative_text\"");
-
- }
- if (request.EnhancePrompt != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnhancePrompt, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
- name: "\"enhance_prompt\"");
-
- }
- if (request.Seed != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"seed\"");
-
- }
- if (request.SkyboxStyleId != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.SkyboxStyleId, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"skybox_style_id\"");
-
- }
- if (request.RemixImagineId != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RemixImagineId, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"remix_imagine_id\"");
-
- }
- if (controlImage != default)
- {
-
- var __contentControlImage = new global::System.Net.Http.StreamContent(controlImage);
- __contentControlImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
- request.ControlImagename is null
- ? "application/octet-stream"
- : (global::System.IO.Path.GetExtension(request.ControlImagename) ?? string.Empty).ToLowerInvariant() switch
- {
- ".aac" => "audio/aac",
- ".flac" => "audio/flac",
- ".gif" => "image/gif",
- ".jpeg" => "image/jpeg",
- ".jpg" => "image/jpeg",
- ".json" => "application/json",
- ".m4a" => "audio/mp4",
- ".mp3" => "audio/mpeg",
- ".mp4" => "video/mp4",
- ".mpeg" => "audio/mpeg",
- ".mpga" => "audio/mpeg",
- ".oga" => "audio/ogg",
- ".ogg" => "audio/ogg",
- ".opus" => "audio/ogg",
- ".pdf" => "application/pdf",
- ".png" => "image/png",
- ".txt" => "text/plain",
- ".wav" => "audio/wav",
- ".weba" => "audio/webm",
- ".webm" => "video/webm",
- ".webp" => "image/webp",
- _ => "application/octet-stream",
- });
- __httpRequestContent.Add(
- content: __contentControlImage,
- name: "\"control_image\"",
- fileName: request.ControlImagename != null ? $"\"{request.ControlImagename}\"" : string.Empty);
- if (__contentControlImage.Headers.ContentDisposition != null)
- {
- __contentControlImage.Headers.ContentDisposition.FileNameStar = null;
- }
-
- }
- if (request.ControlModel != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.ControlModel ?? string.Empty),
- name: "\"control_model\"");
-
- }
- if (initImage != default)
- {
-
- var __contentInitImage = new global::System.Net.Http.StreamContent(initImage);
- __contentInitImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
- request.InitImagename is null
- ? "application/octet-stream"
- : (global::System.IO.Path.GetExtension(request.InitImagename) ?? string.Empty).ToLowerInvariant() switch
- {
- ".aac" => "audio/aac",
- ".flac" => "audio/flac",
- ".gif" => "image/gif",
- ".jpeg" => "image/jpeg",
- ".jpg" => "image/jpeg",
- ".json" => "application/json",
- ".m4a" => "audio/mp4",
- ".mp3" => "audio/mpeg",
- ".mp4" => "video/mp4",
- ".mpeg" => "audio/mpeg",
- ".mpga" => "audio/mpeg",
- ".oga" => "audio/ogg",
- ".ogg" => "audio/ogg",
- ".opus" => "audio/ogg",
- ".pdf" => "application/pdf",
- ".png" => "image/png",
- ".txt" => "text/plain",
- ".wav" => "audio/wav",
- ".weba" => "audio/webm",
- ".webm" => "video/webm",
- ".webp" => "image/webp",
- _ => "application/octet-stream",
- });
- __httpRequestContent.Add(
- content: __contentInitImage,
- name: "\"init_image\"",
- fileName: request.InitImagename != null ? $"\"{request.InitImagename}\"" : string.Empty);
- if (__contentInitImage.Headers.ContentDisposition != null)
- {
- __contentInitImage.Headers.ContentDisposition.FileNameStar = null;
- }
-
- }
- if (request.InitStrength != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.InitStrength, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"init_strength\"");
-
- }
- if (request.ReturnDepthHq != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.ReturnDepthHq, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
- name: "\"return_depth_hq\"");
-
- }
- if (request.WebhookUrl != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.WebhookUrl ?? string.Empty),
- name: "\"webhook_url\"");
-
- }
-
- __httpRequest.Content = __httpRequestContent;
-
- global::BlockadeLabs.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGenerateSkyboxRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::BlockadeLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::BlockadeLabs.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);
- ProcessGenerateSkyboxResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGenerateSkyboxResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- global::BlockadeLabs.GenerateSkyboxResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::BlockadeLabs.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- return
- await global::BlockadeLabs.GenerateSkyboxResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::BlockadeLabs.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Generate Skybox
- /// Used for generating skyboxes, skybox remixes and depth maps.
- ///
- ///
- /// Text prompt describing the skybox world you wish to create. Maximum number of characters: 550. If you are using skybox_style_id then the maximum number of characters is defined in the max-char response parameter defined for each style.
- /// Example: dark forest
- ///
- ///
- /// Describe things to avoid in the skybox world you wish to create. Maximum number of characters: 200. If you are using skybox_style_id then the maximum number of characters is defined in the negative-text-max-char response parameter defined for each style.
- ///
- ///
- /// Have an AI automatically improve your prompt to generate pro-level results every time (default: false)
- ///
- ///
- /// Send 0 for a random seed generation. Any other number (1-2147483647) set will be used to "freeze" the image generator and create similar images when run again with the same seed and settings.
- ///
- ///
- /// Predefined styles that influence the overall aesthetic of your skybox generation (Fantasy landscape, Anime art style, etc...).
- ///
- ///
- /// ID of a previously generated skybox
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Control image used to influence the generation. The image needs to be exacly 1024 pixels wide and 512 pixels tall PNG equirectangular projection image of a scribble with black (#00000) background and white (#ffffff) brush strokes. For "scribble" effect you will also need to send control_model="scribble".
- ///
- ///
- /// Model used for the control_image. Currently, the only option is: "scribble".
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Image (Binary/Base64 string/Absolute URL) to be used as initial image for Skybox generation. Please use equirectangular 360° images. 2:1 aspect ratio recommended. Maximum file size is 50 megabytes.
- ///
- ///
- /// Scale to be used as initial influence of the "Init Image" for Skybox generation. The default value is 0, allowed range is between 0 and 0.97, where 0 represents no influence and 0.97 represents lots of influence. Only has an effect when using an init_image parameter.
- ///
- ///
- /// Request for high quality depth map. It will be returned in the depth_map_url parameter. (default: false)
- ///
- ///
- /// Optionally, you may specify a webhook url to specify the destination for progress updates
- ///
- /// 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> GenerateSkyboxAsResponseAsync(
- string prompt,
- string? negativeText = default,
- bool? enhancePrompt = default,
- int? seed = default,
- int? skyboxStyleId = default,
- int? remixImagineId = default,
- global::System.IO.Stream? controlImage = default,
- string? controlImagename = default,
- string? controlModel = default,
- global::System.IO.Stream? initImage = default,
- string? initImagename = default,
- double? initStrength = default,
- bool? returnDepthHq = default,
- string? webhookUrl = default,
- global::BlockadeLabs.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
-
- var request = new global::BlockadeLabs.GenerateSkyboxRequest
- {
- Prompt = prompt,
- NegativeText = negativeText,
- EnhancePrompt = enhancePrompt,
- Seed = seed,
- SkyboxStyleId = skyboxStyleId,
- RemixImagineId = remixImagineId,
- ControlImage = global::System.Array.Empty(),
- ControlImagename = controlImagename,
- ControlModel = controlModel,
- InitImage = global::System.Array.Empty(),
- InitImagename = initImagename,
- InitStrength = initStrength,
- ReturnDepthHq = returnDepthHq,
- WebhookUrl = webhookUrl,
- };
- PrepareArguments(
- client: HttpClient);
- PrepareGenerateSkyboxArguments(
- httpClient: HttpClient,
- request: request);
-
-
- var __authorizations = global::BlockadeLabs.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GenerateSkyboxSecurityRequirements,
- operationName: "GenerateSkyboxAsync");
-
- using var __timeoutCancellationTokenSource = global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: false);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::BlockadeLabs.PathBuilder(
- path: "/api/v1/skybox",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- __path = global::BlockadeLabs.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
- name: "\"prompt\"");
-
- if (request.NegativeText != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.NegativeText ?? string.Empty),
- name: "\"negative_text\"");
-
- }
- if (request.EnhancePrompt != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnhancePrompt, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
- name: "\"enhance_prompt\"");
-
- }
- if (request.Seed != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"seed\"");
-
- }
- if (request.SkyboxStyleId != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.SkyboxStyleId, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"skybox_style_id\"");
-
- }
- if (request.RemixImagineId != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RemixImagineId, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"remix_imagine_id\"");
-
- }
- if (controlImage != default)
- {
-
- var __contentControlImage = new global::System.Net.Http.StreamContent(controlImage);
- __contentControlImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
- request.ControlImagename is null
- ? "application/octet-stream"
- : (global::System.IO.Path.GetExtension(request.ControlImagename) ?? string.Empty).ToLowerInvariant() switch
- {
- ".aac" => "audio/aac",
- ".flac" => "audio/flac",
- ".gif" => "image/gif",
- ".jpeg" => "image/jpeg",
- ".jpg" => "image/jpeg",
- ".json" => "application/json",
- ".m4a" => "audio/mp4",
- ".mp3" => "audio/mpeg",
- ".mp4" => "video/mp4",
- ".mpeg" => "audio/mpeg",
- ".mpga" => "audio/mpeg",
- ".oga" => "audio/ogg",
- ".ogg" => "audio/ogg",
- ".opus" => "audio/ogg",
- ".pdf" => "application/pdf",
- ".png" => "image/png",
- ".txt" => "text/plain",
- ".wav" => "audio/wav",
- ".weba" => "audio/webm",
- ".webm" => "video/webm",
- ".webp" => "image/webp",
- _ => "application/octet-stream",
- });
- __httpRequestContent.Add(
- content: __contentControlImage,
- name: "\"control_image\"",
- fileName: request.ControlImagename != null ? $"\"{request.ControlImagename}\"" : string.Empty);
- if (__contentControlImage.Headers.ContentDisposition != null)
- {
- __contentControlImage.Headers.ContentDisposition.FileNameStar = null;
- }
-
- }
- if (request.ControlModel != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.ControlModel ?? string.Empty),
- name: "\"control_model\"");
-
- }
- if (initImage != default)
- {
-
- var __contentInitImage = new global::System.Net.Http.StreamContent(initImage);
- __contentInitImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
- request.InitImagename is null
- ? "application/octet-stream"
- : (global::System.IO.Path.GetExtension(request.InitImagename) ?? string.Empty).ToLowerInvariant() switch
- {
- ".aac" => "audio/aac",
- ".flac" => "audio/flac",
- ".gif" => "image/gif",
- ".jpeg" => "image/jpeg",
- ".jpg" => "image/jpeg",
- ".json" => "application/json",
- ".m4a" => "audio/mp4",
- ".mp3" => "audio/mpeg",
- ".mp4" => "video/mp4",
- ".mpeg" => "audio/mpeg",
- ".mpga" => "audio/mpeg",
- ".oga" => "audio/ogg",
- ".ogg" => "audio/ogg",
- ".opus" => "audio/ogg",
- ".pdf" => "application/pdf",
- ".png" => "image/png",
- ".txt" => "text/plain",
- ".wav" => "audio/wav",
- ".weba" => "audio/webm",
- ".webm" => "video/webm",
- ".webp" => "image/webp",
- _ => "application/octet-stream",
- });
- __httpRequestContent.Add(
- content: __contentInitImage,
- name: "\"init_image\"",
- fileName: request.InitImagename != null ? $"\"{request.InitImagename}\"" : string.Empty);
- if (__contentInitImage.Headers.ContentDisposition != null)
- {
- __contentInitImage.Headers.ContentDisposition.FileNameStar = null;
- }
-
- }
- if (request.InitStrength != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.InitStrength, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
- name: "\"init_strength\"");
-
- }
- if (request.ReturnDepthHq != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.ReturnDepthHq, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
- name: "\"return_depth_hq\"");
-
- }
- if (request.WebhookUrl != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent(request.WebhookUrl ?? string.Empty),
- name: "\"webhook_url\"");
-
- }
-
- __httpRequest.Content = __httpRequestContent;
-
- global::BlockadeLabs.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGenerateSkyboxRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::BlockadeLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::BlockadeLabs.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::BlockadeLabs.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);
- ProcessGenerateSkyboxResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::BlockadeLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::BlockadeLabs.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GenerateSkybox",
- methodName: "GenerateSkyboxAsync",
- pathTemplate: "\"/api/v1/skybox\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest!,
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGenerateSkyboxResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::BlockadeLabs.GenerateSkyboxResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::BlockadeLabs.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::BlockadeLabs.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw new global::BlockadeLabs.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::BlockadeLabs.GenerateSkyboxResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::BlockadeLabs.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::BlockadeLabs.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::BlockadeLabs.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
}
}
\ No newline at end of file