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

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

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
"dependencyInjection": true,
"strictSchemaValidation": true,
"hashAlgorithm": "md5",
"useSingleFile": true,
"useSingleFile": false,
"requestStrategy": "Default",
"outputDirectoryName": "Generated",
"noStore": false,
@@ -0,0 +1,94 @@
// <auto-generated/>
#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<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientStoreAccessor> 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::StrawberryShake.IOperationStore>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityStore>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityIdSerializer>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory>>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory>>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp))));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindClansQuery>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindPlayersQuery>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWotBlitzStatisticsProClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
return new global::StrawberryShake.ClientBuilder<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientStoreAccessor>("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<global::StrawberryShake.IEntityStore, global::StrawberryShake.EntityStore>(services);
global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton<global::StrawberryShake.IOperationStore>(services, sp => new global::StrawberryShake.OperationStore(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IEntityStore>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Transport.Http.IHttpConnection>(services, sp =>
{
var clientFactory = global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Net.Http.IHttpClientFactory>(parentServices);
return new global::StrawberryShake.Transport.Http.HttpConnection(() => clientFactory.CreateClient("WotBlitzStatisticsProClient"));
});
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmTypeSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguageSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.StringSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.BooleanSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ByteSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ShortSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.IntSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.LongSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.FloatSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DecimalSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.UrlSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.UuidSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.IdSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DateTimeSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.DateSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.ByteArraySerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializer, global::StrawberryShake.Serialization.TimeSpanSerializer>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.Serialization.ISerializerResolver>(services, sp => new global::StrawberryShake.Serialization.SerializerResolver(global::System.Linq.Enumerable.Concat(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.Serialization.ISerializer>>(parentServices), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::System.Collections.Generic.IEnumerable<global::StrawberryShake.Serialization.ISerializer>>(sp))));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindClansResultFactory>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationRequestFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindClansBuilder>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationExecutor<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>>(services, sp => new global::StrawberryShake.OperationExecutor<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.Http.IHttpConnection>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(sp), strategy));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindClansQuery>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindClansQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindPlayersResultFactory>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationRequestFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.FindPlayersBuilder>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationExecutor<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>>(services, sp => new global::StrawberryShake.OperationExecutor<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.Http.IHttpConnection>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(sp), strategy));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindPlayersQuery>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindPlayersQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IEntityIdSerializer, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientEntityIdFactory>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWotBlitzStatisticsProClient>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(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();
}
}
}
}
}
@@ -0,0 +1,88 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindClans GraphQL operation
/// <code>
/// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// clans(searchString: $searchString, realmType: $realmType, language: $language) {
/// __typename
/// clanId
/// createdAt
/// membersCount
/// name
/// tag
/// }
/// }
/// </code>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery
{
private readonly global::StrawberryShake.IOperationExecutor<IFindClansResult> _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<IFindClansResult> 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<global::StrawberryShake.IOperationResult<IFindClansResult>> 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<global::StrawberryShake.IOperationResult<IFindClansResult>> 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<global::System.String, global::System.Object?>();
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<global::System.String, global::System.Object?>? 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<global::System.String, global::System.Object?>? variables)
{
return CreateRequest(variables!);
}
}
}
@@ -0,0 +1,41 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindClans GraphQL operation
/// <code>
/// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// clans(searchString: $searchString, realmType: $realmType, language: $language) {
/// __typename
/// clanId
/// createdAt
/// membersCount
/// name
/// tag
/// }
/// }
/// </code>
/// </summary>
[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<global::System.Byte> 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
}
}
}
@@ -0,0 +1,76 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansResult : global::System.IEquatable<FindClansResult>, IFindClansResult
{
public FindClansResult(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>? clans)
{
Clans = clans;
}
/// <summary>
/// Finds clans by search string
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>? 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;
}
}
}
}
@@ -0,0 +1,108 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Found clans list item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClans_Clans_ClanSearchResponseItem : global::System.IEquatable<FindClans_Clans_ClanSearchResponseItem>, 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;
}
/// <summary>
/// Clan Id
/// </summary>
public global::System.Int64 ClanId { get; }
/// <summary>
/// Clan created at. (UNIX Epoch time)
/// </summary>
public global::System.Int32 CreatedAt { get; }
/// <summary>
/// Clan members count
/// </summary>
public global::System.Int32 MembersCount { get; }
/// <summary>
/// Clan Name
/// </summary>
public global::System.String? Name { get; }
/// <summary>
/// Clan Tag
/// </summary>
public global::System.String? Tag { get; }
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;
}
}
}
}
@@ -0,0 +1,89 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindPlayers GraphQL operation
/// <code>
/// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// players(accountNick: $accountNick, realmType: $realmType, language: $language) {
/// __typename
/// accountId
/// nickname
/// clanTag
/// lastBattle
/// battlesCount
/// winRate
/// }
/// }
/// </code>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery
{
private readonly global::StrawberryShake.IOperationExecutor<IFindPlayersResult> _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<IFindPlayersResult> 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<global::StrawberryShake.IOperationResult<IFindPlayersResult>> 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<global::StrawberryShake.IOperationResult<IFindPlayersResult>> 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<global::System.String, global::System.Object?>();
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<global::System.String, global::System.Object?>? 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<global::System.String, global::System.Object?>? variables)
{
return CreateRequest(variables!);
}
}
}
@@ -0,0 +1,42 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindPlayers GraphQL operation
/// <code>
/// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// players(accountNick: $accountNick, realmType: $realmType, language: $language) {
/// __typename
/// accountId
/// nickname
/// clanTag
/// lastBattle
/// battlesCount
/// winRate
/// }
/// }
/// </code>
/// </summary>
[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<global::System.Byte> 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
}
}
}
@@ -0,0 +1,73 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersResult : global::System.IEquatable<FindPlayersResult>, IFindPlayersResult
{
public FindPlayersResult(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players> players)
{
Players = players;
}
/// <summary>
/// Finds Wargaming accounts by nick
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players> 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;
}
}
}
}
@@ -0,0 +1,115 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Account search result item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayers_Players_AccountsSearchResponseItem : global::System.IEquatable<FindPlayers_Players_AccountsSearchResponseItem>, 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;
}
/// <summary>
/// Player accountId
/// </summary>
public global::System.Int64 AccountId { get; }
/// <summary>
/// Player nick
/// </summary>
public global::System.String? Nickname { get; }
/// <summary>
/// Clan tag. Null if player doesn't have clan membership
/// </summary>
public global::System.String? ClanTag { get; }
/// <summary>
/// Last battle time
/// </summary>
public global::System.DateTimeOffset LastBattle { get; }
/// <summary>
/// Player's battles count
/// </summary>
public global::System.Int64 BattlesCount { get; }
/// <summary>
/// Win rate from 0 to 100
/// </summary>
public global::System.Int32 WinRate { get; }
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;
}
}
}
}
@@ -0,0 +1,27 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindClans GraphQL operation
/// <code>
/// query FindClans($searchString: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// clans(searchString: $searchString, realmType: $realmType, language: $language) {
/// __typename
/// clanId
/// createdAt
/// membersCount
/// name
/// tag
/// }
/// }
/// </code>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindClansQuery : global::StrawberryShake.IOperationRequestFactory
{
global::System.Threading.Tasks.Task<global::StrawberryShake.IOperationResult<IFindClansResult>> 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<global::StrawberryShake.IOperationResult<IFindClansResult>> Watch(global::System.String searchString, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null);
}
}
@@ -0,0 +1,14 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindClansResult
{
/// <summary>
/// Finds clans by search string
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>? Clans { get; }
}
}
@@ -0,0 +1,37 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Found clans list item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindClans_Clans
{
/// <summary>
/// Clan Id
/// </summary>
public global::System.Int64 ClanId { get; }
/// <summary>
/// Clan created at. (UNIX Epoch time)
/// </summary>
public global::System.Int32 CreatedAt { get; }
/// <summary>
/// Clan members count
/// </summary>
public global::System.Int32 MembersCount { get; }
/// <summary>
/// Clan Name
/// </summary>
public global::System.String? Name { get; }
/// <summary>
/// Clan Tag
/// </summary>
public global::System.String? Tag { get; }
}
}
@@ -0,0 +1,13 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Found clans list item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindClans_Clans_ClanSearchResponseItem : IFindClans_Clans
{
}
}
@@ -0,0 +1,28 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the operation service of the FindPlayers GraphQL operation
/// <code>
/// query FindPlayers($accountNick: String!, $realmType: RealmType!, $language: RequestLanguage!) {
/// players(accountNick: $accountNick, realmType: $realmType, language: $language) {
/// __typename
/// accountId
/// nickname
/// clanTag
/// lastBattle
/// battlesCount
/// winRate
/// }
/// }
/// </code>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindPlayersQuery : global::StrawberryShake.IOperationRequestFactory
{
global::System.Threading.Tasks.Task<global::StrawberryShake.IOperationResult<IFindPlayersResult>> 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<global::StrawberryShake.IOperationResult<IFindPlayersResult>> Watch(global::System.String accountNick, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage language, global::StrawberryShake.ExecutionStrategy? strategy = null);
}
}
@@ -0,0 +1,14 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindPlayersResult
{
/// <summary>
/// Finds Wargaming accounts by nick
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players> Players { get; }
}
}
@@ -0,0 +1,42 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Account search result item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindPlayers_Players
{
/// <summary>
/// Player accountId
/// </summary>
public global::System.Int64 AccountId { get; }
/// <summary>
/// Player nick
/// </summary>
public global::System.String? Nickname { get; }
/// <summary>
/// Clan tag. Null if player doesn't have clan membership
/// </summary>
public global::System.String? ClanTag { get; }
/// <summary>
/// Last battle time
/// </summary>
public global::System.DateTimeOffset LastBattle { get; }
/// <summary>
/// Player's battles count
/// </summary>
public global::System.Int64 BattlesCount { get; }
/// <summary>
/// Win rate from 0 to 100
/// </summary>
public global::System.Int32 WinRate { get; }
}
}
@@ -0,0 +1,13 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Account search result item
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public interface IFindPlayers_Players_AccountsSearchResponseItem : IFindPlayers_Players
{
}
}
@@ -0,0 +1,16 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the WotBlitzStatisticsProClient GraphQL client
/// </summary>
[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; }
}
}
@@ -0,0 +1,26 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public enum RealmType
{
/// <summary>
/// Russian region
/// </summary>
Ru,
/// <summary>
/// European region
/// </summary>
Eu,
/// <summary>
/// North America
/// </summary>
Na,
/// <summary>
/// Asian region
/// </summary>
Asia
}
}
@@ -0,0 +1,22 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public enum RequestLanguage
{
/// <summary>
/// Русский
/// </summary>
Ru,
/// <summary>
/// English
/// </summary>
En,
/// <summary>
/// Deutsch
/// </summary>
De
}
}
@@ -0,0 +1,28 @@
// <auto-generated/>
#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<global::System.String, RealmType>
{
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()}
;
}
}
}
@@ -0,0 +1,28 @@
// <auto-generated/>
#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<global::System.String, RequestLanguage>
{
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()}
;
}
}
}
@@ -0,0 +1,41 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
///<summary>Account search result item</summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class AccountsSearchResponseItemData
{
public AccountsSearchResponseItemData(global::System.String __typename, global::System.Int64? accountId = default !, global::System.String? nickname = default !, global::System.String? clanTag = default !, global::System.DateTimeOffset? lastBattle = default !, global::System.Int64? battlesCount = default !, global::System.Int32? winRate = default !)
{
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
AccountId = accountId;
Nickname = nickname;
ClanTag = clanTag;
LastBattle = lastBattle;
BattlesCount = battlesCount;
WinRate = winRate;
}
public global::System.String __typename { get; }
///<summary>Player accountId</summary>
public global::System.Int64? AccountId { get; }
///<summary>Player nick</summary>
public global::System.String? Nickname { get; }
///<summary>Clan tag. Null if player doesn't have clan membership</summary>
public global::System.String? ClanTag { get; }
///<summary>Last battle time</summary>
public global::System.DateTimeOffset? LastBattle { get; }
///<summary>Player's battles count</summary>
public global::System.Int64? BattlesCount { get; }
///<summary>Win rate from 0 to 100</summary>
public global::System.Int32? WinRate { get; }
}
}
@@ -0,0 +1,37 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
///<summary>Found clans list item</summary>
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class ClanSearchResponseItemData
{
public ClanSearchResponseItemData(global::System.String __typename, global::System.Int64? clanId = default !, global::System.Int32? createdAt = default !, global::System.Int32? membersCount = default !, global::System.String? name = default !, global::System.String? tag = default !)
{
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
ClanId = clanId;
CreatedAt = createdAt;
MembersCount = membersCount;
Name = name;
Tag = tag;
}
public global::System.String __typename { get; }
///<summary>Clan Id</summary>
public global::System.Int64? ClanId { get; }
///<summary>Clan created at. (UNIX Epoch time)</summary>
public global::System.Int32? CreatedAt { get; }
///<summary>Clan members count</summary>
public global::System.Int32? MembersCount { get; }
///<summary>Clan Name</summary>
public global::System.String? Name { get; }
///<summary>Clan Tag</summary>
public global::System.String? Tag { get; }
}
}
@@ -0,0 +1,137 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult> _resultDataFactory;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage> _requestLanguageParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int32, global::System.Int32> _intParser;
public FindClansBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
_requestLanguageParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage>("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found.");
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
_intParser = serializerResolver.GetLeafValueParser<global::System.Int32, global::System.Int32>("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
}
public global::StrawberryShake.IOperationResult<IFindClansResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
{
(IFindClansResult Result, FindClansResultInfo Info)? data = null;
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
if (response.Exception is null)
{
try
{
if (response.Body != null)
{
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
data = BuildData(dataElement);
}
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
{
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
}
}
}
catch (global::System.Exception ex)
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
}
else
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
return new global::StrawberryShake.OperationResult<IFindClansResult>(data?.Result, data?.Info, _resultDataFactory, errors);
}
private (IFindClansResult, FindClansResultInfo) BuildData(global::System.Text.Json.JsonElement obj)
{
var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
_entityStore.Update(session =>
{
snapshot = session.CurrentSnapshot;
});
var resultInfo = new FindClansResultInfo(DeserializeIFindClans_ClansNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clans")), entityIds, snapshot.Version);
return (_resultDataFactory.Create(resultInfo), resultInfo);
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? DeserializeIFindClans_ClansNonNullableArray(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
var clanSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>();
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
{
clanSearchResponseItems.Add(DeserializeNonNullableIFindClans_Clans(child));
}
return clanSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData DeserializeNonNullableIFindClans_Clans(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var typename = obj.Value.GetProperty("__typename").GetString();
if (typename?.Equals("ClanSearchResponseItem", global::System.StringComparison.Ordinal) ?? false)
{
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData(typename, clanId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clanId")), createdAt: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "createdAt")), membersCount: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "membersCount")), name: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), tag: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "tag")));
}
throw new global::System.NotSupportedException();
}
private global::System.Int64 DeserializeNonNullableInt64(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _longParser.Parse(obj.Value.GetInt64()!);
}
private global::System.Int32 DeserializeNonNullableInt32(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _intParser.Parse(obj.Value.GetInt32()!);
}
private global::System.String? DeserializeString(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
return _stringParser.Parse(obj.Value.GetString()!);
}
}
}
@@ -0,0 +1,67 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindClansResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public FindClansResultFactory(global::StrawberryShake.IEntityStore entityStore)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
}
global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansResult);
public FindClansResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is FindClansResultInfo info)
{
return new FindClansResult(MapIFindClans_ClansNonNullableArray(info.Clans, snapshot));
}
throw new global::System.ArgumentException("FindClansResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>? MapIFindClans_ClansNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
return null;
}
var clanSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans>();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData child in list)
{
clanSearchResponseItems.Add(MapNonNullableIFindClans_Clans(child, snapshot));
}
return clanSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClans_Clans MapNonNullableIFindClans_Clans(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IFindClans_Clans returnValue = default !;
if (data.__typename.Equals("ClanSearchResponseItem", global::System.StringComparison.Ordinal))
{
returnValue = new FindClans_Clans_ClanSearchResponseItem(data.ClanId ?? throw new global::System.ArgumentNullException(), data.CreatedAt ?? throw new global::System.ArgumentNullException(), data.MembersCount ?? throw new global::System.ArgumentNullException(), data.Name, data.Tag);
}
else
{
throw new global::System.NotSupportedException();
}
return returnValue;
}
global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
{
return Create(dataInfo, snapshot);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindClansResultInfo : global::StrawberryShake.IOperationResultDataInfo
{
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
private readonly global::System.UInt64 _version;
public FindClansResultInfo(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? clans, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
{
Clans = clans;
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
_version = version;
}
/// <summary>
/// Finds clans by search string
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.ClanSearchResponseItemData>? Clans { get; }
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
public global::System.UInt64 Version => _version;
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
{
return new FindClansResultInfo(Clans, _entityIds, version);
}
}
}
@@ -0,0 +1,149 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult> _resultDataFactory;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage> _requestLanguageParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.DateTimeOffset> _dateTimeParser;
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int32, global::System.Int32> _intParser;
public FindPlayersBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
_requestLanguageParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage>("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found.");
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
_dateTimeParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.DateTimeOffset>("DateTime") ?? throw new global::System.ArgumentException("No serializer for type `DateTime` found.");
_intParser = serializerResolver.GetLeafValueParser<global::System.Int32, global::System.Int32>("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
}
public global::StrawberryShake.IOperationResult<IFindPlayersResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
{
(IFindPlayersResult Result, FindPlayersResultInfo Info)? data = null;
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
if (response.Exception is null)
{
try
{
if (response.Body != null)
{
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
{
data = BuildData(dataElement);
}
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
{
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
}
}
}
catch (global::System.Exception ex)
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
}
else
{
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
}
return new global::StrawberryShake.OperationResult<IFindPlayersResult>(data?.Result, data?.Info, _resultDataFactory, errors);
}
private (IFindPlayersResult, FindPlayersResultInfo) BuildData(global::System.Text.Json.JsonElement obj)
{
var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
_entityStore.Update(session =>
{
snapshot = session.CurrentSnapshot;
});
var resultInfo = new FindPlayersResultInfo(DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "players")), entityIds, snapshot.Version);
return (_resultDataFactory.Create(resultInfo), resultInfo);
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> DeserializeNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var accountsSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData>();
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
{
accountsSearchResponseItems.Add(DeserializeNonNullableIFindPlayers_Players(child));
}
return accountsSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData DeserializeNonNullableIFindPlayers_Players(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
var typename = obj.Value.GetProperty("__typename").GetString();
if (typename?.Equals("AccountsSearchResponseItem", global::System.StringComparison.Ordinal) ?? false)
{
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData(typename, accountId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountId")), nickname: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "nickname")), clanTag: DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "clanTag")), lastBattle: DeserializeNonNullableDateTimeOffset(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "lastBattle")), battlesCount: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "battlesCount")), winRate: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "winRate")));
}
throw new global::System.NotSupportedException();
}
private global::System.Int64 DeserializeNonNullableInt64(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _longParser.Parse(obj.Value.GetInt64()!);
}
private global::System.String? DeserializeString(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
return null;
}
return _stringParser.Parse(obj.Value.GetString()!);
}
private global::System.DateTimeOffset DeserializeNonNullableDateTimeOffset(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _dateTimeParser.Parse(obj.Value.GetString()!);
}
private global::System.Int32 DeserializeNonNullableInt32(global::System.Text.Json.JsonElement? obj)
{
if (!obj.HasValue)
{
throw new global::System.ArgumentNullException();
}
return _intParser.Parse(obj.Value.GetInt32()!);
}
}
}
@@ -0,0 +1,67 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.FindPlayersResult>
{
private readonly global::StrawberryShake.IEntityStore _entityStore;
public FindPlayersResultFactory(global::StrawberryShake.IEntityStore entityStore)
{
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
}
global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersResult);
public FindPlayersResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
{
if (snapshot is null)
{
snapshot = _entityStore.CurrentSnapshot;
}
if (dataInfo is FindPlayersResultInfo info)
{
return new FindPlayersResult(MapNonNullableIFindPlayers_PlayersNonNullableArray(info.Players, snapshot));
}
throw new global::System.ArgumentException("FindPlayersResultInfo expected.");
}
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players> MapNonNullableIFindPlayers_PlayersNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
if (list is null)
{
throw new global::System.ArgumentNullException();
}
var accountsSearchResponseItems = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players>();
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData child in list)
{
accountsSearchResponseItems.Add(MapNonNullableIFindPlayers_Players(child, snapshot));
}
return accountsSearchResponseItems;
}
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayers_Players MapNonNullableIFindPlayers_Players(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
{
IFindPlayers_Players returnValue = default !;
if (data.__typename.Equals("AccountsSearchResponseItem", global::System.StringComparison.Ordinal))
{
returnValue = new FindPlayers_Players_AccountsSearchResponseItem(data.AccountId ?? throw new global::System.ArgumentNullException(), data.Nickname, data.ClanTag, data.LastBattle ?? throw new global::System.ArgumentNullException(), data.BattlesCount ?? throw new global::System.ArgumentNullException(), data.WinRate ?? throw new global::System.ArgumentNullException());
}
else
{
throw new global::System.NotSupportedException();
}
return returnValue;
}
global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
{
return Create(dataInfo, snapshot);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class FindPlayersResultInfo : global::StrawberryShake.IOperationResultDataInfo
{
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
private readonly global::System.UInt64 _version;
public FindPlayersResultInfo(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> players, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
{
Players = players;
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
_version = version;
}
/// <summary>
/// Finds Wargaming accounts by nick
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountsSearchResponseItemData> Players { get; }
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
public global::System.UInt64 Version => _version;
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
{
return new FindPlayersResultInfo(Players, _entityIds, version);
}
}
}
@@ -0,0 +1,30 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class WotBlitzStatisticsProClientEntityIdFactory : global::StrawberryShake.IEntityIdSerializer
{
private static readonly global::System.Text.Json.JsonWriterOptions _options = new global::System.Text.Json.JsonWriterOptions()
{Indented = false};
public global::StrawberryShake.EntityId Parse(global::System.Text.Json.JsonElement obj)
{
global::System.String __typename = obj.GetProperty("__typename").GetString()!;
return __typename switch
{
_ => throw new global::System.NotSupportedException()}
;
}
public global::System.String Format(global::StrawberryShake.EntityId entityId)
{
return entityId.Name switch
{
_ => throw new global::System.NotSupportedException()}
;
}
}
}
@@ -0,0 +1,13 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
{
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class WotBlitzStatisticsProClientStoreAccessor : global::StrawberryShake.StoreAccessor
{
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
{
}
}
}
@@ -0,0 +1,24 @@
// <auto-generated/>
#nullable enable
namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
/// <summary>
/// Represents the WotBlitzStatisticsProClient GraphQL client
/// </summary>
[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;
}
}
@@ -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<App> 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}%"));
+10
View File
@@ -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<IGraphQlBackendService, GraphQlBackendMockService>();
//}
//else
//{
// builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendService>();
//}
var host = builder.Build();
// Reading Current Culture from LocalStorage
@@ -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<IReadOnlyList<IFindPlayers_Players>?> FindPlayers(string accountNick, RealmType realmType, RequestLanguage language)
{
var result = new List<IFindPlayers_Players>();
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<IReadOnlyList<IFindClans_Clans>?> FindClans(string clanNameOrTag, RealmType realmType, RequestLanguage language)
{
var result = new List<IFindClans_Clans>();
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";
}
}
}
}
@@ -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<IReadOnlyList<IFindPlayers_Players>?> 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<IReadOnlyList<IFindClans_Clans>?> FindClans(string clanNameOrTag, RealmType realmType, RequestLanguage language)
{
var clans =
await _client.FindClans.ExecuteAsync(clanNameOrTag, RealmType.Ru, RequestLanguage.En);
return clans.Data?.Clans;
}
}
}
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Blazor.GraphQl;
namespace WotBlitzStatisticsPro.Blazor.Services
{
public interface IGraphQlBackendService
{
Task<IReadOnlyList<IFindPlayers_Players>?> FindPlayers(
string accountNick,
RealmType realmType,
RequestLanguage language);
Task<IReadOnlyList<IFindClans_Clans>?> FindClans(
string clanNameOrTag,
RealmType realmType,
RequestLanguage language);
}
}
@@ -7,10 +7,11 @@
</PropertyGroup>
<ItemGroup>
<None Include="FindAccounts.graphql" />
<GraphQL Remove="FindPlayers.graphql" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Bogus" Version="33.0.2" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.4" />
@@ -0,0 +1,15 @@
query findClans (
$searchString: String!,
$realmType: RealmType!,
$language: RequestLanguage!) {
clans(
searchString: $searchString,
realmType: $realmType,
language: $language) {
clanId
createdAt
membersCount
name
tag
}
}
@@ -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
}
}
}
@@ -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"
@@ -1,19 +0,0 @@
using System.Collections.Generic;
namespace WotBlitzStatisticsPro.Common.Model
{
/// <summary>
/// Response contains a list of found accounts
/// </summary>
public class AccountsSearchResponse
{
/// <summary>
/// Count of found accounts
/// </summary>
public int AccountsCount { get; set; }
/// <summary>
/// Found accounts list
/// </summary>
public ICollection<AccountsSearchResponseItem>? Accounts { get; set; }
}
}
@@ -1,19 +0,0 @@
using System.Collections.Generic;
namespace WotBlitzStatisticsPro.Common.Model
{
/// <summary>
/// Response with list of found clans
/// </summary>
public class ClanSearchResponse
{
/// <summary>
/// Count of clans in the list
/// </summary>
public int ClansCount { get; set; }
/// <summary>
/// List of clans
/// </summary>
public ICollection<ClanSearchResponseItem>? Clans { get; set; }
}
}
@@ -1,38 +0,0 @@
using HotChocolate.Types;
using WotBlitzStatisticsPro.Common.Model;
namespace WotBlitzStatisticsPro.GraphQl.ObjectTypes
{
public class AccountsSearchObjectType: ObjectType<AccountsSearchResponse>
{
// 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<AccountsSearchResponse> descriptor)
//{
// descriptor.Field(r => r.Accounts)
// .UsePaging<AccountsSearchItemObjectType>();
//}
/*
Paging request example
query($accountSearchNick: String!) {
findAccounts(accountNick: $accountSearchNick) {
accounts(first: 5, after: "eyJfX3RvdGFsQ291bnQiOjc0LCJfX3Bvc2l0aW9uIjo5fQ==") {
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount
nodes {
accountId
nickname
}
}
}
}
*/
}
}
@@ -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}"
}
}
}
@@ -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
/// <param name="realmType">Wargaming Realm.</param>
/// <param name="language">Language for the output data.</param>
/// <returns></returns>
public Task<AccountsSearchResponse> FindAccounts(
public Task<ICollection<AccountsSearchResponseItem>> Players(
string accountNick,
RealmType? realmType,
RequestLanguage? language)
@@ -44,7 +45,7 @@ namespace WotBlitzStatisticsPro.GraphQl.Query
/// <param name="realmType">Wargaming Realm.</param>
/// <param name="language">Language for the output data.</param>
/// <returns></returns>
public Task<ClanSearchResponse> FindClans(
public Task<ICollection<ClanSearchResponseItem>?> Clans(
string searchString,
RealmType? realmType,
RequestLanguage? language)
+1 -1
View File
@@ -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<WotBlitzStatisticsMutation>()
.AddType<AuthenticationMutation>()
.AddType<AccountsSearchItemObjectType>()
.AddType<AccountsSearchObjectType>()
.AddEnumType<MarkOfMastery>()
.AddEnumType<RealmType>()
.AddEnumType<RequestLanguage>()
@@ -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<AccountsSearchResponse> FindAccounts(
Task<ICollection<AccountsSearchResponseItem>?> FindAccounts(
string accountNick,
RealmType realmType,
RequestLanguage language);
Task<ClanSearchResponse> FindClans(
Task<ICollection<ClanSearchResponseItem>?> FindClans(
string searchString,
RealmType realmType,
RequestLanguage language);
+12 -21
View File
@@ -19,7 +19,7 @@ namespace WotBlitzStatisticsPro.Logic
_mapper = mapper;
}
public async Task<AccountsSearchResponse> FindAccounts(
public async Task<ICollection<AccountsSearchResponseItem>?> 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<WotAccountListResponse>, List<AccountsSearchResponseItem>>(searchResponse)
};
var accounts = _mapper.Map<List<WotAccountListResponse>, List<AccountsSearchResponseItem>>(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<ClanSearchResponse> FindClans(
public async Task<ICollection<ClanSearchResponseItem>?> 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<WotClanListResponse>, List<ClanSearchResponseItem>>(response)
};
return _mapper.Map<List<WotClanListResponse>, List<ClanSearchResponseItem>>(response);
}
}
}