mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 10:27:18 +02:00
Nullable refernce types refactoring
This commit is contained in:
1 parent
e5c90e03d3
commit
e12734981b
85 files changed
+509
-351
No files matched your search
@@ -7,23 +7,23 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
{
|
||||
public interface IWargamingApiClient
|
||||
{
|
||||
Task<List<WotAccountListResponse>> FindAccounts(string nickName,
|
||||
Task<List<WotAccountListResponse>?> FindAccounts(string nickName,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<List<WotClanListResponse>> FindClans(string searchString,
|
||||
Task<List<WotClanListResponse>?> FindClans(string searchString,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<WotAccountInfo> GetPlayerAccountInfo(long accountId,
|
||||
Task<WotAccountInfo?> GetPlayerAccountInfo(long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<ClanAccountInfo> GetPlayerClanInfo(long accountId,
|
||||
Task<ClanAccountInfo?> GetPlayerClanInfo(long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<ClanInfo> GetClanInfo(long clanId,
|
||||
Task<ClanInfo?> GetClanInfo(long clanId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
}
|
||||
|
||||
@@ -8,16 +8,16 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
public interface IWargamingDictionariesApiClient
|
||||
{
|
||||
Task<(
|
||||
WotEncyclopediaInfoResponse,
|
||||
WotClanMembersDictionaryResponse)> GetStaticDictionariesAsync(
|
||||
WotEncyclopediaInfoResponse?,
|
||||
WotClanMembersDictionaryResponse?)> GetStaticDictionariesAsync(
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<List<WotEncyclopediaAchievementsResponse>> GetAchievementsDictionary(
|
||||
Task<List<WotEncyclopediaAchievementsResponse>?> GetAchievementsDictionary(
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
|
||||
Task<List<WotEncyclopediaVehiclesResponse>> GetVehicles(
|
||||
Task<List<WotEncyclopediaVehiclesResponse>?> GetVehicles(
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
{
|
||||
public interface IWargamingTanksApiClient
|
||||
{
|
||||
Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(long accountId,
|
||||
Task<List<WotAccountTanksStatistics>?> GetPlayerAccountTanksInfo(long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Account nick
|
||||
///</summary>
|
||||
[JsonProperty("account_name")]
|
||||
public string AccountName { get; set; }
|
||||
public string? AccountName { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// ClanId
|
||||
@@ -32,7 +32,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Player clan role
|
||||
///</summary>
|
||||
[JsonProperty("role")]
|
||||
public string Role { get; set; }
|
||||
public string? Role { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan color in HEX #RRGGBB
|
||||
///</summary>
|
||||
[JsonProperty("color")]
|
||||
public string Color { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Date of clan creation
|
||||
@@ -40,25 +40,25 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan creator nick
|
||||
///</summary>
|
||||
[JsonProperty("creator_name")]
|
||||
public string CreatorName { get; set; }
|
||||
public string? CreatorName { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan description
|
||||
///</summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Html Clan description
|
||||
///</summary>
|
||||
[JsonProperty("description_html")]
|
||||
public string DescriptionHtml { get; set; }
|
||||
public string? DescriptionHtml { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Is clan deleted. Actual info about deleted clan only in fields: clan_id, is_clan_disbanded, updated_at.
|
||||
///</summary>
|
||||
[JsonProperty("is_clan_disbanded")]
|
||||
public bool IsClanDisbanded { get; set; }
|
||||
public bool? IsClanDisbanded { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan commander accountId
|
||||
@@ -70,7 +70,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan commander nick
|
||||
///</summary>
|
||||
[JsonProperty("leader_name")]
|
||||
public string LeaderName { get; set; }
|
||||
public string? LeaderName { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan members count
|
||||
@@ -82,25 +82,25 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan motto
|
||||
///</summary>
|
||||
[JsonProperty("motto")]
|
||||
public string Motto { get; set; }
|
||||
public string? Motto { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan name
|
||||
///</summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Renamed clan name
|
||||
///</summary>
|
||||
[JsonProperty("old_name")]
|
||||
public string OldName { get; set; }
|
||||
public string? OldName { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Renamed clan tag
|
||||
///</summary>
|
||||
[JsonProperty("old_tag")]
|
||||
public string OldTag { get; set; }
|
||||
public string? OldTag { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan renaming time in UTC
|
||||
@@ -112,7 +112,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan tag
|
||||
///</summary>
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
public string? Tag { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan info updated at
|
||||
@@ -124,19 +124,19 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan emblems info
|
||||
///</summary>
|
||||
[JsonProperty("emblems")]
|
||||
public WgnClansInfoEmblems Emblems { get; set; }
|
||||
public WgnClansInfoEmblems? Emblems { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan members information. Depends on members_key field in request.
|
||||
///</summary>
|
||||
[JsonProperty("members")]
|
||||
public WgnClansInfoMembers Members { get; set; }
|
||||
public WgnClansInfoMembers? Members { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Private clan info
|
||||
///</summary>
|
||||
[JsonProperty("private")]
|
||||
public WgnClansInfoPrivate Private { get; set; }
|
||||
public WgnClansInfoPrivate? Private { get; set; }
|
||||
}
|
||||
|
||||
public class WgnClansInfoEmblems
|
||||
@@ -145,31 +145,31 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// 195x195 px Icons list
|
||||
///</summary>
|
||||
[JsonProperty("x195")]
|
||||
public Dictionary<string, string> X195 { get; set; }
|
||||
public Dictionary<string, string>? X195 { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 24x24 px Icons list
|
||||
///</summary>
|
||||
[JsonProperty("x24")]
|
||||
public Dictionary<string, string> X24 { get; set; }
|
||||
public Dictionary<string, string>? X24 { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 256x256 px Icons list
|
||||
///</summary>
|
||||
[JsonProperty("x256")]
|
||||
public Dictionary<string, string> X256 { get; set; }
|
||||
public Dictionary<string, string>? X256 { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 32x32 px Icons list
|
||||
///</summary>
|
||||
[JsonProperty("x32")]
|
||||
public Dictionary<string, string> X32 { get; set; }
|
||||
public Dictionary<string, string>? X32 { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 64x64 px Icons list
|
||||
///</summary>
|
||||
[JsonProperty("x64")]
|
||||
public Dictionary<string, string> X64 { get; set; }
|
||||
public Dictionary<string, string>? X64 { get; set; }
|
||||
}
|
||||
|
||||
public class WgnClansInfoMembers
|
||||
@@ -184,7 +184,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan member nick
|
||||
///</summary>
|
||||
[JsonProperty("account_name")]
|
||||
public string AccountName { get; set; }
|
||||
public string? AccountName { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Date of joining the clan
|
||||
@@ -196,19 +196,19 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan member role
|
||||
///</summary>
|
||||
[JsonProperty("role")]
|
||||
public string Role { get; set; }
|
||||
public string? Role { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Localized member role
|
||||
///</summary>
|
||||
[JsonProperty("role_i18n")]
|
||||
public string RoleI18n { get; set; }
|
||||
public string? RoleI18n { get; set; }
|
||||
}
|
||||
|
||||
public class WgnClansInfoPrivate
|
||||
{
|
||||
[JsonProperty("online_members")]
|
||||
public int[] OnlineMembers { get; set; }
|
||||
public int[]? OnlineMembers { get; set; }
|
||||
|
||||
[JsonProperty("treasury")]
|
||||
public long? Treasury { get; set; }
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Player's nick
|
||||
///</summary>
|
||||
[JsonProperty("nickname")]
|
||||
public string Nickname { get; set; }
|
||||
public string? Nickname { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Player information update date
|
||||
@@ -38,12 +38,12 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Private account data
|
||||
///</summary>
|
||||
[JsonProperty("private")]
|
||||
public WotAccountPrivateInfo Private { get; set; }
|
||||
public WotAccountPrivateInfo? Private { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Player's statistics
|
||||
///</summary>
|
||||
[JsonProperty("statistics")]
|
||||
public WotAccountStatistics Statistics { get; set; }
|
||||
public WotAccountStatistics? Statistics { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,6 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Player nick
|
||||
///</summary>
|
||||
[JsonProperty("nickname")]
|
||||
public string Nickname { get; set; }
|
||||
public string? Nickname { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Account ban info
|
||||
///</summary>
|
||||
[JsonProperty("ban_info")]
|
||||
public string BanInfo { get; set; }
|
||||
public string? BanInfo { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Account ban expiration date
|
||||
@@ -47,23 +47,22 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
public bool IsPremium { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Premium accunt expiration time
|
||||
/// Premium account expiration time
|
||||
///</summary>
|
||||
[JsonProperty("premium_expires_at")]
|
||||
private int? PremiumExpiresAt { get; set; }
|
||||
|
||||
///<summary>
|
||||
///Группы контактов.
|
||||
///Дополнительное поле.
|
||||
/// Group of contacts.
|
||||
///</summary>
|
||||
[JsonProperty("grouped_contacts")]
|
||||
public WotAccountPrivateInfoGroupedContacts GroupedContacts { get; set; }
|
||||
public WotAccountPrivateInfoGroupedContacts? GroupedContacts { get; set; }
|
||||
|
||||
///<summary>
|
||||
///Ограничения аккаунта
|
||||
/// Account restrictions
|
||||
///</summary>
|
||||
[JsonProperty("restrictions")]
|
||||
public WotAccountPrivateInfoRestrictions Restrictions { get; set; }
|
||||
public WotAccountPrivateInfoRestrictions? Restrictions { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,18 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Blocked accountIds
|
||||
///</summary>
|
||||
[JsonProperty("blocked")]
|
||||
public int[] Blocked { get; set; }
|
||||
public int[]? Blocked { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Groups
|
||||
///</summary>
|
||||
[JsonProperty("groups")]
|
||||
public Dictionary<string, string> Groups { get; set; }
|
||||
public Dictionary<string, string>? Groups { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Ungrouped accountIds
|
||||
///</summary>
|
||||
[JsonProperty("ungrouped")]
|
||||
public int[] Ungrouped { get; set; }
|
||||
public int[]? Ungrouped { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Amount of destroyed by player tanks.
|
||||
///</summary>
|
||||
[JsonProperty("frags")]
|
||||
public Dictionary<string, string> Frags { get; set; }
|
||||
public Dictionary<string, string>? Frags { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Full player's statistics
|
||||
///</summary>
|
||||
[JsonProperty("all")]
|
||||
public WotAccountFullStatistics All { get; set; }
|
||||
public WotAccountFullStatistics? All { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -50,10 +50,10 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Whole statistics
|
||||
///</summary>
|
||||
[JsonProperty("all")]
|
||||
public WotAccountTanksFullStatistics All { get; set; }
|
||||
public WotAccountTanksFullStatistics? All { get; set; }
|
||||
|
||||
[JsonProperty("frags")]
|
||||
public Dictionary<string, string> Frags { get; set; }
|
||||
public Dictionary<string, string>? Frags { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,13 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan Tag
|
||||
///</summary>
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
public string? Tag { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan Name
|
||||
///</summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Clan created at. (UNIX Epoch time)
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Clan roles list
|
||||
/// </summary>
|
||||
[JsonProperty("clans_roles")]
|
||||
public Dictionary<string, string> ClanRoles { get; set; }
|
||||
public Dictionary<string, string>? ClanRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Clan settings list
|
||||
/// </summary>
|
||||
[JsonProperty("settings")]
|
||||
public Dictionary<string, string> Settings { get; set; }
|
||||
public Dictionary<string, string>? Settings { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,43 +6,43 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
public class WotEncyclopediaAchievementsResponse
|
||||
{
|
||||
[JsonProperty("achievement_id")]
|
||||
public string AchievementId { get; set; }
|
||||
public string? AchievementId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement condition
|
||||
///</summary>
|
||||
[JsonProperty("condition")]
|
||||
public string Condition { get; set; }
|
||||
public string? Condition { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement description
|
||||
///</summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Historical info
|
||||
///</summary>
|
||||
[JsonProperty("hero_info")]
|
||||
public string HeroInfo { get; set; }
|
||||
public string? HeroInfo { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image link
|
||||
///</summary>
|
||||
[JsonProperty("image")]
|
||||
public string Image { get; set; }
|
||||
public string? Image { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image 180x180px link
|
||||
///</summary>
|
||||
[JsonProperty("image_big")]
|
||||
public string ImageBig { get; set; }
|
||||
public string? ImageBig { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement name
|
||||
///</summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Sort order
|
||||
@@ -60,7 +60,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Achievement section
|
||||
///</summary>
|
||||
[JsonProperty("section")]
|
||||
public string Section { get; set; }
|
||||
public string? Section { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement section order
|
||||
@@ -72,13 +72,13 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Achievement Type
|
||||
///</summary>
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
public string? Type { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement options
|
||||
///</summary>
|
||||
[JsonProperty("options")]
|
||||
public WotEncyclopediaAchievementsOptions[] Options { get; set; }
|
||||
public WotEncyclopediaAchievementsOptions[]? Options { get; set; }
|
||||
}
|
||||
|
||||
public class WotEncyclopediaAchievementsOptions
|
||||
@@ -88,21 +88,21 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Achievement description
|
||||
///</summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image link
|
||||
///</summary>
|
||||
[JsonProperty("image")]
|
||||
public string Image { get; set; }
|
||||
public string? Image { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image 180x180px link
|
||||
///</summary>
|
||||
[JsonProperty("image_big")]
|
||||
public string ImageBig { get; set; }
|
||||
public string? ImageBig { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,13 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Game client version
|
||||
///</summary>
|
||||
[JsonProperty("game_version")]
|
||||
public string GameVersion { get; set; }
|
||||
public string? GameVersion { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// List of supported languages
|
||||
///</summary>
|
||||
[JsonProperty("languages")]
|
||||
public Dictionary<string, string> Languages { get; set; }
|
||||
public Dictionary<string, string>? Languages { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Encyclopedia last update time
|
||||
@@ -28,25 +28,25 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Cru clan role
|
||||
///</summary>
|
||||
[JsonProperty("vehicle_crew_roles")]
|
||||
public Dictionary<string, string> VehicleCrewRoles { get; set; }
|
||||
public Dictionary<string, string>? VehicleCrewRoles { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle nations dictionary
|
||||
///</summary>
|
||||
[JsonProperty("vehicle_nations")]
|
||||
public Dictionary<string, string> VehicleNations { get; set; }
|
||||
public Dictionary<string, string>? VehicleNations { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle types dictionary
|
||||
///</summary>
|
||||
[JsonProperty("vehicle_types")]
|
||||
public Dictionary<string, string> VehicleTypes { get; set; }
|
||||
public Dictionary<string, string>? VehicleTypes { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievements sections
|
||||
///</summary>
|
||||
[JsonProperty("achievement_sections")]
|
||||
public Dictionary<string, WotEncyclopediaInfoAchievementSection> AchievementSections { get; set; }
|
||||
public Dictionary<string, WotEncyclopediaInfoAchievementSection>? AchievementSections { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Achievements section name
|
||||
///</summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement section order
|
||||
|
||||
@@ -9,19 +9,19 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Vehicle description
|
||||
///</summary>
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Engines id list
|
||||
///</summary>
|
||||
[JsonProperty("engines")]
|
||||
public int[] Engines { get; set; }
|
||||
public int[]? Engines { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Guns id list
|
||||
///</summary>
|
||||
[JsonProperty("guns")]
|
||||
public int[] Guns { get; set; }
|
||||
public int[]? Guns { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Is vehicle premium
|
||||
@@ -33,13 +33,13 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Vehicle name
|
||||
///</summary>
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
public string? Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle nationId
|
||||
///</summary>
|
||||
[JsonProperty("nation")]
|
||||
public string Nation { get; set; }
|
||||
public string? Nation { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// List of next vehicles in tree:
|
||||
@@ -48,26 +48,26 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// value - amount of XP to open it
|
||||
///</summary>
|
||||
[JsonProperty("next_tanks")]
|
||||
public Dictionary<string, string> NextTanks { get; set; }
|
||||
public Dictionary<string, string>? NextTanks { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle cost by pairs
|
||||
/// with keys: price_credit, price_gold
|
||||
///</summary>
|
||||
[JsonProperty("cost")]
|
||||
public Dictionary<string, string> Cost { get; set; }
|
||||
public Dictionary<string, string>? Cost { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Price in XP for parent vehicle as key
|
||||
///</summary>
|
||||
[JsonProperty("prices_xp")]
|
||||
public Dictionary<string, string> PricesXp { get; set; }
|
||||
public Dictionary<string, string>? PricesXp { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// List of compatible suspensions
|
||||
///</summary>
|
||||
[JsonProperty("suspensions")]
|
||||
public int[] Suspensions { get; set; }
|
||||
public int[]? Suspensions { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// VehicleId
|
||||
@@ -85,13 +85,13 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// List of compatible turrets ids
|
||||
///</summary>
|
||||
[JsonProperty("turrets")]
|
||||
public int[] Turrets { get; set; }
|
||||
public int[]? Turrets { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle type id
|
||||
///</summary>
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
public string? Type { get; set; }
|
||||
|
||||
/////<summary>
|
||||
///// Default vehicle profile
|
||||
@@ -104,7 +104,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
||||
/// Keys: preview, normal
|
||||
///</summary>
|
||||
[JsonProperty("images")]
|
||||
public Dictionary<string, string> Images { get; set; }
|
||||
public Dictionary<string, string>? Images { get; set; }
|
||||
|
||||
/////<summary>
|
||||
///// Information about investigated modules
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace WotBlitzStatisticsPro.WgApiClient
|
||||
{
|
||||
internal class ResponseBody<T>
|
||||
internal class ResponseBody<T> where T: class
|
||||
{
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; }
|
||||
public string? Status { get; set; }
|
||||
|
||||
[JsonProperty("meta")]
|
||||
public Meta Meta { get; set; }
|
||||
public Meta? Meta { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public T Data { get; set; }
|
||||
public T? Data { get; set; }
|
||||
|
||||
[JsonProperty("error")]
|
||||
public Error Error { get; set; }
|
||||
public Error? Error { get; set; }
|
||||
}
|
||||
|
||||
internal class Meta
|
||||
@@ -26,15 +28,15 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
internal class Error
|
||||
{
|
||||
[JsonProperty("field")]
|
||||
public string Field { get; set; }
|
||||
public string? Field { get; set; }
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string Message { get; set; }
|
||||
public string? Message { get; set; }
|
||||
|
||||
[JsonProperty("code")]
|
||||
public string Code { get; set; }
|
||||
public string? Code { get; set; }
|
||||
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
@@ -36,11 +37,11 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
_wotApiUrls[RealmType.Asia] = "https://api.worldoftanks.asia/wot/";
|
||||
}
|
||||
|
||||
protected async Task<T> GetFromBlitzApi<T>(
|
||||
protected async Task<T?> GetFromBlitzApi<T>(
|
||||
RealmType realmType,
|
||||
RequestLanguage language,
|
||||
string method,
|
||||
params string[] queryParameters)
|
||||
params string[] queryParameters) where T: class
|
||||
{
|
||||
string uri = GetUri(realmType, language, method, queryParameters);
|
||||
|
||||
@@ -52,18 +53,20 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
var responseString = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var responseBody = JsonConvert.DeserializeObject<ResponseBody<T>>(responseString);
|
||||
if (responseBody.Status == "ok")
|
||||
{
|
||||
return responseBody.Data;
|
||||
}
|
||||
if (responseBody.Status == "error")
|
||||
{
|
||||
var error = responseBody.Error;
|
||||
var message = $"Field:{error.Field} Message:{error.Message} Value:{error.Value} Code:{error.Code}";
|
||||
throw new ArgumentException(message);
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
switch (responseBody.Status)
|
||||
{
|
||||
case "ok":
|
||||
return responseBody.Data;
|
||||
case "error":
|
||||
{
|
||||
var error = responseBody.Error;
|
||||
var message = $"Field:{(error?.Field ?? "undefined")} Message:{(error?.Message ?? "undefined")} Value:{(error?.Value ?? "undefined")} Code:{(error?.Code ?? "undefined")}";
|
||||
throw new ArgumentException(message);
|
||||
}
|
||||
default:
|
||||
throw new ArgumentException($"Unexpected response body status '{responseBody.Status}'");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetUri(RealmType realmType, RequestLanguage language, string method, string[] queryParameters)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
}
|
||||
|
||||
#region Search methods
|
||||
public async Task<List<WotAccountListResponse>> FindAccounts(string nickName,
|
||||
public async Task<List<WotAccountListResponse>?> FindAccounts(string nickName,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
$"search={nickName}").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<List<WotClanListResponse>> FindClans(string searchString,
|
||||
public async Task<List<WotClanListResponse>?> FindClans(string searchString,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
@@ -47,8 +47,8 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
#region Encyclopedia methods
|
||||
|
||||
public async Task<(
|
||||
WotEncyclopediaInfoResponse,
|
||||
WotClanMembersDictionaryResponse)> GetStaticDictionariesAsync(
|
||||
WotEncyclopediaInfoResponse?,
|
||||
WotClanMembersDictionaryResponse?)> GetStaticDictionariesAsync(
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
@@ -67,24 +67,24 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
return (encyclopedia, clanGlossaryResponse);
|
||||
}
|
||||
|
||||
public async Task<List<WotEncyclopediaAchievementsResponse>> GetAchievementsDictionary(RealmType realmType = RealmType.Ru, RequestLanguage language = RequestLanguage.En)
|
||||
public async Task<List<WotEncyclopediaAchievementsResponse>?> GetAchievementsDictionary(RealmType realmType = RealmType.Ru, RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
var response = await GetFromBlitzApi<Dictionary<string, WotEncyclopediaAchievementsResponse>>(
|
||||
realmType,
|
||||
language,
|
||||
"encyclopedia/achievements/").ConfigureAwait(false);
|
||||
|
||||
return response.Values.ToList();
|
||||
return response?.Values.ToList();
|
||||
}
|
||||
|
||||
public async Task<List<WotEncyclopediaVehiclesResponse>> GetVehicles(RealmType realmType = RealmType.Ru, RequestLanguage language = RequestLanguage.En)
|
||||
public async Task<List<WotEncyclopediaVehiclesResponse>?> GetVehicles(RealmType realmType = RealmType.Ru, RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
var response = await GetFromBlitzApi<Dictionary<string, WotEncyclopediaVehiclesResponse>>(
|
||||
realmType,
|
||||
language,
|
||||
"encyclopedia/vehicles/").ConfigureAwait(false);
|
||||
|
||||
return response.Values.ToList();
|
||||
return response?.Values.ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -94,7 +94,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
|
||||
|
||||
|
||||
public async Task<WotAccountInfo> GetPlayerAccountInfo(long accountId,
|
||||
public async Task<WotAccountInfo?> GetPlayerAccountInfo(long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
@@ -103,10 +103,10 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
language,
|
||||
"account/info/",
|
||||
$"account_id={accountId}").ConfigureAwait(false);
|
||||
return account[accountId.ToString()];
|
||||
return account?[accountId.ToString()];
|
||||
}
|
||||
|
||||
public async Task<ClanAccountInfo> GetPlayerClanInfo(long accountId,
|
||||
public async Task<ClanAccountInfo?> GetPlayerClanInfo(long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
{
|
||||
@@ -115,14 +115,14 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
language,
|
||||
"clans/accountinfo/",
|
||||
$"account_id={accountId}").ConfigureAwait(false);
|
||||
if (clanInfo.ContainsKey(accountId.ToString()))
|
||||
if (clanInfo != null && clanInfo.ContainsKey(accountId.ToString()))
|
||||
{
|
||||
return clanInfo[accountId.ToString()];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<ClanInfo> GetClanInfo(
|
||||
public async Task<ClanInfo?> GetClanInfo(
|
||||
long clanId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
@@ -132,7 +132,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
language,
|
||||
"clans/info/",
|
||||
$"clan_id={clanId}").ConfigureAwait(false);
|
||||
if (clanInfo.ContainsKey(clanId.ToString()))
|
||||
if (clanInfo != null && clanInfo.ContainsKey(clanId.ToString()))
|
||||
{
|
||||
return clanInfo[clanId.ToString()];
|
||||
}
|
||||
@@ -144,7 +144,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
|
||||
#region Tanks methods
|
||||
|
||||
public async Task<List<WotAccountTanksStatistics>> GetPlayerAccountTanksInfo(
|
||||
public async Task<List<WotAccountTanksStatistics>?> GetPlayerAccountTanksInfo(
|
||||
long accountId,
|
||||
RealmType realmType = RealmType.Ru,
|
||||
RequestLanguage language = RequestLanguage.En)
|
||||
@@ -154,7 +154,7 @@ namespace WotBlitzStatisticsPro.WgApiClient
|
||||
language,
|
||||
"tanks/stats/",
|
||||
$"account_id={accountId}").ConfigureAwait(false);
|
||||
return tanks[accountId.ToString()] ?? new List<WotAccountTanksStatistics>();
|
||||
return tanks?[accountId.ToString()] ?? new List<WotAccountTanksStatistics>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in new issue
Block a user