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

82 lines
5.4 KiB
C#
Raw Normal View History

2021-05-28 13:39:29 +02:00
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class PlayerResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.PlayerResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public PlayerResultFactory(global::StrawberryShake.IEntityStore entityStore)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
}
global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerResult);
public PlayerResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is PlayerResultInfo info)
{
return new PlayerResult(MapNonNullableIPlayer_AccountInfo(info.AccountInfo, snapshot));
}
throw new global::System.ArgumentException("PlayerResultInfo expected.");
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountInfo MapNonNullableIPlayer_AccountInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountInfoResponseData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IPlayer_AccountInfo returnValue = default !;
if (data.__typename.Equals("AccountInfoResponse", global::System.StringComparison.Ordinal))
{
returnValue = new Player_AccountInfo_AccountInfoResponse(data.AccountId ?? throw new global::System.ArgumentNullException(), data.Nickname, data.CreatedAt ?? throw new global::System.ArgumentNullException(), data.LastBattleTime ?? throw new global::System.ArgumentNullException(), data.Battles ?? throw new global::System.ArgumentNullException(), data.WinRate ?? throw new global::System.ArgumentNullException(), data.AvgDamage ?? throw new global::System.ArgumentNullException(), data.AvgXp ?? throw new global::System.ArgumentNullException(), data.AvgTier ?? throw new global::System.ArgumentNullException(), data.DamageCoefficient ?? throw new global::System.ArgumentNullException(), data.SurvivalRate ?? throw new global::System.ArgumentNullException(), MapIPlayer_AccountInfo_TanksNonNullableArray(data.Tanks, snapshot));
}
else
{
throw new global::System.NotSupportedException();
}
return returnValue;
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountInfo_Tanks>? MapIPlayer_AccountInfo_TanksNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.TankInfoResponseData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
return null;
}
var tankInfoResponses = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountInfo_Tanks>();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.TankInfoResponseData child in list)
{
tankInfoResponses.Add(MapNonNullableIPlayer_AccountInfo_Tanks(child, snapshot));
}
return tankInfoResponses;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountInfo_Tanks MapNonNullableIPlayer_AccountInfo_Tanks(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.TankInfoResponseData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IPlayer_AccountInfo_Tanks returnValue = default !;
if (data.__typename.Equals("TankInfoResponse", global::System.StringComparison.Ordinal))
{
returnValue = new Player_AccountInfo_Tanks_TankInfoResponse(data.TankId ?? throw new global::System.ArgumentNullException(), data.Name, data.TankNation, data.TankType, data.Tier ?? throw new global::System.ArgumentNullException(), data.IsPremium ?? throw new global::System.ArgumentNullException(), data.LastBattleTime ?? throw new global::System.ArgumentNullException(), data.Battles ?? throw new global::System.ArgumentNullException(), data.WinRate ?? throw new global::System.ArgumentNullException(), data.AvgDamage ?? throw new global::System.ArgumentNullException(), data.AvgXp ?? throw new global::System.ArgumentNullException(), data.AvgBattleLifeTimeInMinutes ?? throw new global::System.ArgumentNullException(), data.DamageCoefficient ?? throw new global::System.ArgumentNullException(), data.SurvivalRate ?? throw new global::System.ArgumentNullException());
}
else
{
throw new global::System.NotSupportedException();
}
return returnValue;
}
global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
{
return Create(dataInfo, snapshot);
}
}
}