From 421dbd0f1836c6e23f4b491811cddaaf87e4ace3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 23 Oct 2024 01:25:47 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ...ohere.CohereApi.Authorizations.Bearer.g.cs | 4 +- .../Generated/Cohere.CohereApi.Chat.g.cs | 72 +++++++++---------- .../Generated/Cohere.CohereApi.Chatv2.g.cs | 70 +++++++++--------- .../Cohere.CohereApi.CheckAPIKey.g.cs | 64 ++++++++--------- .../Generated/Cohere.CohereApi.Classify.g.cs | 70 +++++++++--------- .../Cohere.CohereApi.Constructors.Bearer.g.cs | 9 +-- .../Cohere.CohereApi.Detokenize.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Embed.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Embedv2.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Generate.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Rerank.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Rerankv2.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Summarize.g.cs | 70 +++++++++--------- .../Generated/Cohere.CohereApi.Tokenize.g.cs | 70 +++++++++--------- .../Cohere/Generated/Cohere.CohereApi.g.cs | 48 ++++++++----- ...here.ConnectorsClient.CreateConnector.g.cs | 70 +++++++++--------- ...here.ConnectorsClient.DeleteConnector.g.cs | 64 ++++++++--------- .../Cohere.ConnectorsClient.GetConnector.g.cs | 64 ++++++++--------- ...ohere.ConnectorsClient.ListConnectors.g.cs | 64 ++++++++--------- ...nectorsClient.OAuthAuthorizeConnector.g.cs | 64 ++++++++--------- ...here.ConnectorsClient.UpdateConnector.g.cs | 70 +++++++++--------- .../Generated/Cohere.ConnectorsClient.g.cs | 38 ++++++---- .../Cohere.DatasetsClient.CreateDataset.g.cs | 70 +++++++++--------- .../Cohere.DatasetsClient.DeleteDataset.g.cs | 64 ++++++++--------- .../Cohere.DatasetsClient.GetDataset.g.cs | 64 ++++++++--------- ...Cohere.DatasetsClient.GetDatasetUsage.g.cs | 64 ++++++++--------- .../Cohere.DatasetsClient.ListDatasets.g.cs | 64 ++++++++--------- .../Generated/Cohere.DatasetsClient.g.cs | 38 ++++++---- ...Cohere.EmbedJobsClient.CancelEmbedJob.g.cs | 64 ++++++++--------- ...Cohere.EmbedJobsClient.CreateEmbedJob.g.cs | 70 +++++++++--------- .../Cohere.EmbedJobsClient.GetEmbedJob.g.cs | 64 ++++++++--------- .../Cohere.EmbedJobsClient.ListEmbedJobs.g.cs | 64 ++++++++--------- .../Generated/Cohere.EmbedJobsClient.g.cs | 38 ++++++---- ...FinetuningClient.CreateFinetunedModel.g.cs | 70 +++++++++--------- ...FinetuningClient.DeleteFinetunedModel.g.cs | 64 ++++++++--------- ...re.FinetuningClient.GetFinetunedModel.g.cs | 64 ++++++++--------- .../Cohere.FinetuningClient.ListEvents.g.cs | 64 ++++++++--------- ....FinetuningClient.ListFinetunedModels.g.cs | 64 ++++++++--------- ...etuningClient.ListTrainingStepMetrics.g.cs | 64 ++++++++--------- ...FinetuningClient.UpdateFinetunedModel.g.cs | 70 +++++++++--------- .../Generated/Cohere.FinetuningClient.g.cs | 38 ++++++---- .../Cohere/Generated/Cohere.ICohereApi.g.cs | 15 ++++ .../Generated/Cohere.IConnectorsClient.g.cs | 15 ++++ .../Generated/Cohere.IDatasetsClient.g.cs | 15 ++++ .../Generated/Cohere.IEmbedJobsClient.g.cs | 15 ++++ .../Generated/Cohere.IFinetuningClient.g.cs | 15 ++++ .../Generated/Cohere.IModelsClient.g.cs | 15 ++++ .../Cohere.ModelsClient.GetModel.g.cs | 64 ++++++++--------- .../Cohere.ModelsClient.ListModels.g.cs | 62 ++++++++-------- .../Cohere/Generated/Cohere.ModelsClient.g.cs | 38 ++++++---- 50 files changed, 1461 insertions(+), 1286 deletions(-) diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Authorizations.Bearer.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Authorizations.Bearer.g.cs index 26f0e76..7ef0c35 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Authorizations.Bearer.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Authorizations.Bearer.g.cs @@ -14,8 +14,8 @@ public void AuthorizeUsingBearer( { apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); - _authorizations.Clear(); - _authorizations.Add(new global::Cohere.EndPointAuthorization + Authorizations.Clear(); + Authorizations.Add(new global::Cohere.EndPointAuthorization { Type = "Http", Location = "Header", diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs index 9bcdce9..6b7352e 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Chat.g.cs @@ -44,44 +44,44 @@ partial void ProcessChatResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareChatArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, accepts: ref accepts, request: request); var __pathBuilder = new PathBuilder( path: "/v1/chat", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } if (accepts != default) { - httpRequest.Headers.TryAddWithoutValidation("Accepts", accepts?.ToValueString() ?? string.Empty); + __httpRequest.Headers.TryAddWithoutValidation("Accepts", accepts?.ToValueString() ?? string.Empty); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -89,48 +89,48 @@ partial void ProcessChatResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareChatRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, accepts: accepts, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessChatResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessChatResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -349,7 +349,7 @@ partial void ProcessChatResponseContent( global::Cohere.ChatRequestSafetyMode? safetyMode = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.ChatRequest + var __request = new global::Cohere.ChatRequest { Message = message, Model = model, @@ -381,7 +381,7 @@ partial void ProcessChatResponseContent( return await ChatAsync( xClientName: xClientName, accepts: accepts, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs index 3e8cedf..60492d6 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Chatv2.g.cs @@ -40,39 +40,39 @@ partial void ProcessChatv2ResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareChatv2Arguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v2/chat", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -80,47 +80,47 @@ partial void ProcessChatv2ResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareChatv2Request( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessChatv2Response( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessChatv2ResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -222,7 +222,7 @@ partial void ProcessChatv2ResponseContent( float? p = 0.75F, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.Chatv2Request + var __request = new global::Cohere.Chatv2Request { Model = model, Messages = messages, @@ -243,7 +243,7 @@ partial void ProcessChatv2ResponseContent( return await Chatv2Async( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.CheckAPIKey.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.CheckAPIKey.g.cs index ef00619..52e2e75 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.CheckAPIKey.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.CheckAPIKey.g.cs @@ -33,79 +33,79 @@ partial void ProcessCheckAPIKeyResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCheckAPIKeyArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: "/v1/check-api-key", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCheckAPIKeyRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCheckAPIKeyResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCheckAPIKeyResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Classify.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Classify.g.cs index 703073d..8de54b0 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Classify.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Classify.g.cs @@ -40,39 +40,39 @@ partial void ProcessClassifyResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareClassifyArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/classify", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -80,47 +80,47 @@ partial void ProcessClassifyResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareClassifyRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessClassifyResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessClassifyResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -172,7 +172,7 @@ partial void ProcessClassifyResponseContent( string? xClientName = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.ClassifyRequest + var __request = new global::Cohere.ClassifyRequest { Inputs = inputs, Examples = examples, @@ -183,7 +183,7 @@ partial void ProcessClassifyResponseContent( return await ClassifyAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Constructors.Bearer.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Constructors.Bearer.g.cs index d8d28b2..8f53d12 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Constructors.Bearer.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Constructors.Bearer.g.cs @@ -5,18 +5,19 @@ namespace Cohere { public sealed partial class CohereApi { - /// + /// public CohereApi( string apiKey, global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) : this(httpClient, baseUri, authorizations) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient) { - Authorizing(_httpClient, ref apiKey); + Authorizing(HttpClient, ref apiKey); AuthorizeUsingBearer(apiKey); - Authorized(_httpClient); + Authorized(HttpClient); } partial void Authorizing( diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Detokenize.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Detokenize.g.cs index 8fbedbb..d0e5dda 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Detokenize.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Detokenize.g.cs @@ -39,39 +39,39 @@ partial void ProcessDetokenizeResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDetokenizeArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/detokenize", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessDetokenizeResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDetokenizeRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessDetokenizeResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessDetokenizeResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -147,7 +147,7 @@ partial void ProcessDetokenizeResponseContent( string? xClientName = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.DetokenizeRequest + var __request = new global::Cohere.DetokenizeRequest { Tokens = tokens, Model = model, @@ -155,7 +155,7 @@ partial void ProcessDetokenizeResponseContent( return await DetokenizeAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Embed.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Embed.g.cs index 99b2f5f..10eef5e 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Embed.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Embed.g.cs @@ -41,39 +41,39 @@ partial void ProcessEmbedResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareEmbedArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/embed", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -81,47 +81,47 @@ partial void ProcessEmbedResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareEmbedRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessEmbedResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessEmbedResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -193,7 +193,7 @@ partial void ProcessEmbedResponseContent( global::Cohere.EmbedInputType? inputType = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.EmbedRequest + var __request = new global::Cohere.EmbedRequest { Texts = texts, Images = images, @@ -205,7 +205,7 @@ partial void ProcessEmbedResponseContent( return await EmbedAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Embedv2.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Embedv2.g.cs index 5daa9c0..ef3bce9 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Embedv2.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Embedv2.g.cs @@ -41,39 +41,39 @@ partial void ProcessEmbedv2ResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareEmbedv2Arguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v2/embed", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -81,47 +81,47 @@ partial void ProcessEmbedv2ResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareEmbedv2Request( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessEmbedv2Response( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessEmbedv2ResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -193,7 +193,7 @@ partial void ProcessEmbedv2ResponseContent( global::System.Collections.Generic.IList? images = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.Embedv2Request + var __request = new global::Cohere.Embedv2Request { Texts = texts, Images = images, @@ -205,7 +205,7 @@ partial void ProcessEmbedv2ResponseContent( return await Embedv2Async( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Generate.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Generate.g.cs index 6cead85..af39974 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Generate.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Generate.g.cs @@ -42,39 +42,39 @@ partial void ProcessGenerateResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGenerateArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/generate", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -82,47 +82,47 @@ partial void ProcessGenerateResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGenerateRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGenerateResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGenerateResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -253,7 +253,7 @@ partial void ProcessGenerateResponseContent( bool? rawPrompting = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.GenerateRequest + var __request = new global::Cohere.GenerateRequest { Prompt = prompt, Model = model, @@ -276,7 +276,7 @@ partial void ProcessGenerateResponseContent( return await GenerateAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Rerank.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Rerank.g.cs index df9ae5b..de67a06 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Rerank.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Rerank.g.cs @@ -39,39 +39,39 @@ partial void ProcessRerankResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRerankArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/rerank", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessRerankResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRerankRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessRerankResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessRerankResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -172,7 +172,7 @@ partial void ProcessRerankResponseContent( int? maxChunksPerDoc = 10, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.RerankRequest + var __request = new global::Cohere.RerankRequest { Model = model, Query = query, @@ -185,7 +185,7 @@ partial void ProcessRerankResponseContent( return await RerankAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Rerankv2.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Rerankv2.g.cs index a5e6735..fea6e5b 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Rerankv2.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Rerankv2.g.cs @@ -39,39 +39,39 @@ partial void ProcessRerankv2ResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRerankv2Arguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v2/rerank", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessRerankv2ResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRerankv2Request( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessRerankv2Response( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessRerankv2ResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -172,7 +172,7 @@ partial void ProcessRerankv2ResponseContent( int? maxChunksPerDoc = 10, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.Rerankv2Request + var __request = new global::Cohere.Rerankv2Request { Model = model, Query = query, @@ -185,7 +185,7 @@ partial void ProcessRerankv2ResponseContent( return await Rerankv2Async( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Summarize.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Summarize.g.cs index 2599201..d8ecb80 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Summarize.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Summarize.g.cs @@ -42,39 +42,39 @@ partial void ProcessSummarizeResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareSummarizeArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/summarize", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -82,47 +82,47 @@ partial void ProcessSummarizeResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareSummarizeRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessSummarizeResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessSummarizeResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -183,7 +183,7 @@ partial void ProcessSummarizeResponseContent( string? xClientName = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.SummarizeRequest + var __request = new global::Cohere.SummarizeRequest { Text = text, Length = length, @@ -196,7 +196,7 @@ partial void ProcessSummarizeResponseContent( return await SummarizeAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.Tokenize.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.Tokenize.g.cs index 62f2d4e..db75a5d 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.Tokenize.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.Tokenize.g.cs @@ -39,39 +39,39 @@ partial void ProcessTokenizeResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareTokenizeArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/tokenize", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessTokenizeResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareTokenizeRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessTokenizeResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessTokenizeResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -146,7 +146,7 @@ partial void ProcessTokenizeResponseContent( string? xClientName = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.TokenizeRequest + var __request = new global::Cohere.TokenizeRequest { Text = text, Model = model, @@ -154,7 +154,7 @@ partial void ProcessTokenizeResponseContent( return await TokenizeAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.CohereApi.g.cs b/src/libs/Cohere/Generated/Cohere.CohereApi.g.cs index 3ecbcb6..0214908 100644 --- a/src/libs/Cohere/Generated/Cohere.CohereApi.g.cs +++ b/src/libs/Cohere/Generated/Cohere.CohereApi.g.cs @@ -15,10 +15,18 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -29,7 +37,7 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// Datasets API /// - public DatasetsClient Datasets => new DatasetsClient(_httpClient, authorizations: _authorizations) + public DatasetsClient Datasets => new DatasetsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -37,7 +45,7 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// Connectors API /// - public ConnectorsClient Connectors => new ConnectorsClient(_httpClient, authorizations: _authorizations) + public ConnectorsClient Connectors => new ConnectorsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -45,7 +53,7 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// Embed Jobs API /// - public EmbedJobsClient EmbedJobs => new EmbedJobsClient(_httpClient, authorizations: _authorizations) + public EmbedJobsClient EmbedJobs => new EmbedJobsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -53,7 +61,7 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// Finetuning API (Beta) /// - public FinetuningClient Finetuning => new FinetuningClient(_httpClient, authorizations: _authorizations) + public FinetuningClient Finetuning => new FinetuningClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -61,7 +69,7 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// /// /// - public ModelsClient Models => new ModelsClient(_httpClient, authorizations: _authorizations) + public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -71,25 +79,31 @@ public sealed partial class CohereApi : global::Cohere.ICohereApi, global::Syste /// 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 CohereApi( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs index 8cd7a02..003bdd0 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.CreateConnector.g.cs @@ -39,39 +39,39 @@ partial void ProcessCreateConnectorResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateConnectorArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/connectors", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessCreateConnectorResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateConnectorRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateConnectorResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCreateConnectorResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -168,7 +168,7 @@ partial void ProcessCreateConnectorResponseContent( global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.CreateConnectorRequest + var __request = new global::Cohere.CreateConnectorRequest { Name = name, Description = description, @@ -182,7 +182,7 @@ partial void ProcessCreateConnectorResponseContent( return await CreateConnectorAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs index d511e1a..b7c1626 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.DeleteConnector.g.cs @@ -37,81 +37,81 @@ partial void ProcessDeleteConnectorResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteConnectorArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/connectors/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteConnectorRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessDeleteConnectorResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessDeleteConnectorResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return __content; diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs index c91bf3c..ce82951 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.GetConnector.g.cs @@ -37,81 +37,81 @@ partial void ProcessGetConnectorResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetConnectorArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/connectors/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetConnectorRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetConnectorResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetConnectorResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs index d547575..d7d0b01 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.ListConnectors.g.cs @@ -45,87 +45,87 @@ partial void ProcessListConnectorsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListConnectorsArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, offset: ref offset, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: "/v1/connectors", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("offset", offset?.ToString()) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListConnectorsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, offset: offset, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListConnectorsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListConnectorsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs index 5ba4108..27356d0 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.OAuthAuthorizeConnector.g.cs @@ -41,86 +41,86 @@ partial void ProcessOAuthAuthorizeConnectorResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareOAuthAuthorizeConnectorArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, afterTokenRedirect: ref afterTokenRedirect, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/connectors/{id}/oauth/authorize", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after_token_redirect", afterTokenRedirect) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareOAuthAuthorizeConnectorRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, afterTokenRedirect: afterTokenRedirect, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessOAuthAuthorizeConnectorResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessOAuthAuthorizeConnectorResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs index a9f20be..835dba5 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.UpdateConnector.g.cs @@ -43,40 +43,40 @@ partial void ProcessUpdateConnectorResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareUpdateConnectorArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: $"/v1/connectors/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: new global::System.Net.Http.HttpMethod("PATCH"), requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -84,48 +84,48 @@ partial void ProcessUpdateConnectorResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareUpdateConnectorRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessUpdateConnectorResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessUpdateConnectorResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -170,7 +170,7 @@ partial void ProcessUpdateConnectorResponseContent( global::Cohere.CreateConnectorServiceAuth? serviceAuth = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.UpdateConnectorRequest + var __request = new global::Cohere.UpdateConnectorRequest { Name = name, Url = url, @@ -184,7 +184,7 @@ partial void ProcessUpdateConnectorResponseContent( return await UpdateConnectorAsync( id: id, xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.g.cs b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.g.cs index 792c0c3..a351ab6 100644 --- a/src/libs/Cohere/Generated/Cohere.ConnectorsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ConnectorsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ConnectorsClient : global::Cohere.IConnectorsClient, /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -29,25 +37,31 @@ public sealed partial class ConnectorsClient : global::Cohere.IConnectorsClient, /// 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 ConnectorsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.CreateDataset.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.CreateDataset.g.cs index 69e4352..3197ce7 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.CreateDataset.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.CreateDataset.g.cs @@ -73,9 +73,9 @@ partial void ProcessCreateDatasetResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateDatasetArguments( - httpClient: _httpClient, + httpClient: HttpClient, name: ref name, type: ref type, keepOriginalFile: ref keepOriginalFile, @@ -89,7 +89,7 @@ partial void ProcessCreateDatasetResponseContent( var __pathBuilder = new PathBuilder( path: "/v1/datasets", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("name", name) .AddRequiredParameter("type", type.ToValueString()) @@ -101,29 +101,29 @@ partial void ProcessCreateDatasetResponseContent( .AddOptionalParameter("csv_delimiter", csvDelimiter) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -198,14 +198,14 @@ partial void ProcessCreateDatasetResponseContent( name: "eval_data", fileName: request.EvalDataname ?? string.Empty); } - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateDatasetRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, name: name, type: type, keepOriginalFile: keepOriginalFile, @@ -217,36 +217,36 @@ partial void ProcessCreateDatasetResponseContent( xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateDatasetResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCreateDatasetResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -299,7 +299,7 @@ partial void ProcessCreateDatasetResponseContent( string? evalDataname = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.CreateDatasetRequest + var __request = new global::Cohere.CreateDatasetRequest { Data = data, Dataname = dataname, @@ -317,7 +317,7 @@ partial void ProcessCreateDatasetResponseContent( textSeparator: textSeparator, csvDelimiter: csvDelimiter, xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.DeleteDataset.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.DeleteDataset.g.cs index abb20db..79fcf5b 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.DeleteDataset.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.DeleteDataset.g.cs @@ -37,81 +37,81 @@ partial void ProcessDeleteDatasetResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteDatasetArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/datasets/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteDatasetRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessDeleteDatasetResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessDeleteDatasetResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return __content; diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDataset.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDataset.g.cs index afa400a..f7edd0f 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDataset.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDataset.g.cs @@ -37,81 +37,81 @@ partial void ProcessGetDatasetResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetDatasetArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/datasets/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetDatasetRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetDatasetResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetDatasetResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDatasetUsage.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDatasetUsage.g.cs index 617f9f0..2d7bd92 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDatasetUsage.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.GetDatasetUsage.g.cs @@ -33,79 +33,79 @@ partial void ProcessGetDatasetUsageResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetDatasetUsageArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: "/v1/datasets/usage", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetDatasetUsageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetDatasetUsageResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetDatasetUsageResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.ListDatasets.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.ListDatasets.g.cs index 9a9e124..300446f 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.ListDatasets.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.ListDatasets.g.cs @@ -59,9 +59,9 @@ partial void ProcessListDatasetsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListDatasetsArguments( - httpClient: _httpClient, + httpClient: HttpClient, datasetType: ref datasetType, before: ref before, after: ref after, @@ -72,7 +72,7 @@ partial void ProcessListDatasetsResponseContent( var __pathBuilder = new PathBuilder( path: "/v1/datasets", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("datasetType", datasetType) .AddOptionalParameter("before", before?.ToString("yyyy-MM-ddTHH:mm:ssZ")) @@ -82,38 +82,38 @@ partial void ProcessListDatasetsResponseContent( .AddOptionalParameter("validationStatus", validationStatus?.ToValueString()) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListDatasetsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, datasetType: datasetType, before: before, after: after, @@ -122,36 +122,36 @@ partial void ProcessListDatasetsResponseContent( validationStatus: validationStatus, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListDatasetsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListDatasetsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.DatasetsClient.g.cs b/src/libs/Cohere/Generated/Cohere.DatasetsClient.g.cs index 9ba3a1a..250a53c 100644 --- a/src/libs/Cohere/Generated/Cohere.DatasetsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.DatasetsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class DatasetsClient : global::Cohere.IDatasetsClient, glo /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -29,25 +37,31 @@ public sealed partial class DatasetsClient : global::Cohere.IDatasetsClient, glo /// 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 DatasetsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CancelEmbedJob.g.cs b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CancelEmbedJob.g.cs index 70c68ac..3f30961 100644 --- a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CancelEmbedJob.g.cs +++ b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CancelEmbedJob.g.cs @@ -37,81 +37,81 @@ partial void ProcessCancelEmbedJobResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelEmbedJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/embed-jobs/{id}/cancel", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelEmbedJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCancelEmbedJobResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCancelEmbedJobResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CreateEmbedJob.g.cs b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CreateEmbedJob.g.cs index 0289bb8..8b2df2d 100644 --- a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CreateEmbedJob.g.cs +++ b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.CreateEmbedJob.g.cs @@ -39,39 +39,39 @@ partial void ProcessCreateEmbedJobResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateEmbedJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/embed-jobs", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -79,47 +79,47 @@ partial void ProcessCreateEmbedJobResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateEmbedJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateEmbedJobResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCreateEmbedJobResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -179,7 +179,7 @@ partial void ProcessCreateEmbedJobResponseContent( global::Cohere.CreateEmbedJobRequestTruncate? truncate = global::Cohere.CreateEmbedJobRequestTruncate.END, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.CreateEmbedJobRequest + var __request = new global::Cohere.CreateEmbedJobRequest { Model = model, DatasetId = datasetId, @@ -191,7 +191,7 @@ partial void ProcessCreateEmbedJobResponseContent( return await CreateEmbedJobAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.GetEmbedJob.g.cs b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.GetEmbedJob.g.cs index b42b231..cf933cd 100644 --- a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.GetEmbedJob.g.cs +++ b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.GetEmbedJob.g.cs @@ -37,81 +37,81 @@ partial void ProcessGetEmbedJobResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetEmbedJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/embed-jobs/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetEmbedJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetEmbedJobResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetEmbedJobResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.ListEmbedJobs.g.cs b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.ListEmbedJobs.g.cs index a028ba9..61baa47 100644 --- a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.ListEmbedJobs.g.cs +++ b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.ListEmbedJobs.g.cs @@ -33,79 +33,79 @@ partial void ProcessListEmbedJobsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListEmbedJobsArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: "/v1/embed-jobs", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListEmbedJobsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListEmbedJobsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListEmbedJobsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.g.cs b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.g.cs index f33f6fb..d9c03a7 100644 --- a/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.EmbedJobsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class EmbedJobsClient : global::Cohere.IEmbedJobsClient, g /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -29,25 +37,31 @@ public sealed partial class EmbedJobsClient : global::Cohere.IEmbedJobsClient, g /// 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 EmbedJobsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.CreateFinetunedModel.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.CreateFinetunedModel.g.cs index 10e7971..dfa3055 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.CreateFinetunedModel.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.CreateFinetunedModel.g.cs @@ -38,39 +38,39 @@ partial void ProcessCreateFinetunedModelResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateFinetunedModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: "/v1/finetuning/finetuned-models", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -78,47 +78,47 @@ partial void ProcessCreateFinetunedModelResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateFinetunedModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateFinetunedModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessCreateFinetunedModelResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -158,7 +158,7 @@ partial void ProcessCreateFinetunedModelResponseContent( global::Cohere.Status? status = global::Cohere.Status.UNSPECIFIED, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.FinetunedModel + var __request = new global::Cohere.FinetunedModel { Name = name, Settings = settings, @@ -167,7 +167,7 @@ partial void ProcessCreateFinetunedModelResponseContent( return await CreateFinetunedModelAsync( xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.DeleteFinetunedModel.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.DeleteFinetunedModel.g.cs index 4889bd8..5940956 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.DeleteFinetunedModel.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.DeleteFinetunedModel.g.cs @@ -36,81 +36,81 @@ partial void ProcessDeleteFinetunedModelResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteFinetunedModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/finetuning/finetuned-models/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteFinetunedModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessDeleteFinetunedModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessDeleteFinetunedModelResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return __content; diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.GetFinetunedModel.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.GetFinetunedModel.g.cs index f9c606d..a7ff12e 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.GetFinetunedModel.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.GetFinetunedModel.g.cs @@ -36,81 +36,81 @@ partial void ProcessGetFinetunedModelResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetFinetunedModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/finetuning/finetuned-models/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetFinetunedModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetFinetunedModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetFinetunedModelResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListEvents.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListEvents.g.cs index d0ef043..8fdb42d 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListEvents.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListEvents.g.cs @@ -48,9 +48,9 @@ partial void ProcessListEventsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListEventsArguments( - httpClient: _httpClient, + httpClient: HttpClient, finetunedModelId: ref finetunedModelId, pageSize: ref pageSize, pageToken: ref pageToken, @@ -59,81 +59,81 @@ partial void ProcessListEventsResponseContent( var __pathBuilder = new PathBuilder( path: $"/v1/finetuning/finetuned-models/{finetunedModelId}/events", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page_size", pageSize?.ToString()) .AddOptionalParameter("page_token", pageToken) .AddOptionalParameter("order_by", orderBy) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListEventsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, finetunedModelId: finetunedModelId, pageSize: pageSize, pageToken: pageToken, orderBy: orderBy, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListEventsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListEventsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListFinetunedModels.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListFinetunedModels.g.cs index 06c7fa7..dbd5f25 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListFinetunedModels.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListFinetunedModels.g.cs @@ -44,9 +44,9 @@ partial void ProcessListFinetunedModelsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListFinetunedModelsArguments( - httpClient: _httpClient, + httpClient: HttpClient, pageSize: ref pageSize, pageToken: ref pageToken, orderBy: ref orderBy, @@ -54,80 +54,80 @@ partial void ProcessListFinetunedModelsResponseContent( var __pathBuilder = new PathBuilder( path: "/v1/finetuning/finetuned-models", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page_size", pageSize?.ToString()) .AddOptionalParameter("page_token", pageToken) .AddOptionalParameter("order_by", orderBy) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListFinetunedModelsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, pageSize: pageSize, pageToken: pageToken, orderBy: orderBy, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListFinetunedModelsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListFinetunedModelsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListTrainingStepMetrics.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListTrainingStepMetrics.g.cs index bc21f95..b10795a 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListTrainingStepMetrics.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.ListTrainingStepMetrics.g.cs @@ -44,9 +44,9 @@ partial void ProcessListTrainingStepMetricsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListTrainingStepMetricsArguments( - httpClient: _httpClient, + httpClient: HttpClient, finetunedModelId: ref finetunedModelId, pageSize: ref pageSize, pageToken: ref pageToken, @@ -54,79 +54,79 @@ partial void ProcessListTrainingStepMetricsResponseContent( var __pathBuilder = new PathBuilder( path: $"/v1/finetuning/finetuned-models/{finetunedModelId}/training-step-metrics", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page_size", pageSize?.ToString()) .AddOptionalParameter("page_token", pageToken) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListTrainingStepMetricsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, finetunedModelId: finetunedModelId, pageSize: pageSize, pageToken: pageToken, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListTrainingStepMetricsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListTrainingStepMetricsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.UpdateFinetunedModel.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.UpdateFinetunedModel.g.cs index dcb51b1..a6931ee 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.UpdateFinetunedModel.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.UpdateFinetunedModel.g.cs @@ -42,40 +42,40 @@ partial void ProcessUpdateFinetunedModelResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareUpdateFinetunedModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, id: ref id, xClientName: ref xClientName, request: request); var __pathBuilder = new PathBuilder( path: $"/v1/finetuning/finetuned-models/{id}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: new global::System.Net.Http.HttpMethod("PATCH"), requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); - foreach (var _authorization in _authorizations) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -83,48 +83,48 @@ partial void ProcessUpdateFinetunedModelResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareUpdateFinetunedModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, id: id, xClientName: xClientName, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessUpdateFinetunedModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessUpdateFinetunedModelResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -166,7 +166,7 @@ partial void ProcessUpdateFinetunedModelResponseContent( global::Cohere.Status? status = global::Cohere.Status.UNSPECIFIED, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Cohere.UpdateFinetunedModelRequest + var __request = new global::Cohere.UpdateFinetunedModelRequest { Name = name, Settings = settings, @@ -176,7 +176,7 @@ partial void ProcessUpdateFinetunedModelResponseContent( return await UpdateFinetunedModelAsync( id: id, xClientName: xClientName, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Cohere/Generated/Cohere.FinetuningClient.g.cs b/src/libs/Cohere/Generated/Cohere.FinetuningClient.g.cs index a2c2bef..0629080 100644 --- a/src/libs/Cohere/Generated/Cohere.FinetuningClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.FinetuningClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class FinetuningClient : global::Cohere.IFinetuningClient, /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -29,25 +37,31 @@ public sealed partial class FinetuningClient : global::Cohere.IFinetuningClient, /// 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 FinetuningClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Cohere/Generated/Cohere.ICohereApi.g.cs b/src/libs/Cohere/Generated/Cohere.ICohereApi.g.cs index 2d8ef92..cf49a96 100644 --- a/src/libs/Cohere/Generated/Cohere.ICohereApi.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ICohereApi.g.cs @@ -12,6 +12,21 @@ namespace Cohere /// public partial interface ICohereApi : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.g.cs b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.g.cs index ef1f5ba..abb1efe 100644 --- a/src/libs/Cohere/Generated/Cohere.IConnectorsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.IConnectorsClient.g.cs @@ -10,6 +10,21 @@ namespace Cohere /// public partial interface IConnectorsClient : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.IDatasetsClient.g.cs b/src/libs/Cohere/Generated/Cohere.IDatasetsClient.g.cs index 368e809..6468e69 100644 --- a/src/libs/Cohere/Generated/Cohere.IDatasetsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.IDatasetsClient.g.cs @@ -10,6 +10,21 @@ namespace Cohere /// public partial interface IDatasetsClient : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.IEmbedJobsClient.g.cs b/src/libs/Cohere/Generated/Cohere.IEmbedJobsClient.g.cs index f8a0d4e..50be538 100644 --- a/src/libs/Cohere/Generated/Cohere.IEmbedJobsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.IEmbedJobsClient.g.cs @@ -10,6 +10,21 @@ namespace Cohere /// public partial interface IEmbedJobsClient : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.IFinetuningClient.g.cs b/src/libs/Cohere/Generated/Cohere.IFinetuningClient.g.cs index 4d9e02b..eb699ce 100644 --- a/src/libs/Cohere/Generated/Cohere.IFinetuningClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.IFinetuningClient.g.cs @@ -10,6 +10,21 @@ namespace Cohere /// public partial interface IFinetuningClient : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.IModelsClient.g.cs b/src/libs/Cohere/Generated/Cohere.IModelsClient.g.cs index 155090c..54a5cf1 100644 --- a/src/libs/Cohere/Generated/Cohere.IModelsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.IModelsClient.g.cs @@ -9,6 +9,21 @@ namespace Cohere /// public partial interface IModelsClient : 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; } + /// /// /// diff --git a/src/libs/Cohere/Generated/Cohere.ModelsClient.GetModel.g.cs b/src/libs/Cohere/Generated/Cohere.ModelsClient.GetModel.g.cs index 73c6827..a649204 100644 --- a/src/libs/Cohere/Generated/Cohere.ModelsClient.GetModel.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ModelsClient.GetModel.g.cs @@ -39,81 +39,81 @@ partial void ProcessGetModelResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, model: ref model, xClientName: ref xClientName); var __pathBuilder = new PathBuilder( path: $"/v1/models/{model}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } if (xClientName != default) { - httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); + __httpRequest.Headers.TryAddWithoutValidation("X-Client-Name", xClientName.ToString()); } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, model: model, xClientName: xClientName); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetModelResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.ModelsClient.ListModels.g.cs b/src/libs/Cohere/Generated/Cohere.ModelsClient.ListModels.g.cs index ea67666..1739260 100644 --- a/src/libs/Cohere/Generated/Cohere.ModelsClient.ListModels.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ModelsClient.ListModels.g.cs @@ -47,9 +47,9 @@ partial void ProcessListModelsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListModelsArguments( - httpClient: _httpClient, + httpClient: HttpClient, pageSize: ref pageSize, pageToken: ref pageToken, endpoint: ref endpoint, @@ -57,7 +57,7 @@ partial void ProcessListModelsResponseContent( var __pathBuilder = new PathBuilder( path: "/v1/models", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("page_size", pageSize?.ToString()) .AddOptionalParameter("page_token", pageToken) @@ -65,67 +65,67 @@ partial void ProcessListModelsResponseContent( .AddOptionalParameter("default_only", defaultOnly?.ToString()) ; var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + 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) + foreach (var __authorization in Authorizations) { - if (_authorization.Type == "Http" || - _authorization.Type == "OAuth2") + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") { - httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( - scheme: _authorization.Name, - parameter: _authorization.Value); + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); } - else if (_authorization.Type == "ApiKey" && - _authorization.Location == "Header") + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") { - httpRequest.Headers.Add(_authorization.Name, _authorization.Value); + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListModelsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, pageSize: pageSize, pageToken: pageToken, endpoint: endpoint, defaultOnly: defaultOnly); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListModelsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListModelsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Cohere/Generated/Cohere.ModelsClient.g.cs b/src/libs/Cohere/Generated/Cohere.ModelsClient.g.cs index 3071039..f977453 100644 --- a/src/libs/Cohere/Generated/Cohere.ModelsClient.g.cs +++ b/src/libs/Cohere/Generated/Cohere.ModelsClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class ModelsClient : global::Cohere.IModelsClient, global: /// /// production /// - public const string BaseUrl = "https://api.cohere.com"; + public const string DefaultBaseUrl = "https://api.cohere.com"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + 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; } /// /// @@ -28,25 +36,31 @@ public sealed partial class ModelsClient : global::Cohere.IModelsClient, global: /// 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 ModelsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = 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(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + 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); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized(