From c469bf2a9a3e1f4b54ddd36eb6c2acc79fa8ca61 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Jun 2025 02:00:04 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Vectara.APIKeysClient.CreateApiKey.g.cs | 74 ++++++----- .../Vectara.APIKeysClient.DeleteApiKey.g.cs | 41 ++++--- .../Vectara.APIKeysClient.GetApiKey.g.cs | 53 ++++---- .../Vectara.APIKeysClient.ListApiKeys.g.cs | 74 ++++++----- .../Vectara.APIKeysClient.UpdateApiKey.g.cs | 53 ++++---- ...licationClientsClient.CreateAppClient.g.cs | 74 ++++++----- ...licationClientsClient.DeleteAppClient.g.cs | 41 ++++--- ...ApplicationClientsClient.GetAppClient.g.cs | 53 ++++---- ...pplicationClientsClient.ListAppClient.g.cs | 74 ++++++----- ...licationClientsClient.UpdateAppClient.g.cs | 53 ++++---- ...ra.AuthenticationClient.GetOAuthToken.g.cs | 32 ++--- .../Vectara.ChatsClient.CreateChat.g.cs | 95 +++++++++----- .../Vectara.ChatsClient.CreateChatTurn.g.cs | 95 +++++++++----- .../Vectara.ChatsClient.DeleteChat.g.cs | 62 ++++++---- .../Vectara.ChatsClient.DeleteChatTurn.g.cs | 62 ++++++---- .../Vectara.ChatsClient.GetChat.g.cs | 74 ++++++----- .../Vectara.ChatsClient.GetChatTurn.g.cs | 74 ++++++----- .../Vectara.ChatsClient.ListChatTurns.g.cs | 74 ++++++----- .../Vectara.ChatsClient.ListChats.g.cs | 74 ++++++----- .../Vectara.ChatsClient.UpdateChatTurn.g.cs | 74 ++++++----- ...ctara.CorporaClient.ComputeCorpusSize.g.cs | 74 ++++++----- .../Vectara.CorporaClient.CreateCorpus.g.cs | 95 +++++++++----- .../Vectara.CorporaClient.DeleteCorpus.g.cs | 62 ++++++---- .../Vectara.CorporaClient.GetCorpus.g.cs | 74 ++++++----- .../Vectara.CorporaClient.ListCorpora.g.cs | 53 ++++---- ...CorporaClient.ReplaceFilterAttributes.g.cs | 74 ++++++----- .../Vectara.CorporaClient.ResetCorpus.g.cs | 62 ++++++---- .../Vectara.CorporaClient.UpdateCorpus.g.cs | 74 ++++++----- ....DocumentsClient.DeleteCorpusDocument.g.cs | 62 ++++++---- ...ara.DocumentsClient.GetCorpusDocument.g.cs | 74 ++++++----- ...a.DocumentsClient.ListCorpusDocuments.g.cs | 74 ++++++----- ...cumentsClient.SummarizeCorpusDocument.g.cs | 74 ++++++----- .../Vectara.EncodersClient.CreateEncoder.g.cs | 74 ++++++----- .../Vectara.EncodersClient.ListEncoders.g.cs | 53 ++++---- .../Vectara/Generated/Vectara.Exceptions.g.cs | 4 +- ...tionClient.EvaluateFactualConsistency.g.cs | 95 +++++++++----- ...onPresetsClient.ListGenerationPresets.g.cs | 53 ++++---- ...orrectorsClient.CorrectHallucinations.g.cs | 74 ++++++----- ...orsClient.ListHallucinationCorrectors.g.cs | 53 ++++---- ...tara.IndexClient.CreateCorpusDocument.g.cs | 116 ++++++++++++------ ...xClient.ReplaceCorpusDocumentMetadata.g.cs | 95 +++++++++----- ...tara.IndexClient.UpdateCorpusDocument.g.cs | 95 +++++++++----- .../Generated/Vectara.JobsClient.GetJob.g.cs | 74 ++++++----- .../Vectara.JobsClient.ListJobs.g.cs | 53 ++++---- ...ompletionsClient.CreateChatCompletion.g.cs | 74 ++++++----- ...a.LargeLanguageModelsClient.CreateLLM.g.cs | 74 ++++++----- ...a.LargeLanguageModelsClient.DeleteLLM.g.cs | 62 ++++++---- ...tara.LargeLanguageModelsClient.GetLLM.g.cs | 74 ++++++----- ...ra.LargeLanguageModelsClient.ListLLMs.g.cs | 53 ++++---- .../Vectara.QueriesClient.Query.g.cs | 95 +++++++++----- .../Vectara.QueriesClient.QueryCorpus.g.cs | 95 +++++++++----- .../Vectara.QueriesClient.SearchCorpus.g.cs | 95 +++++++++----- ....QueryHistoryClient.GetQueryHistories.g.cs | 74 ++++++----- ...ra.QueryHistoryClient.GetQueryHistory.g.cs | 74 ++++++----- ...Vectara.RerankersClient.ListRerankers.g.cs | 53 ++++---- ...eExtractorsClient.ListTableExtractors.g.cs | 53 ++++---- .../Vectara.UploadClient.UploadFile.g.cs | 116 ++++++++++++------ .../Vectara.UsersClient.CreateUser.g.cs | 74 ++++++----- .../Vectara.UsersClient.DeleteUser.g.cs | 62 ++++++---- .../Vectara.UsersClient.GetUser.g.cs | 74 ++++++----- .../Vectara.UsersClient.ListUsers.g.cs | 53 ++++---- ...Vectara.UsersClient.ResetUserPassword.g.cs | 74 ++++++----- .../Vectara.UsersClient.UpdateUser.g.cs | 74 ++++++----- 63 files changed, 2740 insertions(+), 1660 deletions(-) diff --git a/src/libs/Vectara/Generated/Vectara.APIKeysClient.CreateApiKey.g.cs b/src/libs/Vectara/Generated/Vectara.APIKeysClient.CreateApiKey.g.cs index a41ff61..90b2b74 100644 --- a/src/libs/Vectara/Generated/Vectara.APIKeysClient.CreateApiKey.g.cs +++ b/src/libs/Vectara/Generated/Vectara.APIKeysClient.CreateApiKey.g.cs @@ -119,20 +119,29 @@ partial void ProcessCreateApiKeyResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCreateApiKeyResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -192,8 +210,12 @@ partial void ProcessCreateApiKeyResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -207,18 +229,24 @@ partial void ProcessCreateApiKeyResponseContent( h => h.Value), }; } - - return - global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -231,16 +259,6 @@ partial void ProcessCreateApiKeyResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.APIKeysClient.DeleteApiKey.g.cs b/src/libs/Vectara/Generated/Vectara.APIKeysClient.DeleteApiKey.g.cs index 8b3224f..c4ad7c4 100644 --- a/src/libs/Vectara/Generated/Vectara.APIKeysClient.DeleteApiKey.g.cs +++ b/src/libs/Vectara/Generated/Vectara.APIKeysClient.DeleteApiKey.g.cs @@ -106,20 +106,29 @@ partial void ProcessDeleteApiKeyResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -147,8 +156,9 @@ partial void ProcessDeleteApiKeyResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -162,15 +172,21 @@ partial void ProcessDeleteApiKeyResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -183,13 +199,6 @@ partial void ProcessDeleteApiKeyResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.APIKeysClient.GetApiKey.g.cs b/src/libs/Vectara/Generated/Vectara.APIKeysClient.GetApiKey.g.cs index a1fd51a..e2ec353 100644 --- a/src/libs/Vectara/Generated/Vectara.APIKeysClient.GetApiKey.g.cs +++ b/src/libs/Vectara/Generated/Vectara.APIKeysClient.GetApiKey.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetApiKeyResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -156,8 +165,12 @@ partial void ProcessGetApiKeyResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -171,18 +184,24 @@ partial void ProcessGetApiKeyResponseContent( h => h.Value), }; } - - return - global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -195,16 +214,6 @@ partial void ProcessGetApiKeyResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.APIKeysClient.ListApiKeys.g.cs b/src/libs/Vectara/Generated/Vectara.APIKeysClient.ListApiKeys.g.cs index cd87101..d528f2f 100644 --- a/src/libs/Vectara/Generated/Vectara.APIKeysClient.ListApiKeys.g.cs +++ b/src/libs/Vectara/Generated/Vectara.APIKeysClient.ListApiKeys.g.cs @@ -143,20 +143,29 @@ partial void ProcessListApiKeysResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -171,20 +180,29 @@ partial void ProcessListApiKeysResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -216,8 +234,12 @@ partial void ProcessListApiKeysResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListApiKeysResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -231,18 +253,24 @@ partial void ProcessListApiKeysResponseContent( h => h.Value), }; } - - return - global::Vectara.ListApiKeysResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListApiKeysResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -255,16 +283,6 @@ partial void ProcessListApiKeysResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListApiKeysResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.APIKeysClient.UpdateApiKey.g.cs b/src/libs/Vectara/Generated/Vectara.APIKeysClient.UpdateApiKey.g.cs index 90b35a4..054c1a5 100644 --- a/src/libs/Vectara/Generated/Vectara.APIKeysClient.UpdateApiKey.g.cs +++ b/src/libs/Vectara/Generated/Vectara.APIKeysClient.UpdateApiKey.g.cs @@ -125,20 +125,29 @@ partial void ProcessUpdateApiKeyResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -170,8 +179,12 @@ partial void ProcessUpdateApiKeyResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -185,18 +198,24 @@ partial void ProcessUpdateApiKeyResponseContent( h => h.Value), }; } - - return - global::Vectara.ApiKey.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -209,16 +228,6 @@ partial void ProcessUpdateApiKeyResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.CreateAppClient.g.cs b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.CreateAppClient.g.cs index 02e46b0..c103234 100644 --- a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.CreateAppClient.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.CreateAppClient.g.cs @@ -117,20 +117,29 @@ partial void ProcessCreateAppClientResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -145,20 +154,29 @@ partial void ProcessCreateAppClientResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -190,8 +208,12 @@ partial void ProcessCreateAppClientResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -205,18 +227,24 @@ partial void ProcessCreateAppClientResponseContent( h => h.Value), }; } - - return - global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -229,16 +257,6 @@ partial void ProcessCreateAppClientResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.DeleteAppClient.g.cs b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.DeleteAppClient.g.cs index 7a20ecd..8a232a0 100644 --- a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.DeleteAppClient.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.DeleteAppClient.g.cs @@ -106,20 +106,29 @@ partial void ProcessDeleteAppClientResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -147,8 +156,9 @@ partial void ProcessDeleteAppClientResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -162,15 +172,21 @@ partial void ProcessDeleteAppClientResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -183,13 +199,6 @@ partial void ProcessDeleteAppClientResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.GetAppClient.g.cs b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.GetAppClient.g.cs index 0827c25..a4a1e12 100644 --- a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.GetAppClient.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.GetAppClient.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetAppClientResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -156,8 +165,12 @@ partial void ProcessGetAppClientResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -171,18 +184,24 @@ partial void ProcessGetAppClientResponseContent( h => h.Value), }; } - - return - global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -195,16 +214,6 @@ partial void ProcessGetAppClientResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.ListAppClient.g.cs b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.ListAppClient.g.cs index d7acab4..bf41784 100644 --- a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.ListAppClient.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.ListAppClient.g.cs @@ -130,20 +130,29 @@ partial void ProcessListAppClientResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -158,20 +167,29 @@ partial void ProcessListAppClientResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -203,8 +221,12 @@ partial void ProcessListAppClientResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListAppClientsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -218,18 +240,24 @@ partial void ProcessListAppClientResponseContent( h => h.Value), }; } - - return - global::Vectara.ListAppClientsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListAppClientsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -242,16 +270,6 @@ partial void ProcessListAppClientResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListAppClientsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.UpdateAppClient.g.cs b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.UpdateAppClient.g.cs index 409aa55..b886a72 100644 --- a/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.UpdateAppClient.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ApplicationClientsClient.UpdateAppClient.g.cs @@ -125,20 +125,29 @@ partial void ProcessUpdateAppClientResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -170,8 +179,12 @@ partial void ProcessUpdateAppClientResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -185,18 +198,24 @@ partial void ProcessUpdateAppClientResponseContent( h => h.Value), }; } - - return - global::Vectara.AppClient.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -209,16 +228,6 @@ partial void ProcessUpdateAppClientResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.AppClient.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.AuthenticationClient.GetOAuthToken.g.cs b/src/libs/Vectara/Generated/Vectara.AuthenticationClient.GetOAuthToken.g.cs index 4cb339f..ad633e8 100644 --- a/src/libs/Vectara/Generated/Vectara.AuthenticationClient.GetOAuthToken.g.cs +++ b/src/libs/Vectara/Generated/Vectara.AuthenticationClient.GetOAuthToken.g.cs @@ -114,8 +114,12 @@ partial void ProcessGetOAuthTokenResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.GetOAuthTokenResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -129,18 +133,24 @@ partial void ProcessGetOAuthTokenResponseContent( h => h.Value), }; } - - return - global::Vectara.GetOAuthTokenResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.GetOAuthTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -153,16 +163,6 @@ partial void ProcessGetOAuthTokenResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.GetOAuthTokenResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChat.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChat.g.cs index aba43e2..ea70903 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChat.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChat.g.cs @@ -119,20 +119,29 @@ partial void ProcessCreateChatResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCreateChatResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,20 +193,29 @@ partial void ProcessCreateChatResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -220,8 +247,12 @@ partial void ProcessCreateChatResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ChatFullResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -235,18 +266,24 @@ partial void ProcessCreateChatResponseContent( h => h.Value), }; } - - return - global::Vectara.ChatFullResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ChatFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -259,16 +296,6 @@ partial void ProcessCreateChatResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ChatFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChatTurn.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChatTurn.g.cs index 973aba6..d2c61cf 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChatTurn.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.CreateChatTurn.g.cs @@ -125,20 +125,29 @@ partial void ProcessCreateChatTurnResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -153,20 +162,29 @@ partial void ProcessCreateChatTurnResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -181,20 +199,29 @@ partial void ProcessCreateChatTurnResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -226,8 +253,12 @@ partial void ProcessCreateChatTurnResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ChatFullResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -241,18 +272,24 @@ partial void ProcessCreateChatTurnResponseContent( h => h.Value), }; } - - return - global::Vectara.ChatFullResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ChatFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -265,16 +302,6 @@ partial void ProcessCreateChatTurnResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ChatFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChat.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChat.g.cs index 32bee1c..3d7af50 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChat.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChat.g.cs @@ -106,20 +106,29 @@ partial void ProcessDeleteChatResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -134,20 +143,29 @@ partial void ProcessDeleteChatResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -175,8 +193,9 @@ partial void ProcessDeleteChatResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,15 +209,21 @@ partial void ProcessDeleteChatResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -211,13 +236,6 @@ partial void ProcessDeleteChatResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChatTurn.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChatTurn.g.cs index cc8e0ce..b47ce17 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChatTurn.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.DeleteChatTurn.g.cs @@ -112,20 +112,29 @@ partial void ProcessDeleteChatTurnResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -140,20 +149,29 @@ partial void ProcessDeleteChatTurnResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -181,8 +199,9 @@ partial void ProcessDeleteChatTurnResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -196,15 +215,21 @@ partial void ProcessDeleteChatTurnResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -217,13 +242,6 @@ partial void ProcessDeleteChatTurnResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChat.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChat.g.cs index f6acdcd..ebd64b7 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChat.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChat.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetChatResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessGetChatResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessGetChatResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Chat.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessGetChatResponseContent( h => h.Value), }; } - - return - global::Vectara.Chat.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Chat.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessGetChatResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Chat.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChatTurn.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChatTurn.g.cs index 64573b8..f0bbd2e 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChatTurn.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.GetChatTurn.g.cs @@ -117,20 +117,29 @@ partial void ProcessGetChatTurnResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -145,20 +154,29 @@ partial void ProcessGetChatTurnResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -190,8 +208,12 @@ partial void ProcessGetChatTurnResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Turn.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -205,18 +227,24 @@ partial void ProcessGetChatTurnResponseContent( h => h.Value), }; } - - return - global::Vectara.Turn.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Turn.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -229,16 +257,6 @@ partial void ProcessGetChatTurnResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Turn.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChatTurns.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChatTurns.g.cs index d13cf53..ce3f5ff 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChatTurns.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChatTurns.g.cs @@ -111,20 +111,29 @@ partial void ProcessListChatTurnsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessListChatTurnsResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessListChatTurnsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListChatTurnsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessListChatTurnsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListChatTurnsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListChatTurnsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessListChatTurnsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListChatTurnsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChats.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChats.g.cs index 353a892..a985d5d 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChats.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.ListChats.g.cs @@ -123,20 +123,29 @@ partial void ProcessListChatsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -151,20 +160,29 @@ partial void ProcessListChatsResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -196,8 +214,12 @@ partial void ProcessListChatsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListChatsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -211,18 +233,24 @@ partial void ProcessListChatsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListChatsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListChatsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -235,16 +263,6 @@ partial void ProcessListChatsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListChatsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.ChatsClient.UpdateChatTurn.g.cs b/src/libs/Vectara/Generated/Vectara.ChatsClient.UpdateChatTurn.g.cs index ee7ab72..c5935eb 100644 --- a/src/libs/Vectara/Generated/Vectara.ChatsClient.UpdateChatTurn.g.cs +++ b/src/libs/Vectara/Generated/Vectara.ChatsClient.UpdateChatTurn.g.cs @@ -131,20 +131,29 @@ partial void ProcessUpdateChatTurnResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -159,20 +168,29 @@ partial void ProcessUpdateChatTurnResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -204,8 +222,12 @@ partial void ProcessUpdateChatTurnResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Turn.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -219,18 +241,24 @@ partial void ProcessUpdateChatTurnResponseContent( h => h.Value), }; } - - return - global::Vectara.Turn.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Turn.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -243,16 +271,6 @@ partial void ProcessUpdateChatTurnResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Turn.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.ComputeCorpusSize.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.ComputeCorpusSize.g.cs index 5ddd967..3da9ab1 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.ComputeCorpusSize.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.ComputeCorpusSize.g.cs @@ -114,20 +114,29 @@ partial void ProcessComputeCorpusSizeResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -142,20 +151,29 @@ partial void ProcessComputeCorpusSizeResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -187,8 +205,12 @@ partial void ProcessComputeCorpusSizeResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ComputeCorpusSizeResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -202,18 +224,24 @@ partial void ProcessComputeCorpusSizeResponseContent( h => h.Value), }; } - - return - global::Vectara.ComputeCorpusSizeResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ComputeCorpusSizeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -226,16 +254,6 @@ partial void ProcessComputeCorpusSizeResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ComputeCorpusSizeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.CreateCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.CreateCorpus.g.cs index 075d8bc..6df55c8 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.CreateCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.CreateCorpus.g.cs @@ -119,20 +119,29 @@ partial void ProcessCreateCorpusResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCreateCorpusResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,20 +193,29 @@ partial void ProcessCreateCorpusResponseContent( if ((int)__response.StatusCode == 409) { string? __content_409 = null; + global::System.Exception? __exception_409 = null; global::Vectara.Error? __value_409 = null; - if (ReadResponseAsString) + try { - __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_409 = global::Vectara.Error.FromJson(__content_409, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_409 = global::Vectara.Error.FromJson(__content_409, JsonSerializerContext); + } + else + { + var __contentStream_409 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_409 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_409, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_409 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_409 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_409, JsonSerializerContext).ConfigureAwait(false); + __exception_409 = __ex; } throw new global::Vectara.ApiException( message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, statusCode: __response.StatusCode) { ResponseBody = __content_409, @@ -220,8 +247,12 @@ partial void ProcessCreateCorpusResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -235,18 +266,24 @@ partial void ProcessCreateCorpusResponseContent( h => h.Value), }; } - - return - global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -259,16 +296,6 @@ partial void ProcessCreateCorpusResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.DeleteCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.DeleteCorpus.g.cs index d220b8f..0d45f0a 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.DeleteCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.DeleteCorpus.g.cs @@ -109,20 +109,29 @@ partial void ProcessDeleteCorpusResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -137,20 +146,29 @@ partial void ProcessDeleteCorpusResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -178,8 +196,9 @@ partial void ProcessDeleteCorpusResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -193,15 +212,21 @@ partial void ProcessDeleteCorpusResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,13 +239,6 @@ partial void ProcessDeleteCorpusResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.GetCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.GetCorpus.g.cs index 7f2b742..bab7ed4 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.GetCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.GetCorpus.g.cs @@ -114,20 +114,29 @@ partial void ProcessGetCorpusResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -142,20 +151,29 @@ partial void ProcessGetCorpusResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -187,8 +205,12 @@ partial void ProcessGetCorpusResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -202,18 +224,24 @@ partial void ProcessGetCorpusResponseContent( h => h.Value), }; } - - return - global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -226,16 +254,6 @@ partial void ProcessGetCorpusResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.ListCorpora.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.ListCorpora.g.cs index 1cc8ce3..c327cd6 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.ListCorpora.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.ListCorpora.g.cs @@ -137,20 +137,29 @@ partial void ProcessListCorporaResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -182,8 +191,12 @@ partial void ProcessListCorporaResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListCorporaResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -197,18 +210,24 @@ partial void ProcessListCorporaResponseContent( h => h.Value), }; } - - return - global::Vectara.ListCorporaResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListCorporaResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -221,16 +240,6 @@ partial void ProcessListCorporaResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListCorporaResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.ReplaceFilterAttributes.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.ReplaceFilterAttributes.g.cs index d59669b..c652ce7 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.ReplaceFilterAttributes.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.ReplaceFilterAttributes.g.cs @@ -129,20 +129,29 @@ partial void ProcessReplaceFilterAttributesResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -157,20 +166,29 @@ partial void ProcessReplaceFilterAttributesResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -202,8 +220,12 @@ partial void ProcessReplaceFilterAttributesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ReplaceFilterAttributesResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -217,18 +239,24 @@ partial void ProcessReplaceFilterAttributesResponseContent( h => h.Value), }; } - - return - global::Vectara.ReplaceFilterAttributesResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ReplaceFilterAttributesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -241,16 +269,6 @@ partial void ProcessReplaceFilterAttributesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ReplaceFilterAttributesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.ResetCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.ResetCorpus.g.cs index 0ddb4c2..1295a8a 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.ResetCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.ResetCorpus.g.cs @@ -109,20 +109,29 @@ partial void ProcessResetCorpusResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -137,20 +146,29 @@ partial void ProcessResetCorpusResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -178,8 +196,9 @@ partial void ProcessResetCorpusResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -193,15 +212,21 @@ partial void ProcessResetCorpusResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,13 +239,6 @@ partial void ProcessResetCorpusResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.cs index 5745d54..8485e4f 100644 --- a/src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.CorporaClient.UpdateCorpus.g.cs @@ -128,20 +128,29 @@ partial void ProcessUpdateCorpusResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -156,20 +165,29 @@ partial void ProcessUpdateCorpusResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -201,8 +219,12 @@ partial void ProcessUpdateCorpusResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -216,18 +238,24 @@ partial void ProcessUpdateCorpusResponseContent( h => h.Value), }; } - - return - global::Vectara.Corpus.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -240,16 +268,6 @@ partial void ProcessUpdateCorpusResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Corpus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.DocumentsClient.DeleteCorpusDocument.g.cs b/src/libs/Vectara/Generated/Vectara.DocumentsClient.DeleteCorpusDocument.g.cs index 7d733de..0d467d8 100644 --- a/src/libs/Vectara/Generated/Vectara.DocumentsClient.DeleteCorpusDocument.g.cs +++ b/src/libs/Vectara/Generated/Vectara.DocumentsClient.DeleteCorpusDocument.g.cs @@ -115,20 +115,29 @@ partial void ProcessDeleteCorpusDocumentResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -143,20 +152,29 @@ partial void ProcessDeleteCorpusDocumentResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,9 @@ partial void ProcessDeleteCorpusDocumentResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,15 +218,21 @@ partial void ProcessDeleteCorpusDocumentResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -220,13 +245,6 @@ partial void ProcessDeleteCorpusDocumentResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.DocumentsClient.GetCorpusDocument.g.cs b/src/libs/Vectara/Generated/Vectara.DocumentsClient.GetCorpusDocument.g.cs index 411603f..778fb66 100644 --- a/src/libs/Vectara/Generated/Vectara.DocumentsClient.GetCorpusDocument.g.cs +++ b/src/libs/Vectara/Generated/Vectara.DocumentsClient.GetCorpusDocument.g.cs @@ -120,20 +120,29 @@ partial void ProcessGetCorpusDocumentResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -148,20 +157,29 @@ partial void ProcessGetCorpusDocumentResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -193,8 +211,12 @@ partial void ProcessGetCorpusDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -208,18 +230,24 @@ partial void ProcessGetCorpusDocumentResponseContent( h => h.Value), }; } - - return - global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -232,16 +260,6 @@ partial void ProcessGetCorpusDocumentResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.DocumentsClient.ListCorpusDocuments.g.cs b/src/libs/Vectara/Generated/Vectara.DocumentsClient.ListCorpusDocuments.g.cs index 19cb0cc..8872ffe 100644 --- a/src/libs/Vectara/Generated/Vectara.DocumentsClient.ListCorpusDocuments.g.cs +++ b/src/libs/Vectara/Generated/Vectara.DocumentsClient.ListCorpusDocuments.g.cs @@ -139,20 +139,29 @@ partial void ProcessListCorpusDocumentsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -167,20 +176,29 @@ partial void ProcessListCorpusDocumentsResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -212,8 +230,12 @@ partial void ProcessListCorpusDocumentsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListDocumentsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -227,18 +249,24 @@ partial void ProcessListCorpusDocumentsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListDocumentsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListDocumentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -251,16 +279,6 @@ partial void ProcessListCorpusDocumentsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListDocumentsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.cs b/src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.cs index 7de37bc..820d34c 100644 --- a/src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.cs +++ b/src/libs/Vectara/Generated/Vectara.DocumentsClient.SummarizeCorpusDocument.g.cs @@ -134,20 +134,29 @@ partial void ProcessSummarizeCorpusDocumentResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -162,20 +171,29 @@ partial void ProcessSummarizeCorpusDocumentResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -207,8 +225,12 @@ partial void ProcessSummarizeCorpusDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.SummarizeDocumentResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -222,18 +244,24 @@ partial void ProcessSummarizeCorpusDocumentResponseContent( h => h.Value), }; } - - return - global::Vectara.SummarizeDocumentResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.SummarizeDocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -246,16 +274,6 @@ partial void ProcessSummarizeCorpusDocumentResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.SummarizeDocumentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.EncodersClient.CreateEncoder.g.cs b/src/libs/Vectara/Generated/Vectara.EncodersClient.CreateEncoder.g.cs index 01f17e4..3ba6f2e 100644 --- a/src/libs/Vectara/Generated/Vectara.EncodersClient.CreateEncoder.g.cs +++ b/src/libs/Vectara/Generated/Vectara.EncodersClient.CreateEncoder.g.cs @@ -117,20 +117,29 @@ partial void ProcessCreateEncoderResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -145,20 +154,29 @@ partial void ProcessCreateEncoderResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -190,8 +208,12 @@ partial void ProcessCreateEncoderResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Encoder.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -205,18 +227,24 @@ partial void ProcessCreateEncoderResponseContent( h => h.Value), }; } - - return - global::Vectara.Encoder.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Encoder.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -229,16 +257,6 @@ partial void ProcessCreateEncoderResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Encoder.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.EncodersClient.ListEncoders.g.cs b/src/libs/Vectara/Generated/Vectara.EncodersClient.ListEncoders.g.cs index e70e66a..34d79bf 100644 --- a/src/libs/Vectara/Generated/Vectara.EncodersClient.ListEncoders.g.cs +++ b/src/libs/Vectara/Generated/Vectara.EncodersClient.ListEncoders.g.cs @@ -132,20 +132,29 @@ partial void ProcessListEncodersResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -177,8 +186,12 @@ partial void ProcessListEncodersResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListEncodersResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -192,18 +205,24 @@ partial void ProcessListEncodersResponseContent( h => h.Value), }; } - - return - global::Vectara.ListEncodersResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListEncodersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -216,16 +235,6 @@ partial void ProcessListEncodersResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListEncodersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.Exceptions.g.cs b/src/libs/Vectara/Generated/Vectara.Exceptions.g.cs index 728f962..7700ee3 100644 --- a/src/libs/Vectara/Generated/Vectara.Exceptions.g.cs +++ b/src/libs/Vectara/Generated/Vectara.Exceptions.g.cs @@ -43,7 +43,7 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. /// The HTTP status code of the response. - public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) + public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) { StatusCode = statusCode; } @@ -83,7 +83,7 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. /// The HTTP status code of the response. - public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) + public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) { } } diff --git a/src/libs/Vectara/Generated/Vectara.FactualConsistencyEvaluationClient.EvaluateFactualConsistency.g.cs b/src/libs/Vectara/Generated/Vectara.FactualConsistencyEvaluationClient.EvaluateFactualConsistency.g.cs index 312415f..39ef90f 100644 --- a/src/libs/Vectara/Generated/Vectara.FactualConsistencyEvaluationClient.EvaluateFactualConsistency.g.cs +++ b/src/libs/Vectara/Generated/Vectara.FactualConsistencyEvaluationClient.EvaluateFactualConsistency.g.cs @@ -119,20 +119,29 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,20 +193,29 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( if ((int)__response.StatusCode == 422) { string? __content_422 = null; + global::System.Exception? __exception_422 = null; global::Vectara.Error? __value_422 = null; - if (ReadResponseAsString) + try { - __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_422 = global::Vectara.Error.FromJson(__content_422, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::Vectara.Error.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_422 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + __exception_422 = __ex; } throw new global::Vectara.ApiException( message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, statusCode: __response.StatusCode) { ResponseBody = __content_422, @@ -220,8 +247,12 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.EvaluateFactualConsistencyResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -235,18 +266,24 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( h => h.Value), }; } - - return - global::Vectara.EvaluateFactualConsistencyResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.EvaluateFactualConsistencyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -259,16 +296,6 @@ partial void ProcessEvaluateFactualConsistencyResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.EvaluateFactualConsistencyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.cs b/src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.cs index 842deac..62ae44c 100644 --- a/src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.cs +++ b/src/libs/Vectara/Generated/Vectara.GenerationPresetsClient.ListGenerationPresets.g.cs @@ -130,20 +130,29 @@ partial void ProcessListGenerationPresetsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,8 +184,12 @@ partial void ProcessListGenerationPresetsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListGenerationPresetsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,18 +203,24 @@ partial void ProcessListGenerationPresetsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListGenerationPresetsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListGenerationPresetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,16 +233,6 @@ partial void ProcessListGenerationPresetsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListGenerationPresetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs b/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs index ee8b214..19d9118 100644 --- a/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs +++ b/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.cs @@ -119,20 +119,29 @@ partial void ProcessCorrectHallucinationsResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCorrectHallucinationsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -192,8 +210,12 @@ partial void ProcessCorrectHallucinationsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.HallucinationCorrectionResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -207,18 +229,24 @@ partial void ProcessCorrectHallucinationsResponseContent( h => h.Value), }; } - - return - global::Vectara.HallucinationCorrectionResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.HallucinationCorrectionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -231,16 +259,6 @@ partial void ProcessCorrectHallucinationsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.HallucinationCorrectionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.ListHallucinationCorrectors.g.cs b/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.ListHallucinationCorrectors.g.cs index 9a41c66..0f44ac3 100644 --- a/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.ListHallucinationCorrectors.g.cs +++ b/src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.ListHallucinationCorrectors.g.cs @@ -130,20 +130,29 @@ partial void ProcessListHallucinationCorrectorsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,8 +184,12 @@ partial void ProcessListHallucinationCorrectorsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListHallucinationCorrectorsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,18 +203,24 @@ partial void ProcessListHallucinationCorrectorsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListHallucinationCorrectorsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListHallucinationCorrectorsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,16 +233,6 @@ partial void ProcessListHallucinationCorrectorsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListHallucinationCorrectorsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.IndexClient.CreateCorpusDocument.g.cs b/src/libs/Vectara/Generated/Vectara.IndexClient.CreateCorpusDocument.g.cs index 68657e2..200a729 100644 --- a/src/libs/Vectara/Generated/Vectara.IndexClient.CreateCorpusDocument.g.cs +++ b/src/libs/Vectara/Generated/Vectara.IndexClient.CreateCorpusDocument.g.cs @@ -128,20 +128,29 @@ partial void ProcessCreateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -156,20 +165,29 @@ partial void ProcessCreateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -184,20 +202,29 @@ partial void ProcessCreateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -212,20 +239,29 @@ partial void ProcessCreateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 409) { string? __content_409 = null; + global::System.Exception? __exception_409 = null; global::Vectara.Error? __value_409 = null; - if (ReadResponseAsString) + try { - __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_409 = global::Vectara.Error.FromJson(__content_409, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_409 = global::Vectara.Error.FromJson(__content_409, JsonSerializerContext); + } + else + { + var __contentStream_409 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_409 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_409, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_409 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_409 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_409, JsonSerializerContext).ConfigureAwait(false); + __exception_409 = __ex; } throw new global::Vectara.ApiException( message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, statusCode: __response.StatusCode) { ResponseBody = __content_409, @@ -257,8 +293,12 @@ partial void ProcessCreateCorpusDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -272,18 +312,24 @@ partial void ProcessCreateCorpusDocumentResponseContent( h => h.Value), }; } - - return - global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -296,16 +342,6 @@ partial void ProcessCreateCorpusDocumentResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.IndexClient.ReplaceCorpusDocumentMetadata.g.cs b/src/libs/Vectara/Generated/Vectara.IndexClient.ReplaceCorpusDocumentMetadata.g.cs index ff3a91d..12792e9 100644 --- a/src/libs/Vectara/Generated/Vectara.IndexClient.ReplaceCorpusDocumentMetadata.g.cs +++ b/src/libs/Vectara/Generated/Vectara.IndexClient.ReplaceCorpusDocumentMetadata.g.cs @@ -134,20 +134,29 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -162,20 +171,29 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -190,20 +208,29 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( if ((int)__response.StatusCode == 429) { string? __content_429 = null; + global::System.Exception? __exception_429 = null; global::Vectara.Error? __value_429 = null; - if (ReadResponseAsString) + try { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Vectara.Error.FromJson(__content_429, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_429 = global::Vectara.Error.FromJson(__content_429, JsonSerializerContext); + } + else + { + var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_429 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); + __exception_429 = __ex; } throw new global::Vectara.ApiException( message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, statusCode: __response.StatusCode) { ResponseBody = __content_429, @@ -235,8 +262,12 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -250,18 +281,24 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( h => h.Value), }; } - - return - global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -274,16 +311,6 @@ partial void ProcessReplaceCorpusDocumentMetadataResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.IndexClient.UpdateCorpusDocument.g.cs b/src/libs/Vectara/Generated/Vectara.IndexClient.UpdateCorpusDocument.g.cs index 36cbc40..f484805 100644 --- a/src/libs/Vectara/Generated/Vectara.IndexClient.UpdateCorpusDocument.g.cs +++ b/src/libs/Vectara/Generated/Vectara.IndexClient.UpdateCorpusDocument.g.cs @@ -134,20 +134,29 @@ partial void ProcessUpdateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -162,20 +171,29 @@ partial void ProcessUpdateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -190,20 +208,29 @@ partial void ProcessUpdateCorpusDocumentResponseContent( if ((int)__response.StatusCode == 429) { string? __content_429 = null; + global::System.Exception? __exception_429 = null; global::Vectara.Error? __value_429 = null; - if (ReadResponseAsString) + try { - __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_429 = global::Vectara.Error.FromJson(__content_429, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_429 = global::Vectara.Error.FromJson(__content_429, JsonSerializerContext); + } + else + { + var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_429 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_429 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false); + __exception_429 = __ex; } throw new global::Vectara.ApiException( message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, statusCode: __response.StatusCode) { ResponseBody = __content_429, @@ -235,8 +262,12 @@ partial void ProcessUpdateCorpusDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -250,18 +281,24 @@ partial void ProcessUpdateCorpusDocumentResponseContent( h => h.Value), }; } - - return - global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -274,16 +311,6 @@ partial void ProcessUpdateCorpusDocumentResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.JobsClient.GetJob.g.cs b/src/libs/Vectara/Generated/Vectara.JobsClient.GetJob.g.cs index eb75f1f..7bc180b 100644 --- a/src/libs/Vectara/Generated/Vectara.JobsClient.GetJob.g.cs +++ b/src/libs/Vectara/Generated/Vectara.JobsClient.GetJob.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetJobResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessGetJobResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessGetJobResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Job.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessGetJobResponseContent( h => h.Value), }; } - - return - global::Vectara.Job.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Job.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessGetJobResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Job.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.JobsClient.ListJobs.g.cs b/src/libs/Vectara/Generated/Vectara.JobsClient.ListJobs.g.cs index 57b12ed..6a9aea1 100644 --- a/src/libs/Vectara/Generated/Vectara.JobsClient.ListJobs.g.cs +++ b/src/libs/Vectara/Generated/Vectara.JobsClient.ListJobs.g.cs @@ -144,20 +144,29 @@ partial void ProcessListJobsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -189,8 +198,12 @@ partial void ProcessListJobsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListJobsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -204,18 +217,24 @@ partial void ProcessListJobsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListJobsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListJobsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -228,16 +247,6 @@ partial void ProcessListJobsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListJobsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.LLMChatCompletionsClient.CreateChatCompletion.g.cs b/src/libs/Vectara/Generated/Vectara.LLMChatCompletionsClient.CreateChatCompletion.g.cs index b314db1..308789a 100644 --- a/src/libs/Vectara/Generated/Vectara.LLMChatCompletionsClient.CreateChatCompletion.g.cs +++ b/src/libs/Vectara/Generated/Vectara.LLMChatCompletionsClient.CreateChatCompletion.g.cs @@ -119,20 +119,29 @@ partial void ProcessCreateChatCompletionResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCreateChatCompletionResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -192,8 +210,12 @@ partial void ProcessCreateChatCompletionResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -207,18 +229,24 @@ partial void ProcessCreateChatCompletionResponseContent( h => h.Value), }; } - - return - global::Vectara.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -231,16 +259,6 @@ partial void ProcessCreateChatCompletionResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.CreateLLM.g.cs b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.CreateLLM.g.cs index 134df12..8b568cb 100644 --- a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.CreateLLM.g.cs +++ b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.CreateLLM.g.cs @@ -117,20 +117,29 @@ partial void ProcessCreateLLMResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -145,20 +154,29 @@ partial void ProcessCreateLLMResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -190,8 +208,12 @@ partial void ProcessCreateLLMResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.LLM.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -205,18 +227,24 @@ partial void ProcessCreateLLMResponseContent( h => h.Value), }; } - - return - global::Vectara.LLM.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.LLM.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -229,16 +257,6 @@ partial void ProcessCreateLLMResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.LLM.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.DeleteLLM.g.cs b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.DeleteLLM.g.cs index 01b3028..2743388 100644 --- a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.DeleteLLM.g.cs +++ b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.DeleteLLM.g.cs @@ -106,20 +106,29 @@ partial void ProcessDeleteLLMResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -134,20 +143,29 @@ partial void ProcessDeleteLLMResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -175,8 +193,9 @@ partial void ProcessDeleteLLMResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,15 +209,21 @@ partial void ProcessDeleteLLMResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -211,13 +236,6 @@ partial void ProcessDeleteLLMResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.GetLLM.g.cs b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.GetLLM.g.cs index 1ff054f..91184a5 100644 --- a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.GetLLM.g.cs +++ b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.GetLLM.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetLLMResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessGetLLMResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessGetLLMResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.LLM.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessGetLLMResponseContent( h => h.Value), }; } - - return - global::Vectara.LLM.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.LLM.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessGetLLMResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.LLM.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.ListLLMs.g.cs b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.ListLLMs.g.cs index 4d501f4..9964f89 100644 --- a/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.ListLLMs.g.cs +++ b/src/libs/Vectara/Generated/Vectara.LargeLanguageModelsClient.ListLLMs.g.cs @@ -130,20 +130,29 @@ partial void ProcessListLLMsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -175,8 +184,12 @@ partial void ProcessListLLMsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListLLMsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,18 +203,24 @@ partial void ProcessListLLMsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListLLMsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListLLMsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -214,16 +233,6 @@ partial void ProcessListLLMsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListLLMsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.cs b/src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.cs index 4c630cc..f893c6a 100644 --- a/src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.cs +++ b/src/libs/Vectara/Generated/Vectara.QueriesClient.Query.g.cs @@ -121,20 +121,29 @@ partial void ProcessQueryResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -149,20 +158,29 @@ partial void ProcessQueryResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -177,20 +195,29 @@ partial void ProcessQueryResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -222,8 +249,12 @@ partial void ProcessQueryResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -237,18 +268,24 @@ partial void ProcessQueryResponseContent( h => h.Value), }; } - - return - global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -261,16 +298,6 @@ partial void ProcessQueryResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.cs index c0698d4..7db1788 100644 --- a/src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.QueriesClient.QueryCorpus.g.cs @@ -130,20 +130,29 @@ partial void ProcessQueryCorpusResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -158,20 +167,29 @@ partial void ProcessQueryCorpusResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -186,20 +204,29 @@ partial void ProcessQueryCorpusResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -231,8 +258,12 @@ partial void ProcessQueryCorpusResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -246,18 +277,24 @@ partial void ProcessQueryCorpusResponseContent( h => h.Value), }; } - - return - global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -270,16 +307,6 @@ partial void ProcessQueryCorpusResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.cs b/src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.cs index 129930c..6a4aac8 100644 --- a/src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.cs +++ b/src/libs/Vectara/Generated/Vectara.QueriesClient.SearchCorpus.g.cs @@ -158,20 +158,29 @@ partial void ProcessSearchCorpusResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -186,20 +195,29 @@ partial void ProcessSearchCorpusResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -214,20 +232,29 @@ partial void ProcessSearchCorpusResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -259,8 +286,12 @@ partial void ProcessSearchCorpusResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -274,18 +305,24 @@ partial void ProcessSearchCorpusResponseContent( h => h.Value), }; } - - return - global::Vectara.QueryFullResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -298,16 +335,6 @@ partial void ProcessSearchCorpusResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.QueryFullResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistories.g.cs b/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistories.g.cs index 188a5de..9bcafb3 100644 --- a/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistories.g.cs +++ b/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistories.g.cs @@ -151,20 +151,29 @@ partial void ProcessGetQueryHistoriesResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -179,20 +188,29 @@ partial void ProcessGetQueryHistoriesResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -224,8 +242,12 @@ partial void ProcessGetQueryHistoriesResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListQueryHistoriesResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -239,18 +261,24 @@ partial void ProcessGetQueryHistoriesResponseContent( h => h.Value), }; } - - return - global::Vectara.ListQueryHistoriesResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListQueryHistoriesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -263,16 +291,6 @@ partial void ProcessGetQueryHistoriesResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListQueryHistoriesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistory.g.cs b/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistory.g.cs index 725b38a..2973d97 100644 --- a/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistory.g.cs +++ b/src/libs/Vectara/Generated/Vectara.QueryHistoryClient.GetQueryHistory.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetQueryHistoryResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessGetQueryHistoryResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessGetQueryHistoryResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.QueryHistory.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessGetQueryHistoryResponseContent( h => h.Value), }; } - - return - global::Vectara.QueryHistory.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.QueryHistory.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessGetQueryHistoryResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.QueryHistory.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.RerankersClient.ListRerankers.g.cs b/src/libs/Vectara/Generated/Vectara.RerankersClient.ListRerankers.g.cs index c6d0a26..f91b129 100644 --- a/src/libs/Vectara/Generated/Vectara.RerankersClient.ListRerankers.g.cs +++ b/src/libs/Vectara/Generated/Vectara.RerankersClient.ListRerankers.g.cs @@ -132,20 +132,29 @@ partial void ProcessListRerankersResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -177,8 +186,12 @@ partial void ProcessListRerankersResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListRerankersResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -192,18 +205,24 @@ partial void ProcessListRerankersResponseContent( h => h.Value), }; } - - return - global::Vectara.ListRerankersResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListRerankersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -216,16 +235,6 @@ partial void ProcessListRerankersResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListRerankersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.TableExtractorsClient.ListTableExtractors.g.cs b/src/libs/Vectara/Generated/Vectara.TableExtractorsClient.ListTableExtractors.g.cs index 8c02ba6..d873538 100644 --- a/src/libs/Vectara/Generated/Vectara.TableExtractorsClient.ListTableExtractors.g.cs +++ b/src/libs/Vectara/Generated/Vectara.TableExtractorsClient.ListTableExtractors.g.cs @@ -105,20 +105,29 @@ partial void ProcessListTableExtractorsResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -150,8 +159,12 @@ partial void ProcessListTableExtractorsResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListTableExtractorsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -165,18 +178,24 @@ partial void ProcessListTableExtractorsResponseContent( h => h.Value), }; } - - return - global::Vectara.ListTableExtractorsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListTableExtractorsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -189,16 +208,6 @@ partial void ProcessListTableExtractorsResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListTableExtractorsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.cs b/src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.cs index dab38fb..f0baa2c 100644 --- a/src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UploadClient.UploadFile.g.cs @@ -170,20 +170,29 @@ partial void ProcessUploadFileResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -198,20 +207,29 @@ partial void ProcessUploadFileResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -226,20 +244,29 @@ partial void ProcessUploadFileResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -254,20 +281,29 @@ partial void ProcessUploadFileResponseContent( if ((int)__response.StatusCode == 415) { string? __content_415 = null; + global::System.Exception? __exception_415 = null; global::Vectara.Error? __value_415 = null; - if (ReadResponseAsString) + try { - __content_415 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_415 = global::Vectara.Error.FromJson(__content_415, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_415 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_415 = global::Vectara.Error.FromJson(__content_415, JsonSerializerContext); + } + else + { + var __contentStream_415 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_415 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_415, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_415 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_415 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_415, JsonSerializerContext).ConfigureAwait(false); + __exception_415 = __ex; } throw new global::Vectara.ApiException( message: __content_415 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_415, statusCode: __response.StatusCode) { ResponseBody = __content_415, @@ -299,8 +335,12 @@ partial void ProcessUploadFileResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -314,18 +354,24 @@ partial void ProcessUploadFileResponseContent( h => h.Value), }; } - - return - global::Vectara.Document.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -338,16 +384,6 @@ partial void ProcessUploadFileResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.Document.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.CreateUser.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.CreateUser.g.cs index 3be091f..d5fd39f 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.CreateUser.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.CreateUser.g.cs @@ -119,20 +119,29 @@ partial void ProcessCreateUserResponseContent( if ((int)__response.StatusCode == 400) { string? __content_400 = null; + global::System.Exception? __exception_400 = null; global::Vectara.BadRequestError? __value_400 = null; - if (ReadResponseAsString) + try { - __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Vectara.BadRequestError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_400 = await global::Vectara.BadRequestError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + __exception_400 = __ex; } throw new global::Vectara.ApiException( message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, statusCode: __response.StatusCode) { ResponseBody = __content_400, @@ -147,20 +156,29 @@ partial void ProcessCreateUserResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -192,8 +210,12 @@ partial void ProcessCreateUserResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.AllOf.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -207,18 +229,24 @@ partial void ProcessCreateUserResponseContent( h => h.Value), }; } - - return - global::Vectara.AllOf.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.AllOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -231,16 +259,6 @@ partial void ProcessCreateUserResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.AllOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.DeleteUser.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.DeleteUser.g.cs index 71d8d5a..989525a 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.DeleteUser.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.DeleteUser.g.cs @@ -106,20 +106,29 @@ partial void ProcessDeleteUserResponse( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -134,20 +143,29 @@ partial void ProcessDeleteUserResponse( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -175,8 +193,9 @@ partial void ProcessDeleteUserResponse( try { __response.EnsureSuccessStatusCode(); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -190,15 +209,21 @@ partial void ProcessDeleteUserResponse( h => h.Value), }; } - } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -211,13 +236,6 @@ partial void ProcessDeleteUserResponse( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.GetUser.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.GetUser.g.cs index 7db8b13..fd2ae20 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.GetUser.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.GetUser.g.cs @@ -111,20 +111,29 @@ partial void ProcessGetUserResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessGetUserResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessGetUserResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.User.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessGetUserResponseContent( h => h.Value), }; } - - return - global::Vectara.User.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessGetUserResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.ListUsers.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.ListUsers.g.cs index 090072c..1e1bd18 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.ListUsers.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.ListUsers.g.cs @@ -133,20 +133,29 @@ partial void ProcessListUsersResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -178,8 +187,12 @@ partial void ProcessListUsersResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ListUsersResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -193,18 +206,24 @@ partial void ProcessListUsersResponseContent( h => h.Value), }; } - - return - global::Vectara.ListUsersResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ListUsersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -217,16 +236,6 @@ partial void ProcessListUsersResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ListUsersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.ResetUserPassword.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.ResetUserPassword.g.cs index 153f941..9aca899 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.ResetUserPassword.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.ResetUserPassword.g.cs @@ -111,20 +111,29 @@ partial void ProcessResetUserPasswordResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -139,20 +148,29 @@ partial void ProcessResetUserPasswordResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -184,8 +202,12 @@ partial void ProcessResetUserPasswordResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.ResetUserPasswordResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -199,18 +221,24 @@ partial void ProcessResetUserPasswordResponseContent( h => h.Value), }; } - - return - global::Vectara.ResetUserPasswordResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.ResetUserPasswordResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -223,16 +251,6 @@ partial void ProcessResetUserPasswordResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.ResetUserPasswordResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } } } diff --git a/src/libs/Vectara/Generated/Vectara.UsersClient.UpdateUser.g.cs b/src/libs/Vectara/Generated/Vectara.UsersClient.UpdateUser.g.cs index 13d9593..7fa98a3 100644 --- a/src/libs/Vectara/Generated/Vectara.UsersClient.UpdateUser.g.cs +++ b/src/libs/Vectara/Generated/Vectara.UsersClient.UpdateUser.g.cs @@ -125,20 +125,29 @@ partial void ProcessUpdateUserResponseContent( if ((int)__response.StatusCode == 403) { string? __content_403 = null; + global::System.Exception? __exception_403 = null; global::Vectara.Error? __value_403 = null; - if (ReadResponseAsString) + try { - __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_403 = global::Vectara.Error.FromJson(__content_403, JsonSerializerContext); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_403 = await global::Vectara.Error.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false); + __exception_403 = __ex; } throw new global::Vectara.ApiException( message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, statusCode: __response.StatusCode) { ResponseBody = __content_403, @@ -153,20 +162,29 @@ partial void ProcessUpdateUserResponseContent( if ((int)__response.StatusCode == 404) { string? __content_404 = null; + global::System.Exception? __exception_404 = null; global::Vectara.NotFoundError? __value_404 = null; - if (ReadResponseAsString) + try { - __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + if (ReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_404 = global::Vectara.NotFoundError.FromJson(__content_404, JsonSerializerContext); + } + else + { + var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + } } - else + catch (global::System.Exception __ex) { - var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - __value_404 = await global::Vectara.NotFoundError.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false); + __exception_404 = __ex; } throw new global::Vectara.ApiException( message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, statusCode: __response.StatusCode) { ResponseBody = __content_404, @@ -198,8 +216,12 @@ partial void ProcessUpdateUserResponseContent( try { __response.EnsureSuccessStatusCode(); + + return + global::Vectara.User.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __content ?? __response.ReasonPhrase ?? string.Empty, @@ -213,18 +235,24 @@ partial void ProcessUpdateUserResponseContent( h => h.Value), }; } - - return - global::Vectara.User.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } else { try { __response.EnsureSuccessStatusCode(); + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Vectara.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); } - catch (global::System.Net.Http.HttpRequestException __ex) + catch (global::System.Exception __ex) { throw new global::Vectara.ApiException( message: __response.ReasonPhrase ?? string.Empty, @@ -237,16 +265,6 @@ partial void ProcessUpdateUserResponseContent( h => h.Value), }; } - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - - return - await global::Vectara.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? - throw new global::System.InvalidOperationException("Response deserialization failed."); } }