Feat: Restuctured GraphQL Queries and added Backend call service into client. And regerated GraphQL client classes

This commit is contained in:
Mikhail Shabanov committed 2021-05-15 17:36:35 +02:00
1 parent d3d25fa62d
commit 4b5b12e87d
53 files changed
+1868 -1193

No files matched your search

@@ -0,0 +1,41 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
///<summary>Account search result item</summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class AccountsSearchResponseItemData
{
public AccountsSearchResponseItemData(global::System.String __typename, global::System.Int64? accountId = default !, global::System.String? nickname = default !, global::System.String? clanTag = default !, global::System.DateTimeOffset? lastBattle = default !, global::System.Int64? battlesCount = default !, global::System.Int32? winRate = default !)
{
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
AccountId = accountId;
Nickname = nickname;
ClanTag = clanTag;
LastBattle = lastBattle;
BattlesCount = battlesCount;
WinRate = winRate;
}
public global::System.String __typename { get; }
///<summary>Player accountId</summary>
public global::System.Int64? AccountId { get; }
///<summary>Player nick</summary>
public global::System.String? Nickname { get; }
///<summary>Clan tag. Null if player doesn't have clan membership</summary>
public global::System.String? ClanTag { get; }
///<summary>Last battle time</summary>
public global::System.DateTimeOffset? LastBattle { get; }
///<summary>Player's battles count</summary>
public global::System.Int64? BattlesCount { get; }
///<summary>Win rate from 0 to 100</summary>
public global::System.Int32? WinRate { get; }
}
}
@@ -0,0 +1,37 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
///<summary>Found clans list item</summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class ClanSearchResponseItemData
{
public ClanSearchResponseItemData(global::System.String __typename, global::System.Int64? clanId = default !, global::System.Int32? createdAt = default !, global::System.Int32? membersCount = default !, global::System.String? name = default !, global::System.String? tag = default !)
{
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
ClanId = clanId;
CreatedAt = createdAt;
MembersCount = membersCount;
Name = name;
Tag = tag;
}
public global::System.String __typename { get; }
///<summary>Clan Id</summary>
public global::System.Int64? ClanId { get; }
///<summary>Clan created at. (UNIX Epoch time)</summary>
public global::System.Int32? CreatedAt { get; }
///<summary>Clan members count</summary>
public global::System.Int32? MembersCount { get; }
///<summary>Clan Name</summary>
public global::System.String? Name { get; }
///<summary>Clan Tag</summary>
public global::System.String? Tag { get; }
}
}
@@ -0,0 +1,137 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult> _resultDataFactory;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage> _requestLanguageParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int32, global::System.Int32> _intParser;
public FindClansBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
_requestLanguageParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage>("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found.");
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
_intParser = serializerResolver.GetLeafValueParser<global::System.Int32, global::System.Int32>("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
}
public global::StrawberryShake.IOperationResult<IFindClansResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
{
(IFindClansResult Result, FindClansResultInfo Info)? data = null;
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
if (response.Exception is null)
{
try
{
if (response.Body != null)
{
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
data = BuildData(dataElement);
}
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
{
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
}
}
}
catch (global::System.Exception ex)
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
}
else
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
return new global::StrawberryShake.OperationResult<IFindClansResult>(data?.Result, data?.Info, _resultDataFactory, errors);
}
private (IFindClansResult, FindClansResultInfo) BuildData(global::System.Text.Json.JsonElement obj)
{
var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
_entityStore.Update(session =>
{
snapshot = session.CurrentSnapshot;
});
var resultInfo = new FindClansResultInfo(DeserializeIFindClans_ClansNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clans")), entityIds, snapshot.Version);
return (_resultDataFactory.Create(resultInfo), resultInfo);
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? DeserializeIFindClans_ClansNonNullableArray(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
var clanSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>();
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
{
clanSearchResponseItems.Add(DeserializeNonNullableIFindClans_Clans(child));
}
return clanSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData DeserializeNonNullableIFindClans_Clans(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var typename = obj.Value.GetProperty("__typename").GetString();
if (typename?.Equals("ClanSearchResponseItem", global::System.StringComparison.Ordinal) ?? false)
{
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData(typename, clanId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clanId")), createdAt: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "createdAt")), membersCount: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "membersCount")), name: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), tag: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "tag")));
}
throw new global::System.NotSupportedException();
}
private global::System.Int64 DeserializeNonNullableInt64(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _longParser.Parse(obj.Value.GetInt64()!);
}
private global::System.Int32 DeserializeNonNullableInt32(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _intParser.Parse(obj.Value.GetInt32()!);
}
private global::System.String? DeserializeString(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
return _stringParser.Parse(obj.Value.GetString()!);
}
}
}
@@ -0,0 +1,67 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindClansResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public FindClansResultFactory(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.IFindClansResult);
public FindClansResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is FindClansResultInfo info)
{
return new FindClansResult(MapIFindClans_ClansNonNullableArray(info.Clans, snapshot));
}
throw new global::System.ArgumentException("FindClansResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>? MapIFindClans_ClansNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
return null;
}
var clanSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData child in list)
{
clanSearchResponseItems.Add(MapNonNullableIFindClans_Clans(child, snapshot));
}
return clanSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans MapNonNullableIFindClans_Clans(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IFindClans_Clans returnValue = default !;
if (data.__typename.Equals("ClanSearchResponseItem", global::System.StringComparison.Ordinal))
{
returnValue = new FindClans_Clans_ClanSearchResponseItem(data.ClanId ?? throw new global::System.ArgumentNullException(), data.CreatedAt ?? throw new global::System.ArgumentNullException(), data.MembersCount ?? throw new global::System.ArgumentNullException(), data.Name, data.Tag);
}
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);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansResultInfo : global::StrawberryShake.IOperationResultDataInfo
{
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
private readonly global::System.UInt64 _version;
public FindClansResultInfo(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? clans, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
{
Clans = clans;
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
_version = version;
}
/// <summary>
/// Finds clans by search string
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? Clans { get; }
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
public global::System.UInt64 Version => _version;
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
{
return new FindClansResultInfo(Clans, _entityIds, version);
}
}
}
@@ -0,0 +1,149 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult> _resultDataFactory;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage> _requestLanguageParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.DateTimeOffset> _dateTimeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int32, global::System.Int32> _intParser;
public FindPlayersBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
_requestLanguageParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage>("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found.");
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
_dateTimeParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.DateTimeOffset>("DateTime") ?? throw new global::System.ArgumentException("No serializer for type `DateTime` found.");
_intParser = serializerResolver.GetLeafValueParser<global::System.Int32, global::System.Int32>("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
}
public global::StrawberryShake.IOperationResult<IFindPlayersResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
{
(IFindPlayersResult Result, FindPlayersResultInfo Info)? data = null;
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
if (response.Exception is null)
{
try
{
if (response.Body != null)
{
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
data = BuildData(dataElement);
}
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
{
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
}
}
}
catch (global::System.Exception ex)
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
}
else
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
return new global::StrawberryShake.OperationResult<IFindPlayersResult>(data?.Result, data?.Info, _resultDataFactory, errors);
}
private (IFindPlayersResult, FindPlayersResultInfo) BuildData(global::System.Text.Json.JsonElement obj)
{
var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
_entityStore.Update(session =>
{
snapshot = session.CurrentSnapshot;
});
var resultInfo = new FindPlayersResultInfo(DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "players")), entityIds, snapshot.Version);
return (_resultDataFactory.Create(resultInfo), resultInfo);
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var accountsSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData>();
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
{
accountsSearchResponseItems.Add(DeserializeNonNullableIFindPlayers_Players(child));
}
return accountsSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData DeserializeNonNullableIFindPlayers_Players(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var typename = obj.Value.GetProperty("__typename").GetString();
if (typename?.Equals("AccountsSearchResponseItem", global::System.StringComparison.Ordinal) ?? false)
{
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData(typename, accountId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountId")), nickname: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "nickname")), clanTag: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clanTag")), lastBattle: DeserializeNonNullableDateTimeOffset(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "lastBattle")), battlesCount: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "battlesCount")), winRate: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "winRate")));
}
throw new global::System.NotSupportedException();
}
private global::System.Int64 DeserializeNonNullableInt64(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _longParser.Parse(obj.Value.GetInt64()!);
}
private global::System.String? DeserializeString(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
return _stringParser.Parse(obj.Value.GetString()!);
}
private global::System.DateTimeOffset DeserializeNonNullableDateTimeOffset(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _dateTimeParser.Parse(obj.Value.GetString()!);
}
private global::System.Int32 DeserializeNonNullableInt32(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _intParser.Parse(obj.Value.GetInt32()!);
}
}
}
@@ -0,0 +1,67 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindPlayersResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public FindPlayersResultFactory(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.IFindPlayersResult);
public FindPlayersResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is FindPlayersResultInfo info)
{
return new FindPlayersResult(MapNonNullableIFindPlayers_PlayersNonNullableArray(info.Players, snapshot));
}
throw new global::System.ArgumentException("FindPlayersResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players> MapNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
throw new global::System.ArgumentNullException();
}
var accountsSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players>();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData child in list)
{
accountsSearchResponseItems.Add(MapNonNullableIFindPlayers_Players(child, snapshot));
}
return accountsSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players MapNonNullableIFindPlayers_Players(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IFindPlayers_Players returnValue = default !;
if (data.__typename.Equals("AccountsSearchResponseItem", global::System.StringComparison.Ordinal))
{
returnValue = new FindPlayers_Players_AccountsSearchResponseItem(data.AccountId ?? throw new global::System.ArgumentNullException(), data.Nickname, data.ClanTag, data.LastBattle ?? throw new global::System.ArgumentNullException(), data.BattlesCount ?? throw new global::System.ArgumentNullException(), data.WinRate ?? 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);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersResultInfo : global::StrawberryShake.IOperationResultDataInfo
{
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
private readonly global::System.UInt64 _version;
public FindPlayersResultInfo(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> players, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
{
Players = players;
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
_version = version;
}
/// <summary>
/// Finds Wargaming accounts by nick
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> Players { get; }
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
public global::System.UInt64 Version => _version;
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
{
return new FindPlayersResultInfo(Players, _entityIds, version);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.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
{
_ => throw new global::System.NotSupportedException()}
;
}
public global::System.String Format(global::StrawberryShake.EntityId entityId)
{
return entityId.Name switch
{
_ => throw new global::System.NotSupportedException()}
;
}
}
}
@@ -0,0 +1,13 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class WotBlitzStatisticsProClientStoreAccessor : global::StrawberryShake.StoreAccessor
{
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
{
}
}
}