mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 11:50:05 +02:00
feat: implemented login-prolong-logout mechanisms
This commit is contained in:
1 parent
79a87d0d66
commit
241b879689
53 files changed
+1789
-13
No files matched your search
+79
@@ -0,0 +1,79 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingAuthenticationQueryBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
|
||||
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryResult> _resultDataFactory;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
|
||||
public WargamingAuthenticationQueryBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
|
||||
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
|
||||
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
|
||||
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
|
||||
}
|
||||
|
||||
public global::StrawberryShake.IOperationResult<IWargamingAuthenticationQueryResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
|
||||
{
|
||||
(IWargamingAuthenticationQueryResult Result, WargamingAuthenticationQueryResultInfo Info)? data = null;
|
||||
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
|
||||
if (response.Exception is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.Body != null)
|
||||
{
|
||||
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
|
||||
{
|
||||
data = BuildData(dataElement);
|
||||
}
|
||||
|
||||
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
|
||||
{
|
||||
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (global::System.Exception ex)
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
|
||||
return new global::StrawberryShake.OperationResult<IWargamingAuthenticationQueryResult>(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.EntityId>();
|
||||
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()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingAuthenticationQueryResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingAuthenticationQueryResult>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingAuthenticationQueryResultInfo : global::StrawberryShake.IOperationResultDataInfo
|
||||
{
|
||||
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public WargamingAuthenticationQueryResultInfo(global::System.String loginUrl, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
LoginUrl = loginUrl;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns authentication URL accourding Realm
|
||||
/// </summary>
|
||||
public global::System.String LoginUrl { get; }
|
||||
|
||||
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
|
||||
public global::System.UInt64 Version => _version;
|
||||
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
|
||||
{
|
||||
return new WargamingAuthenticationQueryResultInfo(LoginUrl, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingOpenIdAuthenticationBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
|
||||
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationResult> _resultDataFactory;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int32, global::System.Int32> _intParser;
|
||||
public WargamingOpenIdAuthenticationBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
|
||||
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
|
||||
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
|
||||
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
|
||||
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
|
||||
_intParser = serializerResolver.GetLeafValueParser<global::System.Int32, global::System.Int32>("Int") ?? throw new global::System.ArgumentException("No serializer for type `Int` found.");
|
||||
}
|
||||
|
||||
public global::StrawberryShake.IOperationResult<IWargamingOpenIdAuthenticationResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
|
||||
{
|
||||
(IWargamingOpenIdAuthenticationResult Result, WargamingOpenIdAuthenticationResultInfo Info)? data = null;
|
||||
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
|
||||
if (response.Exception is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.Body != null)
|
||||
{
|
||||
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
|
||||
{
|
||||
data = BuildData(dataElement);
|
||||
}
|
||||
|
||||
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
|
||||
{
|
||||
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (global::System.Exception ex)
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
|
||||
return new global::StrawberryShake.OperationResult<IWargamingOpenIdAuthenticationResult>(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.EntityId>();
|
||||
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()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingOpenIdAuthenticationResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingOpenIdAuthenticationResult>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingOpenIdAuthenticationResultInfo : global::StrawberryShake.IOperationResultDataInfo
|
||||
{
|
||||
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public WargamingOpenIdAuthenticationResultInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData prolongAuthToken, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
ProlongAuthToken = prolongAuthToken;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prolongates Wargaming authentication token
|
||||
/// </summary>
|
||||
public global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WargamingProlongInfoData ProlongAuthToken { get; }
|
||||
|
||||
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
|
||||
public global::System.UInt64 Version => _version;
|
||||
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
|
||||
{
|
||||
return new WargamingOpenIdAuthenticationResultInfo(ProlongAuthToken, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingOpenIdBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
|
||||
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdResult> _resultDataFactory;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
|
||||
public WargamingOpenIdBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
|
||||
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
|
||||
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
|
||||
_stringParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
|
||||
}
|
||||
|
||||
public global::StrawberryShake.IOperationResult<IWargamingOpenIdResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
|
||||
{
|
||||
(IWargamingOpenIdResult Result, WargamingOpenIdResultInfo Info)? data = null;
|
||||
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
|
||||
if (response.Exception is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.Body != null)
|
||||
{
|
||||
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
|
||||
{
|
||||
data = BuildData(dataElement);
|
||||
}
|
||||
|
||||
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
|
||||
{
|
||||
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (global::System.Exception ex)
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
|
||||
return new global::StrawberryShake.OperationResult<IWargamingOpenIdResult>(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.EntityId>();
|
||||
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()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingOpenIdResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingOpenIdResult>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// <auto-generated/>
|
||||
#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<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public WargamingOpenIdResultInfo(global::System.String logout, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
Logout = logout;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes player's access token
|
||||
///
|
||||
///
|
||||
/// **Returns:**
|
||||
/// Operation result
|
||||
/// </summary>
|
||||
public global::System.String Logout { get; }
|
||||
|
||||
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
|
||||
public global::System.UInt64 Version => _version;
|
||||
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
|
||||
{
|
||||
return new WargamingOpenIdResultInfo(Logout, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingPlayersBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
|
||||
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersResult> _resultDataFactory;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.String> _stringParser;
|
||||
public WargamingPlayersBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersResult> 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<global::System.String, global::System.String>("String") ?? throw new global::System.ArgumentException("No serializer for type `String` found.");
|
||||
}
|
||||
|
||||
public global::StrawberryShake.IOperationResult<IWargamingPlayersResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
|
||||
{
|
||||
(IWargamingPlayersResult Result, WargamingPlayersResultInfo Info)? data = null;
|
||||
global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.IClientError>? errors = null;
|
||||
if (response.Exception is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.Body != null)
|
||||
{
|
||||
if (response.Body.RootElement.TryGetProperty("data", out global::System.Text.Json.JsonElement dataElement) && dataElement.ValueKind == global::System.Text.Json.JsonValueKind.Object)
|
||||
{
|
||||
data = BuildData(dataElement);
|
||||
}
|
||||
|
||||
if (response.Body.RootElement.TryGetProperty("errors", out global::System.Text.Json.JsonElement errorsElement))
|
||||
{
|
||||
errors = global::StrawberryShake.Json.JsonErrorParser.ParseErrors(errorsElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (global::System.Exception ex)
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(ex.Message, exception: ex, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = new global::StrawberryShake.IClientError[]{new global::StrawberryShake.ClientError(response.Exception.Message, exception: response.Exception, extensions: new global::System.Collections.Generic.Dictionary<global::System.String, global::System.Object?>{{"body", response.Body?.RootElement.ToString()}})};
|
||||
}
|
||||
|
||||
return new global::StrawberryShake.OperationResult<IWargamingPlayersResult>(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.EntityId>();
|
||||
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()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class WargamingPlayersResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingPlayersResult>
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// <auto-generated/>
|
||||
#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<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public WargamingPlayersResultInfo(global::System.String removePlayerHistory, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
RemovePlayerHistory = removePlayerHistory;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes player's acoount history from database
|
||||
///
|
||||
///
|
||||
/// **Returns:**
|
||||
/// Operation result
|
||||
/// </summary>
|
||||
public global::System.String RemovePlayerHistory { get; }
|
||||
|
||||
public global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> EntityIds => _entityIds;
|
||||
public global::System.UInt64 Version => _version;
|
||||
public global::StrawberryShake.IOperationResultDataInfo WithVersion(global::System.UInt64 version)
|
||||
{
|
||||
return new WargamingPlayersResultInfo(RemovePlayerHistory, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
///<summary>Prolong Wargaming Auth token response</summary>
|
||||
[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; }
|
||||
|
||||
///<summary>New access token</summary>
|
||||
public global::System.String? AccessToken { get; }
|
||||
|
||||
///<summary>Player Account Id</summary>
|
||||
public global::System.Int64? AccountId { get; }
|
||||
|
||||
///<summary>New expiration unix timestamp</summary>
|
||||
public global::System.Int32? ExpirationTimeStamp { get; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user