diff --git a/src/libs/AI21/Generated/AI21.Ai21Api.g.cs b/src/libs/AI21/Generated/AI21.Ai21Api.g.cs index b8232ba..cd0da05 100644 --- a/src/libs/AI21/Generated/AI21.Ai21Api.g.cs +++ b/src/libs/AI21/Generated/AI21.Ai21Api.g.cs @@ -64,6 +64,15 @@ public sealed partial class Ai21Api : global::AI21.IAi21Api, global::System.IDis JsonSerializerContext = JsonSerializerContext, }; + /// + /// + /// + public SecretsClient Secrets => new SecretsClient(HttpClient, authorizations: Authorizations) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContext = JsonSerializerContext, + }; + /// /// Creates a new instance of the Ai21Api. /// If no httpClient is provided, a new one will be created. diff --git a/src/libs/AI21/Generated/AI21.IAi21Api.g.cs b/src/libs/AI21/Generated/AI21.IAi21Api.g.cs index fa03c17..eb050ca 100644 --- a/src/libs/AI21/Generated/AI21.IAi21Api.g.cs +++ b/src/libs/AI21/Generated/AI21.IAi21Api.g.cs @@ -52,5 +52,10 @@ public partial interface IAi21Api : global::System.IDisposable /// public RAGEngineClient RAGEngine { get; } + /// + /// + /// + public SecretsClient Secrets { get; } + } } \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage.g.cs b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage.g.cs new file mode 100644 index 0000000..772b7c9 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage.g.cs @@ -0,0 +1,19 @@ +#nullable enable + +namespace AI21 +{ + public partial interface ISecretsClient + { + /// + /// Get Secret List + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task V1SecretStorageAsync( + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage2.g.cs b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage2.g.cs new file mode 100644 index 0000000..89915e5 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage2.g.cs @@ -0,0 +1,23 @@ +#nullable enable + +namespace AI21 +{ + public partial interface ISecretsClient + { + /// + /// Save Secret + /// + /// + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task V1SecretStorage2Async( + string secretName, + string secretValue, + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage3.g.cs b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage3.g.cs new file mode 100644 index 0000000..8885b39 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.ISecretsClient.V1SecretStorage3.g.cs @@ -0,0 +1,21 @@ +#nullable enable + +namespace AI21 +{ + public partial interface ISecretsClient + { + /// + /// Delete Secret + /// + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task V1SecretStorage3Async( + string secretName, + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.ISecretsClient.g.cs b/src/libs/AI21/Generated/AI21.ISecretsClient.g.cs new file mode 100644 index 0000000..6dbdf4a --- /dev/null +++ b/src/libs/AI21/Generated/AI21.ISecretsClient.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +namespace AI21 +{ + /// + /// 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. + ///
+ public partial interface ISecretsClient : global::System.IDisposable + { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.Json.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.Json.g.cs new file mode 100644 index 0000000..7893083 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace AI21 +{ + public sealed partial class V1SecretStorageResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::AI21.V1SecretStorageResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::AI21.V1SecretStorageResponse), + jsonSerializerContext) as global::AI21.V1SecretStorageResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::AI21.V1SecretStorageResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::AI21.V1SecretStorageResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::AI21.V1SecretStorageResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.g.cs new file mode 100644 index 0000000..57822ee --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace AI21 +{ + /// + /// + /// + public sealed partial class V1SecretStorageResponse + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public V1SecretStorageResponse( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.Json.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.Json.g.cs new file mode 100644 index 0000000..dbf87f2 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace AI21 +{ + public sealed partial class V1SecretStorageResponse2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::AI21.V1SecretStorageResponse2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::AI21.V1SecretStorageResponse2), + jsonSerializerContext) as global::AI21.V1SecretStorageResponse2; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::AI21.V1SecretStorageResponse2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::AI21.V1SecretStorageResponse2), + jsonSerializerContext).ConfigureAwait(false)) as global::AI21.V1SecretStorageResponse2; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.g.cs new file mode 100644 index 0000000..5b5f921 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse2.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace AI21 +{ + /// + /// + /// + public sealed partial class V1SecretStorageResponse2 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public V1SecretStorageResponse2( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.Json.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.Json.g.cs new file mode 100644 index 0000000..bdb363c --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace AI21 +{ + public sealed partial class V1SecretStorageResponse3 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::AI21.V1SecretStorageResponse3? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::AI21.V1SecretStorageResponse3), + jsonSerializerContext) as global::AI21.V1SecretStorageResponse3; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::AI21.V1SecretStorageResponse3? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::AI21.V1SecretStorageResponse3), + jsonSerializerContext).ConfigureAwait(false)) as global::AI21.V1SecretStorageResponse3; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.g.cs b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.g.cs new file mode 100644 index 0000000..6e2c0c1 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.Models.V1SecretStorageResponse3.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace AI21 +{ + /// + /// + /// + public sealed partial class V1SecretStorageResponse3 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public V1SecretStorageResponse3( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage.g.cs b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage.g.cs new file mode 100644 index 0000000..62fd5c8 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage.g.cs @@ -0,0 +1,177 @@ + +#nullable enable + +namespace AI21 +{ + public partial class SecretsClient + { + partial void PrepareV1SecretStorageArguments( + global::System.Net.Http.HttpClient httpClient, + ref int? requestStartTime); + partial void PrepareV1SecretStorageRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + int? requestStartTime); + partial void ProcessV1SecretStorageResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessV1SecretStorageResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get Secret List + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task V1SecretStorageAsync( + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareV1SecretStorageArguments( + httpClient: HttpClient, + requestStartTime: ref requestStartTime); + + var __pathBuilder = new PathBuilder( + path: "/studio/v1/secrets", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("request_start_time", requestStartTime?.ToString()) + ; + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + + foreach (var __authorization in Authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareV1SecretStorageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + requestStartTime: requestStartTime); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessV1SecretStorageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::AI21.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::AI21.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::AI21.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessV1SecretStorageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage2.g.cs b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage2.g.cs new file mode 100644 index 0000000..1187d4e --- /dev/null +++ b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage2.g.cs @@ -0,0 +1,191 @@ + +#nullable enable + +namespace AI21 +{ + public partial class SecretsClient + { + partial void PrepareV1SecretStorage2Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string secretName, + ref string secretValue, + ref int? requestStartTime); + partial void PrepareV1SecretStorage2Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string secretName, + string secretValue, + int? requestStartTime); + partial void ProcessV1SecretStorage2Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessV1SecretStorage2ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Save Secret + /// + /// + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task V1SecretStorage2Async( + string secretName, + string secretValue, + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareV1SecretStorage2Arguments( + httpClient: HttpClient, + secretName: ref secretName, + secretValue: ref secretValue, + requestStartTime: ref requestStartTime); + + var __pathBuilder = new PathBuilder( + path: "/studio/v1/secrets", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("secret_name", secretName) + .AddRequiredParameter("secret_value", secretValue) + .AddOptionalParameter("request_start_time", requestStartTime?.ToString()) + ; + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + + foreach (var __authorization in Authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareV1SecretStorage2Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + secretName: secretName, + secretValue: secretValue, + requestStartTime: requestStartTime); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessV1SecretStorage2Response( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::AI21.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::AI21.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::AI21.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessV1SecretStorage2ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage3.g.cs b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage3.g.cs new file mode 100644 index 0000000..5931689 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.SecretsClient.V1SecretStorage3.g.cs @@ -0,0 +1,184 @@ + +#nullable enable + +namespace AI21 +{ + public partial class SecretsClient + { + partial void PrepareV1SecretStorage3Arguments( + global::System.Net.Http.HttpClient httpClient, + ref string secretName, + ref int? requestStartTime); + partial void PrepareV1SecretStorage3Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string secretName, + int? requestStartTime); + partial void ProcessV1SecretStorage3Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessV1SecretStorage3ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Delete Secret + /// + /// + /// + /// Default Value: 1730898900272 + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task V1SecretStorage3Async( + string secretName, + int? requestStartTime = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareV1SecretStorage3Arguments( + httpClient: HttpClient, + secretName: ref secretName, + requestStartTime: ref requestStartTime); + + var __pathBuilder = new PathBuilder( + path: "/studio/v1/secrets", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("secret_name", secretName) + .AddOptionalParameter("request_start_time", requestStartTime?.ToString()) + ; + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); + + foreach (var __authorization in Authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareV1SecretStorage3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + secretName: secretName, + requestStartTime: requestStartTime); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessV1SecretStorage3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::AI21.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::AI21.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::AI21.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessV1SecretStorage3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::AI21.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/AI21/Generated/AI21.SecretsClient.g.cs b/src/libs/AI21/Generated/AI21.SecretsClient.g.cs new file mode 100644 index 0000000..7f9c802 --- /dev/null +++ b/src/libs/AI21/Generated/AI21.SecretsClient.g.cs @@ -0,0 +1,86 @@ + +#nullable enable + +namespace AI21 +{ + /// + /// 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. + ///
+ public sealed partial class SecretsClient : global::AI21.ISecretsClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.ai21.com/"; + + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::AI21.SourceGenerationContext.Default; + + + /// + /// Creates a new instance of the SecretsClient. + /// 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. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SecretsClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) + { + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/AI21/openapi.yaml b/src/libs/AI21/openapi.yaml index 377b0df..4c4474d 100644 --- a/src/libs/AI21/openapi.yaml +++ b/src/libs/AI21/openapi.yaml @@ -331,6 +331,97 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' + /studio/v1/secrets: + get: + tags: + - Secrets + summary: Get Secret List + operationId: v1_secret_storage + parameters: + - name: request_start_time + in: query + schema: + title: Request Start Time + type: integer + default: '1730898900272' + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + post: + tags: + - Secrets + summary: Save Secret + operationId: v1_secret_storage + parameters: + - name: secret_name + in: query + required: true + schema: + title: Secret Name + type: string + - name: secret_value + in: query + required: true + schema: + title: Secret Value + type: string + - name: request_start_time + in: query + schema: + title: Request Start Time + type: integer + default: '1730898900272' + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + delete: + tags: + - Secrets + summary: Delete Secret + operationId: v1_secret_storage + parameters: + - name: secret_name + in: query + required: true + schema: + title: Secret Name + type: string + - name: request_start_time + in: query + schema: + title: Request Start Time + type: integer + default: '1730898900272' + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' '/studio/v1/library/files/{file_id}/download': get: tags: