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
32 changes: 16 additions & 16 deletions src/libs/AssemblyAI/Generated/AssemblyAI.AnyOf.2.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public bool TryPickValue1(
/// <summary>
///
/// </summary>
public T1 PickValue1() => IsValue1
? Value1!
public T1 PickValue1() => Value1 is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");

/// <summary>
Expand Down Expand Up @@ -78,8 +78,8 @@ public bool TryPickValue2(
/// <summary>
///
/// </summary>
public T2 PickValue2() => IsValue2
? Value2!
public T2 PickValue2() => Value2 is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
/// <summary>
///
Expand Down Expand Up @@ -176,13 +176,13 @@ public bool Validate()
Validate();
}

if (IsValue1 && value1 != null)
if (Value1 is { } __value0 && value1 != null)
{
return value1(Value1!);
return value1(__value0);
}
else if (IsValue2 && value2 != null)
else if (Value2 is { } __value1 && value2 != null)
{
return value2(Value2!);
return value2(__value1);
}

return default(TResult);
Expand All @@ -202,13 +202,13 @@ public void Match(
Validate();
}

if (IsValue1)
if (Value1 is { } __value0)
{
value1?.Invoke(Value1!);
value1?.Invoke(__value0);
}
else if (IsValue2)
else if (Value2 is { } __value1)
{
value2?.Invoke(Value2!);
value2?.Invoke(__value1);
}
}

Expand All @@ -225,13 +225,13 @@ public void Switch(
Validate();
}

if (IsValue1)
if (Value1 is { } __value0)
{
value1?.Invoke(Value1!);
value1?.Invoke(__value0);
}
else if (IsValue2)
else if (Value2 is { } __value1)
{
value2?.Invoke(Value2!);
value2?.Invoke(__value1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ public static class AutoSDKConditionalRequests
{
send = send ?? throw new global::System.ArgumentNullException(nameof(send));
requestOptions = CloneRequestOptions(requestOptions);
if (!string.IsNullOrWhiteSpace(entityTag))
if (entityTag is { } nonEmptyEntityTag && !string.IsNullOrWhiteSpace(nonEmptyEntityTag))
{
requestOptions.Headers["If-None-Match"] = entityTag!;
requestOptions.Headers["If-None-Match"] = nonEmptyEntityTag;
}

try
Expand Down
10 changes: 5 additions & 5 deletions src/libs/AssemblyAI/Generated/AssemblyAI.FilesClient.Upload.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ partial void ProcessUploadResponseContent(
pathTemplate: "\"/v2/upload\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -230,7 +230,7 @@ partial void ProcessUploadResponseContent(
pathTemplate: "\"/v2/upload\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: null,
exception: __exception,
clientOptions: Options,
Expand Down Expand Up @@ -271,7 +271,7 @@ partial void ProcessUploadResponseContent(
pathTemplate: "\"/v2/upload\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down Expand Up @@ -319,7 +319,7 @@ partial void ProcessUploadResponseContent(
pathTemplate: "\"/v2/upload\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand All @@ -341,7 +341,7 @@ partial void ProcessUploadResponseContent(
pathTemplate: "\"/v2/upload\"",
httpMethod: "POST",
baseUri: BaseUri,
request: __httpRequest!,
request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
response: __response,
exception: null,
clientOptions: Options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo);
}
else if (value.IsValue2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,31 +295,31 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T1?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue1(), typeInfo);
}
else if (value.IsValue2)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T2?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue2(), typeInfo);
}
else if (value.IsValue3)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T3?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T3).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value3!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue3(), typeInfo);
}
else if (value.IsValue4)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T4), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T4?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T4).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value4!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue4(), typeInfo);
}
else if (value.IsValue5)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T5), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<T5?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T5).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value5!, typeInfo);
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickValue5(), typeInfo);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.RedactedAudioResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.RedactedAudioResponse?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.RedactedAudioResponse).Name}");
var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Response!, typeInfo);
var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickResponse(), typeInfo);
if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object)
{
throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.TranscriptParamsVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.TranscriptParamsVariant1?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.TranscriptParamsVariant1).Name}");
var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.TranscriptParamsVariant1!, typeInfo);
var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickTranscriptParamsVariant1(), typeInfo);
if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object)
{
throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects.");
Expand All @@ -88,7 +88,7 @@ public override void Write(
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.TranscriptOptionalParams), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.TranscriptOptionalParams?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.TranscriptOptionalParams).Name}");
var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.Optional!, typeInfo);
var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickOptional(), typeInfo);
if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object)
{
throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public bool TryPickResponse(
/// <summary>
///
/// </summary>
public global::AssemblyAI.RedactedAudioResponse PickResponse() => IsResponse
? Response!
public global::AssemblyAI.RedactedAudioResponse PickResponse() => Response is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Response' but the value was {ToString()}.");
/// <summary>
///
Expand Down Expand Up @@ -103,9 +103,9 @@ public bool Validate()
Validate();
}

if (IsResponse && response != null)
if (Response is { } __value0 && response != null)
{
return response(Response!);
return response(__value0);
}

return default(TResult);
Expand All @@ -123,9 +123,9 @@ public void Match(
Validate();
}

if (IsResponse)
if (Response is { } __value0)
{
response?.Invoke(Response!);
response?.Invoke(__value0);
}
}

