From 798a9d0e432e769141f935a43c7981b9ef2dae91 Mon Sep 17 00:00:00 2001 From: Mikhail Shabanov Date: Fri, 14 May 2021 11:37:45 +0200 Subject: [PATCH] feat: Strawberry Shake first query --- WotBlitzStatisticsPro.Blazor/.graphqlrc.json | 2 +- .../FindAccounts.graphql | 19 + ...litzStatisticsProClient.StrawberryShake.cs | 1042 +++++++++++++++++ .../Pages/SearchDialogTypeBase.cs | 26 +- WotBlitzStatisticsPro.Blazor/Program.cs | 7 + .../WotBlitzStatisticsPro.Blazor.csproj | 6 +- WotBlitzStatisticsPro.Blazor/_Imports.razor | 2 + 7 files changed, 1095 insertions(+), 9 deletions(-) create mode 100644 WotBlitzStatisticsPro.Blazor/FindAccounts.graphql create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs diff --git a/WotBlitzStatisticsPro.Blazor/.graphqlrc.json b/WotBlitzStatisticsPro.Blazor/.graphqlrc.json index 5c30e57..97e15a6 100644 --- a/WotBlitzStatisticsPro.Blazor/.graphqlrc.json +++ b/WotBlitzStatisticsPro.Blazor/.graphqlrc.json @@ -4,7 +4,7 @@ "extensions": { "strawberryShake": { "name": "WotBlitzStatisticsProClient", - "namespace": "WotBlitzStatisticsPro.Blazor", + "namespace": "WotBlitzStatisticsPro.Blazor.GraphQl", "url": "https://localhost:5001/graphql/", "dependencyInjection": true, "strictSchemaValidation": true, diff --git a/WotBlitzStatisticsPro.Blazor/FindAccounts.graphql b/WotBlitzStatisticsPro.Blazor/FindAccounts.graphql new file mode 100644 index 0000000..67ac577 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/FindAccounts.graphql @@ -0,0 +1,19 @@ +query findAccounts( + $accountNick: String!, + $realmType: RealmType!, + $language: RequestLanguage!) { + findAccounts( + accountNick: $accountNick, + realmType: $realmType, + language: $language) { + accountsCount + accounts { + accountId + nickname + clanTag + lastBattle + battlesCount + winRate + } + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..3a5157e --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,1042 @@ +// +#nullable enable + +namespace Microsoft.Extensions.DependencyInjection +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public static partial class WotBlitzStatisticsProClientServiceCollectionExtensions + { + public static global::StrawberryShake.IClientBuilder AddWotBlitzStatisticsProClient(this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly) + { + var serviceCollection = new global::Microsoft.Extensions.DependencyInjection.ServiceCollection(); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => + { + ConfigureClientDefault(sp, serviceCollection, strategy); + return new ClientServiceProvider(global::Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(serviceCollection)); + }); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientStoreAccessor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + return new global::StrawberryShake.ClientBuilder("WotBlitzStatisticsProClient", services, serviceCollection); + } + + private static global::Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureClientDefault(global::System.IServiceProvider parentServices, global::Microsoft.Extensions.DependencyInjection.ServiceCollection services, global::StrawberryShake.ExecutionStrategy strategy = global::StrawberryShake.ExecutionStrategy.NetworkOnly) + { + global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton(services, sp => new global::StrawberryShake.OperationStore(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => + { + var clientFactory = global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(parentServices); + return new global::StrawberryShake.Transport.Http.HttpConnection(() => clientFactory.CreateClient("WotBlitzStatisticsProClient")); + }); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::StrawberryShake.Serialization.SerializerResolver(global::System.Linq.Enumerable.Concat(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(parentServices), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindAccountsResultFactory>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindAccountsBuilder>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + return services; + } + + private class ClientServiceProvider : System.IServiceProvider, System.IDisposable + { + private readonly System.IServiceProvider _provider; + public ClientServiceProvider(System.IServiceProvider provider) + { + _provider = provider; + } + + public object? GetService(System.Type serviceType) + { + return _provider.GetService(serviceType); + } + + public void Dispose() + { + if (_provider is System.IDisposable d) + { + d.Dispose(); + } + } + } + } +} + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsResult : global::System.IEquatable, IFindAccountsResult + { + public FindAccountsResult(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccounts_FindAccounts findAccounts) + { + FindAccounts = findAccounts; + } + + /// + /// Finds Wargaming accounts by nick + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccounts_FindAccounts FindAccounts { get; } + + public virtual global::System.Boolean Equals(FindAccountsResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (FindAccounts.Equals(other.FindAccounts)); + } + + public override global::System.Boolean Equals(global::System.Object? obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != GetType()) + { + return false; + } + + return Equals((FindAccountsResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * FindAccounts.GetHashCode(); + return hash; + } + } + } + + /// + /// Response contains a list of found accounts + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccounts_FindAccounts_AccountsSearchResponse : global::System.IEquatable, IFindAccounts_FindAccounts_AccountsSearchResponse + { + public FindAccounts_FindAccounts_AccountsSearchResponse(global::System.Int32 accountsCount, global::System.Collections.Generic.IReadOnlyList? accounts) + { + AccountsCount = accountsCount; + Accounts = accounts; + } + + /// + /// Count of found accounts + /// + public global::System.Int32 AccountsCount { get; } + + /// + /// Found accounts list + /// + public global::System.Collections.Generic.IReadOnlyList? Accounts { get; } + + public virtual global::System.Boolean Equals(FindAccounts_FindAccounts_AccountsSearchResponse? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (AccountsCount == other.AccountsCount) && global::StrawberryShake.Helper.ComparisonHelper.SequenceEqual(Accounts, other.Accounts); + } + + public override global::System.Boolean Equals(global::System.Object? obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != GetType()) + { + return false; + } + + return Equals((FindAccounts_FindAccounts_AccountsSearchResponse)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * AccountsCount.GetHashCode(); + if (Accounts != null) + { + foreach (var Accounts_elm in Accounts) + { + hash ^= 397 * Accounts_elm.GetHashCode(); + } + } + + return hash; + } + } + } + + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem : global::System.IEquatable, IFindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem + { + public FindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem(global::System.Int64 accountId, global::System.String? nickname, global::System.String? clanTag, global::System.DateTimeOffset lastBattle, global::System.Int64 battlesCount, global::System.Int32 winRate) + { + AccountId = accountId; + Nickname = nickname; + ClanTag = clanTag; + LastBattle = lastBattle; + BattlesCount = battlesCount; + WinRate = winRate; + } + + /// + /// Player accountId + /// + public global::System.Int64 AccountId { get; } + + /// + /// Player nick + /// + public global::System.String? Nickname { get; } + + /// + /// Clan tag. Null if player doesn't have clan membership + /// + public global::System.String? ClanTag { get; } + + /// + /// Last battle time + /// + public global::System.DateTimeOffset LastBattle { get; } + + /// + /// Player's battles count + /// + public global::System.Int64 BattlesCount { get; } + + /// + /// Win rate from 0 to 100 + /// + public global::System.Int32 WinRate { get; } + + public virtual global::System.Boolean Equals(FindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (AccountId == other.AccountId) && ((Nickname is null && other.Nickname is null) || Nickname != null && Nickname.Equals(other.Nickname)) && ((ClanTag is null && other.ClanTag is null) || ClanTag != null && ClanTag.Equals(other.ClanTag)) && LastBattle.Equals(other.LastBattle) && BattlesCount == other.BattlesCount && WinRate == other.WinRate; + } + + public override global::System.Boolean Equals(global::System.Object? obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != GetType()) + { + return false; + } + + return Equals((FindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * AccountId.GetHashCode(); + if (Nickname != null) + { + hash ^= 397 * Nickname.GetHashCode(); + } + + if (ClanTag != null) + { + hash ^= 397 * ClanTag.GetHashCode(); + } + + hash ^= 397 * LastBattle.GetHashCode(); + hash ^= 397 * BattlesCount.GetHashCode(); + hash ^= 397 * WinRate.GetHashCode(); + return hash; + } + } + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccountsResult + { + /// + /// Finds Wargaming accounts by nick + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccounts_FindAccounts FindAccounts { get; } + } + + /// + /// Response contains a list of found accounts + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccounts_FindAccounts + { + /// + /// Count of found accounts + /// + public global::System.Int32 AccountsCount { get; } + + /// + /// Found accounts list + /// + public global::System.Collections.Generic.IReadOnlyList? Accounts { get; } + } + + /// + /// Response contains a list of found accounts + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccounts_FindAccounts_AccountsSearchResponse : IFindAccounts_FindAccounts + { + } + + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccounts_FindAccounts_Accounts + { + /// + /// Player accountId + /// + public global::System.Int64 AccountId { get; } + + /// + /// Player nick + /// + public global::System.String? Nickname { get; } + + /// + /// Clan tag. Null if player doesn't have clan membership + /// + public global::System.String? ClanTag { get; } + + /// + /// Last battle time + /// + public global::System.DateTimeOffset LastBattle { get; } + + /// + /// Player's battles count + /// + public global::System.Int64 BattlesCount { get; } + + /// + /// Win rate from 0 to 100 + /// + public global::System.Int32 WinRate { get; } + } + + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccounts_FindAccounts_Accounts_AccountsSearchResponseItem : IFindAccounts_FindAccounts_Accounts + { + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public enum RealmType + { + /// + /// Russian region + /// + Ru, + /// + /// European region + /// + Eu, + /// + /// North America + /// + Na, + /// + /// Asian region + /// + Asia + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class RealmTypeSerializer : global::StrawberryShake.Serialization.IInputValueFormatter, global::StrawberryShake.Serialization.ILeafValueParser + { + public global::System.String TypeName => "RealmType"; + public RealmType Parse(global::System.String serializedValue) + { + return serializedValue switch + { + "RU" => RealmType.Ru, "EU" => RealmType.Eu, "NA" => RealmType.Na, "ASIA" => RealmType.Asia, _ => throw new global::StrawberryShake.GraphQLClientException()} + + ; + } + + public global::System.Object Format(global::System.Object? runtimeValue) + { + return runtimeValue switch + { + RealmType.Ru => "RU", RealmType.Eu => "EU", RealmType.Na => "NA", RealmType.Asia => "ASIA", _ => throw new global::StrawberryShake.GraphQLClientException()} + + ; + } + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public enum RequestLanguage + { + /// + /// Русский + /// + Ru, + /// + /// English + /// + En, + /// + /// Deutsch + /// + De + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class RequestLanguageSerializer : global::StrawberryShake.Serialization.IInputValueFormatter, global::StrawberryShake.Serialization.ILeafValueParser + { + public global::System.String TypeName => "RequestLanguage"; + public RequestLanguage Parse(global::System.String serializedValue) + { + return serializedValue switch + { + "RU" => RequestLanguage.Ru, "EN" => RequestLanguage.En, "DE" => RequestLanguage.De, _ => throw new global::StrawberryShake.GraphQLClientException()} + + ; + } + + public global::System.Object Format(global::System.Object? runtimeValue) + { + return runtimeValue switch + { + RequestLanguage.Ru => "RU", RequestLanguage.En => "EN", RequestLanguage.De => "DE", _ => throw new global::StrawberryShake.GraphQLClientException()} + + ; + } + } + + /// + /// Represents the operation service of the FindAccounts GraphQL operation + /// + /// query FindAccounts($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// findAccounts(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountsCount + /// accounts { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsQueryDocument : global::StrawberryShake.IDocument + { + private FindAccountsQueryDocument() + { + } + + public static FindAccountsQueryDocument Instance { get; } = new FindAccountsQueryDocument(); + public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query; + public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x28, 0x24, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x69, 0x63, 0x6b, 0x3a, 0x20, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x21, 0x2c, 0x20, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x21, 0x2c, 0x20, 0x24, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a, 0x20, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x21, 0x29, 0x20, 0x7b, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x28, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x69, 0x63, 0x6b, 0x3a, 0x20, 0x24, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x69, 0x63, 0x6b, 0x2c, 0x20, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x3a, 0x20, 0x24, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x29, 0x20, 0x7b, 0x20, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x20, 0x7b, 0x20, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x20, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x63, 0x6c, 0x61, 0x6e, 0x54, 0x61, 0x67, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x6e, 0x52, 0x61, 0x74, 0x65, 0x20, 0x7d, 0x20, 0x7d, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "16176c723580b497e58132294922a157"); + public override global::System.String ToString() + { +#if NETSTANDARD2_0 + return global::System.Text.Encoding.UTF8.GetString(Body.ToArray()); +#else + return global::System.Text.Encoding.UTF8.GetString(Body); +#endif + } + } + + /// + /// Represents the operation service of the FindAccounts GraphQL operation + /// + /// query FindAccounts($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// findAccounts(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountsCount + /// accounts { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccountsQuery + { + private readonly global::StrawberryShake.IOperationExecutor _operationExecutor; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _stringFormatter; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _realmTypeFormatter; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _requestLanguageFormatter; + public FindAccountsQuery(global::StrawberryShake.IOperationExecutor operationExecutor, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor)); + _stringFormatter = serializerResolver.GetInputValueFormatter("String"); + _realmTypeFormatter = serializerResolver.GetInputValueFormatter("RealmType"); + _requestLanguageFormatter = serializerResolver.GetInputValueFormatter("RequestLanguage"); + } + + global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IFindAccountsResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(accountNick, realmType, language); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(accountNick, realmType, language); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language) + { + var variables = new global::System.Collections.Generic.Dictionary(); + variables.Add("accountNick", FormatAccountNick(accountNick)); + variables.Add("realmType", FormatRealmType(realmType)); + variables.Add("language", FormatLanguage(language)); + return CreateRequest(variables); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return new global::StrawberryShake.OperationRequest(id: FindAccountsQueryDocument.Instance.Hash.Value, name: "FindAccounts", document: FindAccountsQueryDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default, variables: variables); + } + + private global::System.Object? FormatAccountNick(global::System.String value) + { + if (value is null) + { + throw new global::System.ArgumentNullException(nameof(value)); + } + + return _stringFormatter.Format(value); + } + + private global::System.Object? FormatRealmType(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType value) + { + return _realmTypeFormatter.Format(value); + } + + private global::System.Object? FormatLanguage(global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage value) + { + return _requestLanguageFormatter.Format(value); + } + + global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return CreateRequest(variables!); + } + } + + /// + /// Represents the operation service of the FindAccounts GraphQL operation + /// + /// query FindAccounts($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// findAccounts(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountsCount + /// accounts { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindAccountsQuery : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::System.Threading.CancellationToken cancellationToken = default); + global::System.IObservable> Watch(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null); + } + + /// + /// Represents the WotBlitzStatisticsProClient GraphQL client + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WotBlitzStatisticsProClient : global::WotBlitzStatisticsPro.Blazor.GraphQl.IWotBlitzStatisticsProClient + { + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccountsQuery _findAccounts; + public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccountsQuery findAccounts) + { + _findAccounts = findAccounts ?? throw new global::System.ArgumentNullException(nameof(findAccounts)); + } + + public static global::System.String ClientName => "WotBlitzStatisticsProClient"; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccountsQuery FindAccounts => _findAccounts; + } + + /// + /// Represents the WotBlitzStatisticsProClient GraphQL client + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWotBlitzStatisticsProClient + { + global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccountsQuery FindAccounts { get; } + } +} + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + public FindAccountsResultFactory(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.IFindAccountsResult); + public FindAccountsResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null) + { + if (snapshot is null) + { + snapshot = _entityStore.CurrentSnapshot; + } + + if (dataInfo is FindAccountsResultInfo info) + { + return new FindAccountsResult(MapNonNullableIFindAccounts_FindAccounts(info.FindAccounts, snapshot)); + } + + throw new global::System.ArgumentException("FindAccountsResultInfo expected."); + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccounts_FindAccounts MapNonNullableIFindAccounts_FindAccounts(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseData data, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + IFindAccounts_FindAccounts returnValue = default !; + if (data.__typename.Equals("AccountsSearchResponse", global::System.StringComparison.Ordinal)) + { + returnValue = new FindAccounts_FindAccounts_AccountsSearchResponse(data.AccountsCount ?? throw new global::System.ArgumentNullException(), MapIFindAccounts_FindAccounts_AccountsNonNullableArray(data.Accounts, snapshot)); + } + else + { + throw new global::System.NotSupportedException(); + } + + return returnValue; + } + + private global::System.Collections.Generic.IReadOnlyList? MapIFindAccounts_FindAccounts_AccountsNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + if (list is null) + { + return null; + } + + var accountsSearchResponseItems = new global::System.Collections.Generic.List(); + foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData child in list) + { + accountsSearchResponseItems.Add(MapNonNullableIFindAccounts_FindAccounts_Accounts(child, snapshot)); + } + + return accountsSearchResponseItems; + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindAccounts_FindAccounts_Accounts MapNonNullableIFindAccounts_FindAccounts_Accounts(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + IFindAccounts_FindAccounts_Accounts returnValue = default !; + if (data.__typename.Equals("AccountsSearchResponseItem", global::System.StringComparison.Ordinal)) + { + returnValue = new FindAccounts_FindAccounts_Accounts_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); + } + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsResultInfo : global::StrawberryShake.IOperationResultDataInfo + { + private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds; + private readonly global::System.UInt64 _version; + public FindAccountsResultInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseData findAccounts, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + FindAccounts = findAccounts; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Finds Wargaming accounts by nick + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseData FindAccounts { get; } + + public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds; + public global::System.UInt64 Version => _version; + public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version) + { + return new FindAccountsResultInfo(FindAccounts, _entityIds, version); + } + } + + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindAccountsBuilder : global::StrawberryShake.IOperationResultBuilder + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer; + private readonly global::StrawberryShake.IOperationResultDataFactory _resultDataFactory; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _realmTypeParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _requestLanguageParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _intParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _longParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _dateTimeParser; + public FindAccountsBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory 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("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found."); + _requestLanguageParser = serializerResolver.GetLeafValueParser("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found."); + _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found."); + _intParser = serializerResolver.GetLeafValueParser("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found."); + _longParser = serializerResolver.GetLeafValueParser("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found."); + _dateTimeParser = serializerResolver.GetLeafValueParser("DateTime") ?? throw new global::System.ArgumentException("No serializer for type `DateTime` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IFindAccountsResult Result, FindAccountsResultInfo Info)? data = null; + global::System.Collections.Generic.IReadOnlyList? 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{{"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{{"body", response.Body?.RootElement.ToString()}})}; + } + + return new global::StrawberryShake.OperationResult(data?.Result, data?.Info, _resultDataFactory, errors); + } + + private (IFindAccountsResult, FindAccountsResultInfo) BuildData(global::System.Text.Json.JsonElement obj) + { + var entityIds = new global::System.Collections.Generic.HashSet(); + global::StrawberryShake.IEntityStoreSnapshot snapshot = default !; + _entityStore.Update(session => + { + snapshot = session.CurrentSnapshot; + }); + var resultInfo = new FindAccountsResultInfo(DeserializeNonNullableIFindAccounts_FindAccounts(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "findAccounts")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseData DeserializeNonNullableIFindAccounts_FindAccounts(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + var typename = obj.Value.GetProperty("__typename").GetString(); + if (typename?.Equals("AccountsSearchResponse", global::System.StringComparison.Ordinal) ?? false) + { + return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseData(typename, accountsCount: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountsCount")), accounts: DeserializeIFindAccounts_FindAccounts_AccountsNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accounts"))); + } + + throw new global::System.NotSupportedException(); + } + + 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.Collections.Generic.IReadOnlyList? DeserializeIFindAccounts_FindAccounts_AccountsNonNullableArray(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + return null; + } + + var accountsSearchResponseItems = new global::System.Collections.Generic.List(); + foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray()) + { + accountsSearchResponseItems.Add(DeserializeNonNullableIFindAccounts_FindAccounts_Accounts(child)); + } + + return accountsSearchResponseItems; + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData DeserializeNonNullableIFindAccounts_FindAccounts_Accounts(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()!); + } + } + + ///Response contains a list of found accounts + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class AccountsSearchResponseData + { + public AccountsSearchResponseData(global::System.String __typename, global::System.Int32? accountsCount = default !, global::System.Collections.Generic.IReadOnlyList? accounts = default !) + { + this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename)); + AccountsCount = accountsCount; + Accounts = accounts; + } + + public global::System.String __typename { get; } + + ///Count of found accounts + public global::System.Int32? AccountsCount { get; } + + ///Found accounts list + public global::System.Collections.Generic.IReadOnlyList? Accounts { get; } + } + + ///Account search result item + [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; } + + ///Player accountId + public global::System.Int64? AccountId { get; } + + ///Player nick + public global::System.String? Nickname { get; } + + ///Clan tag. Null if player doesn't have clan membership + public global::System.String? ClanTag { get; } + + ///Last battle time + public global::System.DateTimeOffset? LastBattle { get; } + + ///Player's battles count + public global::System.Int64? BattlesCount { get; } + + ///Win rate from 0 to 100 + public global::System.Int32? WinRate { get; } + } + + [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()} + + ; + } + } + + [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 requestFactories, global::System.Collections.Generic.IEnumerable resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories) + { + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs index b4d6fc7..d24c7a4 100644 --- a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs +++ b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs @@ -4,6 +4,7 @@ using MediatR; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Localization; using Radzen; +using WotBlitzStatisticsPro.Blazor.GraphQl; using WotBlitzStatisticsPro.Blazor.Messages; using WotBlitzStatisticsPro.Blazor.Model; @@ -20,6 +21,9 @@ namespace WotBlitzStatisticsPro.Blazor.Pages [Inject] public IStringLocalizer Localizer { get; set; } + [Inject] + public WotBlitzStatisticsProClient WotBlitzStatisticsProClient { get; set; } + [Parameter] public DialogType DialogType { get; set; } @@ -39,15 +43,23 @@ namespace WotBlitzStatisticsPro.Blazor.Pages FilteredList.Clear(); await InvokeAsync(StateHasChanged); - // ToDo: Call GraphQL Backend CurrentRealmType + value - await Task.Delay(1000); - for (int i = 0; i < 15; i++) + // ToDo: Add busy cursor + + // ToDo: Move this call to a service + var accounts = + await WotBlitzStatisticsProClient.FindAccounts.ExecuteAsync(value, RealmType.Ru, RequestLanguage.En); + + if (accounts?.Data?.FindAccounts?.Accounts != null) { - FilteredList.Add(new SearchItem(i, $"Item number {i}")); + + foreach (var account in accounts.Data.FindAccounts.Accounts) + { + FilteredList.Add(new SearchItem(account.AccountId, $"{account.Nickname} [{account.ClanTag}] | {account.WinRate}%")); + + } + + await InvokeAsync(StateHasChanged); } - - await InvokeAsync(StateHasChanged); - } public async Task OnOkButtonClick() diff --git a/WotBlitzStatisticsPro.Blazor/Program.cs b/WotBlitzStatisticsPro.Blazor/Program.cs index 00948f2..1354d21 100644 --- a/WotBlitzStatisticsPro.Blazor/Program.cs +++ b/WotBlitzStatisticsPro.Blazor/Program.cs @@ -30,6 +30,13 @@ namespace WotBlitzStatisticsPro.Blazor builder.Services.AddSingleton(); builder.Services.AddScoped(); + // ToDo: Find out URL + // StrawberryShake GraphQL Client + builder.Services + .AddWotBlitzStatisticsProClient() + .ConfigureHttpClient(client => client.BaseAddress = new Uri($"https://localhost:5001/graphql/")); + + var host = builder.Build(); // Reading Current Culture from LocalStorage var localStorageService = host.Services.GetRequiredService(); diff --git a/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj b/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj index e44c58a..925e99c 100644 --- a/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj +++ b/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj @@ -1,4 +1,4 @@ - + net5.0 @@ -6,6 +6,10 @@ true + + + + diff --git a/WotBlitzStatisticsPro.Blazor/_Imports.razor b/WotBlitzStatisticsPro.Blazor/_Imports.razor index e1a3ea1..6f465ad 100644 --- a/WotBlitzStatisticsPro.Blazor/_Imports.razor +++ b/WotBlitzStatisticsPro.Blazor/_Imports.razor @@ -11,3 +11,5 @@ @using WotBlitzStatisticsPro.Blazor.Shared @using Radzen @using Radzen.Blazor +@using StrawberryShake +@using WotBlitzStatisticsPro.Blazor.GraphQl \ No newline at end of file