mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-26 20:00:05 +01:00
feat: reorganized achevements queries and added client achievements request
This commit is contained in:
1 parent
8da5bdbfa8
commit
11b8b15a2a
37 files changed
+1940
-781
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
///<summary>Represents information about player's achievements</summary>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class AccountAchievementsResponseData
|
||||
{
|
||||
public AccountAchievementsResponseData(global::System.String __typename, global::System.Int64? accountId = default !, global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData>? sections = default !)
|
||||
{
|
||||
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
|
||||
AccountId = accountId;
|
||||
Sections = sections;
|
||||
}
|
||||
|
||||
public global::System.String __typename { get; }
|
||||
|
||||
///<summary>Player Id</summary>
|
||||
public global::System.Int64? AccountId { get; }
|
||||
|
||||
///<summary>Player Achievements by sections</summary>
|
||||
public global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData>? Sections { get; }
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
///<summary>Player's achievement information</summary>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class AchievementEntity
|
||||
{
|
||||
public AchievementEntity(global::System.String id = default !, global::System.String? name = default !, global::System.String? medalType = default !, global::System.String? condition = default !, global::System.String? description = default !, global::System.Int32 achievementValue = default !, global::System.Int32? maxSeriesValue = default !, global::System.String? image = default !, global::System.String? imageBig = default !, global::System.Int64? order = default !, global::System.String sectionId = default !)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
MedalType = medalType;
|
||||
Condition = condition;
|
||||
Description = description;
|
||||
AchievementValue = achievementValue;
|
||||
MaxSeriesValue = maxSeriesValue;
|
||||
Image = image;
|
||||
ImageBig = imageBig;
|
||||
Order = order;
|
||||
SectionId = sectionId;
|
||||
}
|
||||
|
||||
///<summary>Achievement Id</summary>
|
||||
public global::System.String Id { get; }
|
||||
|
||||
///<summary>Achievement name</summary>
|
||||
public global::System.String? Name { get; }
|
||||
|
||||
///<summary>Achievement type</summary>
|
||||
public global::System.String? MedalType { get; }
|
||||
|
||||
///<summary>Achievement condition</summary>
|
||||
public global::System.String? Condition { get; }
|
||||
|
||||
///<summary>Achievement description</summary>
|
||||
public global::System.String? Description { get; }
|
||||
|
||||
///<summary>Achievement value</summary>
|
||||
public global::System.Int32 AchievementValue { get; }
|
||||
|
||||
///<summary>Achievement max series value</summary>
|
||||
public global::System.Int32? MaxSeriesValue { get; }
|
||||
|
||||
///<summary>Achievement normal sized image</summary>
|
||||
public global::System.String? Image { get; }
|
||||
|
||||
///<summary>Achievement big image</summary>
|
||||
public global::System.String? ImageBig { get; }
|
||||
|
||||
///<summary>Order</summary>
|
||||
public global::System.Int64? Order { get; }
|
||||
|
||||
///<summary>Section Id</summary>
|
||||
public global::System.String SectionId { get; }
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
///<summary>Represents achievement section info and it's achievements list</summary>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class AchievementSectionData
|
||||
{
|
||||
public AchievementSectionData(global::System.String __typename, global::System.String? sectionId = default !, global::System.Int32? order = default !, global::System.String? name = default !, global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityId>? medals = default !)
|
||||
{
|
||||
this.__typename = __typename ?? throw new global::System.ArgumentNullException(nameof(__typename));
|
||||
SectionId = sectionId;
|
||||
Order = order;
|
||||
Name = name;
|
||||
Medals = medals;
|
||||
}
|
||||
|
||||
public global::System.String __typename { get; }
|
||||
|
||||
///<summary>Section Identifier</summary>
|
||||
public global::System.String? SectionId { get; }
|
||||
|
||||
///<summary>Section order</summary>
|
||||
public global::System.Int32? Order { get; }
|
||||
|
||||
///<summary>Section Name</summary>
|
||||
public global::System.String? Name { get; }
|
||||
|
||||
///<summary>Achievements in the section</summary>
|
||||
public global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityId>? Medals { get; }
|
||||
}
|
||||
}
|
||||
+103
-1
@@ -74,11 +74,13 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
var entityIds = new global::System.Collections.Generic.HashSet<global::StrawberryShake.EntityId>();
|
||||
global::StrawberryShake.IEntityStoreSnapshot snapshot = default !;
|
||||
global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData accountMedalsId = default !;
|
||||
_entityStore.Update(session =>
|
||||
{
|
||||
accountMedalsId = DeserializeNonNullableIPlayer_AccountMedals(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountMedals"), entityIds);
|
||||
snapshot = session.CurrentSnapshot;
|
||||
});
|
||||
var resultInfo = new PlayerResultInfo(DeserializeNonNullableIPlayer_AccountInfo(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountInfo")), entityIds, snapshot.Version);
|
||||
var resultInfo = new PlayerResultInfo(DeserializeNonNullableIPlayer_AccountInfo(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountInfo")), accountMedalsId, entityIds, snapshot.Version);
|
||||
return (_resultDataFactory.Create(resultInfo), resultInfo);
|
||||
}
|
||||
|
||||
@@ -255,5 +257,105 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
|
||||
return _booleanParser.Parse(obj.Value.GetBoolean()!);
|
||||
}
|
||||
|
||||
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData DeserializeNonNullableIPlayer_AccountMedals(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
throw new global::System.ArgumentNullException();
|
||||
}
|
||||
|
||||
var typename = obj.Value.GetProperty("__typename").GetString();
|
||||
if (typename?.Equals("AccountAchievementsResponse", global::System.StringComparison.Ordinal) ?? false)
|
||||
{
|
||||
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData(typename, accountId: DeserializeNonNullableInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "accountId")), sections: DeserializeIPlayer_AccountMedals_SectionsNonNullableArray(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "sections"), entityIds));
|
||||
}
|
||||
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData>? DeserializeIPlayer_AccountMedals_SectionsNonNullableArray(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var achievementSections = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData>();
|
||||
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
|
||||
{
|
||||
achievementSections.Add(DeserializeNonNullableIPlayer_AccountMedals_Sections(session, child, entityIds));
|
||||
}
|
||||
|
||||
return achievementSections;
|
||||
}
|
||||
|
||||
private global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData DeserializeNonNullableIPlayer_AccountMedals_Sections(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
throw new global::System.ArgumentNullException();
|
||||
}
|
||||
|
||||
var typename = obj.Value.GetProperty("__typename").GetString();
|
||||
if (typename?.Equals("AchievementSection", global::System.StringComparison.Ordinal) ?? false)
|
||||
{
|
||||
return new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData(typename, sectionId: DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "sectionId")), order: DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "order")), name: DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), medals: UpdateIPlayer_AccountMedals_Sections_MedalsEntityNonNullableArray(session, global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "medals"), entityIds));
|
||||
}
|
||||
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityId>? UpdateIPlayer_AccountMedals_Sections_MedalsEntityNonNullableArray(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var achievements = new global::System.Collections.Generic.List<global::StrawberryShake.EntityId>();
|
||||
foreach (global::System.Text.Json.JsonElement child in obj.Value.EnumerateArray())
|
||||
{
|
||||
achievements.Add(UpdateNonNullableIPlayer_AccountMedals_Sections_MedalsEntity(session, child, entityIds));
|
||||
}
|
||||
|
||||
return achievements;
|
||||
}
|
||||
|
||||
private global::StrawberryShake.EntityId UpdateNonNullableIPlayer_AccountMedals_Sections_MedalsEntity(global::StrawberryShake.IEntityStoreUpdateSession session, global::System.Text.Json.JsonElement? obj, global::System.Collections.Generic.ISet<global::StrawberryShake.EntityId> entityIds)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
throw new global::System.ArgumentNullException();
|
||||
}
|
||||
|
||||
global::StrawberryShake.EntityId entityId = _idSerializer.Parse(obj.Value);
|
||||
entityIds.Add(entityId);
|
||||
if (entityId.Name.Equals("Achievement", global::System.StringComparison.Ordinal))
|
||||
{
|
||||
if (session.CurrentSnapshot.TryGetEntity(entityId, out global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity? entity))
|
||||
{
|
||||
session.SetEntity(entityId, new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity(DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "medalType")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "condition")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description")), DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "achievementValue")), DeserializeInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "maxSeriesValue")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "image")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "imageBig")), DeserializeInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "order")), DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "sectionId"))));
|
||||
}
|
||||
else
|
||||
{
|
||||
session.SetEntity(entityId, new global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity(DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "id")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "name")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "medalType")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "condition")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "description")), DeserializeNonNullableInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "achievementValue")), DeserializeInt32(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "maxSeriesValue")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "image")), DeserializeString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "imageBig")), DeserializeInt64(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "order")), DeserializeNonNullableString(global::StrawberryShake.Json.JsonElementExtensions.GetPropertyOrNull(obj, "sectionId"))));
|
||||
}
|
||||
|
||||
return entityId;
|
||||
}
|
||||
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
private global::System.Int32? DeserializeInt32(global::System.Text.Json.JsonElement? obj)
|
||||
{
|
||||
if (!obj.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _intParser.Parse(obj.Value.GetInt32()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
+76
-2
@@ -7,9 +7,11 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
public partial class PlayerResultFactory : global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.PlayerResult>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
public PlayerResultFactory(global::StrawberryShake.IEntityStore entityStore)
|
||||
private readonly global::StrawberryShake.IEntityMapper<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity, Player_AccountMedals_Sections_Medals_Achievement> _player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper;
|
||||
public PlayerResultFactory(global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityMapper<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity, Player_AccountMedals_Sections_Medals_Achievement> player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
_player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper = player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper ?? throw new global::System.ArgumentNullException(nameof(player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper));
|
||||
}
|
||||
|
||||
global::System.Type global::StrawberryShake.IOperationResultDataFactory.ResultType => typeof(global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerResult);
|
||||
@@ -22,7 +24,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
|
||||
if (dataInfo is PlayerResultInfo info)
|
||||
{
|
||||
return new PlayerResult(MapNonNullableIPlayer_AccountInfo(info.AccountInfo, snapshot));
|
||||
return new PlayerResult(MapNonNullableIPlayer_AccountInfo(info.AccountInfo, snapshot), MapNonNullableIPlayer_AccountMedals(info.AccountMedals, snapshot));
|
||||
}
|
||||
|
||||
throw new global::System.ArgumentException("PlayerResultInfo expected.");
|
||||
@@ -94,6 +96,78 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals MapNonNullableIPlayer_AccountMedals(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
|
||||
{
|
||||
IPlayer_AccountMedals returnValue = default !;
|
||||
if (data.__typename.Equals("AccountAchievementsResponse", global::System.StringComparison.Ordinal))
|
||||
{
|
||||
returnValue = new Player_AccountMedals_AccountAchievementsResponse(data.AccountId ?? throw new global::System.ArgumentNullException(), MapIPlayer_AccountMedals_SectionsNonNullableArray(data.Sections, snapshot));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections>? MapIPlayer_AccountMedals_SectionsNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
|
||||
{
|
||||
if (list is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var achievementSections = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections>();
|
||||
foreach (global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData child in list)
|
||||
{
|
||||
achievementSections.Add(MapNonNullableIPlayer_AccountMedals_Sections(child, snapshot));
|
||||
}
|
||||
|
||||
return achievementSections;
|
||||
}
|
||||
|
||||
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections MapNonNullableIPlayer_AccountMedals_Sections(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementSectionData data, global::StrawberryShake.IEntityStoreSnapshot snapshot)
|
||||
{
|
||||
IPlayer_AccountMedals_Sections returnValue = default !;
|
||||
if (data.__typename.Equals("AchievementSection", global::System.StringComparison.Ordinal))
|
||||
{
|
||||
returnValue = new Player_AccountMedals_Sections_AchievementSection(data.SectionId ?? throw new global::System.ArgumentNullException(), data.Order ?? throw new global::System.ArgumentNullException(), data.Name ?? throw new global::System.ArgumentNullException(), MapIPlayer_AccountMedals_Sections_MedalsNonNullableArray(data.Medals, snapshot));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private global::System.Collections.Generic.IReadOnlyList<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections_Medals>? MapIPlayer_AccountMedals_Sections_MedalsNonNullableArray(global::System.Collections.Generic.IReadOnlyList<global::StrawberryShake.EntityId>? list, global::StrawberryShake.IEntityStoreSnapshot snapshot)
|
||||
{
|
||||
if (list is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var achievements = new global::System.Collections.Generic.List<global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections_Medals>();
|
||||
foreach (global::StrawberryShake.EntityId child in list)
|
||||
{
|
||||
achievements.Add(MapNonNullableIPlayer_AccountMedals_Sections_Medals(child, snapshot));
|
||||
}
|
||||
|
||||
return achievements;
|
||||
}
|
||||
|
||||
private global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayer_AccountMedals_Sections_Medals MapNonNullableIPlayer_AccountMedals_Sections_Medals(global::StrawberryShake.EntityId entityId, global::StrawberryShake.IEntityStoreSnapshot snapshot)
|
||||
{
|
||||
if (entityId.Name.Equals("Achievement", global::System.StringComparison.Ordinal))
|
||||
{
|
||||
return _player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper.Map(snapshot.GetEntity<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity>(entityId) ?? throw new global::StrawberryShake.GraphQLClientException());
|
||||
}
|
||||
|
||||
throw new global::System.NotSupportedException();
|
||||
}
|
||||
|
||||
global::System.Object global::StrawberryShake.IOperationResultDataFactory.Create(global::StrawberryShake.IOperationResultDataInfo dataInfo, global::StrawberryShake.IEntityStoreSnapshot? snapshot)
|
||||
{
|
||||
return Create(dataInfo, snapshot);
|
||||
|
||||
+8
-2
@@ -8,9 +8,10 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
private readonly global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> _entityIds;
|
||||
private readonly global::System.UInt64 _version;
|
||||
public PlayerResultInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountInfoResponseData accountInfo, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
public PlayerResultInfo(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountInfoResponseData accountInfo, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData accountMedals, global::System.Collections.Generic.IReadOnlyCollection<global::StrawberryShake.EntityId> entityIds, global::System.UInt64 version)
|
||||
{
|
||||
AccountInfo = accountInfo;
|
||||
AccountMedals = accountMedals;
|
||||
_entityIds = entityIds ?? throw new global::System.ArgumentNullException(nameof(entityIds));
|
||||
_version = version;
|
||||
}
|
||||
@@ -20,11 +21,16 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
/// </summary>
|
||||
public global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountInfoResponseData AccountInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns information about player's achievements
|
||||
/// </summary>
|
||||
public global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AccountAchievementsResponseData AccountMedals { 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 PlayerResultInfo(AccountInfo, _entityIds, version);
|
||||
return new PlayerResultInfo(AccountInfo, AccountMedals, _entityIds, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// <auto-generated/>
|
||||
#nullable enable
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
|
||||
public partial class Player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper : global::StrawberryShake.IEntityMapper<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity, Player_AccountMedals_Sections_Medals_Achievement>
|
||||
{
|
||||
private readonly global::StrawberryShake.IEntityStore _entityStore;
|
||||
public Player_AccountMedals_Sections_Medals_AchievementFromAchievementEntityMapper(global::StrawberryShake.IEntityStore entityStore)
|
||||
{
|
||||
_entityStore = entityStore ?? throw new global::System.ArgumentNullException(nameof(entityStore));
|
||||
}
|
||||
|
||||
public Player_AccountMedals_Sections_Medals_Achievement Map(global::WotBlitzStatisticsPro.Blazor.GraphQl.State.AchievementEntity entity, global::StrawberryShake.IEntityStoreSnapshot? snapshot = null)
|
||||
{
|
||||
if (snapshot is null)
|
||||
{
|
||||
snapshot = _entityStore.CurrentSnapshot;
|
||||
}
|
||||
|
||||
return new Player_AccountMedals_Sections_Medals_Achievement(entity.Id, entity.Name, entity.MedalType, entity.Condition, entity.Description, entity.AchievementValue, entity.MaxSeriesValue, entity.Image, entity.ImageBig, entity.Order, entity.SectionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-2
@@ -13,7 +13,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
global::System.String __typename = obj.GetProperty("__typename").GetString()!;
|
||||
return __typename switch
|
||||
{
|
||||
_ => throw new global::System.NotSupportedException()}
|
||||
"Achievement" => ParseAchievementEntityId(obj, __typename), _ => throw new global::System.NotSupportedException()}
|
||||
|
||||
;
|
||||
}
|
||||
@@ -22,9 +22,26 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
|
||||
{
|
||||
return entityId.Name switch
|
||||
{
|
||||
_ => throw new global::System.NotSupportedException()}
|
||||
"Achievement" => FormatAchievementEntityId(entityId), _ => throw new global::System.NotSupportedException()}
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
private global::StrawberryShake.EntityId ParseAchievementEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
|
||||
{
|
||||
return new global::StrawberryShake.EntityId(type, obj.GetProperty("id").GetString()!);
|
||||
}
|
||||
|
||||
private global::System.String FormatAchievementEntityId(global::StrawberryShake.EntityId entityId)
|
||||
{
|
||||
using var writer = new global::StrawberryShake.Internal.ArrayWriter();
|
||||
using var jsonWriter = new global::System.Text.Json.Utf8JsonWriter(writer, _options);
|
||||
jsonWriter.WriteStartObject();
|
||||
jsonWriter.WriteString("__typename", entityId.Name);
|
||||
jsonWriter.WriteString("id", (global::System.String)entityId.Value);
|
||||
jsonWriter.WriteEndObject();
|
||||
jsonWriter.Flush();
|
||||
return global::System.Text.Encoding.UTF8.GetString(writer.GetInternalBuffer(), 0, writer.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user