feat: Passing Wargaming Token for Gather application mutation

This commit is contained in:
Mikhail Shabanov committed 2021-04-02 17:27:11 +02:00
1 parent 0b5da2f7c6
commit c9f933235c
8 files changed
+50 -17

No files matched your search

@@ -17,7 +17,8 @@ namespace WotBlitzStatisticsPro.WgApiClient
Task<WotAccountInfo?> GetPlayerAccountInfo(long accountId,
RealmType realmType = RealmType.Ru,
RequestLanguage language = RequestLanguage.En);
RequestLanguage language = RequestLanguage.En,
string? authenticationToken = null);
Task<ClanAccountInfo?> GetPlayerClanInfo(long accountId,
RealmType realmType = RealmType.Ru,
@@ -94,15 +94,24 @@ 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)
RequestLanguage language = RequestLanguage.En,
string? authenticationToken = null)
{
var account = await GetFromBlitzApi<Dictionary<string, WotAccountInfo>>(
realmType,
language,
"account/info/",
$"account_id={accountId}").ConfigureAwait(false);
var account = authenticationToken == null
? await GetFromBlitzApi<Dictionary<string, WotAccountInfo>>(
realmType,
language,
"account/info/",
$"account_id={accountId}").ConfigureAwait(false)
: await GetFromBlitzApi<Dictionary<string, WotAccountInfo>>(
realmType,
language,
"account/info/",
$"account_id={accountId}",
$"access_token={authenticationToken}").ConfigureAwait(false);
return account?[accountId.ToString()];
}