Some new data entities

This commit is contained in:
Mikhail Shabanov committed 2020-09-18 16:07:25 +02:00
1 parent 50ecb57591
commit 3eeda15491
8 files changed
+227 -6

No files matched your search

@@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Common.Model;
using WotBlitzStatisticsPro.WgApiClient.Model;
namespace WotBlitzStatisticsPro.WgApiClient
{
public interface IWargamingTanksApiClient
{
Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(long accountId,
RealmType realmType = RealmType.Ru,
RequestLanguage language = RequestLanguage.En);
}
}
@@ -0,0 +1,110 @@
using Newtonsoft.Json;
namespace WotBlitzStatisticsPro.WgApiClient.Model
{
public class WotAccountTanksFullStatistics
{
///<summary>
/// Battles count
///</summary>
[JsonProperty("battles")]
public long? Battles { get; set; }
///<summary>
/// Base capture points
///</summary>
[JsonProperty("capture_points")]
public long? CapturePoints { get; set; }
///<summary>
/// Damage dealt
///</summary>
[JsonProperty("damage_dealt")]
public long? DamageDealt { get; set; }
///<summary>
/// Damage received
///</summary>
[JsonProperty("damage_received")]
public long? DamageReceived { get; set; }
///<summary>
/// Base dropped capture points
///</summary>
[JsonProperty("dropped_capture_points")]
public long? DroppedCapturePoints { get; set; }
///<summary>
/// Frags count
///</summary>
[JsonProperty("frags")]
public long? Frags { get; set; }
///<summary>
/// Frags count after 8 tier
///</summary>
[JsonProperty("frags8p")]
public long? Frags8P { get; set; }
///<summary>
/// Hits count
///</summary>
[JsonProperty("hits")]
public long? Hits { get; set; }
///<summary>
/// Losses count
///</summary>
[JsonProperty("losses")]
public long? Losses { get; set; }
///<summary>
/// Max frags per battle
///</summary>
[JsonProperty("max_frags")]
public long? MaxFrags { get; set; }
///<summary>
/// Max XP per battle
///</summary>
[JsonProperty("max_xp")]
public long? MaxXp { get; set; }
///<summary>
/// Shots count
///</summary>
[JsonProperty("shots")]
public long? Shots { get; set; }
///<summary>
/// Spotted vehicles count
///</summary>
[JsonProperty("spotted")]
public long? Spotted { get; set; }
///<summary>
/// Amount of survived battles
///</summary>
[JsonProperty("survived_battles")]
public long? SurvivedBattles { get; set; }
///<summary>
/// Amount of survived and wined battles
///</summary>
[JsonProperty("win_and_survived")]
public long? WinAndSurvived { get; set; }
///<summary>
/// Wins count
///</summary>
[JsonProperty("wins")]
public long? Wins { get; set; }
///<summary>
/// Total experience
///</summary>
[JsonProperty("xp")]
public long? Xp { get; set; }
}
}
@@ -0,0 +1,59 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using WotBlitzStatisticsPro.Common.Model;
namespace WotBlitzStatisticsPro.WgApiClient.Model
{
public class WotAccountTanksStatistics
{
///<summary>
/// Player account identifier
///</summary>
[JsonProperty("account_id")]
public long AccountId { get; set; }
[JsonProperty("battle_life_time")]
public int BattleLifeTimeInSeconds { get; set; }
///<summary>
/// Last battle
///</summary>
[JsonProperty("last_battle_time")]
private int LastBattleTime { get; set; }
[JsonProperty("in_garage")]
public bool? InGarage { get; set; }
[JsonProperty("in_garage_updated")]
private int? InGarageUpdated { get; set; }
///<summary>
/// Mastery:
///
/// 0 — None
/// 1 — Rank 3
/// 2 — Rank 2
/// 3 — Rank 1
/// 4 — Mastery
///</summary>
[JsonProperty("mark_of_mastery")]
private long _markOfMastery { get; set; }
public MarkOfMastery MarkOfMastery => (MarkOfMastery)_markOfMastery;
///<summary>
/// Tank identifier
///</summary>
[JsonProperty("tank_id")]
public long TankId { get; set; }
///<summary>
/// Whole statistics
///</summary>
[JsonProperty("all")]
public WotAccountTanksFullStatistics All { get; set; }
[JsonProperty("frags")]
public Dictionary<string, string> Frags { get; set; }
}
}
@@ -10,7 +10,8 @@ namespace WotBlitzStatisticsPro.WgApiClient
{
public class WargamingApiClient : WagramingApiClientBase,
IWargamingApiClient,
IWargamingDictionariesApiClient
IWargamingDictionariesApiClient,
IWargamingTanksApiClient
{
public WargamingApiClient(
HttpClient httpClient,
@@ -141,7 +142,21 @@ namespace WotBlitzStatisticsPro.WgApiClient
// https://api.wotblitz.ru/wotb/encyclopedia/achievements/?application_id=adc1387489cf9fc8d9a1d85dbd27763d
#region Tanks methods
public async Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(
long accountId,
RealmType realmType = RealmType.Ru,
RequestLanguage language = RequestLanguage.En)
{
var tanks = await GetFromBlitzApi<Dictionary<string, List<WotAccountTanksStatistics>>>(
realmType,
language,
"tanks/stats/",
$"account_id={accountId}").ConfigureAwait(false);
return tanks[accountId.ToString()];
}
#endregion
}
}