Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 46 additions & 28 deletions src/libs/Vectara/Generated/Vectara.APIKeysClient.CreateApiKey.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<global::Vectara.BadRequestError>(
message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_400,
statusCode: __response.StatusCode)
{
ResponseBody = __content_400,
Expand All @@ -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<global::Vectara.Error>(
message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_403,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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.");
}
}

Expand Down
41 changes: 25 additions & 16 deletions src/libs/Vectara/Generated/Vectara.APIKeysClient.DeleteApiKey.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<global::Vectara.Error>(
message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_403,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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);

}
}
}
Expand Down
53 changes: 31 additions & 22 deletions src/libs/Vectara/Generated/Vectara.APIKeysClient.GetApiKey.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<global::Vectara.Error>(
message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_403,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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.");
}
}
}
Expand Down
Loading