From 4b5b12e87d5dda03c09d21ff2864d3ad24133581 Mon Sep 17 00:00:00 2001 From: Mikhail Shabanov Date: Sat, 15 May 2021 17:36:35 +0200 Subject: [PATCH] Feat: Restuctured GraphQL Queries and added Backend call service into client. And regerated GraphQL client classes --- WotBlitzStatisticsPro.Blazor/.graphqlrc.json | 2 +- ...litzStatisticsProClient.StrawberryShake.cs | 94 ++ ...litzStatisticsProClient.StrawberryShake.cs | 88 ++ ...litzStatisticsProClient.StrawberryShake.cs | 41 + ...litzStatisticsProClient.StrawberryShake.cs | 76 ++ ...litzStatisticsProClient.StrawberryShake.cs | 108 ++ ...litzStatisticsProClient.StrawberryShake.cs | 89 ++ ...litzStatisticsProClient.StrawberryShake.cs | 42 + ...litzStatisticsProClient.StrawberryShake.cs | 73 ++ ...litzStatisticsProClient.StrawberryShake.cs | 115 ++ ...litzStatisticsProClient.StrawberryShake.cs | 27 + ...litzStatisticsProClient.StrawberryShake.cs | 14 + ...litzStatisticsProClient.StrawberryShake.cs | 37 + ...litzStatisticsProClient.StrawberryShake.cs | 13 + ...litzStatisticsProClient.StrawberryShake.cs | 28 + ...litzStatisticsProClient.StrawberryShake.cs | 14 + ...litzStatisticsProClient.StrawberryShake.cs | 42 + ...litzStatisticsProClient.StrawberryShake.cs | 13 + ...litzStatisticsProClient.StrawberryShake.cs | 16 + ...litzStatisticsProClient.StrawberryShake.cs | 26 + ...litzStatisticsProClient.StrawberryShake.cs | 22 + ...litzStatisticsProClient.StrawberryShake.cs | 28 + ...litzStatisticsProClient.StrawberryShake.cs | 28 + ...litzStatisticsProClient.StrawberryShake.cs | 41 + ...litzStatisticsProClient.StrawberryShake.cs | 37 + ...litzStatisticsProClient.StrawberryShake.cs | 137 +++ ...litzStatisticsProClient.StrawberryShake.cs | 67 ++ ...litzStatisticsProClient.StrawberryShake.cs | 30 + ...litzStatisticsProClient.StrawberryShake.cs | 149 +++ ...litzStatisticsProClient.StrawberryShake.cs | 67 ++ ...litzStatisticsProClient.StrawberryShake.cs | 30 + ...litzStatisticsProClient.StrawberryShake.cs | 30 + ...litzStatisticsProClient.StrawberryShake.cs | 13 + ...litzStatisticsProClient.StrawberryShake.cs | 1042 ----------------- ...litzStatisticsProClient.StrawberryShake.cs | 24 + .../Pages/SearchDialogTypeBase.cs | 14 +- WotBlitzStatisticsPro.Blazor/Program.cs | 10 + .../Services/GraphQlBackendMockService.cs | 71 ++ .../Services/GraphQlBackendService.cs | 32 + .../Services/IGraphQlBackendService.cs | 19 + .../WotBlitzStatisticsPro.Blazor.csproj | 3 +- .../graphql/FindClans.graphql | 15 + .../FindPlayers.graphql} | 7 +- .../{ => graphql}/schema.extensions.graphql | 0 .../{ => graphql}/schema.graphql | 20 +- .../Model/AccountsSearchResponse.cs | 19 - .../Model/ClanSearchResponse.cs | 19 - .../ObjectTypes/AccountsSearchObjectType.cs | 38 - .../Properties/launchSettings.json | 44 +- .../Query/WotBlitzStatisticsQuery.cs | 5 +- WotBlitzStatisticsPro.GraphQl/Startup.cs | 2 +- .../IWargamingSearch.cs | 7 +- .../WargamingSearch.cs | 33 +- 53 files changed, 1868 insertions(+), 1193 deletions(-) create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindClansQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/FindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/RealmType.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/RequestLanguage.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/Serialization/RealmTypeSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/Serialization/RequestLanguageSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/AccountsSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/ClanSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindClansBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientEntityIdFactory.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientStoreAccessor.WotBlitzStatisticsProClient.StrawberryShake.cs delete mode 100644 WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendMockService.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs create mode 100644 WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs create mode 100644 WotBlitzStatisticsPro.Blazor/graphql/FindClans.graphql rename WotBlitzStatisticsPro.Blazor/{FindAccounts.graphql => graphql/FindPlayers.graphql} (78%) rename WotBlitzStatisticsPro.Blazor/{ => graphql}/schema.extensions.graphql (100%) rename WotBlitzStatisticsPro.Blazor/{ => graphql}/schema.graphql (94%) delete mode 100644 WotBlitzStatisticsPro.Common/Model/AccountsSearchResponse.cs delete mode 100644 WotBlitzStatisticsPro.Common/Model/ClanSearchResponse.cs delete mode 100644 WotBlitzStatisticsPro.GraphQl/ObjectTypes/AccountsSearchObjectType.cs diff --git a/WotBlitzStatisticsPro.Blazor/.graphqlrc.json b/WotBlitzStatisticsPro.Blazor/.graphqlrc.json index 97e15a6..650e043 100644 --- a/WotBlitzStatisticsPro.Blazor/.graphqlrc.json +++ b/WotBlitzStatisticsPro.Blazor/.graphqlrc.json @@ -9,7 +9,7 @@ "dependencyInjection": true, "strictSchemaValidation": true, "hashAlgorithm": "md5", - "useSingleFile": true, + "useSingleFile": false, "requestStrategy": "Default", "outputDirectoryName": "Generated", "noStore": false, diff --git a/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..2b36665 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,94 @@ +// +#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))); + 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.FindClansResultFactory>(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.FindClansBuilder>(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, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindPlayersResultFactory>(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.FindPlayersBuilder>(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(); + } + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..24ab39e --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,88 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindClans GraphQL operation + /// + /// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// clans(searchString: $searchString, realmType: $realmType, language: $language) { + /// __typename + /// clanId + /// createdAt + /// membersCount + /// name + /// tag + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClansQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery + { + 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 FindClansQuery(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(IFindClansResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String searchString, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(searchString, realmType, language); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::System.String searchString, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(searchString, realmType, language); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.String searchString, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language) + { + var variables = new global::System.Collections.Generic.Dictionary(); + variables.Add("searchString", FormatSearchString(searchString)); + 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: FindClansQueryDocument.Instance.Hash.Value, name: "FindClans", document: FindClansQueryDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default, variables: variables); + } + + private global::System.Object? FormatSearchString(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!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindClansQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindClansQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..f64ee1a --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindClansQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,41 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindClans GraphQL operation + /// + /// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// clans(searchString: $searchString, realmType: $realmType, language: $language) { + /// __typename + /// clanId + /// createdAt + /// membersCount + /// name + /// tag + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClansQueryDocument : global::StrawberryShake.IDocument + { + private FindClansQueryDocument() + { + } + + public static FindClansQueryDocument Instance { get; } = new FindClansQueryDocument(); + 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, 0x43, 0x6c, 0x61, 0x6e, 0x73, 0x28, 0x24, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 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, 0x63, 0x6c, 0x61, 0x6e, 0x73, 0x28, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x3a, 0x20, 0x24, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 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, 0x63, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x20, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x74, 0x61, 0x67, 0x20, 0x7d, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "11fca1eacd03c231507100b687abb039"); + 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 + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..9c9e6af --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,76 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClansResult : global::System.IEquatable, IFindClansResult + { + public FindClansResult(global::System.Collections.Generic.IReadOnlyList? clans) + { + Clans = clans; + } + + /// + /// Finds clans by search string + /// + public global::System.Collections.Generic.IReadOnlyList? Clans { get; } + + public virtual global::System.Boolean Equals(FindClansResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (global::StrawberryShake.Helper.ComparisonHelper.SequenceEqual(Clans, other.Clans)); + } + + 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((FindClansResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + if (Clans != null) + { + foreach (var Clans_elm in Clans) + { + hash ^= 397 * Clans_elm.GetHashCode(); + } + } + + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..c18755a --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,108 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Found clans list item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClans_Clans_ClanSearchResponseItem : global::System.IEquatable, IFindClans_Clans_ClanSearchResponseItem + { + public FindClans_Clans_ClanSearchResponseItem(global::System.Int64 clanId, global::System.Int32 createdAt, global::System.Int32 membersCount, global::System.String? name, global::System.String? tag) + { + ClanId = clanId; + CreatedAt = createdAt; + MembersCount = membersCount; + Name = name; + Tag = tag; + } + + /// + /// Clan Id + /// + public global::System.Int64 ClanId { get; } + + /// + /// Clan created at. (UNIX Epoch time) + /// + public global::System.Int32 CreatedAt { get; } + + /// + /// Clan members count + /// + public global::System.Int32 MembersCount { get; } + + /// + /// Clan Name + /// + public global::System.String? Name { get; } + + /// + /// Clan Tag + /// + public global::System.String? Tag { get; } + + public virtual global::System.Boolean Equals(FindClans_Clans_ClanSearchResponseItem? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (ClanId == other.ClanId) && CreatedAt == other.CreatedAt && MembersCount == other.MembersCount && ((Name is null && other.Name is null) || Name != null && Name.Equals(other.Name)) && ((Tag is null && other.Tag is null) || Tag != null && Tag.Equals(other.Tag)); + } + + 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((FindClans_Clans_ClanSearchResponseItem)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * ClanId.GetHashCode(); + hash ^= 397 * CreatedAt.GetHashCode(); + hash ^= 397 * MembersCount.GetHashCode(); + if (Name != null) + { + hash ^= 397 * Name.GetHashCode(); + } + + if (Tag != null) + { + hash ^= 397 * Tag.GetHashCode(); + } + + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..576f4c4 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,89 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindPlayers GraphQL operation + /// + /// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// players(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayersQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery + { + 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 FindPlayersQuery(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(IFindPlayersResult); + 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: FindPlayersQueryDocument.Instance.Hash.Value, name: "FindPlayers", document: FindPlayersQueryDocument.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!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..88de7d2 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,42 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindPlayers GraphQL operation + /// + /// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// players(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayersQueryDocument : global::StrawberryShake.IDocument + { + private FindPlayersQueryDocument() + { + } + + public static FindPlayersQueryDocument Instance { get; } = new FindPlayersQueryDocument(); + 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, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 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, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 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, 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}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "8939fb5a67dcef3387474f884fdfddb7"); + 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 + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..4accd23 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,73 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayersResult : global::System.IEquatable, IFindPlayersResult + { + public FindPlayersResult(global::System.Collections.Generic.IReadOnlyList players) + { + Players = players; + } + + /// + /// Finds Wargaming accounts by nick + /// + public global::System.Collections.Generic.IReadOnlyList Players { get; } + + public virtual global::System.Boolean Equals(FindPlayersResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (global::StrawberryShake.Helper.ComparisonHelper.SequenceEqual(Players, other.Players)); + } + + 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((FindPlayersResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + foreach (var Players_elm in Players) + { + hash ^= 397 * Players_elm.GetHashCode(); + } + + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/FindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..47fefcd --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/FindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,115 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayers_Players_AccountsSearchResponseItem : global::System.IEquatable, IFindPlayers_Players_AccountsSearchResponseItem + { + public FindPlayers_Players_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(FindPlayers_Players_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((FindPlayers_Players_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; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..632ac63 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindClansQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,27 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindClans GraphQL operation + /// + /// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// clans(searchString: $searchString, realmType: $realmType, language: $language) { + /// __typename + /// clanId + /// createdAt + /// membersCount + /// name + /// tag + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindClansQuery : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String searchString, 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 searchString, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..657eecb --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindClansResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,14 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindClansResult + { + /// + /// Finds clans by search string + /// + public global::System.Collections.Generic.IReadOnlyList? Clans { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..fda3c07 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,37 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Found clans list item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindClans_Clans + { + /// + /// Clan Id + /// + public global::System.Int64 ClanId { get; } + + /// + /// Clan created at. (UNIX Epoch time) + /// + public global::System.Int32 CreatedAt { get; } + + /// + /// Clan members count + /// + public global::System.Int32 MembersCount { get; } + + /// + /// Clan Name + /// + public global::System.String? Name { get; } + + /// + /// Clan Tag + /// + public global::System.String? Tag { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..f39c565 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindClans_Clans_ClanSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,13 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Found clans list item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindClans_Clans_ClanSearchResponseItem : IFindClans_Clans + { + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..a7f0ab7 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,28 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the FindPlayers GraphQL operation + /// + /// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { + /// players(accountNick: $accountNick, realmType: $realmType, language: $language) { + /// __typename + /// accountId + /// nickname + /// clanTag + /// lastBattle + /// battlesCount + /// winRate + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindPlayersQuery : 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); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..890bb14 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,14 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindPlayersResult + { + /// + /// Finds Wargaming accounts by nick + /// + public global::System.Collections.Generic.IReadOnlyList Players { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..531fa21 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,42 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindPlayers_Players + { + /// + /// 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; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..e59b13a --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IFindPlayers_Players_AccountsSearchResponseItem.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,13 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Account search result item + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IFindPlayers_Players_AccountsSearchResponseItem : IFindPlayers_Players + { + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..a84008b --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,16 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the WotBlitzStatisticsProClient GraphQL client + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWotBlitzStatisticsProClient + { + global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery FindClans { get; } + + global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery FindPlayers { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/RealmType.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/RealmType.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..82c3aaa --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/RealmType.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,26 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [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 + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/RequestLanguage.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/RequestLanguage.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..36ac4c2 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/RequestLanguage.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,22 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public enum RequestLanguage + { + /// + /// Русский + /// + Ru, + /// + /// English + /// + En, + /// + /// Deutsch + /// + De + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RealmTypeSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RealmTypeSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..e052ebb --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RealmTypeSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,28 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [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()} + + ; + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RequestLanguageSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RequestLanguageSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..6fd96d8 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/Serialization/RequestLanguageSerializer.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,28 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [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()} + + ; + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/AccountsSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/AccountsSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..9f86518 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/AccountsSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,41 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + ///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; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/ClanSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/ClanSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..3437001 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/ClanSearchResponseItemData.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,37 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + ///Found clans list item + [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; } + + ///Clan Id + public global::System.Int64? ClanId { get; } + + ///Clan created at. (UNIX Epoch time) + public global::System.Int32? CreatedAt { get; } + + ///Clan members count + public global::System.Int32? MembersCount { get; } + + ///Clan Name + public global::System.String? Name { get; } + + ///Clan Tag + public global::System.String? Tag { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..bfcef7a --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,137 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClansBuilder : 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 _longParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _intParser; + public FindClansBuilder(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."); + _longParser = serializerResolver.GetLeafValueParser("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found."); + _intParser = serializerResolver.GetLeafValueParser("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IFindClansResult Result, FindClansResultInfo 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 (IFindClansResult, FindClansResultInfo) 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 FindClansResultInfo(DeserializeIFindClans_ClansNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clans")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::System.Collections.Generic.IReadOnlyList? DeserializeIFindClans_ClansNonNullableArray(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + return null; + } + + var clanSearchResponseItems = new global::System.Collections.Generic.List(); + 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()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..8851806 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindClansResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + 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? MapIFindClans_ClansNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + if (list is null) + { + return null; + } + + var clanSearchResponseItems = new global::System.Collections.Generic.List(); + 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); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..bf39736 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindClansResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,30 @@ +// +#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 _entityIds; + private readonly global::System.UInt64 _version; + public FindClansResultInfo(global::System.Collections.Generic.IReadOnlyList? clans, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + Clans = clans; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Finds clans by search string + /// + public global::System.Collections.Generic.IReadOnlyList? Clans { 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 FindClansResultInfo(Clans, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..022dfa6 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,149 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayersBuilder : 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 _longParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _dateTimeParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _intParser; + public FindPlayersBuilder(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."); + _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."); + _intParser = serializerResolver.GetLeafValueParser("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IFindPlayersResult Result, FindPlayersResultInfo 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 (IFindPlayersResult, FindPlayersResultInfo) 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 FindPlayersResultInfo(DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "players")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::System.Collections.Generic.IReadOnlyList DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + var accountsSearchResponseItems = new global::System.Collections.Generic.List(); + 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()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..a3f7a90 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,67 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class FindPlayersResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + 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 MapNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Collections.Generic.IReadOnlyList? list, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + if (list is null) + { + throw new global::System.ArgumentNullException(); + } + + var accountsSearchResponseItems = new global::System.Collections.Generic.List(); + 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); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..81d94ab --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/FindPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,30 @@ +// +#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 _entityIds; + private readonly global::System.UInt64 _version; + public FindPlayersResultInfo(global::System.Collections.Generic.IReadOnlyList players, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + Players = players; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Finds Wargaming accounts by nick + /// + public global::System.Collections.Generic.IReadOnlyList Players { 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 FindPlayersResultInfo(Players, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientEntityIdFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientEntityIdFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..f699ac4 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientEntityIdFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,30 @@ +// +#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()} + + ; + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientStoreAccessor.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientStoreAccessor.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..54e7917 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WotBlitzStatisticsProClientStoreAccessor.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,13 @@ +// +#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 requestFactories, global::System.Collections.Generic.IEnumerable resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories) + { + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs deleted file mode 100644 index 3a5157e..0000000 --- a/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.StrawberryShake.cs +++ /dev/null @@ -1,1042 +0,0 @@ -// -#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/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..0667976 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,24 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// 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.IFindClansQuery _findClans; + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery _findPlayers; + public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery findClans, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery findPlayers) + { + _findClans = findClans ?? throw new global::System.ArgumentNullException(nameof(findClans)); + _findPlayers = findPlayers ?? throw new global::System.ArgumentNullException(nameof(findPlayers)); + } + + public static global::System.String ClientName => "WotBlitzStatisticsProClient"; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery FindClans => _findClans; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery FindPlayers => _findPlayers; + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs index 8b49ca6..34e5a07 100644 --- a/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs +++ b/WotBlitzStatisticsPro.Blazor/Pages/SearchDialogTypeBase.cs @@ -1,12 +1,15 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading.Tasks; using MediatR; using Microsoft.AspNetCore.Components; using Microsoft.Extensions.Localization; using Radzen; using WotBlitzStatisticsPro.Blazor.GraphQl; +//using WotBlitzStatisticsPro.Blazor.GraphQl; using WotBlitzStatisticsPro.Blazor.Messages; using WotBlitzStatisticsPro.Blazor.Model; +using WotBlitzStatisticsPro.Blazor.Services; namespace WotBlitzStatisticsPro.Blazor.Pages { @@ -22,7 +25,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages public IStringLocalizer Localizer { get; set; } [Inject] - public WotBlitzStatisticsProClient WotBlitzStatisticsProClient { get; set; } + public IGraphQlBackendService GraphQlBackendService { get; set; } [Parameter] public DialogType DialogType { get; set; } @@ -37,6 +40,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages public async Task OnSearchTextChange(string value) { + var env = Environment.GetEnvironmentVariable("USE_GRAPH_QL_MOCK"); if (DialogType == DialogType.FindPlayer && value.Length < 3) { return; @@ -48,12 +52,12 @@ namespace WotBlitzStatisticsPro.Blazor.Pages // ToDo: Move this call to a service var accounts = - await WotBlitzStatisticsProClient.FindAccounts.ExecuteAsync(value, RealmType.Ru, RequestLanguage.En); + await GraphQlBackendService.FindPlayers(value, RealmType.Ru, RequestLanguage.En); - if (accounts?.Data?.FindAccounts?.Accounts != null) + if (accounts != null) { - foreach (var account in accounts.Data.FindAccounts.Accounts) + foreach (var account in accounts) { FilteredList.Add(new SearchItem(account.AccountId, $"{account.Nickname} [{account.ClanTag}] | {account.WinRate}%")); diff --git a/WotBlitzStatisticsPro.Blazor/Program.cs b/WotBlitzStatisticsPro.Blazor/Program.cs index d123bcc..ff8bf77 100644 --- a/WotBlitzStatisticsPro.Blazor/Program.cs +++ b/WotBlitzStatisticsPro.Blazor/Program.cs @@ -36,6 +36,16 @@ namespace WotBlitzStatisticsPro.Blazor .AddWotBlitzStatisticsProClient() .ConfigureHttpClient(client => client.BaseAddress = new Uri($"{builder.HostEnvironment.BaseAddress}graphql/")); + // ToDo: Asp Net hosting environment variables don't work here. I don't know why + //var useMock = Environment.GetEnvironmentVariable("USE_GRAPH_QL_MOCK"); + //if (useMock != null && useMock == "true") + //{ + builder.Services.AddTransient(); + //} + //else + //{ + // builder.Services.AddTransient(); + //} var host = builder.Build(); // Reading Current Culture from LocalStorage diff --git a/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendMockService.cs b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendMockService.cs new file mode 100644 index 0000000..9be81b2 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendMockService.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Bogus; +using Bogus.Extensions; +using WotBlitzStatisticsPro.Blazor.GraphQl; + +namespace WotBlitzStatisticsPro.Blazor.Services +{ + public class GraphQlBackendMockService: IGraphQlBackendService + { + public async Task?> FindPlayers(string accountNick, RealmType realmType, RequestLanguage language) + { + var result = new List(); + + var faker = new Faker(FakerLanguage(language)); + var random = faker.Random.Number(10, 80); + + for (int i = 0; i < random; i++) + { + result.Add(new FindPlayers_Players_AccountsSearchResponseItem( + faker.Random.Long(100000, 999999), + faker.Name.LastName(), + faker.Lorem.Word().OrNull(faker, 0.8f), + faker.Date.Past(), + faker.Random.Number(10, 20000), + faker.Random.Number(30, 90))); + } + + await Task.Delay(1000); + + return result; + } + + public async Task?> FindClans(string clanNameOrTag, RealmType realmType, RequestLanguage language) + { + var result = new List(); + + var faker = new Faker(FakerLanguage(language)); + var random = faker.Random.Number(10, 80); + + for (int i = 0; i < random; i++) + { + result.Add(new FindClans_Clans_ClanSearchResponseItem( + faker.Random.Long(100000, 999999), + Convert.ToInt32((faker.Date.Past() - new DateTime(1970, 1, 1)).TotalMilliseconds), + faker.Random.Number(1, 50), + faker.Lorem.Word(), + faker.Lorem.Letter())); + } + + + await Task.Delay(1000); + + return result; + } + + private string FakerLanguage(RequestLanguage language) + { + switch (language) + { + case RequestLanguage.Ru: + return "ru"; + case RequestLanguage.De: + return "de"; + default: + return "en"; + } + } + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs new file mode 100644 index 0000000..23a6bcb --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using WotBlitzStatisticsPro.Blazor.GraphQl; + +namespace WotBlitzStatisticsPro.Blazor.Services +{ + public class GraphQlBackendService: IGraphQlBackendService + { + private readonly WotBlitzStatisticsProClient _client; + + public GraphQlBackendService(WotBlitzStatisticsProClient client) + { + _client = client; + } + + public async Task?> FindPlayers(string accountNick, RealmType realmType, RequestLanguage language) + { + var accounts = + await _client.FindPlayers.ExecuteAsync(accountNick, RealmType.Ru, RequestLanguage.En); + + return accounts.Data?.Players; + } + + public async Task?> FindClans(string clanNameOrTag, RealmType realmType, RequestLanguage language) + { + var clans = + await _client.FindClans.ExecuteAsync(clanNameOrTag, RealmType.Ru, RequestLanguage.En); + + return clans.Data?.Clans; + } + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs b/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs new file mode 100644 index 0000000..5fbef43 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using WotBlitzStatisticsPro.Blazor.GraphQl; + +namespace WotBlitzStatisticsPro.Blazor.Services +{ + public interface IGraphQlBackendService + { + Task?> FindPlayers( + string accountNick, + RealmType realmType, + RequestLanguage language); + + Task?> FindClans( + string clanNameOrTag, + RealmType realmType, + RequestLanguage language); + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj b/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj index 925e99c..3dab03a 100644 --- a/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj +++ b/WotBlitzStatisticsPro.Blazor/WotBlitzStatisticsPro.Blazor.csproj @@ -7,10 +7,11 @@ - + + diff --git a/WotBlitzStatisticsPro.Blazor/graphql/FindClans.graphql b/WotBlitzStatisticsPro.Blazor/graphql/FindClans.graphql new file mode 100644 index 0000000..713debb --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/graphql/FindClans.graphql @@ -0,0 +1,15 @@ +query findClans ( + $searchString: String!, + $realmType: RealmType!, + $language: RequestLanguage!) { + clans( + searchString: $searchString, + realmType: $realmType, + language: $language) { + clanId + createdAt + membersCount + name + tag + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/FindAccounts.graphql b/WotBlitzStatisticsPro.Blazor/graphql/FindPlayers.graphql similarity index 78% rename from WotBlitzStatisticsPro.Blazor/FindAccounts.graphql rename to WotBlitzStatisticsPro.Blazor/graphql/FindPlayers.graphql index 67ac577..5249a4a 100644 --- a/WotBlitzStatisticsPro.Blazor/FindAccounts.graphql +++ b/WotBlitzStatisticsPro.Blazor/graphql/FindPlayers.graphql @@ -1,19 +1,16 @@ -query findAccounts( +query findPlayers( $accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) { - findAccounts( + players( 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/schema.extensions.graphql b/WotBlitzStatisticsPro.Blazor/graphql/schema.extensions.graphql similarity index 100% rename from WotBlitzStatisticsPro.Blazor/schema.extensions.graphql rename to WotBlitzStatisticsPro.Blazor/graphql/schema.extensions.graphql diff --git a/WotBlitzStatisticsPro.Blazor/schema.graphql b/WotBlitzStatisticsPro.Blazor/graphql/schema.graphql similarity index 94% rename from WotBlitzStatisticsPro.Blazor/schema.graphql rename to WotBlitzStatisticsPro.Blazor/graphql/schema.graphql index 3319655..aa29f1f 100644 --- a/WotBlitzStatisticsPro.Blazor/schema.graphql +++ b/WotBlitzStatisticsPro.Blazor/graphql/schema.graphql @@ -5,9 +5,9 @@ type Query { "Finds Wargaming accounts by nick" - findAccounts("Search string." accountNick: String! "Wargaming Realm." realmType: RealmType "Language for the output data." language: RequestLanguage): AccountsSearchResponse! + players("Search string." accountNick: String! "Wargaming Realm." realmType: RealmType "Language for the output data." language: RequestLanguage): [AccountsSearchResponseItem!]! "Finds clans by search string" - findClans("Search string." searchString: String! "Wargaming Realm." realmType: RealmType "Language for the output data." language: RequestLanguage): ClanSearchResponse! + clans("Search string." searchString: String! "Wargaming Realm." realmType: RealmType "Language for the output data." language: RequestLanguage): [ClanSearchResponseItem!] "Gathers all account information" accountInfo("AccountId" accountId: Long! "Account region" realmType: RealmType "Request language" requestLanguage: RequestLanguage): AccountInfoResponse! "Account statistics history for period since \"startDate\"" @@ -149,14 +149,6 @@ type AccountsSearchResponseItem { lastBattle: DateTime! } -"Response contains a list of found accounts" -type AccountsSearchResponse { - "Count of found accounts" - accountsCount: Int! - "Found accounts list" - accounts: [AccountsSearchResponseItem!] -} - enum ApplyPolicy { BEFORE_RESOLVER AFTER_RESOLVER @@ -365,14 +357,6 @@ type AccountInfoHistoryResponse { statisticsHistory: [StatisticsDifference!] } -"Response with list of found clans" -type ClanSearchResponse { - "Count of clans in the list" - clansCount: Int! - "List of clans" - clans: [ClanSearchResponseItem!] -} - "Found clans list item" type ClanSearchResponseItem { "Clan Id" diff --git a/WotBlitzStatisticsPro.Common/Model/AccountsSearchResponse.cs b/WotBlitzStatisticsPro.Common/Model/AccountsSearchResponse.cs deleted file mode 100644 index 628d1e2..0000000 --- a/WotBlitzStatisticsPro.Common/Model/AccountsSearchResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; - -namespace WotBlitzStatisticsPro.Common.Model -{ - /// - /// Response contains a list of found accounts - /// - public class AccountsSearchResponse - { - /// - /// Count of found accounts - /// - public int AccountsCount { get; set; } - /// - /// Found accounts list - /// - public ICollection? Accounts { get; set; } - } -} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Common/Model/ClanSearchResponse.cs b/WotBlitzStatisticsPro.Common/Model/ClanSearchResponse.cs deleted file mode 100644 index 140b17a..0000000 --- a/WotBlitzStatisticsPro.Common/Model/ClanSearchResponse.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; - -namespace WotBlitzStatisticsPro.Common.Model -{ - /// - /// Response with list of found clans - /// - public class ClanSearchResponse - { - /// - /// Count of clans in the list - /// - public int ClansCount { get; set; } - /// - /// List of clans - /// - public ICollection? Clans { get; set; } - } -} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.GraphQl/ObjectTypes/AccountsSearchObjectType.cs b/WotBlitzStatisticsPro.GraphQl/ObjectTypes/AccountsSearchObjectType.cs deleted file mode 100644 index 4973fe7..0000000 --- a/WotBlitzStatisticsPro.GraphQl/ObjectTypes/AccountsSearchObjectType.cs +++ /dev/null @@ -1,38 +0,0 @@ -using HotChocolate.Types; -using WotBlitzStatisticsPro.Common.Model; - -namespace WotBlitzStatisticsPro.GraphQl.ObjectTypes -{ - public class AccountsSearchObjectType: ObjectType - { - // ToDo: This is just for history. We don't need to paginate this because each page request does the request to API. - // The database driver can optimize this and will request data page by page - - //protected override void Configure(IObjectTypeDescriptor descriptor) - //{ - // descriptor.Field(r => r.Accounts) - // .UsePaging(); - //} - - /* - Paging request example -query($accountSearchNick: String!) { - findAccounts(accountNick: $accountSearchNick) { - accounts(first: 5, after: "eyJfX3RvdGFsQ291bnQiOjc0LCJfX3Bvc2l0aW9uIjo5fQ==") { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - totalCount - nodes { - accountId - nickname - } - } - } -} - */ - } -} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.GraphQl/Properties/launchSettings.json b/WotBlitzStatisticsPro.GraphQl/Properties/launchSettings.json index 7101034..5c7c5d2 100644 --- a/WotBlitzStatisticsPro.GraphQl/Properties/launchSettings.json +++ b/WotBlitzStatisticsPro.GraphQl/Properties/launchSettings.json @@ -1,5 +1,4 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, @@ -8,25 +7,34 @@ "sslPort": 44333 } }, + "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - //"launchUrl": "graphql", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" }, "WotBlitzStatistics.GraphQl": { - "commandName": "Project", - "launchBrowser": true, - //"launchUrl": "graphql", - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" + }, + "WotBlitzStatistics.Mock": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "USE_GRAPH_QL_MOCK": "true" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" } } -} +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.GraphQl/Query/WotBlitzStatisticsQuery.cs b/WotBlitzStatisticsPro.GraphQl/Query/WotBlitzStatisticsQuery.cs index ca2d09b..14eebcb 100644 --- a/WotBlitzStatisticsPro.GraphQl/Query/WotBlitzStatisticsQuery.cs +++ b/WotBlitzStatisticsPro.GraphQl/Query/WotBlitzStatisticsQuery.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using HotChocolate.Types; using WotBlitzStatisticsPro.Common.Model; @@ -29,7 +30,7 @@ namespace WotBlitzStatisticsPro.GraphQl.Query /// Wargaming Realm. /// Language for the output data. /// - public Task FindAccounts( + public Task> Players( string accountNick, RealmType? realmType, RequestLanguage? language) @@ -44,7 +45,7 @@ namespace WotBlitzStatisticsPro.GraphQl.Query /// Wargaming Realm. /// Language for the output data. /// - public Task FindClans( + public Task?> Clans( string searchString, RealmType? realmType, RequestLanguage? language) diff --git a/WotBlitzStatisticsPro.GraphQl/Startup.cs b/WotBlitzStatisticsPro.GraphQl/Startup.cs index 282c86c..ddb038b 100644 --- a/WotBlitzStatisticsPro.GraphQl/Startup.cs +++ b/WotBlitzStatisticsPro.GraphQl/Startup.cs @@ -1,3 +1,4 @@ +using System; using System.Security.Claims; using System.Text; using System.Threading.Tasks; @@ -87,7 +88,6 @@ namespace WotBlitzStatisticsPro.GraphQl .AddType() .AddType() .AddType() - .AddType() .AddEnumType() .AddEnumType() .AddEnumType() diff --git a/WotBlitzStatisticsPro.Logic/IWargamingSearch.cs b/WotBlitzStatisticsPro.Logic/IWargamingSearch.cs index 64a88f5..cf5c341 100644 --- a/WotBlitzStatisticsPro.Logic/IWargamingSearch.cs +++ b/WotBlitzStatisticsPro.Logic/IWargamingSearch.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using WotBlitzStatisticsPro.Common.Model; using WotBlitzStatisticsPro.WgApiClient.Model; @@ -6,12 +7,12 @@ namespace WotBlitzStatisticsPro.Logic { public interface IWargamingSearch { - Task FindAccounts( + Task?> FindAccounts( string accountNick, RealmType realmType, RequestLanguage language); - Task FindClans( + Task?> FindClans( string searchString, RealmType realmType, RequestLanguage language); diff --git a/WotBlitzStatisticsPro.Logic/WargamingSearch.cs b/WotBlitzStatisticsPro.Logic/WargamingSearch.cs index 5a02c7a..ab129e4 100644 --- a/WotBlitzStatisticsPro.Logic/WargamingSearch.cs +++ b/WotBlitzStatisticsPro.Logic/WargamingSearch.cs @@ -19,7 +19,7 @@ namespace WotBlitzStatisticsPro.Logic _mapper = mapper; } - public async Task FindAccounts( + public async Task?> FindAccounts( string accountNick, RealmType realmType, RequestLanguage language) @@ -28,21 +28,17 @@ namespace WotBlitzStatisticsPro.Logic if (searchResponse == null) { - return new AccountsSearchResponse(); + return null; } - var response = new AccountsSearchResponse - { - AccountsCount = searchResponse.Count, - Accounts = _mapper.Map, List>(searchResponse) - }; + var accounts = _mapper.Map, List>(searchResponse); if (searchResponse.Count > 100) { - return response; + return accounts; } - var accountIds = response.Accounts.Select(a => a.AccountId).ToArray(); + var accountIds = accounts.Select(a => a.AccountId).ToArray(); var shortAccountInfos = await _wargamingApiClient.GetShortPlayerAccountsInfo(accountIds, realmType, language); @@ -55,9 +51,9 @@ namespace WotBlitzStatisticsPro.Logic realmType, language); } - for (int i = 0; i < response.Accounts.Count; i++) + for (int i = 0; i < accounts.Count; i++) { - var accountResponse = response.Accounts.ToArray()[i]; + var accountResponse = accounts.ToArray()[i]; var shortAccountInfo = shortAccountInfos?.FirstOrDefault(a => a.AccountId == accountResponse.AccountId); if (shortAccountInfo != null) { @@ -77,13 +73,12 @@ namespace WotBlitzStatisticsPro.Logic } // Filter WOT Blitz accounts - response.Accounts = response.Accounts.Where(a => a.BattlesCount > 0).ToList(); - response.AccountsCount = response.Accounts.Count; + accounts = accounts.Where(a => a.BattlesCount > 0).ToList(); - return response; + return accounts; } - public async Task FindClans( + public async Task?> FindClans( string searchString, RealmType realmType, RequestLanguage language) @@ -92,14 +87,10 @@ namespace WotBlitzStatisticsPro.Logic if (response == null) { - return new ClanSearchResponse(); + return null; } - return new ClanSearchResponse - { - ClansCount = response.Count, - Clans = _mapper.Map, List>(response) - }; + return _mapper.Map, List>(response); } } } \ No newline at end of file