Expand All @@ -141,9 +141,9 @@ public void Switch(
Validate();
}

if (IsResponse)
if (Response is { } __value0)
{
response?.Invoke(Response!);
response?.Invoke(__value0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public bool TryPickTranscriptParamsVariant1(
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptParamsVariant1 PickTranscriptParamsVariant1() => IsTranscriptParamsVariant1
? TranscriptParamsVariant1!
public global::AssemblyAI.TranscriptParamsVariant1 PickTranscriptParamsVariant1() => TranscriptParamsVariant1 is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'TranscriptParamsVariant1' but the value was {ToString()}.");

/// <summary>
Expand Down Expand Up @@ -81,8 +81,8 @@ public bool TryPickOptional(
/// <summary>
///
/// </summary>
public global::AssemblyAI.TranscriptOptionalParams PickOptional() => IsOptional
? Optional!
public global::AssemblyAI.TranscriptOptionalParams PickOptional() => Optional is { } value
? value
: throw new global::System.InvalidOperationException($"Expected union variant 'Optional' but the value was {ToString()}.");
/// <summary>
///
Expand Down Expand Up @@ -179,13 +179,13 @@ public bool Validate()
Validate();
}

if (IsTranscriptParamsVariant1 && transcriptParamsVariant1 != null)
if (TranscriptParamsVariant1 is { } __value0 && transcriptParamsVariant1 != null)
{
return transcriptParamsVariant1(TranscriptParamsVariant1!);
return transcriptParamsVariant1(__value0);
}
else if (IsOptional && optional != null)
else if (Optional is { } __value1 && optional != null)
{
return optional(Optional!);
return optional(__value1);
}

return default(TResult);
Expand All @@ -205,13 +205,13 @@ public void Match(
Validate();
}

if (IsTranscriptParamsVariant1)
if (TranscriptParamsVariant1 is { } __value0)
{
transcriptParamsVariant1?.Invoke(TranscriptParamsVariant1!);
transcriptParamsVariant1?.Invoke(__value0);
}
else if (IsOptional)
else if (Optional is { } __value1)
{
optional?.Invoke(Optional!);
optional?.Invoke(__value1);
}
}

Expand All @@ -228,13 +228,13 @@ public void Switch(
Validate();
}

if (IsTranscriptParamsVariant1)
if (TranscriptParamsVariant1 is { } __value0)
{
transcriptParamsVariant1?.Invoke(TranscriptParamsVariant1!);
transcriptParamsVariant1?.Invoke(__value0);
}
else if (IsOptional)
else if (Optional is { } __value1)
{
optional?.Invoke(Optional!);
optional?.Invoke(__value1);
}
}

Expand Down
Loading
Loading