Files
WotBlitzStatisticsBlazor/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientEntityIdFactory.WotBlitzStatisticsProClient.StrawberryShake.cs
T

46 lines
2.1 KiB
C#

// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "12.12.1.0")]
public partial class WotBlitzStatisticsProClientEntityIdFactory : global::StrawberryShake.IEntityIdSerializer
{
private static readonly global::System.Text.Json.JsonWriterOptions _options = new global::System.Text.Json.JsonWriterOptions()
{Indented = false};
public global::StrawberryShake.EntityId Parse(global::System.Text.Json.JsonElement obj)
{
global::System.String __typename = obj.GetProperty("__typename").GetString()!;
return __typename switch
{
"Achievement" => ParseAchievementEntityId(obj, __typename),
_ => throw new global::System.NotSupportedException()};
}
public global::System.String Format(global::StrawberryShake.EntityId entityId)
{
return entityId.Name switch
{
"Achievement" => FormatAchievementEntityId(entityId),
_ => throw new global::System.NotSupportedException()};
}
private global::StrawberryShake.EntityId ParseAchievementEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
{
return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
}
private global::System.String FormatAchievementEntityId(global::StrawberryShake.EntityId entityId)
{
using var writer = new global::StrawberryShake.Internal.ArrayWriter();
using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
jsonWriter.WriteStartObject();
jsonWriter.WriteString("__typename", entityId.Name);
jsonWriter.WriteString("id", (global::System.String)entityId.Value);
jsonWriter.WriteEndObject();
jsonWriter.Flush();
return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
}
}
}