diff --git a/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.2.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.2.g.cs index 5e60c80..3e64bc9 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.2.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.2.g.cs @@ -85,6 +85,11 @@ public AnyOf(T1? value) Value1 = value; } + /// + /// + /// + public static AnyOf FromValue1(T1? value) => new AnyOf(value); + /// /// /// @@ -103,6 +108,11 @@ public AnyOf(T2? value) Value2 = value; } + /// + /// + /// + public static AnyOf FromValue2(T2? value) => new AnyOf(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.3.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.3.g.cs index 93810a0..d48c481 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.3.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.AnyOf.3.g.cs @@ -115,6 +115,11 @@ public AnyOf(T1? value) Value1 = value; } + /// + /// + /// + public static AnyOf FromValue1(T1? value) => new AnyOf(value); + /// /// /// @@ -133,6 +138,11 @@ public AnyOf(T2? value) Value2 = value; } + /// + /// + /// + public static AnyOf FromValue2(T2? value) => new AnyOf(value); + /// /// /// @@ -151,6 +161,11 @@ public AnyOf(T3? value) Value3 = value; } + /// + /// + /// + public static AnyOf FromValue3(T3? value) => new AnyOf(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.Content2.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.Content2.g.cs index d6968fa..3b06957 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.Content2.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.Content2.g.cs @@ -121,6 +121,11 @@ public Content2(global::WorldLabs.MediaAssetReference? value) MediaAsset = value; } + /// + /// + /// + public static Content2 FromMediaAsset(global::WorldLabs.MediaAssetReference? value) => new Content2(value); + /// /// /// @@ -139,6 +144,11 @@ public Content2(global::WorldLabs.UriReference? value) Uri = value; } + /// + /// + /// + public static Content2 FromUri(global::WorldLabs.UriReference? value) => new Content2(value); + /// /// /// @@ -157,6 +167,11 @@ public Content2(global::WorldLabs.DataBase64Reference? value) DataBase64 = value; } + /// + /// + /// + public static Content2 FromDataBase64(global::WorldLabs.DataBase64Reference? value) => new Content2(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.DepthPanoImage.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.DepthPanoImage.g.cs index 5705519..fcec2a5 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.DepthPanoImage.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.DepthPanoImage.g.cs @@ -121,6 +121,11 @@ public DepthPanoImage(global::WorldLabs.MediaAssetReference? value) MediaAsset = value; } + /// + /// + /// + public static DepthPanoImage FromMediaAsset(global::WorldLabs.MediaAssetReference? value) => new DepthPanoImage(value); + /// /// /// @@ -139,6 +144,11 @@ public DepthPanoImage(global::WorldLabs.UriReference? value) Uri = value; } + /// + /// + /// + public static DepthPanoImage FromUri(global::WorldLabs.UriReference? value) => new DepthPanoImage(value); + /// /// /// @@ -157,6 +167,11 @@ public DepthPanoImage(global::WorldLabs.DataBase64Reference? value) DataBase64 = value; } + /// + /// + /// + public static DepthPanoImage FromDataBase64(global::WorldLabs.DataBase64Reference? value) => new DepthPanoImage(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.ImagePrompt1.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.ImagePrompt1.g.cs index dc1e81a..f3c3134 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.ImagePrompt1.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.ImagePrompt1.g.cs @@ -121,6 +121,11 @@ public ImagePrompt1(global::WorldLabs.MediaAssetReference? value) MediaAsset = value; } + /// + /// + /// + public static ImagePrompt1 FromMediaAsset(global::WorldLabs.MediaAssetReference? value) => new ImagePrompt1(value); + /// /// /// @@ -139,6 +144,11 @@ public ImagePrompt1(global::WorldLabs.UriReference? value) Uri = value; } + /// + /// + /// + public static ImagePrompt1 FromUri(global::WorldLabs.UriReference? value) => new ImagePrompt1(value); + /// /// /// @@ -157,6 +167,11 @@ public ImagePrompt1(global::WorldLabs.DataBase64Reference? value) DataBase64 = value; } + /// + /// + /// + public static ImagePrompt1 FromDataBase64(global::WorldLabs.DataBase64Reference? value) => new ImagePrompt1(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.VideoPrompt.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.VideoPrompt.g.cs index 5e2bd79..29bb93a 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.VideoPrompt.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.VideoPrompt.g.cs @@ -121,6 +121,11 @@ public VideoPrompt(global::WorldLabs.MediaAssetReference? value) MediaAsset = value; } + /// + /// + /// + public static VideoPrompt FromMediaAsset(global::WorldLabs.MediaAssetReference? value) => new VideoPrompt(value); + /// /// /// @@ -139,6 +144,11 @@ public VideoPrompt(global::WorldLabs.UriReference? value) Uri = value; } + /// + /// + /// + public static VideoPrompt FromUri(global::WorldLabs.UriReference? value) => new VideoPrompt(value); + /// /// /// @@ -157,6 +167,11 @@ public VideoPrompt(global::WorldLabs.DataBase64Reference? value) DataBase64 = value; } + /// + /// + /// + public static VideoPrompt FromDataBase64(global::WorldLabs.DataBase64Reference? value) => new VideoPrompt(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPrompt.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPrompt.g.cs index 9d92c40..e3a28b1 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPrompt.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPrompt.g.cs @@ -160,6 +160,11 @@ public WorldPrompt(global::WorldLabs.WorldTextPromptInput? value) Text = value; } + /// + /// + /// + public static WorldPrompt FromText(global::WorldLabs.WorldTextPromptInput? value) => new WorldPrompt(value); + /// /// /// @@ -178,6 +183,11 @@ public WorldPrompt(global::WorldLabs.ImagePrompt? value) Image = value; } + /// + /// + /// + public static WorldPrompt FromImage(global::WorldLabs.ImagePrompt? value) => new WorldPrompt(value); + /// /// /// @@ -196,6 +206,11 @@ public WorldPrompt(global::WorldLabs.MultiImagePromptInput? value) MultiImage = value; } + /// + /// + /// + public static WorldPrompt FromMultiImage(global::WorldLabs.MultiImagePromptInput? value) => new WorldPrompt(value); + /// /// /// @@ -214,6 +229,11 @@ public WorldPrompt(global::WorldLabs.VideoPromptInput? value) Video = value; } + /// + /// + /// + public static WorldPrompt FromVideo(global::WorldLabs.VideoPromptInput? value) => new WorldPrompt(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPromptVariant1.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPromptVariant1.g.cs index 45b15e5..2dfef7d 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPromptVariant1.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.Models.WorldPromptVariant1.g.cs @@ -217,6 +217,11 @@ public WorldPromptVariant1(global::WorldLabs.WorldTextPromptOutput? value) Text = value; } + /// + /// + /// + public static WorldPromptVariant1 FromText(global::WorldLabs.WorldTextPromptOutput? value) => new WorldPromptVariant1(value); + /// /// /// @@ -235,6 +240,11 @@ public WorldPromptVariant1(global::WorldLabs.Prompt? value) DepthPano1 = value; } + /// + /// + /// + public static WorldPromptVariant1 FromDepthPano1(global::WorldLabs.Prompt? value) => new WorldPromptVariant1(value); + /// /// /// @@ -253,6 +263,11 @@ public WorldPromptVariant1(global::WorldLabs.MultiImagePromptOutput? value) MultiImage = value; } + /// + /// + /// + public static WorldPromptVariant1 FromMultiImage(global::WorldLabs.MultiImagePromptOutput? value) => new WorldPromptVariant1(value); + /// /// /// @@ -271,6 +286,11 @@ public WorldPromptVariant1(global::WorldLabs.VideoPromptOutput? value) Video = value; } + /// + /// + /// + public static WorldPromptVariant1 FromVideo(global::WorldLabs.VideoPromptOutput? value) => new WorldPromptVariant1(value); + /// /// /// @@ -289,6 +309,11 @@ public WorldPromptVariant1(global::WorldLabs.DepthPanoPrompt? value) DepthPano2 = value; } + /// + /// + /// + public static WorldPromptVariant1 FromDepthPano2(global::WorldLabs.DepthPanoPrompt? value) => new WorldPromptVariant1(value); + /// /// /// @@ -307,6 +332,11 @@ public WorldPromptVariant1(global::WorldLabs.InpaintPanoPrompt? value) InpaintPano = value; } + /// + /// + /// + public static WorldPromptVariant1 FromInpaintPano(global::WorldLabs.InpaintPanoPrompt? value) => new WorldPromptVariant1(value); + /// /// /// diff --git a/src/libs/WorldLabs/Generated/WorldLabs.OptionsSupport.g.cs b/src/libs/WorldLabs/Generated/WorldLabs.OptionsSupport.g.cs index 8a1fee6..ce541b8 100644 --- a/src/libs/WorldLabs/Generated/WorldLabs.OptionsSupport.g.cs +++ b/src/libs/WorldLabs/Generated/WorldLabs.OptionsSupport.g.cs @@ -54,6 +54,156 @@ public sealed class AutoSDKClientOptions Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook))); return this; } + + /// + /// Optional per-request authorization provider invoked before each request is sent. + /// Set this when the client is registered as a singleton in DI but each call needs + /// a fresh credential resolved from a provider, secret-store, or session — instead + /// of mutating the shared Authorizations list at construction time. + /// + public global::WorldLabs.IAutoSDKAuthorizationProvider? AuthorizationProvider { get; set; } + + /// + /// Convenience helper that registers + /// using so request-level auth is resolved without + /// touching shared client state. + /// + /// + public global::WorldLabs.AutoSDKClientOptions UseAuthorizationProvider( + global::WorldLabs.IAutoSDKAuthorizationProvider provider) + { + AuthorizationProvider = provider ?? throw new global::System.ArgumentNullException(nameof(provider)); + if (Hooks.Find(static x => x is global::WorldLabs.AutoSDKAuthorizationProviderHook) == null) + { + Hooks.Add(new global::WorldLabs.AutoSDKAuthorizationProviderHook()); + } + + return this; + } + } + + /// + /// A request-level authorization value supplied by . + /// Mirrors the runtime fields the SDK applies for HTTP / OAuth2 / API-key auth without + /// requiring the consumer to construct the generated EndPointAuthorization type. + /// + public readonly struct AutoSDKAuthorizationValue + { + /// + /// Initializes a new . + /// + /// + /// + /// + /// + /// + public AutoSDKAuthorizationValue( + string value, + string scheme = "Bearer", + string? headerName = null, + string location = "Header", + string type = "Http") + { + Value = value ?? string.Empty; + Scheme = string.IsNullOrWhiteSpace(scheme) ? "Bearer" : scheme; + HeaderName = headerName ?? string.Empty; + Location = string.IsNullOrWhiteSpace(location) ? "Header" : location; + Type = string.IsNullOrWhiteSpace(type) ? "Http" : type; + } + + /// The credential value (token, API key, etc.). + public string Value { get; } + + /// The HTTP authorization scheme — typically Bearer, Basic, or Token. + public string Scheme { get; } + + /// The custom header name when is ApiKey; ignored for HTTP/OAuth2 auth. + public string HeaderName { get; } + + /// The credential location — Header, Query, or Cookie. + public string Location { get; } + + /// The auth type — Http, OAuth2, OpenIdConnect, or ApiKey. + public string Type { get; } + + /// Convenience factory for a Bearer token. + public static global::WorldLabs.AutoSDKAuthorizationValue Bearer(string token) => new(value: token, scheme: "Bearer"); + + /// Convenience factory for an API-key header. + public static global::WorldLabs.AutoSDKAuthorizationValue ApiKeyHeader(string name, string value) => + new(value: value, headerName: name, location: "Header", type: "ApiKey"); + } + + /// + /// Resolves request-level authorization values without mutating the shared client + /// authorization list. Implementations should be safe to invoke concurrently — + /// the hook calls them once per outgoing request. + /// + public interface IAutoSDKAuthorizationProvider + { + /// + /// Returns one or more values to apply to + /// the current request, or an empty list / null to leave the request as-is. + /// + /// + global::System.Threading.Tasks.Task?> ResolveAsync( + global::WorldLabs.AutoSDKHookContext context); + } + + /// + /// Built-in that consults + /// before every outgoing + /// request and stamps the resolved values onto the . + /// + public sealed class AutoSDKAuthorizationProviderHook : global::WorldLabs.AutoSDKHook + { + /// + public override async global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::WorldLabs.AutoSDKHookContext context) + { + context = context ?? throw new global::System.ArgumentNullException(nameof(context)); + + var provider = context.ClientOptions?.AuthorizationProvider; + if (provider == null || context.Request == null) + { + return; + } + + var resolved = await provider.ResolveAsync(context).ConfigureAwait(false); + if (resolved == null || resolved.Count == 0) + { + return; + } + + for (var index = 0; index < resolved.Count; index++) + { + ApplyAuthorization(context.Request, resolved[index]); + } + } + + private static void ApplyAuthorization( + global::System.Net.Http.HttpRequestMessage request, + global::WorldLabs.AutoSDKAuthorizationValue authorization) + { + switch (authorization.Type) + { + case "Http": + case "OAuth2": + case "OpenIdConnect": + request.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: authorization.Scheme, + parameter: authorization.Value); + break; + case "ApiKey": + if (string.Equals(authorization.Location, "Header", global::System.StringComparison.OrdinalIgnoreCase) && + !string.IsNullOrEmpty(authorization.HeaderName)) + { + request.Headers.Remove(authorization.HeaderName); + request.Headers.TryAddWithoutValidation(authorization.HeaderName, authorization.Value ?? string.Empty); + } + break; + } + } } ///