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
@@ -0,0 +1,53 @@
#nullable enable

namespace RetellAI.JsonConverters
{
/// <inheritdoc />
public sealed class V3CallBaseCallStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::RetellAI.V3CallBaseCallStatus>
{
/// <inheritdoc />
public override global::RetellAI.V3CallBaseCallStatus 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::RetellAI.V3CallBaseCallStatusExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace RetellAI.JsonConverters
{
/// <inheritdoc />
public sealed class V3CallBaseCallStatusNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::RetellAI.V3CallBaseCallStatus?>
{
/// <inheritdoc />
public override global::RetellAI.V3CallBaseCallStatus? 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::RetellAI.V3CallBaseCallStatusExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::RetellAI.V3CallBaseCallStatus? 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::RetellAI.V3CallBaseCallStatusExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace RetellAI.JsonConverters
{
/// <inheritdoc />
public sealed class V3CallBaseDataStorageSettingJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::RetellAI.V3CallBaseDataStorageSetting>
{
/// <inheritdoc />
public override global::RetellAI.V3CallBaseDataStorageSetting 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::RetellAI.V3CallBaseDataStorageSettingExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace RetellAI.JsonConverters
{
/// <inheritdoc />
public sealed class V3CallBaseDataStorageSettingNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::RetellAI.V3CallBaseDataStorageSetting?>
{
/// <inheritdoc />
public override global::RetellAI.V3CallBaseDataStorageSetting? 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::RetellAI.V3CallBaseDataStorageSettingExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::RetellAI.V3CallBaseDataStorageSetting? 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::RetellAI.V3CallBaseDataStorageSettingExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio

var __score0 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallResponse), options);
var __ti = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponse), options);
if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object)
{
foreach (var __prop in __ti.Properties)
Expand All @@ -40,7 +40,7 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
}
var __score1 = 0;
{
var __ti = typeInfoResolver.GetTypeInfo(typeof(object), options);
var __ti = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponse), options);
if (__ti != null && __ti.Kind == global::System.Text.Json.Serialization.Metadata.JsonTypeInfoKind.Object)
{
foreach (var __prop in __ti.Properties)
Expand All @@ -54,18 +54,18 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
if (__score0 > __bestScore) { __bestScore = __score0; __bestIndex = 0; }
if (__score1 > __bestScore) { __bestScore = __score1; __bestIndex = 1; }

global::RetellAI.V2CallResponse? v2 = default;
object? v3CallResponseVariant2 = default;
global::RetellAI.V3WebCallResponse? web = default;
global::RetellAI.V3PhoneCallResponse? phone = default;
if (__bestIndex >= 0)
{
if (__bestIndex == 0)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V2CallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallResponse).Name}");
v2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3WebCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponse).Name}");
web = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -80,9 +80,9 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
v3CallResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3PhoneCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponse).Name}");
phone = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -93,14 +93,14 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
}
}

if (v2 == null && v3CallResponseVariant2 == null)
if (web == null && phone == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V2CallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallResponse).Name}");
v2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3WebCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponse).Name}");
web = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -110,14 +110,14 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
}
}

if (v2 == null && v3CallResponseVariant2 == null)
if (web == null && phone == null)
{
try
{

var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
v3CallResponseVariant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3PhoneCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponse).Name}");
phone = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo);
}
catch (global::System.Text.Json.JsonException)
{
Expand All @@ -128,9 +128,9 @@ public class V3CallResponseJsonConverter : global::System.Text.Json.Serializatio
}

var __value = new global::RetellAI.V3CallResponse(
v2,
web,

v3CallResponseVariant2
phone
);

return __value;
Expand All @@ -145,17 +145,17 @@ public override void Write(
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsV2)
if (value.IsWeb)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V2CallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V2CallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V2CallResponse).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.V2!.Value, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3WebCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3WebCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3WebCallResponse).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Web!.Value, typeInfo);
}
else if (value.IsV3CallResponseVariant2)
else if (value.IsPhone)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(object), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<object?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(object).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.V3CallResponseVariant2!, typeInfo);
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::RetellAI.V3PhoneCallResponse), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::RetellAI.V3PhoneCallResponse> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::RetellAI.V3PhoneCallResponse).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.Phone!.Value, typeInfo);
}
}
}
Expand Down
Loading
Loading