diff --git a/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs b/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs
index 1c84e03..9e63ca4 100644
--- a/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs
+++ b/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs
@@ -39,6 +39,13 @@ public bool TryPickDropdown(
return IsDropdown;
}
+ ///
+ ///
+ ///
+ public global::Writer.ApplicationInputDropdownOptions PickDropdown() => IsDropdown
+ ? Dropdown!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Dropdown' but the value was {ToString()}.");
+
///
/// Configuration options specific to file upload input fields.
///
@@ -69,6 +76,13 @@ public bool TryPickFile(
return IsFile;
}
+ ///
+ ///
+ ///
+ public global::Writer.ApplicationInputFileOptions PickFile() => IsFile
+ ? File!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'File' but the value was {ToString()}.");
+
///
/// Configuration options specific to media upload input fields.
///
@@ -99,6 +113,13 @@ public bool TryPickMedia(
return IsMedia;
}
+ ///
+ ///
+ ///
+ public global::Writer.ApplicationInputMediaOptions PickMedia() => IsMedia
+ ? Media!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Media' but the value was {ToString()}.");
+
///
/// Configuration options specific to text input fields.
///
@@ -128,6 +149,13 @@ public bool TryPickText(
value = Text;
return IsText;
}
+
+ ///
+ ///
+ ///
+ public global::Writer.ApplicationInputTextOptions PickText() => IsText
+ ? Text!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Text' but the value was {ToString()}.");
///
///
///
@@ -146,6 +174,11 @@ public ApplicationInputOptions(global::Writer.ApplicationInputDropdownOptions? v
Dropdown = value;
}
+ ///
+ ///
+ ///
+ public static ApplicationInputOptions FromDropdown(global::Writer.ApplicationInputDropdownOptions? value) => new ApplicationInputOptions(value);
+
///
///
///
@@ -164,6 +197,11 @@ public ApplicationInputOptions(global::Writer.ApplicationInputFileOptions? value
File = value;
}
+ ///
+ ///
+ ///
+ public static ApplicationInputOptions FromFile(global::Writer.ApplicationInputFileOptions? value) => new ApplicationInputOptions(value);
+
///
///
///
@@ -182,6 +220,11 @@ public ApplicationInputOptions(global::Writer.ApplicationInputMediaOptions? valu
Media = value;
}
+ ///
+ ///
+ ///
+ public static ApplicationInputOptions FromMedia(global::Writer.ApplicationInputMediaOptions? value) => new ApplicationInputOptions(value);
+
///
///
///
@@ -200,6 +243,11 @@ public ApplicationInputOptions(global::Writer.ApplicationInputTextOptions? value
Text = value;
}
+ ///
+ ///
+ ///
+ public static ApplicationInputOptions FromText(global::Writer.ApplicationInputTextOptions? value) => new ApplicationInputOptions(value);
+
///
///
///
diff --git a/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs b/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs
index 243220c..bbeb29a 100644
--- a/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs
+++ b/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs
@@ -39,6 +39,13 @@ public bool TryPickText(
return IsText;
}
+ ///
+ ///
+ ///
+ public global::Writer.TextFragment PickText() => IsText
+ ? Text!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Text' but the value was {ToString()}.");
+
///
/// Represents an image content fragment within a chat message. Note: This content type is only supported with the Palmyra X5 model.
///
@@ -68,6 +75,13 @@ public bool TryPickImage(
value = Image;
return IsImage;
}
+
+ ///
+ ///
+ ///
+ public global::Writer.ImageFragment PickImage() => IsImage
+ ? Image!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Image' but the value was {ToString()}.");
///
///
///
@@ -86,6 +100,11 @@ public CompositeContent(global::Writer.TextFragment? value)
Text = value;
}
+ ///
+ ///
+ ///
+ public static CompositeContent FromText(global::Writer.TextFragment? value) => new CompositeContent(value);
+
///
///
///
@@ -104,6 +123,11 @@ public CompositeContent(global::Writer.ImageFragment? value)
Image = value;
}
+ ///
+ ///
+ ///
+ public static CompositeContent FromImage(global::Writer.ImageFragment? value) => new CompositeContent(value);
+
///
///
///
diff --git a/src/libs/Writer/Generated/Writer.Models.Tool.g.cs b/src/libs/Writer/Generated/Writer.Models.Tool.g.cs
index 4b06924..10df6e0 100644
--- a/src/libs/Writer/Generated/Writer.Models.Tool.g.cs
+++ b/src/libs/Writer/Generated/Writer.Models.Tool.g.cs
@@ -44,6 +44,13 @@ public bool TryPickFunction(
return IsFunction;
}
+ ///
+ ///
+ ///
+ public global::Writer.FunctionTool PickFunction() => IsFunction
+ ? Function!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Function' but the value was {ToString()}.");
+
///
///
///
@@ -74,6 +81,13 @@ public bool TryPickGraph(
return IsGraph;
}
+ ///
+ ///
+ ///
+ public global::Writer.GraphTool PickGraph() => IsGraph
+ ? Graph!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Graph' but the value was {ToString()}.");
+
///
///
///
@@ -104,6 +118,13 @@ public bool TryPickLlm(
return IsLlm;
}
+ ///
+ ///
+ ///
+ public global::Writer.LlmTool PickLlm() => IsLlm
+ ? Llm!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Llm' but the value was {ToString()}.");
+
///
/// A tool that uses Palmyra Translate to translate text. Note that this tool does not stream results. The response is returned after the translation is complete.
///
@@ -134,6 +155,13 @@ public bool TryPickTranslation(
return IsTranslation;
}
+ ///
+ ///
+ ///
+ public global::Writer.TranslationTool PickTranslation() => IsTranslation
+ ? Translation!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Translation' but the value was {ToString()}.");
+
///
///
///
@@ -164,6 +192,13 @@ public bool TryPickVision(
return IsVision;
}
+ ///
+ ///
+ ///
+ public global::Writer.VisionTool PickVision() => IsVision
+ ? Vision!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Vision' but the value was {ToString()}.");
+
///
///
///
@@ -193,6 +228,13 @@ public bool TryPickWebSearch(
value = WebSearch;
return IsWebSearch;
}
+
+ ///
+ ///
+ ///
+ public global::Writer.WebSearchTool PickWebSearch() => IsWebSearch
+ ? WebSearch!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'WebSearch' but the value was {ToString()}.");
///
///
///
@@ -211,6 +253,11 @@ public Tool(global::Writer.FunctionTool? value)
Function = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromFunction(global::Writer.FunctionTool? value) => new Tool(value);
+
///
///
///
@@ -229,6 +276,11 @@ public Tool(global::Writer.GraphTool? value)
Graph = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromGraph(global::Writer.GraphTool? value) => new Tool(value);
+
///
///
///
@@ -247,6 +299,11 @@ public Tool(global::Writer.LlmTool? value)
Llm = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromLlm(global::Writer.LlmTool? value) => new Tool(value);
+
///
///
///
@@ -265,6 +322,11 @@ public Tool(global::Writer.TranslationTool? value)
Translation = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromTranslation(global::Writer.TranslationTool? value) => new Tool(value);
+
///
///
///
@@ -283,6 +345,11 @@ public Tool(global::Writer.VisionTool? value)
Vision = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromVision(global::Writer.VisionTool? value) => new Tool(value);
+
///
///
///
@@ -301,6 +368,11 @@ public Tool(global::Writer.WebSearchTool? value)
WebSearch = value;
}
+ ///
+ ///
+ ///
+ public static Tool FromWebSearch(global::Writer.WebSearchTool? value) => new Tool(value);
+
///
///
///
diff --git a/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs b/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs
index 97665df..758b062 100644
--- a/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs
+++ b/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs
@@ -43,6 +43,13 @@ public bool TryPickString(
return IsString;
}
+ ///
+ ///
+ ///
+ public global::Writer.StringToolChoice PickString() => IsString
+ ? String!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'String' but the value was {ToString()}.");
+
///
///
///
@@ -72,6 +79,13 @@ public bool TryPickJsonObject(
value = JsonObject;
return IsJsonObject;
}
+
+ ///
+ ///
+ ///
+ public global::Writer.JsonObjectToolChoice PickJsonObject() => IsJsonObject
+ ? JsonObject!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'JsonObject' but the value was {ToString()}.");
///
///
///
@@ -90,6 +104,11 @@ public ToolChoice(global::Writer.StringToolChoice? value)
String = value;
}
+ ///
+ ///
+ ///
+ public static ToolChoice FromString(global::Writer.StringToolChoice? value) => new ToolChoice(value);
+
///
///
///
@@ -108,6 +127,11 @@ public ToolChoice(global::Writer.JsonObjectToolChoice? value)
JsonObject = value;
}
+ ///
+ ///
+ ///
+ public static ToolChoice FromJsonObject(global::Writer.JsonObjectToolChoice? value) => new ToolChoice(value);
+
///
///
///
diff --git a/src/libs/Writer/Generated/Writer.OneOf.2.g.cs b/src/libs/Writer/Generated/Writer.OneOf.2.g.cs
index b717583..5a1d37f 100644
--- a/src/libs/Writer/Generated/Writer.OneOf.2.g.cs
+++ b/src/libs/Writer/Generated/Writer.OneOf.2.g.cs
@@ -38,6 +38,13 @@ public bool TryPickValue1(
return IsValue1;
}
+ ///
+ ///
+ ///
+ public T1 PickValue1() => IsValue1
+ ? Value1!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");
+
///
///
///
@@ -67,6 +74,13 @@ public bool TryPickValue2(
value = Value2;
return IsValue2;
}
+
+ ///
+ ///
+ ///
+ public T2 PickValue2() => IsValue2
+ ? Value2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
///
///
///
@@ -85,6 +99,11 @@ public OneOf(T1? value)
Value1 = value;
}
+ ///
+ ///
+ ///
+ public static OneOf FromValue1(T1? value) => new OneOf(value);
+
///
///
///
@@ -103,6 +122,11 @@ public OneOf(T2? value)
Value2 = value;
}
+ ///
+ ///
+ ///
+ public static OneOf FromValue2(T2? value) => new OneOf(value);
+
///
///
///
diff --git a/src/libs/Writer/Generated/Writer.OptionsSupport.g.cs b/src/libs/Writer/Generated/Writer.OptionsSupport.g.cs
index 8f762ea..a01ce2d 100644
--- a/src/libs/Writer/Generated/Writer.OptionsSupport.g.cs
+++ b/src/libs/Writer/Generated/Writer.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::Writer.IAutoSDKAuthorizationProvider? AuthorizationProvider { get; set; }
+
+ ///
+ /// Convenience helper that registers
+ /// using so request-level auth is resolved without
+ /// touching shared client state.
+ ///
+ ///
+ public global::Writer.AutoSDKClientOptions UseAuthorizationProvider(
+ global::Writer.IAutoSDKAuthorizationProvider provider)
+ {
+ AuthorizationProvider = provider ?? throw new global::System.ArgumentNullException(nameof(provider));
+ if (Hooks.Find(static x => x is global::Writer.AutoSDKAuthorizationProviderHook) == null)
+ {
+ Hooks.Add(new global::Writer.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::Writer.AutoSDKAuthorizationValue Bearer(string token) => new(value: token, scheme: "Bearer");
+
+ /// Convenience factory for an API-key header.
+ public static global::Writer.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::Writer.AutoSDKHookContext context);
+ }
+
+ ///
+ /// Built-in that consults
+ /// before every outgoing
+ /// request and stamps the resolved values onto the .
+ ///
+ public sealed class AutoSDKAuthorizationProviderHook : global::Writer.AutoSDKHook
+ {
+ ///
+ public override async global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::Writer.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::Writer.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;
+ }
+ }
}
///