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
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class CreateSpeechUnderstandingResponse200JsonConverter : global::System.
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.LLMGatewayTranslationResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.LLMGatewayTranslationResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.LLMGatewayTranslationResponse).Name}");
lLMGatewayTranslationResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -124,9 +125,13 @@ public class CreateSpeechUnderstandingResponse200JsonConverter : global::System.
catch (global::System.InvalidOperationException)
{
}
}

if (lLMGatewayTranslationResponse == null && lLMGatewaySpeakerIdentificationResponse == null && lLMGatewayCustomFormattingResponse == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.LLMGatewaySpeakerIdentificationResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.LLMGatewaySpeakerIdentificationResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.LLMGatewaySpeakerIdentificationResponse).Name}");
lLMGatewaySpeakerIdentificationResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -137,9 +142,13 @@ public class CreateSpeechUnderstandingResponse200JsonConverter : global::System.
catch (global::System.InvalidOperationException)
{
}
}

if (lLMGatewayTranslationResponse == null && lLMGatewaySpeakerIdentificationResponse == null && lLMGatewayCustomFormattingResponse == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.LLMGatewayCustomFormattingResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.LLMGatewayCustomFormattingResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.LLMGatewayCustomFormattingResponse).Name}");
lLMGatewayCustomFormattingResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public class MessageJsonConverter : global::System.Text.Json.Serialization.JsonC
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.MessageVariant1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.MessageVariant1> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.MessageVariant1).Name}");
messageVariant1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -132,9 +133,13 @@ public class MessageJsonConverter : global::System.Text.Json.Serialization.JsonC
catch (global::System.InvalidOperationException)
{
}
}

if (messageVariant1 == null && messageVariant2 == null && messageVariant3 == null && tool == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.MessageVariant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.MessageVariant2> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.MessageVariant2).Name}");
messageVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -145,9 +150,13 @@ public class MessageJsonConverter : global::System.Text.Json.Serialization.JsonC
catch (global::System.InvalidOperationException)
{
}
}

if (messageVariant1 == null && messageVariant2 == null && messageVariant3 == null && tool == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.MessageVariant3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.MessageVariant3> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.MessageVariant3).Name}");
messageVariant3 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -158,9 +167,13 @@ public class MessageJsonConverter : global::System.Text.Json.Serialization.JsonC
catch (global::System.InvalidOperationException)
{
}
}

if (messageVariant1 == null && messageVariant2 == null && messageVariant3 == null && tool == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.MessageVariant4), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.MessageVariant4> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.MessageVariant4).Name}");
tool = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace AssemblyAI.JsonConverters
{
/// <inheritdoc />
public sealed class MessageDiscriminatorRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::AssemblyAI.MessageDiscriminatorRole>
{
/// <inheritdoc />
public override global::AssemblyAI.MessageDiscriminatorRole Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::AssemblyAI.MessageDiscriminatorRoleExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::AssemblyAI.MessageDiscriminatorRole)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::AssemblyAI.MessageDiscriminatorRole);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::AssemblyAI.MessageDiscriminatorRole value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::AssemblyAI.MessageDiscriminatorRoleExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace AssemblyAI.JsonConverters
{
/// <inheritdoc />
public sealed class MessageDiscriminatorRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::AssemblyAI.MessageDiscriminatorRole?>
{
/// <inheritdoc />
public override global::AssemblyAI.MessageDiscriminatorRole? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::AssemblyAI.MessageDiscriminatorRoleExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::AssemblyAI.MessageDiscriminatorRole)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::AssemblyAI.MessageDiscriminatorRole?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::AssemblyAI.MessageDiscriminatorRole? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::AssemblyAI.MessageDiscriminatorRoleExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ public class OneOfJsonConverter<T1, T2> : global::System.Text.Json.Serialization
catch (global::System.InvalidOperationException)
{
}
}

if (value1 == null && value2 == null)
{
try
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class ToolChoiceJsonConverter : global::System.Text.Json.Serialization.Js
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.ToolChoice0), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.ToolChoice0> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.ToolChoice0).Name}");
toolChoice0 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -94,9 +95,13 @@ public class ToolChoiceJsonConverter : global::System.Text.Json.Serialization.Js
catch (global::System.InvalidOperationException)
{
}
}

if (toolChoice0 == null && toolChoice1 == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.ToolChoice1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.ToolChoice1> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.ToolChoice1).Name}");
toolChoice1 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public class TranscriptOptionalParamsSpeechUnderstandingRequestJsonConverter : g
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.TranslationRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.TranslationRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.TranslationRequestBody).Name}");
translationRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -121,9 +122,13 @@ public class TranscriptOptionalParamsSpeechUnderstandingRequestJsonConverter : g
catch (global::System.InvalidOperationException)
{
}
}

if (translationRequestBody == null && speakerIdentificationRequestBody == null && customFormattingRequestBody == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.SpeakerIdentificationRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.SpeakerIdentificationRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.SpeakerIdentificationRequestBody).Name}");
speakerIdentificationRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -134,9 +139,13 @@ public class TranscriptOptionalParamsSpeechUnderstandingRequestJsonConverter : g
catch (global::System.InvalidOperationException)
{
}
}

if (translationRequestBody == null && speakerIdentificationRequestBody == null && customFormattingRequestBody == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.CustomFormattingRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.CustomFormattingRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.CustomFormattingRequestBody).Name}");
customFormattingRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public class TranscriptSpeechUnderstandingRequestJsonConverter : global::System.
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.TranslationRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.TranslationRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.TranslationRequestBody).Name}");
translationRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -121,9 +122,13 @@ public class TranscriptSpeechUnderstandingRequestJsonConverter : global::System.
catch (global::System.InvalidOperationException)
{
}
}

if (translationRequestBody == null && speakerIdentificationRequestBody == null && customFormattingRequestBody == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.SpeakerIdentificationRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.SpeakerIdentificationRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.SpeakerIdentificationRequestBody).Name}");
speakerIdentificationRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -134,9 +139,13 @@ public class TranscriptSpeechUnderstandingRequestJsonConverter : global::System.
catch (global::System.InvalidOperationException)
{
}
}

if (translationRequestBody == null && speakerIdentificationRequestBody == null && customFormattingRequestBody == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.CustomFormattingRequestBody), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.CustomFormattingRequestBody> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.CustomFormattingRequestBody).Name}");
customFormattingRequestBody = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class TranscriptSpeechUnderstandingResponseJsonConverter : global::System
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.TranslationResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.TranslationResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.TranslationResponse).Name}");
translationResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -117,9 +118,13 @@ public class TranscriptSpeechUnderstandingResponseJsonConverter : global::System
catch (global::System.InvalidOperationException)
{
}
}

if (translationResponse == null && speakerIdentificationResponse == null && customFormattingResponse == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.SpeakerIdentificationResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.SpeakerIdentificationResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.SpeakerIdentificationResponse).Name}");
speakerIdentificationResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand All @@ -130,9 +135,13 @@ public class TranscriptSpeechUnderstandingResponseJsonConverter : global::System
catch (global::System.InvalidOperationException)
{
}
}

if (translationResponse == null && speakerIdentificationResponse == null && customFormattingResponse == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::AssemblyAI.CustomFormattingResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::AssemblyAI.CustomFormattingResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::AssemblyAI.CustomFormattingResponse).Name}");
customFormattingResponse = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
Expand Down
Loading