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
4 changes: 3 additions & 1 deletion src/libs/AssemblyAI/Generated/AssemblyAI.Exceptions.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public partial class ApiException : global::System.Exception
/// </summary>
public global::System.Net.HttpStatusCode StatusCode { get; }
/// <summary>
/// The response body.
/// The response body as a string, or <c>null</c> if the body could not be read.
/// This is always populated for error responses regardless of the <c>ReadResponseAsString</c> setting.
/// For success-path failures (e.g. deserialization errors), the client attempts a best-effort read.
/// </summary>
public string? ResponseBody { get; set; }
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial interface IAssemblyAIClient : global::System.IDisposable
/// <summary>
/// Gets or sets a value indicating whether the response content should be read as a string.
/// True by default in debug builds, false otherwise.
/// When false, successful responses are deserialized directly from the response stream for better performance.
/// Error responses are always read as strings regardless of this setting,
/// ensuring <see cref="ApiException.ResponseBody"/> is populated.
/// </summary>
public bool ReadResponseAsString { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial interface IStreamingClient : global::System.IDisposable
/// <summary>
/// Gets or sets a value indicating whether the response content should be read as a string.
/// True by default in debug builds, false otherwise.
/// When false, successful responses are deserialized directly from the response stream for better performance.
/// Error responses are always read as strings regardless of this setting,
/// ensuring <see cref="ApiException.ResponseBody"/> is populated.
/// </summary>
public bool ReadResponseAsString { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial interface ITranscriptClient : global::System.IDisposable
/// <summary>
/// Gets or sets a value indicating whether the response content should be read as a string.
/// True by default in debug builds, false otherwise.
/// When false, successful responses are deserialized directly from the response stream for better performance.
/// Error responses are always read as strings regardless of this setting,
/// ensuring <see cref="ApiException.ResponseBody"/> is populated.
/// </summary>
public bool ReadResponseAsString { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_400 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false);
__content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_400 = global::AssemblyAI.Error.FromJson(__content_400, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -145,8 +146,9 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_401 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false);
__content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_401 = global::AssemblyAI.Error.FromJson(__content_401, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -182,8 +184,9 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_404 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false);
__content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_404 = global::AssemblyAI.Error.FromJson(__content_404, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -219,8 +222,9 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_429 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false);
__content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_429 = global::AssemblyAI.Error.FromJson(__content_429, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -256,8 +260,9 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_500 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false);
__content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_500 = global::AssemblyAI.Error.FromJson(__content_500, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -291,7 +296,7 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -324,7 +329,7 @@ partial void ProcessCreateTranscriptResponseContent(
}
else
{
var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -403,11 +408,25 @@ partial void ProcessCreateTranscriptResponseContent(
}
catch (global::System.Exception __ex)
{
string? __content = null;
try
{
__content = await __response.Content.ReadAsStringAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);
}
catch (global::System.Exception)
{
}

throw new global::AssemblyAI.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_400 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false);
__content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_400 = global::AssemblyAI.Error.FromJson(__content_400, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -139,8 +140,9 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_401 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_401, JsonSerializerContext).ConfigureAwait(false);
__content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_401 = global::AssemblyAI.Error.FromJson(__content_401, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -176,8 +178,9 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_404 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_404 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_404, JsonSerializerContext).ConfigureAwait(false);
__content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_404 = global::AssemblyAI.Error.FromJson(__content_404, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -213,8 +216,9 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_429 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_429 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_429, JsonSerializerContext).ConfigureAwait(false);
__content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_429 = global::AssemblyAI.Error.FromJson(__content_429, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -250,8 +254,9 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_500 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_500 = await global::AssemblyAI.Error.FromJsonStreamAsync(__contentStream_500, JsonSerializerContext).ConfigureAwait(false);
__content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

__value_500 = global::AssemblyAI.Error.FromJson(__content_500, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -285,7 +290,7 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_503 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -318,7 +323,7 @@ partial void ProcessDeleteTranscriptResponseContent(
}
else
{
var __contentStream_504 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
}
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -397,11 +402,25 @@ partial void ProcessDeleteTranscriptResponseContent(
}
catch (global::System.Exception __ex)
{
string? __content = null;
try
{
__content = await __response.Content.ReadAsStringAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);
}
catch (global::System.Exception)
{
}

throw new global::AssemblyAI.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
Expand Down
Loading
Loading