mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-23 19:30:06 +02:00
feat: mutation metadatada added
This commit is contained in:
1 parent
7d1d1b5ad6
commit
64ad05dc92
17 files changed
+422
-36
No files matched your search
+83
@@ -0,0 +1,83 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class UpdatePlayerBuilder : global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
private readonly global::StrawberryShake.IEntityIdSerializer _idSerializer;
|
||||
private readonly global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult> _resultDataFactory;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType> _realmTypeParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage> _requestLanguageParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.Int64, global::System.Int64> _longParser;
|
||||
private readonly global::StrawberryShake.Serialization.ILeafValueParser<global::System.String, global::System.DateTimeOffset> _dateTimeParser;
|
||||
public UpdatePlayerBuilder(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer idSerializer, global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult> resultDataFactory, global::StrawberryShake.Serialization.ISerializerResolver serializerResolver)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
_idSerializer = idSerializer ?? throw new global::System.ArgumentNullException(nameof(idSerializer));
|
||||
_resultDataFactory = resultDataFactory ?? throw new global::System.ArgumentNullException(nameof(resultDataFactory));
|
||||
_realmTypeParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RealmType>("RealmType") ?? throw new global::System.ArgumentException("No serializer for type `RealmType` found.");
|
||||
_requestLanguageParser = serializerResolver.GetLeafValueParser<global::System.String, global::WotBlitzStatisticsPro.Blazor.GraphQl.RequestLanguage>("RequestLanguage") ?? throw new global::System.ArgumentException("No serializer for type `RequestLanguage` found.");
|
||||
_longParser = serializerResolver.GetLeafValueParser<global::System.Int64, global::System.Int64>("Long") ?? throw new global::System.ArgumentException("No serializer for type `Long` found.");
|
||||
_dateTimeParser = serializerResolver.GetLeafValueParser<global::System.String, global::System.DateTimeOffset>("DateTime") ?? throw new global::System.ArgumentException("No serializer for type `DateTime` found.");
|
||||
}
|
||||
|
||||
public global::StrawberryShake.IOperationResult<IUpdatePlayerResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
|
||||
{
|
||||
(IUpdatePlayerResult Result, UpdatePlayerResultInfo 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<IUpdatePlayerResult>(data?.Result, data?.Info, _resultDataFactory, errors);
|
||||
}
|
||||
|
||||
private (IUpdatePlayerResult, UpdatePlayerResultInfo) 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 UpdatePlayerResultInfo(DeserializeNonNullableDateTimeOffset(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "gatherAccountInformation")), entityIds, snapshot.Version);
|
||||
return (_resultDataFactory.Create(resultInfo), resultInfo);
|
||||
}
|
||||
|
||||
private global::System.DateTimeOffset DeserializeNonNullableDateTimeOffset(global::System.Text.Json.JsonElement? obj)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
throw new global::System.ArgumentNullException();
|
||||
}
|
||||
|
||||
return _dateTimeParser.Parse(obj.Value.GetString()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+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 UpdatePlayerResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.UpdatePlayerResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
public UpdatePlayerResultFactory(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.IUpdatePlayerResult);
|
||||
public UpdatePlayerResult Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
|
||||
{
|
||||
if (snapshot is null)
|
||||
{
|
||||
snapshot = _entityStore.CurrentSnapshot;
|
||||
}
|
||||
|
||||
if (dataInfo is UpdatePlayerResultInfo info)
|
||||
{
|
||||
return new UpdatePlayerResult(info.GatherAccountInformation);
|
||||
}
|
||||
|
||||
throw new global::System.ArgumentException("UpdatePlayerResultInfo 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 UpdatePlayerResultInfo : global::StrawberryShake.IOperationResultDataInfo
|
||||
{
|
||||
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public UpdatePlayerResultInfo(global::System.DateTimeOffset gatherAccountInformation, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
GatherAccountInformation = gatherAccountInformation;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gathers all account information
|
||||
/// </summary>
|
||||
public global::System.DateTimeOffset GatherAccountInformation { 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 UpdatePlayerResultInfo(GatherAccountInformation, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user