diff --git a/src/libs/Recraft/Generated/Recraft.Models.CreateStyleResponse.g.cs b/src/libs/Recraft/Generated/Recraft.Models.CreateStyleResponse.g.cs
index 1bd81de..faa5d89 100644
--- a/src/libs/Recraft/Generated/Recraft.Models.CreateStyleResponse.g.cs
+++ b/src/libs/Recraft/Generated/Recraft.Models.CreateStyleResponse.g.cs
@@ -39,6 +39,13 @@ public bool TryPickStyle(
return IsStyle;
}
+ ///
+ ///
+ ///
+ public global::Recraft.Style PickStyle() => IsStyle
+ ? Style!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Style' but the value was {ToString()}.");
+
///
///
///
@@ -68,6 +75,13 @@ public bool TryPickCreateStyleResponseVariant2(
value = CreateStyleResponseVariant2;
return IsCreateStyleResponseVariant2;
}
+
+ ///
+ ///
+ ///
+ public global::Recraft.CreateStyleResponseVariant2 PickCreateStyleResponseVariant2() => IsCreateStyleResponseVariant2
+ ? CreateStyleResponseVariant2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'CreateStyleResponseVariant2' but the value was {ToString()}.");
///
///
///
@@ -86,6 +100,11 @@ public CreateStyleResponse(global::Recraft.Style? value)
Style = value;
}
+ ///
+ ///
+ ///
+ public static CreateStyleResponse FromStyle(global::Recraft.Style? value) => new CreateStyleResponse(value);
+
///
///
///
@@ -104,6 +123,11 @@ public CreateStyleResponse(global::Recraft.CreateStyleResponseVariant2? value)
CreateStyleResponseVariant2 = value;
}
+ ///
+ ///
+ ///
+ public static CreateStyleResponse FromCreateStyleResponseVariant2(global::Recraft.CreateStyleResponseVariant2? value) => new CreateStyleResponse(value);
+
///
///
///
diff --git a/src/libs/Recraft/Generated/Recraft.Models.TransformImageWithMaskRequest.g.cs b/src/libs/Recraft/Generated/Recraft.Models.TransformImageWithMaskRequest.g.cs
index 3f18db9..8d4ba43 100644
--- a/src/libs/Recraft/Generated/Recraft.Models.TransformImageWithMaskRequest.g.cs
+++ b/src/libs/Recraft/Generated/Recraft.Models.TransformImageWithMaskRequest.g.cs
@@ -39,6 +39,13 @@ public bool TryPickTransformImageRequest(
return IsTransformImageRequest;
}
+ ///
+ ///
+ ///
+ public global::Recraft.TransformImageRequest PickTransformImageRequest() => IsTransformImageRequest
+ ? TransformImageRequest!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'TransformImageRequest' but the value was {ToString()}.");
+
///
///
///
@@ -68,6 +75,13 @@ public bool TryPickTransformImageWithMaskRequestVariant2(
value = TransformImageWithMaskRequestVariant2;
return IsTransformImageWithMaskRequestVariant2;
}
+
+ ///
+ ///
+ ///
+ public global::Recraft.TransformImageWithMaskRequestVariant2 PickTransformImageWithMaskRequestVariant2() => IsTransformImageWithMaskRequestVariant2
+ ? TransformImageWithMaskRequestVariant2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'TransformImageWithMaskRequestVariant2' but the value was {ToString()}.");
///
///
///
@@ -86,6 +100,11 @@ public TransformImageWithMaskRequest(global::Recraft.TransformImageRequest? valu
TransformImageRequest = value;
}
+ ///
+ ///
+ ///
+ public static TransformImageWithMaskRequest FromTransformImageRequest(global::Recraft.TransformImageRequest? value) => new TransformImageWithMaskRequest(value);
+
///
///
///
@@ -104,6 +123,11 @@ public TransformImageWithMaskRequest(global::Recraft.TransformImageWithMaskReque
TransformImageWithMaskRequestVariant2 = value;
}
+ ///
+ ///
+ ///
+ public static TransformImageWithMaskRequest FromTransformImageWithMaskRequestVariant2(global::Recraft.TransformImageWithMaskRequestVariant2? value) => new TransformImageWithMaskRequest(value);
+
///
///
///
diff --git a/src/libs/Recraft/Generated/Recraft.Models.VectorizeImageRequest.g.cs b/src/libs/Recraft/Generated/Recraft.Models.VectorizeImageRequest.g.cs
index 6b81379..f167476 100644
--- a/src/libs/Recraft/Generated/Recraft.Models.VectorizeImageRequest.g.cs
+++ b/src/libs/Recraft/Generated/Recraft.Models.VectorizeImageRequest.g.cs
@@ -39,6 +39,13 @@ public bool TryPickProcess(
return IsProcess;
}
+ ///
+ ///
+ ///
+ public global::Recraft.ProcessImageRequest PickProcess() => IsProcess
+ ? Process!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Process' but the value was {ToString()}.");
+
///
///
///
@@ -68,6 +75,13 @@ public bool TryPickVectorizeImageRequestVariant2(
value = VectorizeImageRequestVariant2;
return IsVectorizeImageRequestVariant2;
}
+
+ ///
+ ///
+ ///
+ public global::Recraft.VectorizeImageRequestVariant2 PickVectorizeImageRequestVariant2() => IsVectorizeImageRequestVariant2
+ ? VectorizeImageRequestVariant2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'VectorizeImageRequestVariant2' but the value was {ToString()}.");
///
///
///
@@ -86,6 +100,11 @@ public VectorizeImageRequest(global::Recraft.ProcessImageRequest? value)
Process = value;
}
+ ///
+ ///
+ ///
+ public static VectorizeImageRequest FromProcess(global::Recraft.ProcessImageRequest? value) => new VectorizeImageRequest(value);
+
///
///
///
@@ -104,6 +123,11 @@ public VectorizeImageRequest(global::Recraft.VectorizeImageRequestVariant2? valu
VectorizeImageRequestVariant2 = value;
}
+ ///
+ ///
+ ///
+ public static VectorizeImageRequest FromVectorizeImageRequestVariant2(global::Recraft.VectorizeImageRequestVariant2? value) => new VectorizeImageRequest(value);
+
///
///
///
diff --git a/src/libs/Recraft/Generated/Recraft.OptionsSupport.g.cs b/src/libs/Recraft/Generated/Recraft.OptionsSupport.g.cs
index 4d65880..0d0488f 100644
--- a/src/libs/Recraft/Generated/Recraft.OptionsSupport.g.cs
+++ b/src/libs/Recraft/Generated/Recraft.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::Recraft.IAutoSDKAuthorizationProvider? AuthorizationProvider { get; set; }
+
+ ///
+ /// Convenience helper that registers
+ /// using so request-level auth is resolved without
+ /// touching shared client state.
+ ///
+ ///
+ public global::Recraft.AutoSDKClientOptions UseAuthorizationProvider(
+ global::Recraft.IAutoSDKAuthorizationProvider provider)
+ {
+ AuthorizationProvider = provider ?? throw new global::System.ArgumentNullException(nameof(provider));
+ if (Hooks.Find(static x => x is global::Recraft.AutoSDKAuthorizationProviderHook) == null)
+ {
+ Hooks.Add(new global::Recraft.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::Recraft.AutoSDKAuthorizationValue Bearer(string token) => new(value: token, scheme: "Bearer");
+
+ /// Convenience factory for an API-key header.
+ public static global::Recraft.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::Recraft.AutoSDKHookContext context);
+ }
+
+ ///
+ /// Built-in that consults
+ /// before every outgoing
+ /// request and stamps the resolved values onto the .
+ ///
+ public sealed class AutoSDKAuthorizationProviderHook : global::Recraft.AutoSDKHook
+ {
+ ///
+ public override async global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::Recraft.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::Recraft.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;
+ }
+ }
}
///