From c174c08c81463edff536819633ad5bebbdef25f5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 9 Apr 2026 13:55:19 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Reka.ChatClient.CreateChatCompletion.g.cs | 29 +++- src/libs/Reka/Generated/Reka.ChatClient.g.cs | 4 +- src/libs/Reka/Generated/Reka.IChatClient.g.cs | 2 +- .../Reka/Generated/Reka.IModelsClient.g.cs | 2 +- ...aClient.Authorizations.ApiKeyInHeader.g.cs | 1 + src/libs/Reka/Generated/Reka.IRekaClient.g.cs | 6 +- .../Reka/Generated/Reka.ISpeechClient.g.cs | 2 +- .../Reka.ModelsClient.ListModels.g.cs | 29 +++- .../Reka/Generated/Reka.ModelsClient.g.cs | 4 +- src/libs/Reka/Generated/Reka.PathBuilder.g.cs | 34 ++++ ...aClient.Authorizations.ApiKeyInHeader.g.cs | 13 +- ...ekaClient.Constructors.ApiKeyInHeader.g.cs | 1 + src/libs/Reka/Generated/Reka.RekaClient.g.cs | 8 +- src/libs/Reka/Generated/Reka.Security.g.cs | 145 ++++++++++++++++++ ...ka.SpeechClient.TranscribeOrTranslate.g.cs | 29 +++- .../Reka/Generated/Reka.SpeechClient.g.cs | 4 +- 16 files changed, 290 insertions(+), 23 deletions(-) create mode 100644 src/libs/Reka/Generated/Reka.Security.g.cs diff --git a/src/libs/Reka/Generated/Reka.ChatClient.CreateChatCompletion.g.cs b/src/libs/Reka/Generated/Reka.ChatClient.CreateChatCompletion.g.cs index 39f3965..c2e0bf4 100644 --- a/src/libs/Reka/Generated/Reka.ChatClient.CreateChatCompletion.g.cs +++ b/src/libs/Reka/Generated/Reka.ChatClient.CreateChatCompletion.g.cs @@ -5,6 +5,25 @@ namespace Reka { public partial class ChatClient { + + + private static readonly global::Reka.EndPointSecurityRequirement s_CreateChatCompletionSecurityRequirement0 = + new global::Reka.EndPointSecurityRequirement + { + Authorizations = new global::Reka.EndPointAuthorizationRequirement[] + { new global::Reka.EndPointAuthorizationRequirement + { + Type = "ApiKey", + Location = "Header", + Name = "X-Api-Key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Reka.EndPointSecurityRequirement[] s_CreateChatCompletionSecurityRequirements = + new global::Reka.EndPointSecurityRequirement[] + { s_CreateChatCompletionSecurityRequirement0, + }; partial void PrepareCreateChatCompletionArguments( global::System.Net.Http.HttpClient httpClient, global::Reka.CreateChatCompletionRequest request); @@ -41,9 +60,15 @@ partial void ProcessCreateChatCompletionResponseContent( httpClient: HttpClient, request: request); + + var __authorizations = global::Reka.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateChatCompletionSecurityRequirements, + operationName: "CreateChatCompletionAsync"); + var __pathBuilder = new global::Reka.PathBuilder( path: "/v1/chat/completions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, @@ -53,7 +78,7 @@ partial void ProcessCreateChatCompletionResponseContent( __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif - foreach (var __authorization in Authorizations) + foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || __authorization.Type == "OAuth2") diff --git a/src/libs/Reka/Generated/Reka.ChatClient.g.cs b/src/libs/Reka/Generated/Reka.ChatClient.g.cs index 6894ef0..03d808b 100644 --- a/src/libs/Reka/Generated/Reka.ChatClient.g.cs +++ b/src/libs/Reka/Generated/Reka.ChatClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Chat completion operations
+ /// Chat completion operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -13,7 +13,7 @@ public sealed partial class ChatClient : global::Reka.IChatClient, global::Syste /// /// Reka API /// - public const string DefaultBaseUrl = "https://api.reka.ai"; + public const string DefaultBaseUrl = "https://api.reka.ai/"; private bool _disposeHttpClient = true; diff --git a/src/libs/Reka/Generated/Reka.IChatClient.g.cs b/src/libs/Reka/Generated/Reka.IChatClient.g.cs index 2a70243..412e265 100644 --- a/src/libs/Reka/Generated/Reka.IChatClient.g.cs +++ b/src/libs/Reka/Generated/Reka.IChatClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Chat completion operations
+ /// Chat completion operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
diff --git a/src/libs/Reka/Generated/Reka.IModelsClient.g.cs b/src/libs/Reka/Generated/Reka.IModelsClient.g.cs index 52e16ad..8452526 100644 --- a/src/libs/Reka/Generated/Reka.IModelsClient.g.cs +++ b/src/libs/Reka/Generated/Reka.IModelsClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Model management operations
+ /// Model management operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
diff --git a/src/libs/Reka/Generated/Reka.IRekaClient.Authorizations.ApiKeyInHeader.g.cs b/src/libs/Reka/Generated/Reka.IRekaClient.Authorizations.ApiKeyInHeader.g.cs index 87c1062..3b5c842 100644 --- a/src/libs/Reka/Generated/Reka.IRekaClient.Authorizations.ApiKeyInHeader.g.cs +++ b/src/libs/Reka/Generated/Reka.IRekaClient.Authorizations.ApiKeyInHeader.g.cs @@ -9,6 +9,7 @@ public partial interface IRekaClient /// Authorize using ApiKey authentication. /// /// + public void AuthorizeUsingApiKeyInHeader( string apiKey); } diff --git a/src/libs/Reka/Generated/Reka.IRekaClient.g.cs b/src/libs/Reka/Generated/Reka.IRekaClient.g.cs index 92cf48f..4bcfb89 100644 --- a/src/libs/Reka/Generated/Reka.IRekaClient.g.cs +++ b/src/libs/Reka/Generated/Reka.IRekaClient.g.cs @@ -41,17 +41,17 @@ public partial interface IRekaClient : global::System.IDisposable /// - /// Chat completion operations + /// Chat completion operations. /// public ChatClient Chat { get; } /// - /// Model management operations + /// Model management operations. /// public ModelsClient Models { get; } /// - /// Speech transcription and translation operations + /// Speech transcription and translation operations. /// public SpeechClient Speech { get; } diff --git a/src/libs/Reka/Generated/Reka.ISpeechClient.g.cs b/src/libs/Reka/Generated/Reka.ISpeechClient.g.cs index b608cae..7d7269c 100644 --- a/src/libs/Reka/Generated/Reka.ISpeechClient.g.cs +++ b/src/libs/Reka/Generated/Reka.ISpeechClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Speech transcription and translation operations
+ /// Speech transcription and translation operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
diff --git a/src/libs/Reka/Generated/Reka.ModelsClient.ListModels.g.cs b/src/libs/Reka/Generated/Reka.ModelsClient.ListModels.g.cs index f641bdc..6e7b205 100644 --- a/src/libs/Reka/Generated/Reka.ModelsClient.ListModels.g.cs +++ b/src/libs/Reka/Generated/Reka.ModelsClient.ListModels.g.cs @@ -5,6 +5,25 @@ namespace Reka { public partial class ModelsClient { + + + private static readonly global::Reka.EndPointSecurityRequirement s_ListModelsSecurityRequirement0 = + new global::Reka.EndPointSecurityRequirement + { + Authorizations = new global::Reka.EndPointAuthorizationRequirement[] + { new global::Reka.EndPointAuthorizationRequirement + { + Type = "ApiKey", + Location = "Header", + Name = "X-Api-Key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Reka.EndPointSecurityRequirement[] s_ListModelsSecurityRequirements = + new global::Reka.EndPointSecurityRequirement[] + { s_ListModelsSecurityRequirement0, + }; partial void PrepareListModelsArguments( global::System.Net.Http.HttpClient httpClient); partial void PrepareListModelsRequest( @@ -33,9 +52,15 @@ partial void ProcessListModelsResponseContent( PrepareListModelsArguments( httpClient: HttpClient); + + var __authorizations = global::Reka.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListModelsSecurityRequirements, + operationName: "ListModelsAsync"); + var __pathBuilder = new global::Reka.PathBuilder( path: "/v1/models", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Get, @@ -45,7 +70,7 @@ partial void ProcessListModelsResponseContent( __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif - foreach (var __authorization in Authorizations) + foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || __authorization.Type == "OAuth2") diff --git a/src/libs/Reka/Generated/Reka.ModelsClient.g.cs b/src/libs/Reka/Generated/Reka.ModelsClient.g.cs index 748b364..bcb93c6 100644 --- a/src/libs/Reka/Generated/Reka.ModelsClient.g.cs +++ b/src/libs/Reka/Generated/Reka.ModelsClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Model management operations
+ /// Model management operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -13,7 +13,7 @@ public sealed partial class ModelsClient : global::Reka.IModelsClient, global::S /// /// Reka API /// - public const string DefaultBaseUrl = "https://api.reka.ai"; + public const string DefaultBaseUrl = "https://api.reka.ai/"; private bool _disposeHttpClient = true; diff --git a/src/libs/Reka/Generated/Reka.PathBuilder.g.cs b/src/libs/Reka/Generated/Reka.PathBuilder.g.cs index d660b5b..1c443e8 100644 --- a/src/libs/Reka/Generated/Reka.PathBuilder.g.cs +++ b/src/libs/Reka/Generated/Reka.PathBuilder.g.cs @@ -224,6 +224,40 @@ public PathBuilder AddOptionalParameter( return this; } + /// + /// Adds a pre-serialized query string fragment to the URL. + /// + /// The serialized query string value. + /// The current instance. + public PathBuilder AddRawQueryString( + string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return this; + } + + value = value.TrimStart('?', '&'); + if (value.Length == 0) + { + return this; + } + + if (_firstParameter) + { + _stringBuilder.Append('?'); + _firstParameter = false; + } + else + { + _stringBuilder.Append('&'); + } + + _stringBuilder.Append(value); + + return this; + } + /// /// Returns the constructed URL as a string. /// diff --git a/src/libs/Reka/Generated/Reka.RekaClient.Authorizations.ApiKeyInHeader.g.cs b/src/libs/Reka/Generated/Reka.RekaClient.Authorizations.ApiKeyInHeader.g.cs index 380bdc6..7d2cba6 100644 --- a/src/libs/Reka/Generated/Reka.RekaClient.Authorizations.ApiKeyInHeader.g.cs +++ b/src/libs/Reka/Generated/Reka.RekaClient.Authorizations.ApiKeyInHeader.g.cs @@ -5,13 +5,24 @@ namespace Reka { public sealed partial class RekaClient { + /// public void AuthorizeUsingApiKeyInHeader( string apiKey) { apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); - Authorizations.Clear(); + for (var i = Authorizations.Count - 1; i >= 0; i--) + { + var __authorization = Authorizations[i]; + if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header" && + __authorization.Name == "X-Api-Key") + { + Authorizations.RemoveAt(i); + } + } + Authorizations.Add(new global::Reka.EndPointAuthorization { Type = "ApiKey", diff --git a/src/libs/Reka/Generated/Reka.RekaClient.Constructors.ApiKeyInHeader.g.cs b/src/libs/Reka/Generated/Reka.RekaClient.Constructors.ApiKeyInHeader.g.cs index 572092b..de819c6 100644 --- a/src/libs/Reka/Generated/Reka.RekaClient.Constructors.ApiKeyInHeader.g.cs +++ b/src/libs/Reka/Generated/Reka.RekaClient.Constructors.ApiKeyInHeader.g.cs @@ -6,6 +6,7 @@ namespace Reka public sealed partial class RekaClient { /// + public RekaClient( string apiKey, global::System.Net.Http.HttpClient? httpClient = null, diff --git a/src/libs/Reka/Generated/Reka.RekaClient.g.cs b/src/libs/Reka/Generated/Reka.RekaClient.g.cs index 3bd89d9..b453505 100644 --- a/src/libs/Reka/Generated/Reka.RekaClient.g.cs +++ b/src/libs/Reka/Generated/Reka.RekaClient.g.cs @@ -13,7 +13,7 @@ public sealed partial class RekaClient : global::Reka.IRekaClient, global::Syste /// /// Reka API /// - public const string DefaultBaseUrl = "https://api.reka.ai"; + public const string DefaultBaseUrl = "https://api.reka.ai/"; private bool _disposeHttpClient = true; @@ -38,7 +38,7 @@ public sealed partial class RekaClient : global::Reka.IRekaClient, global::Syste /// - /// Chat completion operations + /// Chat completion operations. /// public ChatClient Chat => new ChatClient(HttpClient, authorizations: Authorizations) { @@ -47,7 +47,7 @@ public sealed partial class RekaClient : global::Reka.IRekaClient, global::Syste }; /// - /// Model management operations + /// Model management operations. /// public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations) { @@ -56,7 +56,7 @@ public sealed partial class RekaClient : global::Reka.IRekaClient, global::Syste }; /// - /// Speech transcription and translation operations + /// Speech transcription and translation operations. /// public SpeechClient Speech => new SpeechClient(HttpClient, authorizations: Authorizations) { diff --git a/src/libs/Reka/Generated/Reka.Security.g.cs b/src/libs/Reka/Generated/Reka.Security.g.cs new file mode 100644 index 0000000..c07cce7 --- /dev/null +++ b/src/libs/Reka/Generated/Reka.Security.g.cs @@ -0,0 +1,145 @@ +#nullable enable + +namespace Reka +{ + internal sealed class EndPointAuthorizationRequirement + { + internal string Type { get; set; } = string.Empty; + + internal string Location { get; set; } = string.Empty; + + internal string Name { get; set; } = string.Empty; + + internal string FriendlyName { get; set; } = string.Empty; + } + + internal sealed class EndPointSecurityRequirement + { + internal global::System.Collections.Generic.IReadOnlyList Authorizations { get; set; } = + global::System.Array.Empty(); + } + + internal static class EndPointSecurityResolver + { + internal static global::System.Collections.Generic.List ResolveAuthorizations( + global::System.Collections.Generic.IReadOnlyList availableAuthorizations, + global::System.Collections.Generic.IReadOnlyList securityRequirements, + string operationName) + { + availableAuthorizations = availableAuthorizations ?? throw new global::System.ArgumentNullException(nameof(availableAuthorizations)); + securityRequirements = securityRequirements ?? throw new global::System.ArgumentNullException(nameof(securityRequirements)); + operationName = operationName ?? throw new global::System.ArgumentNullException(nameof(operationName)); + + if (securityRequirements.Count == 0) + { + return new global::System.Collections.Generic.List(); + } + + var allowsAnonymous = false; + + foreach (var requirement in securityRequirements) + { + if (requirement.Authorizations.Count == 0) + { + allowsAnonymous = true; + continue; + } + + var selected = new global::System.Collections.Generic.List(requirement.Authorizations.Count); + var satisfied = true; + + foreach (var requiredAuthorization in requirement.Authorizations) + { + var found = false; + + for (var i = 0; i < availableAuthorizations.Count; i++) + { + if (!Matches(availableAuthorizations[i], requiredAuthorization)) + { + continue; + } + + selected.Add(availableAuthorizations[i]); + found = true; + break; + } + + if (!found) + { + satisfied = false; + break; + } + } + + if (satisfied) + { + return selected; + } + } + + if (allowsAnonymous) + { + return new global::System.Collections.Generic.List(); + } + + throw new global::System.InvalidOperationException( + $"Operation '{operationName}' requires one of the configured security alternatives: {DescribeRequirements(securityRequirements)}."); + } + + private static bool Matches( + EndPointAuthorization availableAuthorization, + EndPointAuthorizationRequirement requiredAuthorization) + { + if (!string.Equals(availableAuthorization.Type, requiredAuthorization.Type, global::System.StringComparison.Ordinal)) + { + return false; + } + + return requiredAuthorization.Type switch + { + "OAuth2" => true, + "Http" => string.Equals( + availableAuthorization.Name, + requiredAuthorization.Name, + global::System.StringComparison.Ordinal), + "ApiKey" => string.Equals( + availableAuthorization.Location, + requiredAuthorization.Location, + global::System.StringComparison.Ordinal) && + string.Equals( + availableAuthorization.Name, + requiredAuthorization.Name, + global::System.StringComparison.Ordinal), + _ => string.Equals( + availableAuthorization.Location, + requiredAuthorization.Location, + global::System.StringComparison.Ordinal) && + string.Equals( + availableAuthorization.Name, + requiredAuthorization.Name, + global::System.StringComparison.Ordinal), + }; + } + + private static string DescribeRequirements( + global::System.Collections.Generic.IReadOnlyList securityRequirements) + { + var parts = new global::System.Collections.Generic.List(securityRequirements.Count); + + foreach (var requirement in securityRequirements) + { + if (requirement.Authorizations.Count == 0) + { + parts.Add("anonymous"); + continue; + } + + parts.Add(string.Join( + " + ", + global::System.Linq.Enumerable.Select(requirement.Authorizations, static x => x.FriendlyName))); + } + + return string.Join(" or ", parts); + } + } +} \ No newline at end of file diff --git a/src/libs/Reka/Generated/Reka.SpeechClient.TranscribeOrTranslate.g.cs b/src/libs/Reka/Generated/Reka.SpeechClient.TranscribeOrTranslate.g.cs index 3c2be01..9a92727 100644 --- a/src/libs/Reka/Generated/Reka.SpeechClient.TranscribeOrTranslate.g.cs +++ b/src/libs/Reka/Generated/Reka.SpeechClient.TranscribeOrTranslate.g.cs @@ -5,6 +5,25 @@ namespace Reka { public partial class SpeechClient { + + + private static readonly global::Reka.EndPointSecurityRequirement s_TranscribeOrTranslateSecurityRequirement0 = + new global::Reka.EndPointSecurityRequirement + { + Authorizations = new global::Reka.EndPointAuthorizationRequirement[] + { new global::Reka.EndPointAuthorizationRequirement + { + Type = "ApiKey", + Location = "Header", + Name = "X-Api-Key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Reka.EndPointSecurityRequirement[] s_TranscribeOrTranslateSecurityRequirements = + new global::Reka.EndPointSecurityRequirement[] + { s_TranscribeOrTranslateSecurityRequirement0, + }; partial void PrepareTranscribeOrTranslateArguments( global::System.Net.Http.HttpClient httpClient, global::Reka.TranscribeOrTranslateRequest request); @@ -43,9 +62,15 @@ partial void ProcessTranscribeOrTranslateResponseContent( httpClient: HttpClient, request: request); + + var __authorizations = global::Reka.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_TranscribeOrTranslateSecurityRequirements, + operationName: "TranscribeOrTranslateAsync"); + var __pathBuilder = new global::Reka.PathBuilder( path: "/v1/transcription_or_translation", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, @@ -55,7 +80,7 @@ partial void ProcessTranscribeOrTranslateResponseContent( __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif - foreach (var __authorization in Authorizations) + foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || __authorization.Type == "OAuth2") diff --git a/src/libs/Reka/Generated/Reka.SpeechClient.g.cs b/src/libs/Reka/Generated/Reka.SpeechClient.g.cs index 6f7c229..989095a 100644 --- a/src/libs/Reka/Generated/Reka.SpeechClient.g.cs +++ b/src/libs/Reka/Generated/Reka.SpeechClient.g.cs @@ -4,7 +4,7 @@ namespace Reka { /// - /// Speech transcription and translation operations
+ /// Speech transcription and translation operations.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
@@ -13,7 +13,7 @@ public sealed partial class SpeechClient : global::Reka.ISpeechClient, global::S /// /// Reka API /// - public const string DefaultBaseUrl = "https://api.reka.ai"; + public const string DefaultBaseUrl = "https://api.reka.ai/"; private bool _disposeHttpClient = true;