From ce01368a3f56a5b4dd0ad0428b31fc3c6a972080 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 23 Oct 2024 12:28:59 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../OpenAI.AssistantsClient.CancelRun.g.cs | 62 ++++++++-------- ...enAI.AssistantsClient.CreateAssistant.g.cs | 68 +++++++++--------- ...OpenAI.AssistantsClient.CreateMessage.g.cs | 68 +++++++++--------- .../OpenAI.AssistantsClient.CreateRun.g.cs | 68 +++++++++--------- .../OpenAI.AssistantsClient.CreateThread.g.cs | 68 +++++++++--------- ...I.AssistantsClient.CreateThreadAndRun.g.cs | 68 +++++++++--------- ...enAI.AssistantsClient.DeleteAssistant.g.cs | 62 ++++++++-------- ...OpenAI.AssistantsClient.DeleteMessage.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.DeleteThread.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.GetAssistant.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.GetMessage.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.GetRun.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.GetRunStep.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.GetThread.g.cs | 62 ++++++++-------- ...penAI.AssistantsClient.ListAssistants.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.ListMessages.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.ListRunSteps.g.cs | 62 ++++++++-------- .../OpenAI.AssistantsClient.ListRuns.g.cs | 62 ++++++++-------- ...enAI.AssistantsClient.ModifyAssistant.g.cs | 68 +++++++++--------- ...OpenAI.AssistantsClient.ModifyMessage.g.cs | 68 +++++++++--------- .../OpenAI.AssistantsClient.ModifyRun.g.cs | 68 +++++++++--------- .../OpenAI.AssistantsClient.ModifyThread.g.cs | 68 +++++++++--------- ...ssistantsClient.SubmitToolOuputsToRun.g.cs | 68 +++++++++--------- .../Generated/OpenAI.AssistantsClient.g.cs | 38 ++++++---- .../OpenAI.AudioClient.CreateSpeech.g.cs | 60 ++++++++-------- ...penAI.AudioClient.CreateTranscription.g.cs | 68 +++++++++--------- .../OpenAI.AudioClient.CreateTranslation.g.cs | 68 +++++++++--------- .../OpenAI/Generated/OpenAI.AudioClient.g.cs | 38 ++++++---- .../OpenAI.AuditLogsClient.ListAuditLogs.g.cs | 62 ++++++++-------- .../Generated/OpenAI.AuditLogsClient.g.cs | 38 ++++++---- .../OpenAI.BatchClient.CancelBatch.g.cs | 62 ++++++++-------- .../OpenAI.BatchClient.CreateBatch.g.cs | 68 +++++++++--------- .../OpenAI.BatchClient.ListBatches.g.cs | 62 ++++++++-------- .../OpenAI.BatchClient.RetrieveBatch.g.cs | 62 ++++++++-------- .../OpenAI/Generated/OpenAI.BatchClient.g.cs | 38 ++++++---- ...penAI.ChatClient.CreateChatCompletion.g.cs | 68 +++++++++--------- .../OpenAI/Generated/OpenAI.ChatClient.g.cs | 38 ++++++---- ...AI.CompletionsClient.CreateCompletion.g.cs | 68 +++++++++--------- .../Generated/OpenAI.CompletionsClient.g.cs | 38 ++++++---- ...enAI.EmbeddingsClient.CreateEmbedding.g.cs | 68 +++++++++--------- .../Generated/OpenAI.EmbeddingsClient.g.cs | 38 ++++++---- .../OpenAI.FilesClient.CreateFile.g.cs | 68 +++++++++--------- .../OpenAI.FilesClient.DeleteFile.g.cs | 62 ++++++++-------- .../OpenAI.FilesClient.DownloadFile.g.cs | 54 +++++++------- .../OpenAI.FilesClient.ListFiles.g.cs | 62 ++++++++-------- .../OpenAI.FilesClient.RetrieveFile.g.cs | 62 ++++++++-------- .../OpenAI/Generated/OpenAI.FilesClient.g.cs | 38 ++++++---- ....FineTuningClient.CancelFineTuningJob.g.cs | 62 ++++++++-------- ....FineTuningClient.CreateFineTuningJob.g.cs | 68 +++++++++--------- ...FineTuningClient.ListFineTuningEvents.g.cs | 62 ++++++++-------- ...ngClient.ListFineTuningJobCheckpoints.g.cs | 62 ++++++++-------- ...ingClient.ListPaginatedFineTuningJobs.g.cs | 62 ++++++++-------- ...ineTuningClient.RetrieveFineTuningJob.g.cs | 62 ++++++++-------- .../Generated/OpenAI.FineTuningClient.g.cs | 38 ++++++---- .../Generated/OpenAI.IAssistantsClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IAudioClient.g.cs | 15 ++++ .../Generated/OpenAI.IAuditLogsClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IBatchClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IChatClient.g.cs | 15 ++++ .../Generated/OpenAI.ICompletionsClient.g.cs | 15 ++++ .../Generated/OpenAI.IEmbeddingsClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IFilesClient.g.cs | 15 ++++ .../Generated/OpenAI.IFineTuningClient.g.cs | 15 ++++ .../Generated/OpenAI.IImagesClient.g.cs | 15 ++++ .../Generated/OpenAI.IInvitesClient.g.cs | 15 ++++ .../Generated/OpenAI.IModelsClient.g.cs | 15 ++++ .../Generated/OpenAI.IModerationsClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IOpenAiApi.g.cs | 15 ++++ .../Generated/OpenAI.IProjectsClient.g.cs | 15 ++++ .../Generated/OpenAI.IUploadsClient.g.cs | 15 ++++ .../OpenAI/Generated/OpenAI.IUsersClient.g.cs | 15 ++++ .../Generated/OpenAI.IVectorStoresClient.g.cs | 15 ++++ .../OpenAI.ImagesClient.CreateImage.g.cs | 68 +++++++++--------- .../OpenAI.ImagesClient.CreateImageEdit.g.cs | 68 +++++++++--------- ...nAI.ImagesClient.CreateImageVariation.g.cs | 68 +++++++++--------- .../OpenAI/Generated/OpenAI.ImagesClient.g.cs | 38 ++++++---- .../OpenAI.InvitesClient.DeleteInvite.g.cs | 62 ++++++++-------- .../OpenAI.InvitesClient.InviteUser.g.cs | 68 +++++++++--------- .../OpenAI.InvitesClient.ListInvites.g.cs | 62 ++++++++-------- .../OpenAI.InvitesClient.RetrieveInvite.g.cs | 62 ++++++++-------- .../Generated/OpenAI.InvitesClient.g.cs | 38 ++++++---- .../OpenAI.ModelsClient.DeleteModel.g.cs | 62 ++++++++-------- .../OpenAI.ModelsClient.ListModels.g.cs | 62 ++++++++-------- .../OpenAI.ModelsClient.RetrieveModel.g.cs | 62 ++++++++-------- .../OpenAI/Generated/OpenAI.ModelsClient.g.cs | 38 ++++++---- ...AI.ModerationsClient.CreateModeration.g.cs | 68 +++++++++--------- .../Generated/OpenAI.ModerationsClient.g.cs | 38 ++++++---- ...penAI.OpenAiApi.Authorizations.Bearer.g.cs | 4 +- .../OpenAI.OpenAiApi.Constructors.Bearer.g.cs | 9 +-- .../OpenAI/Generated/OpenAI.OpenAiApi.g.cs | 72 +++++++++++-------- .../OpenAI.ProjectsClient.ArchiveProject.g.cs | 62 ++++++++-------- .../OpenAI.ProjectsClient.CreateProject.g.cs | 68 +++++++++--------- ...ctsClient.CreateProjectServiceAccount.g.cs | 68 +++++++++--------- ...enAI.ProjectsClient.CreateProjectUser.g.cs | 68 +++++++++--------- ...AI.ProjectsClient.DeleteProjectApiKey.g.cs | 62 ++++++++-------- ...ctsClient.DeleteProjectServiceAccount.g.cs | 62 ++++++++-------- ...enAI.ProjectsClient.DeleteProjectUser.g.cs | 62 ++++++++-------- ...nAI.ProjectsClient.ListProjectApiKeys.g.cs | 62 ++++++++-------- ...ectsClient.ListProjectServiceAccounts.g.cs | 62 ++++++++-------- ...penAI.ProjectsClient.ListProjectUsers.g.cs | 62 ++++++++-------- .../OpenAI.ProjectsClient.ListProjects.g.cs | 62 ++++++++-------- .../OpenAI.ProjectsClient.ModifyProject.g.cs | 68 +++++++++--------- ...enAI.ProjectsClient.ModifyProjectUser.g.cs | 68 +++++++++--------- ...OpenAI.ProjectsClient.RetrieveProject.g.cs | 62 ++++++++-------- ....ProjectsClient.RetrieveProjectApiKey.g.cs | 62 ++++++++-------- ...sClient.RetrieveProjectServiceAccount.g.cs | 62 ++++++++-------- ...AI.ProjectsClient.RetrieveProjectUser.g.cs | 62 ++++++++-------- .../Generated/OpenAI.ProjectsClient.g.cs | 38 ++++++---- .../OpenAI.UploadsClient.AddUploadPart.g.cs | 68 +++++++++--------- .../OpenAI.UploadsClient.CancelUpload.g.cs | 62 ++++++++-------- .../OpenAI.UploadsClient.CompleteUpload.g.cs | 68 +++++++++--------- .../OpenAI.UploadsClient.CreateUpload.g.cs | 68 +++++++++--------- .../Generated/OpenAI.UploadsClient.g.cs | 38 ++++++---- .../OpenAI.UsersClient.DeleteUser.g.cs | 62 ++++++++-------- .../OpenAI.UsersClient.ListUsers.g.cs | 62 ++++++++-------- .../OpenAI.UsersClient.ModifyUser.g.cs | 68 +++++++++--------- .../OpenAI.UsersClient.RetrieveUser.g.cs | 62 ++++++++-------- .../OpenAI/Generated/OpenAI.UsersClient.g.cs | 38 ++++++---- ...oresClient.CancelVectorStoreFileBatch.g.cs | 62 ++++++++-------- ....VectorStoresClient.CreateVectorStore.g.cs | 68 +++++++++--------- ...torStoresClient.CreateVectorStoreFile.g.cs | 68 +++++++++--------- ...oresClient.CreateVectorStoreFileBatch.g.cs | 68 +++++++++--------- ....VectorStoresClient.DeleteVectorStore.g.cs | 62 ++++++++-------- ...torStoresClient.DeleteVectorStoreFile.g.cs | 62 ++++++++-------- ...nAI.VectorStoresClient.GetVectorStore.g.cs | 62 ++++++++-------- ...VectorStoresClient.GetVectorStoreFile.g.cs | 62 ++++++++-------- ...rStoresClient.GetVectorStoreFileBatch.g.cs | 62 ++++++++-------- ...resClient.ListFilesInVectorStoreBatch.g.cs | 62 ++++++++-------- ...ctorStoresClient.ListVectorStoreFiles.g.cs | 62 ++++++++-------- ...I.VectorStoresClient.ListVectorStores.g.cs | 62 ++++++++-------- ....VectorStoresClient.ModifyVectorStore.g.cs | 68 +++++++++--------- .../Generated/OpenAI.VectorStoresClient.g.cs | 38 ++++++---- 132 files changed, 3779 insertions(+), 3256 deletions(-) diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CancelRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CancelRun.g.cs index 43a7ab48..64e996f3 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CancelRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CancelRun.g.cs @@ -36,75 +36,75 @@ partial void ProcessCancelRunResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId); - 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); ProcessCancelRunResponse( - 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); ProcessCancelRunResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.CreateAssistant.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateAssistant.g.cs index 2cac6a1b..3f7d34ad 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateAssistant.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateAssistant.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateAssistantResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateAssistantArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/assistants", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateAssistantResponseContent( 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); PrepareCreateAssistantRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateAssistantResponse( - 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); ProcessCreateAssistantResponseContent( - 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 @@ -171,7 +171,7 @@ partial void ProcessCreateAssistantResponseContent( global::OpenAI.AssistantsApiResponseFormatOption? responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateAssistantRequest + var __request = new global::OpenAI.CreateAssistantRequest { Model = model, Name = name, @@ -186,7 +186,7 @@ partial void ProcessCreateAssistantResponseContent( }; return await CreateAssistantAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateMessage.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateMessage.g.cs index 70b5f9e3..85ae13b1 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateMessage.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateMessage.g.cs @@ -38,33 +38,33 @@ partial void ProcessCreateMessageResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateMessageArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/messages", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessCreateMessageResponseContent( 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); PrepareCreateMessageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, 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); ProcessCreateMessageResponse( - 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); ProcessCreateMessageResponseContent( - 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 ProcessCreateMessageResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateMessageRequest + var __request = new global::OpenAI.CreateMessageRequest { Role = role, Content = content, @@ -156,7 +156,7 @@ partial void ProcessCreateMessageResponseContent( return await CreateMessageAsync( threadId: threadId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateRun.g.cs index c107ec61..e28bdd8b 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateRun.g.cs @@ -42,34 +42,34 @@ partial void ProcessCreateRunResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, include: include, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,48 +77,48 @@ partial void ProcessCreateRunResponseContent( 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); PrepareCreateRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, include: include, 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); ProcessCreateRunResponse( - 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); ProcessCreateRunResponseContent( - 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 @@ -215,7 +215,7 @@ partial void ProcessCreateRunResponseContent( global::OpenAI.AssistantsApiResponseFormatOption? responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateRunRequest + var __request = new global::OpenAI.CreateRunRequest { AssistantId = assistantId, Model = model, @@ -238,7 +238,7 @@ partial void ProcessCreateRunResponseContent( return await CreateRunAsync( threadId: threadId, include: include, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThread.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThread.g.cs index f217bd94..2b3b7be7 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThread.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThread.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateThreadResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateThreadArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/threads", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateThreadResponseContent( 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); PrepareCreateThreadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateThreadResponse( - 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); ProcessCreateThreadResponseContent( - 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 @@ -134,7 +134,7 @@ partial void ProcessCreateThreadResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateThreadRequest + var __request = new global::OpenAI.CreateThreadRequest { Messages = messages, ToolResources = toolResources, @@ -142,7 +142,7 @@ partial void ProcessCreateThreadResponseContent( }; return await CreateThreadAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThreadAndRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThreadAndRun.g.cs index dd5f5344..f4ba8d86 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThreadAndRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.CreateThreadAndRun.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateThreadAndRunResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateThreadAndRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/threads/runs", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateThreadAndRunResponseContent( 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); PrepareCreateThreadAndRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateThreadAndRunResponse( - 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); ProcessCreateThreadAndRunResponseContent( - 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 @@ -197,7 +197,7 @@ partial void ProcessCreateThreadAndRunResponseContent( global::OpenAI.AssistantsApiResponseFormatOption? responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateThreadAndRunRequest + var __request = new global::OpenAI.CreateThreadAndRunRequest { AssistantId = assistantId, Thread = thread, @@ -218,7 +218,7 @@ partial void ProcessCreateThreadAndRunResponseContent( }; return await CreateThreadAndRunAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteAssistant.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteAssistant.g.cs index b3094ad1..11e40ec2 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteAssistant.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteAssistant.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteAssistantResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteAssistantArguments( - httpClient: _httpClient, + httpClient: HttpClient, assistantId: ref assistantId); var __pathBuilder = new PathBuilder( path: $"/assistants/{assistantId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteAssistantRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, assistantId: assistantId); - 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); ProcessDeleteAssistantResponse( - 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); ProcessDeleteAssistantResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.DeleteMessage.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteMessage.g.cs index 3c499e3a..6dbf23e0 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteMessage.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteMessage.g.cs @@ -36,75 +36,75 @@ partial void ProcessDeleteMessageResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteMessageArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, messageId: ref messageId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/messages/{messageId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteMessageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, messageId: messageId); - 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); ProcessDeleteMessageResponse( - 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); ProcessDeleteMessageResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.DeleteThread.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteThread.g.cs index 8378f5c6..b1db8847 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteThread.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.DeleteThread.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteThreadResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteThreadArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteThreadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId); - 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); ProcessDeleteThreadResponse( - 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); ProcessDeleteThreadResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.GetAssistant.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetAssistant.g.cs index 8c3018be..3b7c95a5 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetAssistant.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetAssistant.g.cs @@ -32,73 +32,73 @@ partial void ProcessGetAssistantResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetAssistantArguments( - httpClient: _httpClient, + httpClient: HttpClient, assistantId: ref assistantId); var __pathBuilder = new PathBuilder( path: $"/assistants/{assistantId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetAssistantRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, assistantId: assistantId); - 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); ProcessGetAssistantResponse( - 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); ProcessGetAssistantResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.GetMessage.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetMessage.g.cs index 5b4b7962..9d2c85b9 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetMessage.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetMessage.g.cs @@ -36,75 +36,75 @@ partial void ProcessGetMessageResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetMessageArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, messageId: ref messageId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/messages/{messageId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetMessageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, messageId: messageId); - 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); ProcessGetMessageResponse( - 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); ProcessGetMessageResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.GetRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRun.g.cs index 63cc11f8..ba3e77ec 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRun.g.cs @@ -36,75 +36,75 @@ partial void ProcessGetRunResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId); - 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); ProcessGetRunResponse( - 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); ProcessGetRunResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.GetRunStep.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRunStep.g.cs index eba4945f..4fa44364 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRunStep.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetRunStep.g.cs @@ -44,9 +44,9 @@ partial void ProcessGetRunStepResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetRunStepArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId, stepId: ref stepId, @@ -54,69 +54,69 @@ partial void ProcessGetRunStepResponseContent( var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}/steps/{stepId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetRunStepRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId, stepId: stepId, include: include); - 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); ProcessGetRunStepResponse( - 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); ProcessGetRunStepResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.GetThread.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetThread.g.cs index b77ac05f..d04a40ce 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetThread.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.GetThread.g.cs @@ -32,73 +32,73 @@ partial void ProcessGetThreadResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetThreadArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetThreadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId); - 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); ProcessGetThreadResponse( - 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); ProcessGetThreadResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.ListAssistants.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListAssistants.g.cs index af099a9c..6c589cb8 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListAssistants.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListAssistants.g.cs @@ -48,9 +48,9 @@ partial void ProcessListAssistantsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListAssistantsArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, order: ref order, after: ref after, @@ -58,7 +58,7 @@ partial void ProcessListAssistantsResponseContent( var __pathBuilder = new PathBuilder( path: "/assistants", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -66,67 +66,67 @@ partial void ProcessListAssistantsResponseContent( .AddOptionalParameter("before", before) ; 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); PrepareListAssistantsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, order: order, after: after, before: before); - 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); ProcessListAssistantsResponse( - 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); ProcessListAssistantsResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.ListMessages.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListMessages.g.cs index e5b252ff..e73c5e91 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListMessages.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListMessages.g.cs @@ -56,9 +56,9 @@ partial void ProcessListMessagesResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListMessagesArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, limit: ref limit, order: ref order, @@ -68,7 +68,7 @@ partial void ProcessListMessagesResponseContent( var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/messages", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -77,32 +77,32 @@ partial void ProcessListMessagesResponseContent( .AddOptionalParameter("run_id", runId) ; 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); PrepareListMessagesRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, limit: limit, order: order, @@ -110,36 +110,36 @@ partial void ProcessListMessagesResponseContent( before: before, runId: runId); - 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); ProcessListMessagesResponse( - 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); ProcessListMessagesResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.ListRunSteps.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRunSteps.g.cs index 1d3b8239..e0601266 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRunSteps.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRunSteps.g.cs @@ -60,9 +60,9 @@ partial void ProcessListRunStepsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListRunStepsArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId, limit: ref limit, @@ -73,7 +73,7 @@ partial void ProcessListRunStepsResponseContent( var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}/steps", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -81,32 +81,32 @@ partial void ProcessListRunStepsResponseContent( .AddOptionalParameter("before", before) ; 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); PrepareListRunStepsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId, limit: limit, @@ -115,36 +115,36 @@ partial void ProcessListRunStepsResponseContent( before: before, include: include); - 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); ProcessListRunStepsResponse( - 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); ProcessListRunStepsResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.ListRuns.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRuns.g.cs index ba6aa9dc..ceb5e1dd 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRuns.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ListRuns.g.cs @@ -52,9 +52,9 @@ partial void ProcessListRunsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListRunsArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, limit: ref limit, order: ref order, @@ -63,7 +63,7 @@ partial void ProcessListRunsResponseContent( var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -71,68 +71,68 @@ partial void ProcessListRunsResponseContent( .AddOptionalParameter("before", before) ; 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); PrepareListRunsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, limit: limit, order: order, after: after, before: before); - 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); ProcessListRunsResponse( - 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); ProcessListRunsResponseContent( - 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/OpenAI/Generated/OpenAI.AssistantsClient.ModifyAssistant.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyAssistant.g.cs index 66ea7479..5be5f83a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyAssistant.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyAssistant.g.cs @@ -38,33 +38,33 @@ partial void ProcessModifyAssistantResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyAssistantArguments( - httpClient: _httpClient, + httpClient: HttpClient, assistantId: ref assistantId, request: request); var __pathBuilder = new PathBuilder( path: $"/assistants/{assistantId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessModifyAssistantResponseContent( 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); PrepareModifyAssistantRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, assistantId: assistantId, 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); ProcessModifyAssistantResponse( - 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); ProcessModifyAssistantResponseContent( - 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 @@ -178,7 +178,7 @@ partial void ProcessModifyAssistantResponseContent( global::OpenAI.AssistantsApiResponseFormatOption? responseFormat = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ModifyAssistantRequest + var __request = new global::OpenAI.ModifyAssistantRequest { Model = model, Name = name, @@ -194,7 +194,7 @@ partial void ProcessModifyAssistantResponseContent( return await ModifyAssistantAsync( assistantId: assistantId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyMessage.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyMessage.g.cs index 69d87957..f7897d1c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyMessage.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyMessage.g.cs @@ -42,34 +42,34 @@ partial void ProcessModifyMessageResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyMessageArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, messageId: ref messageId, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/messages/{messageId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,48 +77,48 @@ partial void ProcessModifyMessageResponseContent( 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); PrepareModifyMessageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, messageId: messageId, 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); ProcessModifyMessageResponse( - 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); ProcessModifyMessageResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessModifyMessageResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ModifyMessageRequest + var __request = new global::OpenAI.ModifyMessageRequest { Metadata = metadata, }; @@ -150,7 +150,7 @@ partial void ProcessModifyMessageResponseContent( return await ModifyMessageAsync( threadId: threadId, messageId: messageId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyRun.g.cs index dc3221d8..2179c33a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyRun.g.cs @@ -42,34 +42,34 @@ partial void ProcessModifyRunResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,48 +77,48 @@ partial void ProcessModifyRunResponseContent( 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); PrepareModifyRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId, 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); ProcessModifyRunResponse( - 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); ProcessModifyRunResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessModifyRunResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ModifyRunRequest + var __request = new global::OpenAI.ModifyRunRequest { Metadata = metadata, }; @@ -150,7 +150,7 @@ partial void ProcessModifyRunResponseContent( return await ModifyRunAsync( threadId: threadId, runId: runId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyThread.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyThread.g.cs index fe79705a..f60a560d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyThread.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.ModifyThread.g.cs @@ -38,33 +38,33 @@ partial void ProcessModifyThreadResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyThreadArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessModifyThreadResponseContent( 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); PrepareModifyThreadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, 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); ProcessModifyThreadResponse( - 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); ProcessModifyThreadResponseContent( - 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 @@ -138,7 +138,7 @@ partial void ProcessModifyThreadResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ModifyThreadRequest + var __request = new global::OpenAI.ModifyThreadRequest { ToolResources = toolResources, Metadata = metadata, @@ -146,7 +146,7 @@ partial void ProcessModifyThreadResponseContent( return await ModifyThreadAsync( threadId: threadId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.SubmitToolOuputsToRun.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.SubmitToolOuputsToRun.g.cs index 59aa9853..eb10df38 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.SubmitToolOuputsToRun.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.SubmitToolOuputsToRun.g.cs @@ -42,34 +42,34 @@ partial void ProcessSubmitToolOuputsToRunResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareSubmitToolOuputsToRunArguments( - httpClient: _httpClient, + httpClient: HttpClient, threadId: ref threadId, runId: ref runId, request: request); var __pathBuilder = new PathBuilder( path: $"/threads/{threadId}/runs/{runId}/submit_tool_outputs", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,48 +77,48 @@ partial void ProcessSubmitToolOuputsToRunResponseContent( 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); PrepareSubmitToolOuputsToRunRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, threadId: threadId, runId: runId, 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); ProcessSubmitToolOuputsToRunResponse( - 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); ProcessSubmitToolOuputsToRunResponseContent( - 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 ProcessSubmitToolOuputsToRunResponseContent( bool? stream = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.SubmitToolOutputsRunRequest + var __request = new global::OpenAI.SubmitToolOutputsRunRequest { ToolOutputs = toolOutputs, Stream = stream, @@ -155,7 +155,7 @@ partial void ProcessSubmitToolOuputsToRunResponseContent( return await SubmitToolOuputsToRunAsync( threadId: threadId, runId: runId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.g.cs index 627cea39..5461cc6d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AssistantsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class AssistantsClient : global::OpenAI.IAssistantsClient, /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 AssistantsClient : global::OpenAI.IAssistantsClient, /// 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 AssistantsClient( 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/OpenAI/Generated/OpenAI.AudioClient.CreateSpeech.g.cs b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateSpeech.g.cs index 977103e3..f35e39fb 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateSpeech.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateSpeech.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateSpeechResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateSpeechArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/audio/speech", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,37 +67,37 @@ partial void ProcessCreateSpeechResponseContent( 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); PrepareCreateSpeechRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateSpeechResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); ProcessCreateSpeechResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); return __content; } @@ -132,7 +132,7 @@ partial void ProcessCreateSpeechResponseContent( double? speed = 1, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateSpeechRequest + var __request = new global::OpenAI.CreateSpeechRequest { Model = model, Input = input, @@ -142,7 +142,7 @@ partial void ProcessCreateSpeechResponseContent( }; return await CreateSpeechAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranscription.g.cs b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranscription.g.cs index 4ff9eb86..c207f4c6 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranscription.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranscription.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateTranscriptionResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateTranscriptionArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/audio/transcriptions", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -106,46 +106,46 @@ partial void ProcessCreateTranscriptionResponseContent( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"), name: "timestamp_granularities[]"); } - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateTranscriptionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateTranscriptionResponse( - 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); ProcessCreateTranscriptionResponseContent( - 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 @@ -197,7 +197,7 @@ partial void ProcessCreateTranscriptionResponseContent( global::System.Collections.Generic.IList? timestampGranularities = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateTranscriptionRequest + var __request = new global::OpenAI.CreateTranscriptionRequest { File = file, Filename = filename, @@ -210,7 +210,7 @@ partial void ProcessCreateTranscriptionResponseContent( }; return await CreateTranscriptionAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranslation.g.cs b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranslation.g.cs index 0372d00d..c15622b9 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranslation.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AudioClient.CreateTranslation.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateTranslationResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateTranslationArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/audio/translations", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -94,46 +94,46 @@ partial void ProcessCreateTranslationResponseContent( content: new global::System.Net.Http.StringContent($"{request.Temperature}"), name: "temperature"); } - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateTranslationRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateTranslationResponse( - 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); ProcessCreateTranslationResponseContent( - 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 @@ -176,7 +176,7 @@ partial void ProcessCreateTranslationResponseContent( double? temperature = 0, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateTranslationRequest + var __request = new global::OpenAI.CreateTranslationRequest { File = file, Filename = filename, @@ -187,7 +187,7 @@ partial void ProcessCreateTranslationResponseContent( }; return await CreateTranslationAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.AudioClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.AudioClient.g.cs index 5196af37..b9751726 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AudioClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AudioClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class AudioClient : global::OpenAI.IAudioClient, global::S /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 AudioClient : global::OpenAI.IAudioClient, global::S /// 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 AudioClient( 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/OpenAI/Generated/OpenAI.AuditLogsClient.ListAuditLogs.g.cs b/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.ListAuditLogs.g.cs index 29d9293d..22cef55f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.ListAuditLogs.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.ListAuditLogs.g.cs @@ -66,9 +66,9 @@ partial void ProcessListAuditLogsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListAuditLogsArguments( - httpClient: _httpClient, + httpClient: HttpClient, effectiveAt: effectiveAt, projectIds: projectIds, eventTypes: eventTypes, @@ -81,7 +81,7 @@ partial void ProcessListAuditLogsResponseContent( var __pathBuilder = new PathBuilder( path: "/organization/audit_logs", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("gt", effectiveAt?.Gt?.ToString()) .AddOptionalParameter("gte", effectiveAt?.Gte?.ToString()) @@ -96,32 +96,32 @@ partial void ProcessListAuditLogsResponseContent( .AddOptionalParameter("before", before) ; 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); PrepareListAuditLogsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, effectiveAt: effectiveAt, projectIds: projectIds, eventTypes: eventTypes, @@ -132,36 +132,36 @@ partial void ProcessListAuditLogsResponseContent( after: after, before: before); - 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); ProcessListAuditLogsResponse( - 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); ProcessListAuditLogsResponseContent( - 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/OpenAI/Generated/OpenAI.AuditLogsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.g.cs index 804639cf..9f6205ce 100644 --- a/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.AuditLogsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class AuditLogsClient : global::OpenAI.IAuditLogsClient, g /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 AuditLogsClient : global::OpenAI.IAuditLogsClient, 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 AuditLogsClient( 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/OpenAI/Generated/OpenAI.BatchClient.CancelBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.BatchClient.CancelBatch.g.cs index 92135459..223d214c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.BatchClient.CancelBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.BatchClient.CancelBatch.g.cs @@ -32,73 +32,73 @@ partial void ProcessCancelBatchResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, batchId: ref batchId); var __pathBuilder = new PathBuilder( path: $"/batches/{batchId}/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, batchId: batchId); - 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); ProcessCancelBatchResponse( - 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); ProcessCancelBatchResponseContent( - 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/OpenAI/Generated/OpenAI.BatchClient.CreateBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.BatchClient.CreateBatch.g.cs index ec834660..fc7065a1 100644 --- a/src/libs/OpenAI/Generated/OpenAI.BatchClient.CreateBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.BatchClient.CreateBatch.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateBatchResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/batches", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateBatchResponseContent( 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); PrepareCreateBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateBatchResponse( - 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); ProcessCreateBatchResponseContent( - 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 @@ -140,7 +140,7 @@ partial void ProcessCreateBatchResponseContent( global::System.Collections.Generic.Dictionary? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateBatchRequest + var __request = new global::OpenAI.CreateBatchRequest { InputFileId = inputFileId, Endpoint = endpoint, @@ -149,7 +149,7 @@ partial void ProcessCreateBatchResponseContent( }; return await CreateBatchAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.BatchClient.ListBatches.g.cs b/src/libs/OpenAI/Generated/OpenAI.BatchClient.ListBatches.g.cs index 605adf47..38feaaf4 100644 --- a/src/libs/OpenAI/Generated/OpenAI.BatchClient.ListBatches.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.BatchClient.ListBatches.g.cs @@ -38,79 +38,79 @@ partial void ProcessListBatchesResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListBatchesArguments( - httpClient: _httpClient, + httpClient: HttpClient, after: ref after, limit: ref limit); var __pathBuilder = new PathBuilder( path: "/batches", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.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); PrepareListBatchesRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, after: after, limit: limit); - 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); ProcessListBatchesResponse( - 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); ProcessListBatchesResponseContent( - 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/OpenAI/Generated/OpenAI.BatchClient.RetrieveBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.BatchClient.RetrieveBatch.g.cs index 7d390a6b..3ee6e89f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.BatchClient.RetrieveBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.BatchClient.RetrieveBatch.g.cs @@ -32,73 +32,73 @@ partial void ProcessRetrieveBatchResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, batchId: ref batchId); var __pathBuilder = new PathBuilder( path: $"/batches/{batchId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, batchId: batchId); - 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); ProcessRetrieveBatchResponse( - 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); ProcessRetrieveBatchResponseContent( - 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/OpenAI/Generated/OpenAI.BatchClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.BatchClient.g.cs index e88e3d07..cbb8c77c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.BatchClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.BatchClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class BatchClient : global::OpenAI.IBatchClient, global::S /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 BatchClient : global::OpenAI.IBatchClient, global::S /// 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 BatchClient( 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/OpenAI/Generated/OpenAI.ChatClient.CreateChatCompletion.g.cs b/src/libs/OpenAI/Generated/OpenAI.ChatClient.CreateChatCompletion.g.cs index 3eeea5ee..26655e88 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ChatClient.CreateChatCompletion.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ChatClient.CreateChatCompletion.g.cs @@ -36,32 +36,32 @@ partial void ProcessCreateChatCompletionResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateChatCompletionArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/chat/completions", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -69,46 +69,46 @@ partial void ProcessCreateChatCompletionResponseContent( 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); PrepareCreateChatCompletionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateChatCompletionResponse( - 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); ProcessCreateChatCompletionResponseContent( - 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 @@ -272,7 +272,7 @@ partial void ProcessCreateChatCompletionResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateChatCompletionRequest + var __request = new global::OpenAI.CreateChatCompletionRequest { Messages = messages, Model = model, @@ -302,7 +302,7 @@ partial void ProcessCreateChatCompletionResponseContent( }; return await CreateChatCompletionAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ChatClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ChatClient.g.cs index 8f3d8236..b8f598fa 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ChatClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ChatClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ChatClient : global::OpenAI.IChatClient, global::Sys /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 ChatClient : global::OpenAI.IChatClient, global::Sys /// 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 ChatClient( 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/OpenAI/Generated/OpenAI.CompletionsClient.CreateCompletion.g.cs b/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.CreateCompletion.g.cs index 9cde73a0..434cbad3 100644 --- a/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.CreateCompletion.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.CreateCompletion.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateCompletionResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateCompletionArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/completions", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateCompletionResponseContent( 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); PrepareCreateCompletionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateCompletionResponse( - 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); ProcessCreateCompletionResponseContent( - 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 @@ -224,7 +224,7 @@ partial void ProcessCreateCompletionResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateCompletionRequest + var __request = new global::OpenAI.CreateCompletionRequest { Model = model, Prompt = prompt, @@ -247,7 +247,7 @@ partial void ProcessCreateCompletionResponseContent( }; return await CreateCompletionAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.g.cs index 272eca6d..ddfc8694 100644 --- a/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.CompletionsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class CompletionsClient : global::OpenAI.ICompletionsClien /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 CompletionsClient : global::OpenAI.ICompletionsClien /// 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 CompletionsClient( 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/OpenAI/Generated/OpenAI.EmbeddingsClient.CreateEmbedding.g.cs b/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.CreateEmbedding.g.cs index 6374a9d6..f99fcf77 100644 --- a/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.CreateEmbedding.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.CreateEmbedding.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateEmbeddingResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateEmbeddingArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/embeddings", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateEmbeddingResponseContent( 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); PrepareCreateEmbeddingRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateEmbeddingResponse( - 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); ProcessCreateEmbeddingResponseContent( - 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 ProcessCreateEmbeddingResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateEmbeddingRequest + var __request = new global::OpenAI.CreateEmbeddingRequest { Input = input, Model = model, @@ -157,7 +157,7 @@ partial void ProcessCreateEmbeddingResponseContent( }; return await CreateEmbeddingAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.g.cs index 1a1289d3..8192b9e7 100644 --- a/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.EmbeddingsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class EmbeddingsClient : global::OpenAI.IEmbeddingsClient, /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 EmbeddingsClient : global::OpenAI.IEmbeddingsClient, /// 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 EmbeddingsClient( 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/OpenAI/Generated/OpenAI.FilesClient.CreateFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.CreateFile.g.cs index a4869915..1eae5b3e 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.CreateFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.CreateFile.g.cs @@ -38,32 +38,32 @@ partial void ProcessCreateFileResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/files", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -80,46 +80,46 @@ partial void ProcessCreateFileResponseContent( __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"{request.Purpose.ToValueString()}"), name: "purpose"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateFileResponse( - 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); ProcessCreateFileResponseContent( - 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 @@ -152,7 +152,7 @@ partial void ProcessCreateFileResponseContent( global::OpenAI.CreateFileRequestPurpose purpose, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateFileRequest + var __request = new global::OpenAI.CreateFileRequest { File = file, Filename = filename, @@ -160,7 +160,7 @@ partial void ProcessCreateFileResponseContent( }; return await CreateFileAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.FilesClient.DeleteFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.DeleteFile.g.cs index b7e04bad..2471a610 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.DeleteFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.DeleteFile.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteFileResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, fileId: ref fileId); var __pathBuilder = new PathBuilder( path: $"/files/{fileId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fileId: fileId); - 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); ProcessDeleteFileResponse( - 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); ProcessDeleteFileResponseContent( - 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/OpenAI/Generated/OpenAI.FilesClient.DownloadFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.DownloadFile.g.cs index f6ac8d6d..b1748e8f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.DownloadFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.DownloadFile.g.cs @@ -32,64 +32,64 @@ partial void ProcessDownloadFileResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDownloadFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, fileId: ref fileId); var __pathBuilder = new PathBuilder( path: $"/files/{fileId}/content", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDownloadFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fileId: fileId); - 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); ProcessDownloadFileResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsByteArrayAsync(cancellationToken).ConfigureAwait(false); ProcessDownloadFileResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); return __content; } diff --git a/src/libs/OpenAI/Generated/OpenAI.FilesClient.ListFiles.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.ListFiles.g.cs index f8955b6a..fc576232 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.ListFiles.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.ListFiles.g.cs @@ -32,76 +32,76 @@ partial void ProcessListFilesResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListFilesArguments( - httpClient: _httpClient, + httpClient: HttpClient, purpose: ref purpose); var __pathBuilder = new PathBuilder( path: "/files", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("purpose", purpose) ; 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); PrepareListFilesRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, purpose: purpose); - 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); ProcessListFilesResponse( - 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); ProcessListFilesResponseContent( - 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/OpenAI/Generated/OpenAI.FilesClient.RetrieveFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.RetrieveFile.g.cs index 1bd9682b..3afc6c74 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.RetrieveFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.RetrieveFile.g.cs @@ -32,73 +32,73 @@ partial void ProcessRetrieveFileResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, fileId: ref fileId); var __pathBuilder = new PathBuilder( path: $"/files/{fileId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fileId: fileId); - 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); ProcessRetrieveFileResponse( - 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); ProcessRetrieveFileResponseContent( - 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/OpenAI/Generated/OpenAI.FilesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.FilesClient.g.cs index 0c65ad03..fc0dbef3 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FilesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FilesClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class FilesClient : global::OpenAI.IFilesClient, global::S /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 FilesClient : global::OpenAI.IFilesClient, global::S /// 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 FilesClient( 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/OpenAI/Generated/OpenAI.FineTuningClient.CancelFineTuningJob.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CancelFineTuningJob.g.cs index 82bc4e3a..be7e7530 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CancelFineTuningJob.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CancelFineTuningJob.g.cs @@ -34,73 +34,73 @@ partial void ProcessCancelFineTuningJobResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelFineTuningJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, fineTuningJobId: ref fineTuningJobId); var __pathBuilder = new PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelFineTuningJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fineTuningJobId: fineTuningJobId); - 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); ProcessCancelFineTuningJobResponse( - 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); ProcessCancelFineTuningJobResponseContent( - 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/OpenAI/Generated/OpenAI.FineTuningClient.CreateFineTuningJob.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CreateFineTuningJob.g.cs index eb920d6b..792ed7bf 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CreateFineTuningJob.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.CreateFineTuningJob.g.cs @@ -36,32 +36,32 @@ partial void ProcessCreateFineTuningJobResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateFineTuningJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/fine_tuning/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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -69,46 +69,46 @@ partial void ProcessCreateFineTuningJobResponseContent( 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); PrepareCreateFineTuningJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateFineTuningJobResponse( - 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); ProcessCreateFineTuningJobResponseContent( - 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 @@ -171,7 +171,7 @@ partial void ProcessCreateFineTuningJobResponseContent( int? seed = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateFineTuningJobRequest + var __request = new global::OpenAI.CreateFineTuningJobRequest { Model = model, TrainingFile = trainingFile, @@ -183,7 +183,7 @@ partial void ProcessCreateFineTuningJobResponseContent( }; return await CreateFineTuningJobAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningEvents.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningEvents.g.cs index 41aef382..35f49be6 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningEvents.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningEvents.g.cs @@ -44,81 +44,81 @@ partial void ProcessListFineTuningEventsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListFineTuningEventsArguments( - httpClient: _httpClient, + httpClient: HttpClient, fineTuningJobId: ref fineTuningJobId, after: ref after, limit: ref limit); var __pathBuilder = new PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/events", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.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); PrepareListFineTuningEventsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fineTuningJobId: fineTuningJobId, after: after, limit: limit); - 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); ProcessListFineTuningEventsResponse( - 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); ProcessListFineTuningEventsResponseContent( - 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/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningJobCheckpoints.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningJobCheckpoints.g.cs index e8dbdf45..0383e07e 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningJobCheckpoints.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListFineTuningJobCheckpoints.g.cs @@ -44,81 +44,81 @@ partial void ProcessListFineTuningJobCheckpointsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListFineTuningJobCheckpointsArguments( - httpClient: _httpClient, + httpClient: HttpClient, fineTuningJobId: ref fineTuningJobId, after: ref after, limit: ref limit); var __pathBuilder = new PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/checkpoints", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.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); PrepareListFineTuningJobCheckpointsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fineTuningJobId: fineTuningJobId, after: after, limit: limit); - 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); ProcessListFineTuningJobCheckpointsResponse( - 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); ProcessListFineTuningJobCheckpointsResponseContent( - 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/OpenAI/Generated/OpenAI.FineTuningClient.ListPaginatedFineTuningJobs.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListPaginatedFineTuningJobs.g.cs index 3ca47e4f..89d997e8 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListPaginatedFineTuningJobs.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.ListPaginatedFineTuningJobs.g.cs @@ -38,79 +38,79 @@ partial void ProcessListPaginatedFineTuningJobsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListPaginatedFineTuningJobsArguments( - httpClient: _httpClient, + httpClient: HttpClient, after: ref after, limit: ref limit); var __pathBuilder = new PathBuilder( path: "/fine_tuning/jobs", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.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); PrepareListPaginatedFineTuningJobsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, after: after, limit: limit); - 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); ProcessListPaginatedFineTuningJobsResponse( - 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); ProcessListPaginatedFineTuningJobsResponseContent( - 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/OpenAI/Generated/OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs index 27546c7f..e1a626c1 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs @@ -35,73 +35,73 @@ partial void ProcessRetrieveFineTuningJobResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveFineTuningJobArguments( - httpClient: _httpClient, + httpClient: HttpClient, fineTuningJobId: ref fineTuningJobId); var __pathBuilder = new PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveFineTuningJobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, fineTuningJobId: fineTuningJobId); - 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); ProcessRetrieveFineTuningJobResponse( - 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); ProcessRetrieveFineTuningJobResponseContent( - 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/OpenAI/Generated/OpenAI.FineTuningClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.g.cs index 3dba95c9..dce31f78 100644 --- a/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.FineTuningClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class FineTuningClient : global::OpenAI.IFineTuningClient, /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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::OpenAI.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/OpenAI/Generated/OpenAI.IAssistantsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IAssistantsClient.g.cs index 1d144cb3..c4b5002a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IAssistantsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IAssistantsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IAssistantsClient : 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/OpenAI/Generated/OpenAI.IAudioClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IAudioClient.g.cs index 12e77392..7e49035a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IAudioClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IAudioClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IAudioClient : 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/OpenAI/Generated/OpenAI.IAuditLogsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IAuditLogsClient.g.cs index 45f6db47..a4fda7ea 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IAuditLogsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IAuditLogsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IAuditLogsClient : 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/OpenAI/Generated/OpenAI.IBatchClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IBatchClient.g.cs index df293411..2050fee1 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IBatchClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IBatchClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IBatchClient : 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/OpenAI/Generated/OpenAI.IChatClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IChatClient.g.cs index e6e81729..a1be00f3 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IChatClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IChatClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IChatClient : 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/OpenAI/Generated/OpenAI.ICompletionsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ICompletionsClient.g.cs index 45a2f51a..da24ca97 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ICompletionsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ICompletionsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface ICompletionsClient : 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/OpenAI/Generated/OpenAI.IEmbeddingsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IEmbeddingsClient.g.cs index 72a237e5..156ea557 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IEmbeddingsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IEmbeddingsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IEmbeddingsClient : 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/OpenAI/Generated/OpenAI.IFilesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IFilesClient.g.cs index bd7ca54e..b589dff9 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IFilesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IFilesClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IFilesClient : 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/OpenAI/Generated/OpenAI.IFineTuningClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IFineTuningClient.g.cs index 799e0773..65fcb88a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IFineTuningClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IFineTuningClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// 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/OpenAI/Generated/OpenAI.IImagesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IImagesClient.g.cs index 789fa22b..31126cea 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IImagesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IImagesClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IImagesClient : 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/OpenAI/Generated/OpenAI.IInvitesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IInvitesClient.g.cs index 789f033c..311b279d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IInvitesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IInvitesClient.g.cs @@ -9,6 +9,21 @@ namespace OpenAI /// public partial interface IInvitesClient : 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/OpenAI/Generated/OpenAI.IModelsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IModelsClient.g.cs index 6c1f17c2..fb9c8f36 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IModelsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IModelsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// 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/OpenAI/Generated/OpenAI.IModerationsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IModerationsClient.g.cs index d18d7394..323aef75 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IModerationsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IModerationsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IModerationsClient : 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/OpenAI/Generated/OpenAI.IOpenAiApi.g.cs b/src/libs/OpenAI/Generated/OpenAI.IOpenAiApi.g.cs index 832bc9ca..bc0b780c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IOpenAiApi.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IOpenAiApi.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IOpenAiApi : 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/OpenAI/Generated/OpenAI.IProjectsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IProjectsClient.g.cs index d6919b43..75391928 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IProjectsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IProjectsClient.g.cs @@ -9,6 +9,21 @@ namespace OpenAI /// public partial interface IProjectsClient : 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/OpenAI/Generated/OpenAI.IUploadsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IUploadsClient.g.cs index 39659d9b..fb55a76f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IUploadsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IUploadsClient.g.cs @@ -10,6 +10,21 @@ namespace OpenAI /// public partial interface IUploadsClient : 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/OpenAI/Generated/OpenAI.IUsersClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IUsersClient.g.cs index ee468b24..98a39bdc 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IUsersClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IUsersClient.g.cs @@ -9,6 +9,21 @@ namespace OpenAI /// public partial interface IUsersClient : 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/OpenAI/Generated/OpenAI.IVectorStoresClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.IVectorStoresClient.g.cs index d71e4fd1..e5b1c607 100644 --- a/src/libs/OpenAI/Generated/OpenAI.IVectorStoresClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.IVectorStoresClient.g.cs @@ -9,6 +9,21 @@ namespace OpenAI /// public partial interface IVectorStoresClient : 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/OpenAI/Generated/OpenAI.ImagesClient.CreateImage.g.cs b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImage.g.cs index 7e34e1e4..28d8c927 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImage.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImage.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateImageResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateImageArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/images/generations", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateImageResponseContent( 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); PrepareCreateImageRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateImageResponse( - 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); ProcessCreateImageResponseContent( - 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 ProcessCreateImageResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateImageRequest + var __request = new global::OpenAI.CreateImageRequest { Prompt = prompt, Model = model, @@ -181,7 +181,7 @@ partial void ProcessCreateImageResponseContent( }; return await CreateImageAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageEdit.g.cs b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageEdit.g.cs index 6601e9a1..5cbb6ad2 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageEdit.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageEdit.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateImageEditResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateImageEditArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/images/edits", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -119,46 +119,46 @@ partial void ProcessCreateImageEditResponseContent( content: new global::System.Net.Http.StringContent($"{request.User}"), name: "user"); } - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateImageEditRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateImageEditResponse( - 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); ProcessCreateImageEditResponseContent( - 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 @@ -224,7 +224,7 @@ partial void ProcessCreateImageEditResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateImageEditRequest + var __request = new global::OpenAI.CreateImageEditRequest { Image = image, Imagename = imagename, @@ -239,7 +239,7 @@ partial void ProcessCreateImageEditResponseContent( }; return await CreateImageEditAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageVariation.g.cs b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageVariation.g.cs index bcc744b8..4b7877c9 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageVariation.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.CreateImageVariation.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateImageVariationResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateImageVariationArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/images/variations", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -103,46 +103,46 @@ partial void ProcessCreateImageVariationResponseContent( content: new global::System.Net.Http.StringContent($"{request.User}"), name: "user"); } - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateImageVariationRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateImageVariationResponse( - 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); ProcessCreateImageVariationResponseContent( - 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 @@ -195,7 +195,7 @@ partial void ProcessCreateImageVariationResponseContent( string? user = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateImageVariationRequest + var __request = new global::OpenAI.CreateImageVariationRequest { Image = image, Imagename = imagename, @@ -207,7 +207,7 @@ partial void ProcessCreateImageVariationResponseContent( }; return await CreateImageVariationAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.g.cs index 8a188cdf..5452699f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ImagesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ImagesClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ImagesClient : global::OpenAI.IImagesClient, global: /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 ImagesClient : global::OpenAI.IImagesClient, 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 ImagesClient( 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/OpenAI/Generated/OpenAI.InvitesClient.DeleteInvite.g.cs b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.DeleteInvite.g.cs index 83873918..f1db1c2f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.DeleteInvite.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.DeleteInvite.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteInviteResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteInviteArguments( - httpClient: _httpClient, + httpClient: HttpClient, inviteId: ref inviteId); var __pathBuilder = new PathBuilder( path: $"/organization/invites/{inviteId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteInviteRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, inviteId: inviteId); - 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); ProcessDeleteInviteResponse( - 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); ProcessDeleteInviteResponseContent( - 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/OpenAI/Generated/OpenAI.InvitesClient.InviteUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.InviteUser.g.cs index 7b4dadb4..c4e8173a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.InviteUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.InviteUser.g.cs @@ -34,32 +34,32 @@ partial void ProcessInviteUserResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareInviteUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/organization/invites", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessInviteUserResponseContent( 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); PrepareInviteUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessInviteUserResponse( - 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); ProcessInviteUserResponseContent( - 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 @@ -130,14 +130,14 @@ partial void ProcessInviteUserResponseContent( global::OpenAI.InviteRequestRole role, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.InviteRequest + var __request = new global::OpenAI.InviteRequest { Email = email, Role = role, }; return await InviteUserAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.ListInvites.g.cs b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.ListInvites.g.cs index 330610ea..db69e5ac 100644 --- a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.ListInvites.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.ListInvites.g.cs @@ -38,79 +38,79 @@ partial void ProcessListInvitesResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListInvitesArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, after: ref after); var __pathBuilder = new PathBuilder( path: "/organization/invites", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) ; 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); PrepareListInvitesRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, after: after); - 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); ProcessListInvitesResponse( - 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); ProcessListInvitesResponseContent( - 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/OpenAI/Generated/OpenAI.InvitesClient.RetrieveInvite.g.cs b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.RetrieveInvite.g.cs index 2b948aa7..173ea47b 100644 --- a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.RetrieveInvite.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.RetrieveInvite.g.cs @@ -32,73 +32,73 @@ partial void ProcessRetrieveInviteResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveInviteArguments( - httpClient: _httpClient, + httpClient: HttpClient, inviteId: ref inviteId); var __pathBuilder = new PathBuilder( path: $"/organization/invites/{inviteId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveInviteRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, inviteId: inviteId); - 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); ProcessRetrieveInviteResponse( - 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); ProcessRetrieveInviteResponseContent( - 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/OpenAI/Generated/OpenAI.InvitesClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.g.cs index ba8e3335..0c5ec5a8 100644 --- a/src/libs/OpenAI/Generated/OpenAI.InvitesClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.InvitesClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class InvitesClient : global::OpenAI.IInvitesClient, globa /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 InvitesClient : global::OpenAI.IInvitesClient, globa /// 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 InvitesClient( 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/OpenAI/Generated/OpenAI.ModelsClient.DeleteModel.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.DeleteModel.g.cs index 9d09074e..83d82e50 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModelsClient.DeleteModel.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.DeleteModel.g.cs @@ -34,73 +34,73 @@ partial void ProcessDeleteModelResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, model: ref model); var __pathBuilder = new PathBuilder( path: $"/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.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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, model: model); - 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); ProcessDeleteModelResponse( - 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); ProcessDeleteModelResponseContent( - 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/OpenAI/Generated/OpenAI.ModelsClient.ListModels.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.ListModels.g.cs index 10ccf8c6..546a441c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModelsClient.ListModels.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.ListModels.g.cs @@ -28,71 +28,71 @@ partial void ProcessListModelsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListModelsArguments( - httpClient: _httpClient); + httpClient: HttpClient); var __pathBuilder = new PathBuilder( path: "/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.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); - 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/OpenAI/Generated/OpenAI.ModelsClient.RetrieveModel.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.RetrieveModel.g.cs index 19072afb..ea6f3d57 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModelsClient.RetrieveModel.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.RetrieveModel.g.cs @@ -34,73 +34,73 @@ partial void ProcessRetrieveModelResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, model: ref model); var __pathBuilder = new PathBuilder( path: $"/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, model: model); - 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); ProcessRetrieveModelResponse( - 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); ProcessRetrieveModelResponseContent( - 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/OpenAI/Generated/OpenAI.ModelsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.g.cs index cb2ca685..7ece78b6 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModelsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModelsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ModelsClient : global::OpenAI.IModelsClient, global: /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 ModelsClient : global::OpenAI.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( diff --git a/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.CreateModeration.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.CreateModeration.g.cs index 00e105cb..b174365c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.CreateModeration.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.CreateModeration.g.cs @@ -35,32 +35,32 @@ partial void ProcessCreateModerationResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateModerationArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/moderations", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -68,46 +68,46 @@ partial void ProcessCreateModerationResponseContent( 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); PrepareCreateModerationRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateModerationResponse( - 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); ProcessCreateModerationResponseContent( - 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 @@ -137,14 +137,14 @@ partial void ProcessCreateModerationResponseContent( global::OpenAI.AnyOf? model = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateModerationRequest + var __request = new global::OpenAI.CreateModerationRequest { Input = input, Model = model, }; return await CreateModerationAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.g.cs index 62d8a97d..3f30a633 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ModerationsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ModerationsClient : global::OpenAI.IModerationsClien /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 ModerationsClient : global::OpenAI.IModerationsClien /// 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 ModerationsClient( 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/OpenAI/Generated/OpenAI.OpenAiApi.Authorizations.Bearer.g.cs b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Authorizations.Bearer.g.cs index 478f2c82..f3f6fac0 100644 --- a/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Authorizations.Bearer.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.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::OpenAI.EndPointAuthorization + Authorizations.Clear(); + Authorizations.Add(new global::OpenAI.EndPointAuthorization { Type = "Http", Location = "Header", diff --git a/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Constructors.Bearer.g.cs b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Constructors.Bearer.g.cs index b01bdc04..9cf8be7d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Constructors.Bearer.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.Constructors.Bearer.g.cs @@ -5,18 +5,19 @@ namespace OpenAI { public sealed partial class OpenAiApi { - /// + /// public OpenAiApi( 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/OpenAI/Generated/OpenAI.OpenAiApi.g.cs b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.g.cs index 070d29d3..7df23443 100644 --- a/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.OpenAiApi.g.cs @@ -13,10 +13,18 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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; } /// /// @@ -27,7 +35,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Build Assistants that can call models and use tools. /// - public AssistantsClient Assistants => new AssistantsClient(_httpClient, authorizations: _authorizations) + public AssistantsClient Assistants => new AssistantsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -35,7 +43,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Turn audio into text or text into audio. /// - public AudioClient Audio => new AudioClient(_httpClient, authorizations: _authorizations) + public AudioClient Audio => new AudioClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -43,7 +51,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Given a list of messages comprising a conversation, the model will return a response. /// - public ChatClient Chat => new ChatClient(_httpClient, authorizations: _authorizations) + public ChatClient Chat => new ChatClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -51,7 +59,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. /// - public CompletionsClient Completions => new CompletionsClient(_httpClient, authorizations: _authorizations) + public CompletionsClient Completions => new CompletionsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -59,7 +67,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. /// - public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient, authorizations: _authorizations) + public EmbeddingsClient Embeddings => new EmbeddingsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -67,7 +75,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Manage fine-tuning jobs to tailor a model to your specific training data. /// - public FineTuningClient FineTuning => new FineTuningClient(_httpClient, authorizations: _authorizations) + public FineTuningClient FineTuning => new FineTuningClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -75,7 +83,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Create large batches of API requests to run asynchronously. /// - public BatchClient Batch => new BatchClient(_httpClient, authorizations: _authorizations) + public BatchClient Batch => new BatchClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -83,7 +91,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Files are used to upload documents that can be used with features like Assistants and Fine-tuning. /// - public FilesClient Files => new FilesClient(_httpClient, authorizations: _authorizations) + public FilesClient Files => new FilesClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -91,7 +99,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Use Uploads to upload large files in multiple parts. /// - public UploadsClient Uploads => new UploadsClient(_httpClient, authorizations: _authorizations) + public UploadsClient Uploads => new UploadsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -99,7 +107,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Given a prompt and/or an input image, the model will generate a new image. /// - public ImagesClient Images => new ImagesClient(_httpClient, authorizations: _authorizations) + public ImagesClient Images => new ImagesClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -107,7 +115,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// List and describe the various models available in the API. /// - public ModelsClient Models => new ModelsClient(_httpClient, authorizations: _authorizations) + public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -115,7 +123,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// Given text and/or image inputs, classifies if those inputs are potentially harmful. /// - public ModerationsClient Moderations => new ModerationsClient(_httpClient, authorizations: _authorizations) + public ModerationsClient Moderations => new ModerationsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -123,7 +131,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// List user actions and configuration changes within this organization. /// - public AuditLogsClient AuditLogs => new AuditLogsClient(_httpClient, authorizations: _authorizations) + public AuditLogsClient AuditLogs => new AuditLogsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -131,7 +139,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// /// - public InvitesClient Invites => new InvitesClient(_httpClient, authorizations: _authorizations) + public InvitesClient Invites => new InvitesClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -139,7 +147,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// /// - public ProjectsClient Projects => new ProjectsClient(_httpClient, authorizations: _authorizations) + public ProjectsClient Projects => new ProjectsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -147,7 +155,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// /// - public UsersClient Users => new UsersClient(_httpClient, authorizations: _authorizations) + public UsersClient Users => new UsersClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -155,7 +163,7 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, global::Syste /// /// /// - public VectorStoresClient VectorStores => new VectorStoresClient(_httpClient, authorizations: _authorizations) + public VectorStoresClient VectorStores => new VectorStoresClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -165,25 +173,31 @@ public sealed partial class OpenAiApi : global::OpenAI.IOpenAiApi, 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 OpenAiApi( 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/OpenAI/Generated/OpenAI.ProjectsClient.ArchiveProject.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ArchiveProject.g.cs index 2901149c..6980d2d9 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ArchiveProject.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ArchiveProject.g.cs @@ -32,73 +32,73 @@ partial void ProcessArchiveProjectResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareArchiveProjectArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/archive", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareArchiveProjectRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId); - 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); ProcessArchiveProjectResponse( - 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); ProcessArchiveProjectResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.CreateProject.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProject.g.cs index 8fc3a4f5..e813c0bb 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProject.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProject.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateProjectResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateProjectArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/organization/projects", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateProjectResponseContent( 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); PrepareCreateProjectRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateProjectResponse( - 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); ProcessCreateProjectResponseContent( - 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 @@ -126,13 +126,13 @@ partial void ProcessCreateProjectResponseContent( string name, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ProjectCreateRequest + var __request = new global::OpenAI.ProjectCreateRequest { Name = name, }; return await CreateProjectAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs index fa394d40..b8fc9bc4 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs @@ -38,33 +38,33 @@ partial void ProcessCreateProjectServiceAccountResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateProjectServiceAccountArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, request: request); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/service_accounts", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessCreateProjectServiceAccountResponseContent( 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); PrepareCreateProjectServiceAccountRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, 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); ProcessCreateProjectServiceAccountResponse( - 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); ProcessCreateProjectServiceAccountResponseContent( - 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 @@ -134,14 +134,14 @@ partial void ProcessCreateProjectServiceAccountResponseContent( string name, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ProjectServiceAccountCreateRequest + var __request = new global::OpenAI.ProjectServiceAccountCreateRequest { Name = name, }; return await CreateProjectServiceAccountAsync( projectId: projectId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectUser.g.cs index e6377747..a7968ed4 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.CreateProjectUser.g.cs @@ -38,33 +38,33 @@ partial void ProcessCreateProjectUserResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateProjectUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, request: request); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/users", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessCreateProjectUserResponseContent( 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); PrepareCreateProjectUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, 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); ProcessCreateProjectUserResponse( - 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); ProcessCreateProjectUserResponseContent( - 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 @@ -138,7 +138,7 @@ partial void ProcessCreateProjectUserResponseContent( global::OpenAI.ProjectUserCreateRequestRole role, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ProjectUserCreateRequest + var __request = new global::OpenAI.ProjectUserCreateRequest { UserId = userId, Role = role, @@ -146,7 +146,7 @@ partial void ProcessCreateProjectUserResponseContent( return await CreateProjectUserAsync( projectId: projectId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs index 4a011dff..70b16469 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs @@ -36,75 +36,75 @@ partial void ProcessDeleteProjectApiKeyResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteProjectApiKeyArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, keyId: ref keyId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/api_keys/{keyId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteProjectApiKeyRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, keyId: keyId); - 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); ProcessDeleteProjectApiKeyResponse( - 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); ProcessDeleteProjectApiKeyResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs index d4848d7b..46ee3baf 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs @@ -36,75 +36,75 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteProjectServiceAccountArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, serviceAccountId: ref serviceAccountId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/service_accounts/{serviceAccountId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteProjectServiceAccountRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, serviceAccountId: serviceAccountId); - 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); ProcessDeleteProjectServiceAccountResponse( - 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); ProcessDeleteProjectServiceAccountResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectUser.g.cs index 95b76c1b..50d37fdb 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.DeleteProjectUser.g.cs @@ -36,75 +36,75 @@ partial void ProcessDeleteProjectUserResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteProjectUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, userId: ref userId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteProjectUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, userId: userId); - 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); ProcessDeleteProjectUserResponse( - 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); ProcessDeleteProjectUserResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectApiKeys.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectApiKeys.g.cs index be5d7cab..78f31e79 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectApiKeys.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectApiKeys.g.cs @@ -42,81 +42,81 @@ partial void ProcessListProjectApiKeysResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListProjectApiKeysArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, limit: ref limit, after: ref after); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/api_keys", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) ; 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); PrepareListProjectApiKeysRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, limit: limit, after: after); - 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); ProcessListProjectApiKeysResponse( - 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); ProcessListProjectApiKeysResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs index 4e5a62ec..d2b7165f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs @@ -42,81 +42,81 @@ partial void ProcessListProjectServiceAccountsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListProjectServiceAccountsArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, limit: ref limit, after: ref after); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/service_accounts", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) ; 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); PrepareListProjectServiceAccountsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, limit: limit, after: after); - 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); ProcessListProjectServiceAccountsResponse( - 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); ProcessListProjectServiceAccountsResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectUsers.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectUsers.g.cs index 61fc50d8..6a3a05fa 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectUsers.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjectUsers.g.cs @@ -42,81 +42,81 @@ partial void ProcessListProjectUsersResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListProjectUsersArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, limit: ref limit, after: ref after); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/users", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) ; 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); PrepareListProjectUsersRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, limit: limit, after: after); - 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); ProcessListProjectUsersResponse( - 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); ProcessListProjectUsersResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.ListProjects.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjects.g.cs index 8af57cdd..4c22a60c 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjects.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ListProjects.g.cs @@ -44,82 +44,82 @@ partial void ProcessListProjectsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListProjectsArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, after: ref after, includeArchived: ref includeArchived); var __pathBuilder = new PathBuilder( path: "/organization/projects", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) .AddOptionalParameter("include_archived", includeArchived?.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); PrepareListProjectsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, after: after, includeArchived: includeArchived); - 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); ProcessListProjectsResponse( - 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); ProcessListProjectsResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProject.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProject.g.cs index 61a6f184..f2729b24 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProject.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProject.g.cs @@ -38,33 +38,33 @@ partial void ProcessModifyProjectResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyProjectArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, request: request); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessModifyProjectResponseContent( 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); PrepareModifyProjectRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, 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); ProcessModifyProjectResponse( - 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); ProcessModifyProjectResponseContent( - 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 @@ -134,14 +134,14 @@ partial void ProcessModifyProjectResponseContent( string name, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ProjectUpdateRequest + var __request = new global::OpenAI.ProjectUpdateRequest { Name = name, }; return await ModifyProjectAsync( projectId: projectId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProjectUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProjectUser.g.cs index 81bfba83..0c8f04be 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProjectUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.ModifyProjectUser.g.cs @@ -42,34 +42,34 @@ partial void ProcessModifyProjectUserResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyProjectUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, userId: ref userId, request: request); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,48 +77,48 @@ partial void ProcessModifyProjectUserResponseContent( 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); PrepareModifyProjectUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, userId: userId, 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); ProcessModifyProjectUserResponse( - 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); ProcessModifyProjectUserResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessModifyProjectUserResponseContent( global::OpenAI.ProjectUserUpdateRequestRole role, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.ProjectUserUpdateRequest + var __request = new global::OpenAI.ProjectUserUpdateRequest { Role = role, }; @@ -150,7 +150,7 @@ partial void ProcessModifyProjectUserResponseContent( return await ModifyProjectUserAsync( projectId: projectId, userId: userId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProject.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProject.g.cs index 6a1327ec..4f812129 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProject.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProject.g.cs @@ -32,73 +32,73 @@ partial void ProcessRetrieveProjectResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveProjectArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveProjectRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId); - 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); ProcessRetrieveProjectResponse( - 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); ProcessRetrieveProjectResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs index 6fdb29a4..0c2831a0 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs @@ -36,75 +36,75 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveProjectApiKeyArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, keyId: ref keyId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/api_keys/{keyId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveProjectApiKeyRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, keyId: keyId); - 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); ProcessRetrieveProjectApiKeyResponse( - 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); ProcessRetrieveProjectApiKeyResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs index ebd55fc8..88ea4a98 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs @@ -36,75 +36,75 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveProjectServiceAccountArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, serviceAccountId: ref serviceAccountId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/service_accounts/{serviceAccountId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveProjectServiceAccountRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, serviceAccountId: serviceAccountId); - 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); ProcessRetrieveProjectServiceAccountResponse( - 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); ProcessRetrieveProjectServiceAccountResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectUser.g.cs index f006d56d..a46044e2 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.RetrieveProjectUser.g.cs @@ -36,75 +36,75 @@ partial void ProcessRetrieveProjectUserResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveProjectUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, projectId: ref projectId, userId: ref userId); var __pathBuilder = new PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveProjectUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, projectId: projectId, userId: userId); - 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); ProcessRetrieveProjectUserResponse( - 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); ProcessRetrieveProjectUserResponseContent( - 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/OpenAI/Generated/OpenAI.ProjectsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.g.cs index e6329a47..f2aea060 100644 --- a/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.ProjectsClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class ProjectsClient : global::OpenAI.IProjectsClient, glo /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 ProjectsClient : global::OpenAI.IProjectsClient, 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 ProjectsClient( 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/OpenAI/Generated/OpenAI.UploadsClient.AddUploadPart.g.cs b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.AddUploadPart.g.cs index daa614da..cd722979 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.AddUploadPart.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.AddUploadPart.g.cs @@ -42,33 +42,33 @@ partial void ProcessAddUploadPartResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareAddUploadPartArguments( - httpClient: _httpClient, + httpClient: HttpClient, uploadId: ref uploadId, request: request); var __pathBuilder = new PathBuilder( path: $"/uploads/{uploadId}/parts", - 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); } } using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); @@ -85,47 +85,47 @@ partial void ProcessAddUploadPartResponseContent( }, name: "data", fileName: request.Dataname ?? string.Empty); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareAddUploadPartRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, uploadId: uploadId, 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); ProcessAddUploadPartResponse( - 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); ProcessAddUploadPartResponseContent( - 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 @@ -155,7 +155,7 @@ partial void ProcessAddUploadPartResponseContent( string dataname, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.AddUploadPartRequest + var __request = new global::OpenAI.AddUploadPartRequest { Data = data, Dataname = dataname, @@ -163,7 +163,7 @@ partial void ProcessAddUploadPartResponseContent( return await AddUploadPartAsync( uploadId: uploadId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CancelUpload.g.cs b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CancelUpload.g.cs index 4182713a..87f4318e 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CancelUpload.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CancelUpload.g.cs @@ -34,73 +34,73 @@ partial void ProcessCancelUploadResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelUploadArguments( - httpClient: _httpClient, + httpClient: HttpClient, uploadId: ref uploadId); var __pathBuilder = new PathBuilder( path: $"/uploads/{uploadId}/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelUploadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, uploadId: uploadId); - 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); ProcessCancelUploadResponse( - 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); ProcessCancelUploadResponseContent( - 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/OpenAI/Generated/OpenAI.UploadsClient.CompleteUpload.g.cs b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CompleteUpload.g.cs index 9430bf7f..555843a4 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CompleteUpload.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CompleteUpload.g.cs @@ -43,33 +43,33 @@ partial void ProcessCompleteUploadResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCompleteUploadArguments( - httpClient: _httpClient, + httpClient: HttpClient, uploadId: ref uploadId, request: request); var __pathBuilder = new PathBuilder( path: $"/uploads/{uploadId}/complete", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -77,47 +77,47 @@ partial void ProcessCompleteUploadResponseContent( 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); PrepareCompleteUploadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, uploadId: uploadId, 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); ProcessCompleteUploadResponse( - 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); ProcessCompleteUploadResponseContent( - 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 @@ -148,7 +148,7 @@ partial void ProcessCompleteUploadResponseContent( string? md5 = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CompleteUploadRequest + var __request = new global::OpenAI.CompleteUploadRequest { PartIds = partIds, Md5 = md5, @@ -156,7 +156,7 @@ partial void ProcessCompleteUploadResponseContent( return await CompleteUploadAsync( uploadId: uploadId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CreateUpload.g.cs b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CreateUpload.g.cs index cd605aa9..90045987 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CreateUpload.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.CreateUpload.g.cs @@ -38,32 +38,32 @@ partial void ProcessCreateUploadResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateUploadArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/uploads", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -71,46 +71,46 @@ partial void ProcessCreateUploadResponseContent( 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); PrepareCreateUploadRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateUploadResponse( - 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); ProcessCreateUploadResponseContent( - 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 @@ -148,7 +148,7 @@ partial void ProcessCreateUploadResponseContent( string mimeType, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateUploadRequest + var __request = new global::OpenAI.CreateUploadRequest { Filename = filename, Purpose = purpose, @@ -157,7 +157,7 @@ partial void ProcessCreateUploadResponseContent( }; return await CreateUploadAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.g.cs index 5bd1002d..52f41b48 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UploadsClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UploadsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class UploadsClient : global::OpenAI.IUploadsClient, globa /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 UploadsClient : global::OpenAI.IUploadsClient, globa /// 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 UploadsClient( 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/OpenAI/Generated/OpenAI.UsersClient.DeleteUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.UsersClient.DeleteUser.g.cs index 48f481b0..2915f2cb 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UsersClient.DeleteUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UsersClient.DeleteUser.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteUserResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, userId: ref userId); var __pathBuilder = new PathBuilder( path: $"/organization/users/{userId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, userId: userId); - 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); ProcessDeleteUserResponse( - 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); ProcessDeleteUserResponseContent( - 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/OpenAI/Generated/OpenAI.UsersClient.ListUsers.g.cs b/src/libs/OpenAI/Generated/OpenAI.UsersClient.ListUsers.g.cs index 430d7630..6b45f471 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UsersClient.ListUsers.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UsersClient.ListUsers.g.cs @@ -38,79 +38,79 @@ partial void ProcessListUsersResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListUsersArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, after: ref after); var __pathBuilder = new PathBuilder( path: "/organization/users", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) ; 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); PrepareListUsersRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, after: after); - 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); ProcessListUsersResponse( - 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); ProcessListUsersResponseContent( - 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/OpenAI/Generated/OpenAI.UsersClient.ModifyUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.UsersClient.ModifyUser.g.cs index 0d201c9c..78891247 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UsersClient.ModifyUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UsersClient.ModifyUser.g.cs @@ -38,33 +38,33 @@ partial void ProcessModifyUserResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, userId: ref userId, request: request); var __pathBuilder = new PathBuilder( path: $"/organization/users/{userId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessModifyUserResponseContent( 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); PrepareModifyUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, userId: userId, 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); ProcessModifyUserResponse( - 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); ProcessModifyUserResponseContent( - 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 @@ -134,14 +134,14 @@ partial void ProcessModifyUserResponseContent( global::OpenAI.UserRoleUpdateRequestRole role, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.UserRoleUpdateRequest + var __request = new global::OpenAI.UserRoleUpdateRequest { Role = role, }; return await ModifyUserAsync( userId: userId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.UsersClient.RetrieveUser.g.cs b/src/libs/OpenAI/Generated/OpenAI.UsersClient.RetrieveUser.g.cs index 591e9c53..399d389a 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UsersClient.RetrieveUser.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UsersClient.RetrieveUser.g.cs @@ -32,73 +32,73 @@ partial void ProcessRetrieveUserResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareRetrieveUserArguments( - httpClient: _httpClient, + httpClient: HttpClient, userId: ref userId); var __pathBuilder = new PathBuilder( path: $"/organization/users/{userId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareRetrieveUserRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, userId: userId); - 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); ProcessRetrieveUserResponse( - 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); ProcessRetrieveUserResponseContent( - 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/OpenAI/Generated/OpenAI.UsersClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.UsersClient.g.cs index e5bb2989..32b1aa4f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.UsersClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.UsersClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class UsersClient : global::OpenAI.IUsersClient, global::S /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 UsersClient : global::OpenAI.IUsersClient, global::S /// 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 UsersClient( 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/OpenAI/Generated/OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs index 765919e9..73bc49d5 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs @@ -36,75 +36,75 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCancelVectorStoreFileBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, batchId: ref batchId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}/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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCancelVectorStoreFileBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, batchId: batchId); - 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); ProcessCancelVectorStoreFileBatchResponse( - 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); ProcessCancelVectorStoreFileBatchResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStore.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStore.g.cs index c3e38129..96d1074e 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStore.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStore.g.cs @@ -34,32 +34,32 @@ partial void ProcessCreateVectorStoreResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateVectorStoreArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/vector_stores", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -67,46 +67,46 @@ partial void ProcessCreateVectorStoreResponseContent( 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); PrepareCreateVectorStoreRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, 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); ProcessCreateVectorStoreResponse( - 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); ProcessCreateVectorStoreResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessCreateVectorStoreResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateVectorStoreRequest + var __request = new global::OpenAI.CreateVectorStoreRequest { FileIds = fileIds, Name = name, @@ -152,7 +152,7 @@ partial void ProcessCreateVectorStoreResponseContent( }; return await CreateVectorStoreAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs index 4d29f584..f865dd8d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs @@ -40,33 +40,33 @@ partial void ProcessCreateVectorStoreFileResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateVectorStoreFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, request: request); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/files", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -74,47 +74,47 @@ partial void ProcessCreateVectorStoreFileResponseContent( 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); PrepareCreateVectorStoreFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, 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); ProcessCreateVectorStoreFileResponse( - 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); ProcessCreateVectorStoreFileResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessCreateVectorStoreFileResponseContent( global::OpenAI.ChunkingStrategyRequestParam? chunkingStrategy = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateVectorStoreFileRequest + var __request = new global::OpenAI.CreateVectorStoreFileRequest { FileId = fileId, ChunkingStrategy = chunkingStrategy, @@ -150,7 +150,7 @@ partial void ProcessCreateVectorStoreFileResponseContent( return await CreateVectorStoreFileAsync( vectorStoreId: vectorStoreId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs index b3e38dcb..8ee5e63b 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs @@ -40,33 +40,33 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateVectorStoreFileBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, request: request); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -74,47 +74,47 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( 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); PrepareCreateVectorStoreFileBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, 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); ProcessCreateVectorStoreFileBatchResponse( - 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); ProcessCreateVectorStoreFileBatchResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( global::OpenAI.ChunkingStrategyRequestParam? chunkingStrategy = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.CreateVectorStoreFileBatchRequest + var __request = new global::OpenAI.CreateVectorStoreFileBatchRequest { FileIds = fileIds, ChunkingStrategy = chunkingStrategy, @@ -150,7 +150,7 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( return await CreateVectorStoreFileBatchAsync( vectorStoreId: vectorStoreId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStore.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStore.g.cs index 3fdfc34b..4a022224 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStore.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStore.g.cs @@ -32,73 +32,73 @@ partial void ProcessDeleteVectorStoreResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteVectorStoreArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteVectorStoreRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId); - 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); ProcessDeleteVectorStoreResponse( - 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); ProcessDeleteVectorStoreResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs index 1c9d1531..eca11162 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs @@ -36,75 +36,75 @@ partial void ProcessDeleteVectorStoreFileResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteVectorStoreFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, fileId: ref fileId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteVectorStoreFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, fileId: fileId); - 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); ProcessDeleteVectorStoreFileResponse( - 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); ProcessDeleteVectorStoreFileResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStore.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStore.g.cs index 873c8e61..8e25b12d 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStore.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStore.g.cs @@ -32,73 +32,73 @@ partial void ProcessGetVectorStoreResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetVectorStoreArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetVectorStoreRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId); - 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); ProcessGetVectorStoreResponse( - 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); ProcessGetVectorStoreResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFile.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFile.g.cs index b3a8fd97..72088434 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFile.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFile.g.cs @@ -40,75 +40,75 @@ partial void ProcessGetVectorStoreFileResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetVectorStoreFileArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, fileId: ref fileId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetVectorStoreFileRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, fileId: fileId); - 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); ProcessGetVectorStoreFileResponse( - 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); ProcessGetVectorStoreFileResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFileBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFileBatch.g.cs index 55de02c0..0d01eb61 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFileBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.GetVectorStoreFileBatch.g.cs @@ -40,75 +40,75 @@ partial void ProcessGetVectorStoreFileBatchResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetVectorStoreFileBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, batchId: ref batchId); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}", - 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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetVectorStoreFileBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, batchId: batchId); - 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); ProcessGetVectorStoreFileBatchResponse( - 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); ProcessGetVectorStoreFileBatchResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.ListFilesInVectorStoreBatch.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListFilesInVectorStoreBatch.g.cs index e274fe98..df7dfc5f 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListFilesInVectorStoreBatch.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListFilesInVectorStoreBatch.g.cs @@ -60,9 +60,9 @@ partial void ProcessListFilesInVectorStoreBatchResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListFilesInVectorStoreBatchArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, batchId: ref batchId, limit: ref limit, @@ -73,7 +73,7 @@ partial void ProcessListFilesInVectorStoreBatchResponseContent( var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}/files", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -82,32 +82,32 @@ partial void ProcessListFilesInVectorStoreBatchResponseContent( .AddOptionalParameter("filter", filter?.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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListFilesInVectorStoreBatchRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, batchId: batchId, limit: limit, @@ -116,36 +116,36 @@ partial void ProcessListFilesInVectorStoreBatchResponseContent( before: before, filter: filter); - 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); ProcessListFilesInVectorStoreBatchResponse( - 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); ProcessListFilesInVectorStoreBatchResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs index 66bb8842..9f0aee11 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs @@ -56,9 +56,9 @@ partial void ProcessListVectorStoreFilesResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListVectorStoreFilesArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, limit: ref limit, order: ref order, @@ -68,7 +68,7 @@ partial void ProcessListVectorStoreFilesResponseContent( var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}/files", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -77,32 +77,32 @@ partial void ProcessListVectorStoreFilesResponseContent( .AddOptionalParameter("filter", filter?.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); } } PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListVectorStoreFilesRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, limit: limit, order: order, @@ -110,36 +110,36 @@ partial void ProcessListVectorStoreFilesResponseContent( before: before, filter: filter); - 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); ProcessListVectorStoreFilesResponse( - 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); ProcessListVectorStoreFilesResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStores.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStores.g.cs index 1094b07c..b872aaad 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStores.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ListVectorStores.g.cs @@ -48,9 +48,9 @@ partial void ProcessListVectorStoresResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListVectorStoresArguments( - httpClient: _httpClient, + httpClient: HttpClient, limit: ref limit, order: ref order, after: ref after, @@ -58,7 +58,7 @@ partial void ProcessListVectorStoresResponseContent( var __pathBuilder = new PathBuilder( path: "/vector_stores", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) @@ -66,67 +66,67 @@ partial void ProcessListVectorStoresResponseContent( .AddOptionalParameter("before", before) ; 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); PrepareListVectorStoresRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, limit: limit, order: order, after: after, before: before); - 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); ProcessListVectorStoresResponse( - 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); ProcessListVectorStoresResponseContent( - 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/OpenAI/Generated/OpenAI.VectorStoresClient.ModifyVectorStore.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ModifyVectorStore.g.cs index 82716c65..d5258435 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ModifyVectorStore.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.ModifyVectorStore.g.cs @@ -38,33 +38,33 @@ partial void ProcessModifyVectorStoreResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareModifyVectorStoreArguments( - httpClient: _httpClient, + httpClient: HttpClient, vectorStoreId: ref vectorStoreId, request: request); var __pathBuilder = new PathBuilder( path: $"/vector_stores/{vectorStoreId}", - 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); } } var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -72,47 +72,47 @@ partial void ProcessModifyVectorStoreResponseContent( 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); PrepareModifyVectorStoreRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, vectorStoreId: vectorStoreId, 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); ProcessModifyVectorStoreResponse( - 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); ProcessModifyVectorStoreResponseContent( - 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 @@ -142,7 +142,7 @@ partial void ProcessModifyVectorStoreResponseContent( object? metadata = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::OpenAI.UpdateVectorStoreRequest + var __request = new global::OpenAI.UpdateVectorStoreRequest { Name = name, ExpiresAfter = expiresAfter, @@ -151,7 +151,7 @@ partial void ProcessModifyVectorStoreResponseContent( return await ModifyVectorStoreAsync( vectorStoreId: vectorStoreId, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.g.cs b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.g.cs index 6da6c30b..920ae5eb 100644 --- a/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.VectorStoresClient.g.cs @@ -12,10 +12,18 @@ public sealed partial class VectorStoresClient : global::OpenAI.IVectorStoresCli /// /// /// - public const string BaseUrl = "https://api.openai.com/v1"; + public const string DefaultBaseUrl = "https://api.openai.com/v1"; - 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 VectorStoresClient : global::OpenAI.IVectorStoresCli /// 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 VectorStoresClient( 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(