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 Dust.JsonConverters
{
/// <inheritdoc />
public sealed class PrivateAgentMessageModelResolutionMethodJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Dust.PrivateAgentMessageModelResolutionMethod>
{
/// <inheritdoc />
public override global::Dust.PrivateAgentMessageModelResolutionMethod 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::Dust.PrivateAgentMessageModelResolutionMethodExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

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

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

return default;
}

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

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

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

return default;
}

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

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

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

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

return default;
}

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

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Dust.PrivateSandboxFunctionInvocationErrorEventType? 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::Dust.PrivateSandboxFunctionInvocationErrorEventTypeExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ public class PrivateSandboxFunctionInvocationEventJsonConverter : global::System
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Dust.PrivateSandboxFunctionInvocationResultEvent)}");
sandboxFunctionInvocationResult = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::Dust.PrivateSandboxFunctionInvocationErrorEvent? sandboxFunctionInvocationError = default;
if (discriminator?.Type == global::Dust.PrivateSandboxFunctionInvocationEventDiscriminatorType.SandboxFunctionInvocationError)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Dust.PrivateSandboxFunctionInvocationErrorEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Dust.PrivateSandboxFunctionInvocationErrorEvent> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Dust.PrivateSandboxFunctionInvocationErrorEvent)}");
sandboxFunctionInvocationError = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

var __value = new global::Dust.PrivateSandboxFunctionInvocationEvent(
discriminator?.Type,
sandboxFunctionInvocationCreated,

sandboxFunctionInvocationResult
sandboxFunctionInvocationResult,

sandboxFunctionInvocationError
);

return __value;
Expand All @@ -67,6 +76,12 @@ public override void Write(
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Dust.PrivateSandboxFunctionInvocationResultEvent).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.SandboxFunctionInvocationResult!, typeInfo);
}
else if (value.IsSandboxFunctionInvocationError)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Dust.PrivateSandboxFunctionInvocationErrorEvent), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Dust.PrivateSandboxFunctionInvocationErrorEvent?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Dust.PrivateSandboxFunctionInvocationErrorEvent).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.SandboxFunctionInvocationError!, typeInfo);
}
}
}
}
Loading