diff --git a/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs b/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs index 610294f..1c84e03 100644 --- a/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs +++ b/src/libs/Writer/Generated/Writer.Models.ApplicationInputOptions.g.cs @@ -26,6 +26,19 @@ namespace Writer #endif public bool IsDropdown => Dropdown != null; + /// + /// + /// + public bool TryPickDropdown( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.ApplicationInputDropdownOptions? value) + { + value = Dropdown; + return IsDropdown; + } + /// /// Configuration options specific to file upload input fields. /// @@ -43,6 +56,19 @@ namespace Writer #endif public bool IsFile => File != null; + /// + /// + /// + public bool TryPickFile( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.ApplicationInputFileOptions? value) + { + value = File; + return IsFile; + } + /// /// Configuration options specific to media upload input fields. /// @@ -60,6 +86,19 @@ namespace Writer #endif public bool IsMedia => Media != null; + /// + /// + /// + public bool TryPickMedia( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.ApplicationInputMediaOptions? value) + { + value = Media; + return IsMedia; + } + /// /// Configuration options specific to text input fields. /// @@ -76,6 +115,19 @@ namespace Writer [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] #endif public bool IsText => Text != null; + + /// + /// + /// + public bool TryPickText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.ApplicationInputTextOptions? value) + { + value = Text; + return IsText; + } /// /// /// @@ -196,10 +248,10 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? dropdown = null, - global::System.Func? file = null, - global::System.Func? media = null, - global::System.Func? text = null, + global::System.Func? dropdown = null, + global::System.Func? file = null, + global::System.Func? media = null, + global::System.Func? text = null, bool validate = true) { if (validate) @@ -231,10 +283,46 @@ public bool Validate() /// /// public void Match( - global::System.Action? dropdown = null, - global::System.Action? file = null, - global::System.Action? media = null, - global::System.Action? text = null, + global::System.Action? dropdown = null, + + global::System.Action? file = null, + + global::System.Action? media = null, + + global::System.Action? text = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsDropdown) + { + dropdown?.Invoke(Dropdown!); + } + else if (IsFile) + { + file?.Invoke(File!); + } + else if (IsMedia) + { + media?.Invoke(Media!); + } + else if (IsText) + { + text?.Invoke(Text!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? dropdown = null, + global::System.Action? file = null, + global::System.Action? media = null, + global::System.Action? text = null, bool validate = true) { if (validate) diff --git a/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs b/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs index 9a6097a..243220c 100644 --- a/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs +++ b/src/libs/Writer/Generated/Writer.Models.CompositeContent.g.cs @@ -26,6 +26,19 @@ namespace Writer #endif public bool IsText => Text != null; + /// + /// + /// + public bool TryPickText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.TextFragment? value) + { + value = Text; + return IsText; + } + /// /// Represents an image content fragment within a chat message. Note: This content type is only supported with the Palmyra X5 model. /// @@ -42,6 +55,19 @@ namespace Writer [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Image))] #endif public bool IsImage => Image != null; + + /// + /// + /// + public bool TryPickImage( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.ImageFragment? value) + { + value = Image; + return IsImage; + } /// /// /// @@ -118,8 +144,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? text = null, - global::System.Func? image = null, + global::System.Func? text = null, + global::System.Func? image = null, bool validate = true) { if (validate) @@ -143,8 +169,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? text = null, - global::System.Action? image = null, + global::System.Action? text = null, + + global::System.Action? image = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsText) + { + text?.Invoke(Text!); + } + else if (IsImage) + { + image?.Invoke(Image!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? text = null, + global::System.Action? image = null, bool validate = true) { if (validate) diff --git a/src/libs/Writer/Generated/Writer.Models.Tool.g.cs b/src/libs/Writer/Generated/Writer.Models.Tool.g.cs index afb35a4..4b06924 100644 --- a/src/libs/Writer/Generated/Writer.Models.Tool.g.cs +++ b/src/libs/Writer/Generated/Writer.Models.Tool.g.cs @@ -31,6 +31,19 @@ namespace Writer #endif public bool IsFunction => Function != null; + /// + /// + /// + public bool TryPickFunction( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.FunctionTool? value) + { + value = Function; + return IsFunction; + } + /// /// /// @@ -48,6 +61,19 @@ namespace Writer #endif public bool IsGraph => Graph != null; + /// + /// + /// + public bool TryPickGraph( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.GraphTool? value) + { + value = Graph; + return IsGraph; + } + /// /// /// @@ -65,6 +91,19 @@ namespace Writer #endif public bool IsLlm => Llm != null; + /// + /// + /// + public bool TryPickLlm( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.LlmTool? value) + { + value = Llm; + return IsLlm; + } + /// /// 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. /// @@ -82,6 +121,19 @@ namespace Writer #endif public bool IsTranslation => Translation != null; + /// + /// + /// + public bool TryPickTranslation( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.TranslationTool? value) + { + value = Translation; + return IsTranslation; + } + /// /// /// @@ -99,6 +151,19 @@ namespace Writer #endif public bool IsVision => Vision != null; + /// + /// + /// + public bool TryPickVision( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.VisionTool? value) + { + value = Vision; + return IsVision; + } + /// /// /// @@ -115,6 +180,19 @@ namespace Writer [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(WebSearch))] #endif public bool IsWebSearch => WebSearch != null; + + /// + /// + /// + public bool TryPickWebSearch( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.WebSearchTool? value) + { + value = WebSearch; + return IsWebSearch; + } /// /// /// @@ -282,12 +360,12 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? function = null, - global::System.Func? graph = null, - global::System.Func? llm = null, - global::System.Func? translation = null, - global::System.Func? vision = null, - global::System.Func? webSearch = null, + global::System.Func? function = null, + global::System.Func? graph = null, + global::System.Func? llm = null, + global::System.Func? translation = null, + global::System.Func? vision = null, + global::System.Func? webSearch = null, bool validate = true) { if (validate) @@ -327,12 +405,60 @@ public bool Validate() /// /// public void Match( - global::System.Action? function = null, - global::System.Action? graph = null, - global::System.Action? llm = null, - global::System.Action? translation = null, - global::System.Action? vision = null, - global::System.Action? webSearch = null, + global::System.Action? function = null, + + global::System.Action? graph = null, + + global::System.Action? llm = null, + + global::System.Action? translation = null, + + global::System.Action? vision = null, + + global::System.Action? webSearch = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsFunction) + { + function?.Invoke(Function!); + } + else if (IsGraph) + { + graph?.Invoke(Graph!); + } + else if (IsLlm) + { + llm?.Invoke(Llm!); + } + else if (IsTranslation) + { + translation?.Invoke(Translation!); + } + else if (IsVision) + { + vision?.Invoke(Vision!); + } + else if (IsWebSearch) + { + webSearch?.Invoke(WebSearch!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? function = null, + global::System.Action? graph = null, + global::System.Action? llm = null, + global::System.Action? translation = null, + global::System.Action? vision = null, + global::System.Action? webSearch = null, bool validate = true) { if (validate) diff --git a/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs b/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs index a31fa87..97665df 100644 --- a/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs +++ b/src/libs/Writer/Generated/Writer.Models.ToolChoice.g.cs @@ -30,6 +30,19 @@ namespace Writer #endif public bool IsString => String != null; + /// + /// + /// + public bool TryPickString( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.StringToolChoice? value) + { + value = String; + return IsString; + } + /// /// /// @@ -46,6 +59,19 @@ namespace Writer [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(JsonObject))] #endif public bool IsJsonObject => JsonObject != null; + + /// + /// + /// + public bool TryPickJsonObject( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Writer.JsonObjectToolChoice? value) + { + value = JsonObject; + return IsJsonObject; + } /// /// /// @@ -122,8 +148,8 @@ public bool Validate() /// /// public TResult? Match( - global::System.Func? @string = null, - global::System.Func? jsonObject = null, + global::System.Func? @string = null, + global::System.Func? jsonObject = null, bool validate = true) { if (validate) @@ -147,8 +173,32 @@ public bool Validate() /// /// public void Match( - global::System.Action? @string = null, - global::System.Action? jsonObject = null, + global::System.Action? @string = null, + + global::System.Action? jsonObject = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsString) + { + @string?.Invoke(String!); + } + else if (IsJsonObject) + { + jsonObject?.Invoke(JsonObject!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? @string = null, + global::System.Action? jsonObject = null, bool validate = true) { if (validate) diff --git a/src/libs/Writer/Generated/Writer.OneOf.2.g.cs b/src/libs/Writer/Generated/Writer.OneOf.2.g.cs index 35ffc6f..b717583 100644 --- a/src/libs/Writer/Generated/Writer.OneOf.2.g.cs +++ b/src/libs/Writer/Generated/Writer.OneOf.2.g.cs @@ -25,6 +25,19 @@ namespace Writer #endif public bool IsValue1 => Value1 != null; + /// + /// + /// + public bool TryPickValue1( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T1? value) + { + value = Value1; + return IsValue1; + } + /// /// /// @@ -41,6 +54,19 @@ namespace Writer [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))] #endif public bool IsValue2 => Value2 != null; + + /// + /// + /// + public bool TryPickValue2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T2? value) + { + value = Value2; + return IsValue2; + } /// /// /// @@ -143,6 +169,30 @@ public bool Validate() /// public void Match( global::System.Action? value1 = null, + + global::System.Action? value2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1) + { + value1?.Invoke(Value1!); + } + else if (IsValue2) + { + value2?.Invoke(Value2!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? value1 = null, global::System.Action? value2 = null, bool validate = true) { diff --git a/src/libs/Writer/Generated/Writer.WriterClient.Constructors.Bearer.g.cs b/src/libs/Writer/Generated/Writer.WriterClient.Constructors.Bearer.g.cs index b5996ea..8d56fb0 100644 --- a/src/libs/Writer/Generated/Writer.WriterClient.Constructors.Bearer.g.cs +++ b/src/libs/Writer/Generated/Writer.WriterClient.Constructors.Bearer.g.cs @@ -26,5 +26,6 @@ partial void Authorizing( ref string apiKey); partial void Authorized( global::System.Net.Http.HttpClient client); + } } \ No newline at end of file