diff --git a/WotBlitzStatisticsPro.Blazor.Tests/Services/GraphQlBackendServiceTests.cs b/WotBlitzStatisticsPro.Blazor.Tests/Services/GraphQlBackendServiceTests.cs index fbae44c..83dac2e 100644 --- a/WotBlitzStatisticsPro.Blazor.Tests/Services/GraphQlBackendServiceTests.cs +++ b/WotBlitzStatisticsPro.Blazor.Tests/Services/GraphQlBackendServiceTests.cs @@ -20,6 +20,11 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services private Mock _findPlayersQueryMock; private Mock _playerQueryMock; private Mock _updatePlayerMutationMock; + private Mock _wargamingAuthenticationQueryMock; + private Mock _wagamingOpenIdMutation; + private Mock _wargamingOpenIdAuthenticationMutationMock; + private Mock _wargamingPlayersMutation; + private WotBlitzStatisticsProClient _generatedClient; private Mock _notificationServiceMock; private GraphQlBackendService _service; @@ -48,13 +53,25 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services _findPlayersQueryMock = new(); _playerQueryMock = new(); _updatePlayerMutationMock = new(); + _wargamingAuthenticationQueryMock = new(); + _wagamingOpenIdMutation = new(); + _wargamingOpenIdAuthenticationMutationMock = new(); + _wargamingPlayersMutation = new(); await SetUpFindClans(); await SetUpFindPlayers(); await SetUpGetPlayer(); _generatedClient = - new WotBlitzStatisticsProClient(_findClanQueryMock.Object, _findPlayersQueryMock.Object, _playerQueryMock.Object, _updatePlayerMutationMock.Object); + new WotBlitzStatisticsProClient( + _findClanQueryMock.Object, + _findPlayersQueryMock.Object, + _wargamingAuthenticationQueryMock.Object, + _wagamingOpenIdMutation.Object, + _playerQueryMock.Object, + _wargamingOpenIdAuthenticationMutationMock.Object, + _wargamingPlayersMutation.Object, + _updatePlayerMutationMock.Object); _notificationServiceMock = new(); diff --git a/WotBlitzStatisticsPro.Blazor.Tests/Services/WargamingLoginServiceTests.cs b/WotBlitzStatisticsPro.Blazor.Tests/Services/WargamingLoginServiceTests.cs index 9090d83..368df17 100644 --- a/WotBlitzStatisticsPro.Blazor.Tests/Services/WargamingLoginServiceTests.cs +++ b/WotBlitzStatisticsPro.Blazor.Tests/Services/WargamingLoginServiceTests.cs @@ -109,13 +109,13 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services _localStorageMock.Setup(s => s.GetItemAsync(Constants.LoginInfoLocalStorageKey)) .ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = oldToken, ExpiresAt = 12345678, Realm = realm }); - _graphQlBackendMock.Setup(s => s.ProlongToken(accountId, oldToken, realm)).ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = newToken, ExpiresAt = newEvpiration, Realm = realm }); + _graphQlBackendMock.Setup(s => s.ProlongToken(oldToken, realm)).ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = newToken, ExpiresAt = newEvpiration, Realm = realm }); // Avtion await _service.Handle(new ProlongWargamingAccessToken(), CancellationToken.None); // Assert - _graphQlBackendMock.Verify(s => s.ProlongToken(accountId, oldToken, realm), Times.Once); + _graphQlBackendMock.Verify(s => s.ProlongToken(oldToken, realm), Times.Once); _localStorageMock.Verify(s => s.SetItemAsync( Constants.LoginInfoLocalStorageKey, It.Is(l => l.Realm == realm && l.AccountId == accountId && l.AccessToken == newToken && l.ExpiresAt == newEvpiration)) diff --git a/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs index 69c08f4..6ba77a2 100644 --- a/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs +++ b/WotBlitzStatisticsPro.Blazor/Generated/DependencyInjection/WotBlitzStatisticsProClientServiceCollectionExtensions.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -17,7 +17,11 @@ namespace Microsoft.Extensions.DependencyInjection global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientStoreAccessor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp))); @@ -67,6 +71,20 @@ namespace Microsoft.Extensions.DependencyInjection global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingAuthenticationQueryResultFactory>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingAuthenticationQueryBuilder>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingOpenIdResultFactory>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingOpenIdBuilder>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.PlayerResultFactory>(services); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); @@ -74,6 +92,20 @@ namespace Microsoft.Extensions.DependencyInjection global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingOpenIdAuthenticationResultFactory>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingOpenIdAuthenticationBuilder>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingPlayersResultFactory>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingPlayersBuilder>(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton>(services, sp => new global::StrawberryShake.OperationExecutor(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp), strategy)); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services); + global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.UpdatePlayerResultFactory>(services); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService>(sp)); global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(sp)); diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..4e1ff8a --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingAuthenticationQuery GraphQL operation + /// + /// query WargamingAuthenticationQuery($realmType: RealmType!) { + /// loginUrl(realmType: $realmType) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingAuthenticationQueryQuery : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default); + global::System.IObservable> Watch(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..9180024 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,14 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingAuthenticationQueryResult + { + /// + /// Returns authentication URL accourding Realm + /// + public global::System.String LoginUrl { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..54c3092 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,25 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenIdAuthentication GraphQL operation + /// + /// mutation WargamingOpenIdAuthentication($oldToken: String!, $realmType: RealmType!) { + /// prolongAuthToken(oldToken: $oldToken, realm: $realmType) { + /// __typename + /// accessToken + /// accountId + /// expirationTimeStamp + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdAuthenticationMutation : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String oldToken, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default); + global::System.IObservable> Watch(global::System.String oldToken, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..8fbb63c --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,14 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdAuthenticationResult + { + /// + /// Prolongates Wargaming authentication token + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthentication_ProlongAuthToken ProlongAuthToken { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..96bf089 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,27 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Prolong Wargaming Auth token response + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdAuthentication_ProlongAuthToken + { + /// + /// New access token + /// + public global::System.String AccessToken { get; } + + /// + /// Player Account Id + /// + public global::System.Int64 AccountId { get; } + + /// + /// New expiration unix timestamp + /// + public global::System.Int32 ExpirationTimeStamp { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..f13ed95 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,13 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Prolong Wargaming Auth token response + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo : IWargamingOpenIdAuthentication_ProlongAuthToken + { + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..b36555d --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenId GraphQL operation + /// + /// mutation WargamingOpenId($token: String!, $realmType: RealmType!) { + /// logout(realm: $realmType, token: $token) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdMutation : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String token, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default); + global::System.IObservable> Watch(global::System.String token, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..a8a2301 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,18 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingOpenIdResult + { + /// + /// Removes player's access token + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String Logout { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..970dc5b --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,20 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingPlayers GraphQL operation + /// + /// mutation WargamingPlayers { + /// removePlayerHistory(realm: RU, accountId: 12345) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingPlayersMutation : global::StrawberryShake.IOperationRequestFactory + { + global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default); + global::System.IObservable> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null); + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..4c50944 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,18 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public interface IWargamingPlayersResult + { + /// + /// Removes player's acoount history from database + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String RemovePlayerHistory { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs index 4a43a5b..100ca10 100644 --- a/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs +++ b/WotBlitzStatisticsPro.Blazor/Generated/IWotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -13,8 +13,16 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery FindPlayers { get; } + global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery WargamingAuthenticationQuery { get; } + + global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation WargamingOpenId { get; } + global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery Player { get; } + global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation WargamingOpenIdAuthentication { get; } + + global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation WargamingPlayers { get; } + global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation UpdatePlayer { get; } } } diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..d66a6fc --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryBuilder : global::StrawberryShake.IOperationResultBuilder + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer; + private readonly global::StrawberryShake.IOperationResultDataFactory _resultDataFactory; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _realmTypeParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser; + public WargamingAuthenticationQueryBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore)); + _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer)); + _resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory)); + _realmTypeParser = serializerResolver.GetLeafValueParser("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found."); + _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IWargamingAuthenticationQueryResult Result, WargamingAuthenticationQueryResultInfo Info)? data = null; + global::System.Collections.Generic.IReadOnlyList? errors = null; + if (response.Exception is null) + { + try + { + if (response.Body != null) + { + if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + { + data = BuildData(dataElement); + } + + if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) + { + errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); + } + } + } + catch (global::System.Exception ex) + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + } + else + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + + return new global::StrawberryShake.OperationResult(data?.Result, data?.Info, _resultDataFactory, errors); + } + + private (IWargamingAuthenticationQueryResult, WargamingAuthenticationQueryResultInfo) BuildData(global::System.Text.Json.JsonElement obj) + { + var entityIds = new global::System.Collections.Generic.HashSet(); + global::StrawberryShake.IEntityStoreSnapshot snapshot = default !; + _entityStore.Update(session => + { + snapshot = session.CurrentSnapshot; + }); + var resultInfo = new WargamingAuthenticationQueryResultInfo(DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "loginUrl")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::System.String DeserializeNonNullableString(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + return _stringParser.Parse(obj.Value.GetString()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..decb370 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,36 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + public WargamingAuthenticationQueryResultFactory(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.IWargamingAuthenticationQueryResult); + public WargamingAuthenticationQueryResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null) + { + if (snapshot is null) + { + snapshot = _entityStore.CurrentSnapshot; + } + + if (dataInfo is WargamingAuthenticationQueryResultInfo info) + { + return new WargamingAuthenticationQueryResult(info.LoginUrl); + } + + throw new global::System.ArgumentException("WargamingAuthenticationQueryResultInfo expected."); + } + + global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot) + { + return Create(dataInfo, snapshot); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..1ae3b89 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingAuthenticationQueryResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,30 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryResultInfo : global::StrawberryShake.IOperationResultDataInfo + { + private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds; + private readonly global::System.UInt64 _version; + public WargamingAuthenticationQueryResultInfo(global::System.String loginUrl, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + LoginUrl = loginUrl; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Returns authentication URL accourding Realm + /// + public global::System.String LoginUrl { get; } + + public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds; + public global::System.UInt64 Version => _version; + public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version) + { + return new WargamingAuthenticationQueryResultInfo(LoginUrl, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..16fd7bc --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,119 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationBuilder : global::StrawberryShake.IOperationResultBuilder + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer; + private readonly global::StrawberryShake.IOperationResultDataFactory _resultDataFactory; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _realmTypeParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _longParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _intParser; + public WargamingOpenIdAuthenticationBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore)); + _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer)); + _resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory)); + _realmTypeParser = serializerResolver.GetLeafValueParser("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found."); + _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found."); + _longParser = serializerResolver.GetLeafValueParser("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found."); + _intParser = serializerResolver.GetLeafValueParser("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IWargamingOpenIdAuthenticationResult Result, WargamingOpenIdAuthenticationResultInfo Info)? data = null; + global::System.Collections.Generic.IReadOnlyList? errors = null; + if (response.Exception is null) + { + try + { + if (response.Body != null) + { + if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + { + data = BuildData(dataElement); + } + + if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) + { + errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); + } + } + } + catch (global::System.Exception ex) + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + } + else + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + + return new global::StrawberryShake.OperationResult(data?.Result, data?.Info, _resultDataFactory, errors); + } + + private (IWargamingOpenIdAuthenticationResult, WargamingOpenIdAuthenticationResultInfo) BuildData(global::System.Text.Json.JsonElement obj) + { + var entityIds = new global::System.Collections.Generic.HashSet(); + global::StrawberryShake.IEntityStoreSnapshot snapshot = default !; + _entityStore.Update(session => + { + snapshot = session.CurrentSnapshot; + }); + var resultInfo = new WargamingOpenIdAuthenticationResultInfo(DeserializeNonNullableIWargamingOpenIdAuthentication_ProlongAuthToken(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "prolongAuthToken")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData DeserializeNonNullableIWargamingOpenIdAuthentication_ProlongAuthToken(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + var typename = obj.Value.GetProperty("__typename").GetString(); + if (typename?.Equals("WargamingProlongInfo", global::System.StringComparison.Ordinal) ?? false) + { + return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData(typename, accessToken: DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accessToken")), accountId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountId")), expirationTimeStamp: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "expirationTimeStamp"))); + } + + throw new global::System.NotSupportedException(); + } + + private global::System.String DeserializeNonNullableString(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + return _stringParser.Parse(obj.Value.GetString()!); + } + + 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()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..5131c22 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + public WargamingOpenIdAuthenticationResultFactory(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.IWargamingOpenIdAuthenticationResult); + public WargamingOpenIdAuthenticationResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null) + { + if (snapshot is null) + { + snapshot = _entityStore.CurrentSnapshot; + } + + if (dataInfo is WargamingOpenIdAuthenticationResultInfo info) + { + return new WargamingOpenIdAuthenticationResult(MapNonNullableIWargamingOpenIdAuthentication_ProlongAuthToken(info.ProlongAuthToken, snapshot)); + } + + throw new global::System.ArgumentException("WargamingOpenIdAuthenticationResultInfo expected."); + } + + private global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthentication_ProlongAuthToken MapNonNullableIWargamingOpenIdAuthentication_ProlongAuthToken(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData data, global::StrawberryShake.IEntityStoreSnapshot snapshot) + { + IWargamingOpenIdAuthentication_ProlongAuthToken returnValue = default !; + if (data.__typename.Equals("WargamingProlongInfo", global::System.StringComparison.Ordinal)) + { + returnValue = new WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo(data.AccessToken ?? throw new global::System.ArgumentNullException(), data.AccountId ?? throw new global::System.ArgumentNullException(), data.ExpirationTimeStamp ?? throw new global::System.ArgumentNullException()); + } + else + { + throw new global::System.NotSupportedException(); + } + + return returnValue; + } + + global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot) + { + return Create(dataInfo, snapshot); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..03fb7ec --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdAuthenticationResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,30 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationResultInfo : global::StrawberryShake.IOperationResultDataInfo + { + private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds; + private readonly global::System.UInt64 _version; + public WargamingOpenIdAuthenticationResultInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData prolongAuthToken, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + ProlongAuthToken = prolongAuthToken; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Prolongates Wargaming authentication token + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData ProlongAuthToken { get; } + + public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds; + public global::System.UInt64 Version => _version; + public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version) + { + return new WargamingOpenIdAuthenticationResultInfo(ProlongAuthToken, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..6b4e122 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,79 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdBuilder : global::StrawberryShake.IOperationResultBuilder + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer; + private readonly global::StrawberryShake.IOperationResultDataFactory _resultDataFactory; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _realmTypeParser; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser; + public WargamingOpenIdBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore)); + _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer)); + _resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory)); + _realmTypeParser = serializerResolver.GetLeafValueParser("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found."); + _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IWargamingOpenIdResult Result, WargamingOpenIdResultInfo Info)? data = null; + global::System.Collections.Generic.IReadOnlyList? errors = null; + if (response.Exception is null) + { + try + { + if (response.Body != null) + { + if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + { + data = BuildData(dataElement); + } + + if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) + { + errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); + } + } + } + catch (global::System.Exception ex) + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + } + else + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + + return new global::StrawberryShake.OperationResult(data?.Result, data?.Info, _resultDataFactory, errors); + } + + private (IWargamingOpenIdResult, WargamingOpenIdResultInfo) BuildData(global::System.Text.Json.JsonElement obj) + { + var entityIds = new global::System.Collections.Generic.HashSet(); + global::StrawberryShake.IEntityStoreSnapshot snapshot = default !; + _entityStore.Update(session => + { + snapshot = session.CurrentSnapshot; + }); + var resultInfo = new WargamingOpenIdResultInfo(DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "logout")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::System.String DeserializeNonNullableString(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + return _stringParser.Parse(obj.Value.GetString()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..ffc25cf --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,36 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + public WargamingOpenIdResultFactory(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.IWargamingOpenIdResult); + public WargamingOpenIdResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null) + { + if (snapshot is null) + { + snapshot = _entityStore.CurrentSnapshot; + } + + if (dataInfo is WargamingOpenIdResultInfo info) + { + return new WargamingOpenIdResult(info.Logout); + } + + throw new global::System.ArgumentException("WargamingOpenIdResultInfo expected."); + } + + global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot) + { + return Create(dataInfo, snapshot); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..95eb0d9 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingOpenIdResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,34 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdResultInfo : global::StrawberryShake.IOperationResultDataInfo + { + private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds; + private readonly global::System.UInt64 _version; + public WargamingOpenIdResultInfo(global::System.String logout, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + Logout = logout; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Removes player's access token + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String Logout { get; } + + public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds; + public global::System.UInt64 Version => _version; + public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version) + { + return new WargamingOpenIdResultInfo(Logout, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..1e6a349 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersBuilder.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,77 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersBuilder : global::StrawberryShake.IOperationResultBuilder + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer; + private readonly global::StrawberryShake.IOperationResultDataFactory _resultDataFactory; + private readonly global::StrawberryShake.Serialization.ILeafValueParser _stringParser; + public WargamingPlayersBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore)); + _idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer)); + _resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory)); + _stringParser = serializerResolver.GetLeafValueParser("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found."); + } + + public global::StrawberryShake.IOperationResult Build(global::StrawberryShake.Response response) + { + (IWargamingPlayersResult Result, WargamingPlayersResultInfo Info)? data = null; + global::System.Collections.Generic.IReadOnlyList? errors = null; + if (response.Exception is null) + { + try + { + if (response.Body != null) + { + if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object) + { + data = BuildData(dataElement); + } + + if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement)) + { + errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement); + } + } + } + catch (global::System.Exception ex) + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + } + else + { + errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary{{"body", response.Body?.RootElement.ToString()}})}; + } + + return new global::StrawberryShake.OperationResult(data?.Result, data?.Info, _resultDataFactory, errors); + } + + private (IWargamingPlayersResult, WargamingPlayersResultInfo) BuildData(global::System.Text.Json.JsonElement obj) + { + var entityIds = new global::System.Collections.Generic.HashSet(); + global::StrawberryShake.IEntityStoreSnapshot snapshot = default !; + _entityStore.Update(session => + { + snapshot = session.CurrentSnapshot; + }); + var resultInfo = new WargamingPlayersResultInfo(DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "removePlayerHistory")), entityIds, snapshot.Version); + return (_resultDataFactory.Create(resultInfo), resultInfo); + } + + private global::System.String DeserializeNonNullableString(global::System.Text.Json.JsonElement? obj) + { + if (!obj.HasValue) + { + throw new global::System.ArgumentNullException(); + } + + return _stringParser.Parse(obj.Value.GetString()!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..73c692d --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultFactory.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,36 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersResultFactory : global::StrawberryShake.IOperationResultDataFactory + { + private readonly global::StrawberryShake.IEntityStore _entityStore; + public WargamingPlayersResultFactory(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.IWargamingPlayersResult); + public WargamingPlayersResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null) + { + if (snapshot is null) + { + snapshot = _entityStore.CurrentSnapshot; + } + + if (dataInfo is WargamingPlayersResultInfo info) + { + return new WargamingPlayersResult(info.RemovePlayerHistory); + } + + throw new global::System.ArgumentException("WargamingPlayersResultInfo expected."); + } + + global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot) + { + return Create(dataInfo, snapshot); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..8f09c96 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingPlayersResultInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,34 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersResultInfo : global::StrawberryShake.IOperationResultDataInfo + { + private readonly global::System.Collections.Generic.IReadOnlyCollection _entityIds; + private readonly global::System.UInt64 _version; + public WargamingPlayersResultInfo(global::System.String removePlayerHistory, global::System.Collections.Generic.IReadOnlyCollection entityIds, global::System.UInt64 version) + { + RemovePlayerHistory = removePlayerHistory; + _entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds)); + _version = version; + } + + /// + /// Removes player's acoount history from database + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String RemovePlayerHistory { get; } + + public global::System.Collections.Generic.IReadOnlyCollection EntityIds => _entityIds; + public global::System.UInt64 Version => _version; + public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version) + { + return new WargamingPlayersResultInfo(RemovePlayerHistory, _entityIds, version); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingProlongInfoData.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingProlongInfoData.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..c683385 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/State/WargamingProlongInfoData.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,29 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl.State +{ + ///Prolong Wargaming Auth token response + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingProlongInfoData + { + public WargamingProlongInfoData(global::System.String __typename, global::System.String? accessToken = default !, global::System.Int64? accountId = default !, global::System.Int32? expirationTimeStamp = default !) + { + this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename)); + AccessToken = accessToken; + AccountId = accountId; + ExpirationTimeStamp = expirationTimeStamp; + } + + public global::System.String __typename { get; } + + ///New access token + public global::System.String? AccessToken { get; } + + ///Player Account Id + public global::System.Int64? AccountId { get; } + + ///New expiration unix timestamp + public global::System.Int32? ExpirationTimeStamp { get; } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..00bbe94 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQuery.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,60 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingAuthenticationQuery GraphQL operation + /// + /// query WargamingAuthenticationQuery($realmType: RealmType!) { + /// loginUrl(realmType: $realmType) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryQuery : global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery + { + private readonly global::StrawberryShake.IOperationExecutor _operationExecutor; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _realmTypeFormatter; + public WargamingAuthenticationQueryQuery(global::StrawberryShake.IOperationExecutor operationExecutor, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor)); + _realmTypeFormatter = serializerResolver.GetInputValueFormatter("RealmType"); + } + + global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IWargamingAuthenticationQueryResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(realmType); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(realmType); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType) + { + var variables = new global::System.Collections.Generic.Dictionary(); + variables.Add("realmType", FormatRealmType(realmType)); + return CreateRequest(variables); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return new global::StrawberryShake.OperationRequest(id: WargamingAuthenticationQueryQueryDocument.Instance.Hash.Value, name: "WargamingAuthenticationQuery", document: WargamingAuthenticationQueryQueryDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default, variables: variables); + } + + private global::System.Object? FormatRealmType(global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType value) + { + return _realmTypeFormatter.Format(value); + } + + global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return CreateRequest(variables!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..53d08db --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryQueryDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,34 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingAuthenticationQuery GraphQL operation + /// + /// query WargamingAuthenticationQuery($realmType: RealmType!) { + /// loginUrl(realmType: $realmType) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryQueryDocument : global::StrawberryShake.IDocument + { + private WargamingAuthenticationQueryQueryDocument() + { + } + + public static WargamingAuthenticationQueryQueryDocument Instance { get; } = new WargamingAuthenticationQueryQueryDocument(); + public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Query; + public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x57, 0x61, 0x72, 0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x28, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x21, 0x29, 0x20, 0x7b, 0x20, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x55, 0x72, 0x6c, 0x28, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x29, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "f467abbe316298d2d118610155cfcc64"); + public override global::System.String ToString() + { +#if NETSTANDARD2_0 + return global::System.Text.Encoding.UTF8.GetString(Body.ToArray()); +#else + return global::System.Text.Encoding.UTF8.GetString(Body); +#endif + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..a1952b5 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingAuthenticationQueryResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,69 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingAuthenticationQueryResult : global::System.IEquatable, IWargamingAuthenticationQueryResult + { + public WargamingAuthenticationQueryResult(global::System.String loginUrl) + { + LoginUrl = loginUrl; + } + + /// + /// Returns authentication URL accourding Realm + /// + public global::System.String LoginUrl { get; } + + public virtual global::System.Boolean Equals(WargamingAuthenticationQueryResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (LoginUrl.Equals(other.LoginUrl)); + } + + 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((WargamingAuthenticationQueryResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * LoginUrl.GetHashCode(); + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..f9189af --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,78 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenIdAuthentication GraphQL operation + /// + /// mutation WargamingOpenIdAuthentication($oldToken: String!, $realmType: RealmType!) { + /// prolongAuthToken(oldToken: $oldToken, realm: $realmType) { + /// __typename + /// accessToken + /// accountId + /// expirationTimeStamp + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationMutation : global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation + { + private readonly global::StrawberryShake.IOperationExecutor _operationExecutor; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _stringFormatter; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _realmTypeFormatter; + public WargamingOpenIdAuthenticationMutation(global::StrawberryShake.IOperationExecutor operationExecutor, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor)); + _stringFormatter = serializerResolver.GetInputValueFormatter("String"); + _realmTypeFormatter = serializerResolver.GetInputValueFormatter("RealmType"); + } + + global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IWargamingOpenIdAuthenticationResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String oldToken, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(oldToken, realmType); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::System.String oldToken, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(oldToken, realmType); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.String oldToken, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType) + { + var variables = new global::System.Collections.Generic.Dictionary(); + variables.Add("oldToken", FormatOldToken(oldToken)); + variables.Add("realmType", FormatRealmType(realmType)); + return CreateRequest(variables); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return new global::StrawberryShake.OperationRequest(id: WargamingOpenIdAuthenticationMutationDocument.Instance.Hash.Value, name: "WargamingOpenIdAuthentication", document: WargamingOpenIdAuthenticationMutationDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default, variables: variables); + } + + private global::System.Object? FormatOldToken(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); + } + + global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return CreateRequest(variables!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..c466887 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,39 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenIdAuthentication GraphQL operation + /// + /// mutation WargamingOpenIdAuthentication($oldToken: String!, $realmType: RealmType!) { + /// prolongAuthToken(oldToken: $oldToken, realm: $realmType) { + /// __typename + /// accessToken + /// accountId + /// expirationTimeStamp + /// } + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationMutationDocument : global::StrawberryShake.IDocument + { + private WargamingOpenIdAuthenticationMutationDocument() + { + } + + public static WargamingOpenIdAuthenticationMutationDocument Instance { get; } = new WargamingOpenIdAuthenticationMutationDocument(); + public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Mutation; + public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x57, 0x61, 0x72, 0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x24, 0x6f, 0x6c, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 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, 0x29, 0x20, 0x7b, 0x20, 0x70, 0x72, 0x6f, 0x6c, 0x6f, 0x6e, 0x67, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x28, 0x6f, 0x6c, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x20, 0x24, 0x6f, 0x6c, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2c, 0x20, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x3a, 0x20, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x29, 0x20, 0x7b, 0x20, 0x5f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x20, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x20, 0x7d, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "13ea3202081b573b70c0675e0c40d464"); + public override global::System.String ToString() + { +#if NETSTANDARD2_0 + return global::System.Text.Encoding.UTF8.GetString(Body.ToArray()); +#else + return global::System.Text.Encoding.UTF8.GetString(Body); +#endif + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..80c82c0 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthenticationResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,69 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthenticationResult : global::System.IEquatable, IWargamingOpenIdAuthenticationResult + { + public WargamingOpenIdAuthenticationResult(global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthentication_ProlongAuthToken prolongAuthToken) + { + ProlongAuthToken = prolongAuthToken; + } + + /// + /// Prolongates Wargaming authentication token + /// + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthentication_ProlongAuthToken ProlongAuthToken { get; } + + public virtual global::System.Boolean Equals(WargamingOpenIdAuthenticationResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (ProlongAuthToken.Equals(other.ProlongAuthToken)); + } + + 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((WargamingOpenIdAuthenticationResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * ProlongAuthToken.GetHashCode(); + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..e86dd18 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,86 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Prolong Wargaming Auth token response + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo : global::System.IEquatable, IWargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo + { + public WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo(global::System.String accessToken, global::System.Int64 accountId, global::System.Int32 expirationTimeStamp) + { + AccessToken = accessToken; + AccountId = accountId; + ExpirationTimeStamp = expirationTimeStamp; + } + + /// + /// New access token + /// + public global::System.String AccessToken { get; } + + /// + /// Player Account Id + /// + public global::System.Int64 AccountId { get; } + + /// + /// New expiration unix timestamp + /// + public global::System.Int32 ExpirationTimeStamp { get; } + + public virtual global::System.Boolean Equals(WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (AccessToken.Equals(other.AccessToken)) && AccountId == other.AccountId && ExpirationTimeStamp == other.ExpirationTimeStamp; + } + + 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((WargamingOpenIdAuthentication_ProlongAuthToken_WargamingProlongInfo)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * AccessToken.GetHashCode(); + hash ^= 397 * AccountId.GetHashCode(); + hash ^= 397 * ExpirationTimeStamp.GetHashCode(); + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..24cf7da --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,73 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenId GraphQL operation + /// + /// mutation WargamingOpenId($token: String!, $realmType: RealmType!) { + /// logout(realm: $realmType, token: $token) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdMutation : global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation + { + private readonly global::StrawberryShake.IOperationExecutor _operationExecutor; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _stringFormatter; + private readonly global::StrawberryShake.Serialization.IInputValueFormatter _realmTypeFormatter; + public WargamingOpenIdMutation(global::StrawberryShake.IOperationExecutor operationExecutor, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver) + { + _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor)); + _stringFormatter = serializerResolver.GetInputValueFormatter("String"); + _realmTypeFormatter = serializerResolver.GetInputValueFormatter("RealmType"); + } + + global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IWargamingOpenIdResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.String token, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(token, realmType); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::System.String token, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType, global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(token, realmType); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.String token, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType realmType) + { + var variables = new global::System.Collections.Generic.Dictionary(); + variables.Add("token", FormatToken(token)); + variables.Add("realmType", FormatRealmType(realmType)); + return CreateRequest(variables); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return new global::StrawberryShake.OperationRequest(id: WargamingOpenIdMutationDocument.Instance.Hash.Value, name: "WargamingOpenId", document: WargamingOpenIdMutationDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default, variables: variables); + } + + private global::System.Object? FormatToken(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); + } + + global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return CreateRequest(variables!); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..af91cc8 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,34 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingOpenId GraphQL operation + /// + /// mutation WargamingOpenId($token: String!, $realmType: RealmType!) { + /// logout(realm: $realmType, token: $token) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdMutationDocument : global::StrawberryShake.IDocument + { + private WargamingOpenIdMutationDocument() + { + } + + public static WargamingOpenIdMutationDocument Instance { get; } = new WargamingOpenIdMutationDocument(); + public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Mutation; + public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x57, 0x61, 0x72, 0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x28, 0x24, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 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, 0x29, 0x20, 0x7b, 0x20, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x28, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x3a, 0x20, 0x24, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x2c, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x20, 0x24, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x29, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "88f415f20c5c8613faf5d38870c8324c"); + public override global::System.String ToString() + { +#if NETSTANDARD2_0 + return global::System.Text.Encoding.UTF8.GetString(Body.ToArray()); +#else + return global::System.Text.Encoding.UTF8.GetString(Body); +#endif + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..099b94b --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingOpenIdResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,73 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingOpenIdResult : global::System.IEquatable, IWargamingOpenIdResult + { + public WargamingOpenIdResult(global::System.String logout) + { + Logout = logout; + } + + /// + /// Removes player's access token + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String Logout { get; } + + public virtual global::System.Boolean Equals(WargamingOpenIdResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (Logout.Equals(other.Logout)); + } + + 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((WargamingOpenIdResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * Logout.GetHashCode(); + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..79b98e6 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutation.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,51 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingPlayers GraphQL operation + /// + /// mutation WargamingPlayers { + /// removePlayerHistory(realm: RU, accountId: 12345) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersMutation : global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation + { + private readonly global::StrawberryShake.IOperationExecutor _operationExecutor; + public WargamingPlayersMutation(global::StrawberryShake.IOperationExecutor operationExecutor) + { + _operationExecutor = operationExecutor ?? throw new global::System.ArgumentNullException(nameof(operationExecutor)); + } + + global::System.Type global::StrawberryShake.IOperationRequestFactory.ResultType => typeof(IWargamingPlayersResult); + public async global::System.Threading.Tasks.Task> ExecuteAsync(global::System.Threading.CancellationToken cancellationToken = default) + { + var request = CreateRequest(); + return await _operationExecutor.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + + public global::System.IObservable> Watch(global::StrawberryShake.ExecutionStrategy? strategy = null) + { + var request = CreateRequest(); + return _operationExecutor.Watch(request, strategy); + } + + private global::StrawberryShake.OperationRequest CreateRequest() + { + return CreateRequest(null); + } + + private global::StrawberryShake.OperationRequest CreateRequest(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return new global::StrawberryShake.OperationRequest(id: WargamingPlayersMutationDocument.Instance.Hash.Value, name: "WargamingPlayers", document: WargamingPlayersMutationDocument.Instance, strategy: global::StrawberryShake.RequestStrategy.Default); + } + + global::StrawberryShake.OperationRequest global::StrawberryShake.IOperationRequestFactory.Create(global::System.Collections.Generic.IReadOnlyDictionary? variables) + { + return CreateRequest(); + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..5096210 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersMutationDocument.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,34 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + /// + /// Represents the operation service of the WargamingPlayers GraphQL operation + /// + /// mutation WargamingPlayers { + /// removePlayerHistory(realm: RU, accountId: 12345) + /// } + /// + /// + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersMutationDocument : global::StrawberryShake.IDocument + { + private WargamingPlayersMutationDocument() + { + } + + public static WargamingPlayersMutationDocument Instance { get; } = new WargamingPlayersMutationDocument(); + public global::StrawberryShake.OperationKind Kind => global::StrawberryShake.OperationKind.Mutation; + public global::System.ReadOnlySpan Body => new global::System.Byte[]{0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x57, 0x61, 0x72, 0x67, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x20, 0x7b, 0x20, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x28, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x3a, 0x20, 0x52, 0x55, 0x2c, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x3a, 0x20, 0x31, 0x32, 0x33, 0x34, 0x35, 0x29, 0x20, 0x7d}; + public global::StrawberryShake.DocumentHash Hash { get; } = new global::StrawberryShake.DocumentHash("md5Hash", "9e9dc9903157ecf352cf78698ecf670f"); + public override global::System.String ToString() + { +#if NETSTANDARD2_0 + return global::System.Text.Encoding.UTF8.GetString(Body.ToArray()); +#else + return global::System.Text.Encoding.UTF8.GetString(Body); +#endif + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs new file mode 100644 index 0000000..7410309 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/Generated/WargamingPlayersResult.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -0,0 +1,73 @@ +// +#nullable enable + +namespace WotBlitzStatisticsPro.Blazor.GraphQl +{ + [global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")] + public partial class WargamingPlayersResult : global::System.IEquatable, IWargamingPlayersResult + { + public WargamingPlayersResult(global::System.String removePlayerHistory) + { + RemovePlayerHistory = removePlayerHistory; + } + + /// + /// Removes player's acoount history from database + /// + /// + /// **Returns:** + /// Operation result + /// + public global::System.String RemovePlayerHistory { get; } + + public virtual global::System.Boolean Equals(WargamingPlayersResult? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + if (other.GetType() != GetType()) + { + return false; + } + + return (RemovePlayerHistory.Equals(other.RemovePlayerHistory)); + } + + 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((WargamingPlayersResult)obj); + } + + public override global::System.Int32 GetHashCode() + { + unchecked + { + int hash = 5; + hash ^= 397 * RemovePlayerHistory.GetHashCode(); + return hash; + } + } + } +} diff --git a/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs index 3b28d13..4b7b560 100644 --- a/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs +++ b/WotBlitzStatisticsPro.Blazor/Generated/WotBlitzStatisticsProClient.WotBlitzStatisticsProClient.StrawberryShake.cs @@ -11,20 +11,32 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl { private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery _findClans; private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery _findPlayers; + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery _wargamingAuthenticationQuery; + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation _wargamingOpenId; private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery _player; + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation _wargamingOpenIdAuthentication; + private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation _wargamingPlayers; private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation _updatePlayer; - public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery findClans, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery findPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery player, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation updatePlayer) + public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery findClans, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery findPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery wargamingAuthenticationQuery, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation wargamingOpenId, global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery player, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation wargamingOpenIdAuthentication, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation wargamingPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation updatePlayer) { _findClans = findClans ?? throw new global::System.ArgumentNullException(nameof(findClans)); _findPlayers = findPlayers ?? throw new global::System.ArgumentNullException(nameof(findPlayers)); + _wargamingAuthenticationQuery = wargamingAuthenticationQuery ?? throw new global::System.ArgumentNullException(nameof(wargamingAuthenticationQuery)); + _wargamingOpenId = wargamingOpenId ?? throw new global::System.ArgumentNullException(nameof(wargamingOpenId)); _player = player ?? throw new global::System.ArgumentNullException(nameof(player)); + _wargamingOpenIdAuthentication = wargamingOpenIdAuthentication ?? throw new global::System.ArgumentNullException(nameof(wargamingOpenIdAuthentication)); + _wargamingPlayers = wargamingPlayers ?? throw new global::System.ArgumentNullException(nameof(wargamingPlayers)); _updatePlayer = updatePlayer ?? throw new global::System.ArgumentNullException(nameof(updatePlayer)); } public static global::System.String ClientName => "WotBlitzStatisticsProClient"; public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery FindClans => _findClans; public global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery FindPlayers => _findPlayers; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery WargamingAuthenticationQuery => _wargamingAuthenticationQuery; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation WargamingOpenId => _wargamingOpenId; public global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery Player => _player; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation WargamingOpenIdAuthentication => _wargamingOpenIdAuthentication; + public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation WargamingPlayers => _wargamingPlayers; public global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation UpdatePlayer => _updatePlayer; } } diff --git a/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs index 251d017..a010b6a 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/GraphQlBackendService.cs @@ -50,14 +50,35 @@ namespace WotBlitzStatisticsPro.Blazor.Services return (playerInfo.Data?.AccountInfo, playerInfo.Data?.AccountMedals?.Sections); } - public Task GetWgLoginUrl(RealmType realmType) + public async Task GetWgLoginUrl(RealmType realmType) { - throw new System.NotImplementedException("Request for LoginUrl will be implemented soon"); + var loginUrl = await _client.WargamingAuthenticationQuery.ExecuteAsync(realmType); + CheckErrors(loginUrl.Errors); + + return loginUrl.Data?.LoginUrl; } - public Task ProlongToken(long accountId, string oldToken, RealmType realmType) + public async Task ProlongToken(string oldToken, RealmType realmType) { - throw new System.NotImplementedException(); + var prolongMutation = await _client.WargamingOpenIdAuthentication.ExecuteAsync(oldToken, realmType); + CheckErrors(prolongMutation.Errors); + + var backendProlongToken = prolongMutation.Data?.ProlongAuthToken; + + return new LoginInfo + { + AccountId = backendProlongToken?.AccountId ?? 0, + AccessToken = backendProlongToken?.AccessToken ?? string.Empty, + ExpiresAt = backendProlongToken?.ExpirationTimeStamp ?? 0, + }; + } + + public async Task Logout(string token, RealmType realmType) + { + var logoutMutation = await _client.WargamingOpenId.ExecuteAsync(token, realmType); + CheckErrors(logoutMutation.Errors); + + return logoutMutation.Data?.Logout; } public async Task CollectPlayerInfo(long accountId, RealmType realmType, string accessToken) diff --git a/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs b/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs index e20f045..880a320 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/IGraphQlBackendService.cs @@ -27,8 +27,11 @@ namespace WotBlitzStatisticsPro.Blazor.Services Task GetWgLoginUrl(RealmType realmType); Task ProlongToken( - long accountId, string oldToken, RealmType realmType); + + Task Logout( + string token, + RealmType realmType); } } \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/ILocalStorageService.cs b/WotBlitzStatisticsPro.Blazor/Services/ILocalStorageService.cs index 6a97086..55f2dcf 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/ILocalStorageService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/ILocalStorageService.cs @@ -10,5 +10,7 @@ namespace WotBlitzStatisticsPro.Blazor.Services Task GetItemAsync(string key); Task ReadSettings(); + + ValueTask DeleteItemAsync(string key); } } \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/LocalStorageService.cs b/WotBlitzStatisticsPro.Blazor/Services/LocalStorageService.cs index b1a55d5..3d3500c 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/LocalStorageService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/LocalStorageService.cs @@ -55,5 +55,10 @@ namespace WotBlitzStatisticsPro.Blazor.Services currentSettings.RealmType = notification.RealmType; await SetItemAsync(UserSettings.UserSettingsLocalStorageKey, currentSettings); } + + public ValueTask DeleteItemAsync(string key) + { + return _jsRuntime.InvokeVoidAsync("localStorage.removeItem", key); + } } } \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/Mock/GraphQlBackendMockService.cs b/WotBlitzStatisticsPro.Blazor/Services/Mock/GraphQlBackendMockService.cs index e0ecef3..80eacd2 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/Mock/GraphQlBackendMockService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/Mock/GraphQlBackendMockService.cs @@ -398,5 +398,15 @@ namespace WotBlitzStatisticsPro.Blazor.Services.Mock { return Task.CompletedTask; } + + public Task ProlongToken(string oldToken, RealmType realmType) + { + return Task.FromResult(new LoginInfo { AccessToken = oldToken, Realm = realmType, ExpiresAt = 1631182800, NickName = "Fake nick" }); + } + + public Task Logout(string token, RealmType realmType) + { + return Task.FromResult("Fake logout"); + } } } \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/Services/NavigationMessagesInterceptor.cs b/WotBlitzStatisticsPro.Blazor/Services/NavigationMessagesInterceptor.cs index be0d7c9..a3422d7 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/NavigationMessagesInterceptor.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/NavigationMessagesInterceptor.cs @@ -29,7 +29,7 @@ namespace WotBlitzStatisticsPro.Blazor.Services { await CheckExpirationDateAndProlongIfNeeded(); } - _navigationManager.NavigateTo($"/player/{notification.AccountId}"); + _navigationManager.NavigateTo($"/player/{notification.AccountId}", forceLoad: true); } private async Task CheckExpirationDateAndProlongIfNeeded() diff --git a/WotBlitzStatisticsPro.Blazor/Services/WargamingLoginService.cs b/WotBlitzStatisticsPro.Blazor/Services/WargamingLoginService.cs index 930f68e..649c5e5 100644 --- a/WotBlitzStatisticsPro.Blazor/Services/WargamingLoginService.cs +++ b/WotBlitzStatisticsPro.Blazor/Services/WargamingLoginService.cs @@ -14,7 +14,8 @@ namespace WotBlitzStatisticsPro.Blazor.Services INotificationHandler, INotificationHandler, INotificationHandler, - INotificationHandler + INotificationHandler, + INotificationHandler { private readonly IGraphQlBackendService _graphQlBackendService; private readonly DialogService _dialogService; @@ -73,10 +74,20 @@ namespace WotBlitzStatisticsPro.Blazor.Services public async Task Handle(ProlongWargamingAccessToken notification, CancellationToken cancellationToken) { var loggedInData = await _localStorage.GetItemAsync(Constants.LoginInfoLocalStorageKey); - var newLoginInfo = await _graphQlBackendService.ProlongToken(loggedInData.AccountId, loggedInData.AccessToken, loggedInData.Realm); + var newLoginInfo = await _graphQlBackendService.ProlongToken(loggedInData.AccessToken, loggedInData.Realm); loggedInData.AccessToken = newLoginInfo.AccessToken; loggedInData.ExpiresAt = newLoginInfo.ExpiresAt; await _localStorage.SetItemAsync(Constants.LoginInfoLocalStorageKey, loggedInData); } + + public async Task Handle(LogOutFromWgMessage notification, CancellationToken cancellationToken) + { + var loggedInData = await _localStorage.GetItemAsync(Constants.LoginInfoLocalStorageKey); + var logoutInfo = await _graphQlBackendService.Logout(loggedInData.AccessToken, loggedInData.Realm); + + await _localStorage.DeleteItemAsync(Constants.LoginInfoLocalStorageKey); + + _navigationManager.NavigateTo("/", forceLoad: true); + } } } \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/graphql/RemovePlayerHistory.graphql b/WotBlitzStatisticsPro.Blazor/graphql/RemovePlayerHistory.graphql new file mode 100644 index 0000000..9858f63 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/graphql/RemovePlayerHistory.graphql @@ -0,0 +1,3 @@ +mutation WargamingPlayers { + removePlayerHistory(realm: RU, accountId: 12345) +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/graphql/loginUrl.graphql b/WotBlitzStatisticsPro.Blazor/graphql/loginUrl.graphql new file mode 100644 index 0000000..0f2fcbd --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/graphql/loginUrl.graphql @@ -0,0 +1,3 @@ +query WargamingAuthenticationQuery($realmType: RealmType!) { + loginUrl(realmType: $realmType,) +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/graphql/logout.graphql b/WotBlitzStatisticsPro.Blazor/graphql/logout.graphql new file mode 100644 index 0000000..1ab89ed --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/graphql/logout.graphql @@ -0,0 +1,6 @@ +mutation WargamingOpenId( + $token: String!, + $realmType: RealmType!){ + logout (realm: $realmType, + token: $token) +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.Blazor/graphql/prolongAuthToken.graphql b/WotBlitzStatisticsPro.Blazor/graphql/prolongAuthToken.graphql new file mode 100644 index 0000000..c0cb889 --- /dev/null +++ b/WotBlitzStatisticsPro.Blazor/graphql/prolongAuthToken.graphql @@ -0,0 +1,11 @@ +mutation WargamingOpenIdAuthentication( + $oldToken: String!, + $realmType: RealmType!) { + prolongAuthToken( + oldToken: $oldToken, + realm: $realmType) { + accessToken + accountId + expirationTimeStamp + } +} \ No newline at end of file diff --git a/WotBlitzStatisticsPro.GraphQl/Mutation/WargamingAuthMutation.cs b/WotBlitzStatisticsPro.GraphQl/Mutation/WargamingAuthMutation.cs index ab15062..5e447e3 100644 --- a/WotBlitzStatisticsPro.GraphQl/Mutation/WargamingAuthMutation.cs +++ b/WotBlitzStatisticsPro.GraphQl/Mutation/WargamingAuthMutation.cs @@ -46,7 +46,7 @@ namespace WotBlitzStatisticsPro.GraphQl.Mutation /// Operation result public Task RemovePlayerHistory(RealmType realm, long accountId) { - return Task.FromResult("Metod it not implemented yet."); + return Task.FromResult("Metod is not implemented yet."); } } }