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

@@ -4,15 +4,17 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.OperationContex
{
public class AccountRequest
{
public AccountRequest(long accountId, RealmType realmType, RequestLanguage requestLanguage)
public AccountRequest(long accountId, RealmType realmType, RequestLanguage requestLanguage, string? authenticationToken = null)
{
AccountId = accountId;
RealmType = realmType;
RequestLanguage = requestLanguage;
AuthenticationToken = authenticationToken;
}
public long AccountId { get; }
public RealmType RealmType { get; }
public RequestLanguage RequestLanguage { get; }
public string? AuthenticationToken { get; }
}
}
@@ -29,7 +29,7 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
public async Task Invoke(IOperationContext context, Func<IOperationContext, Task>? next)
{
var accountInfo = await
_wargamingApi.GetPlayerAccountInfo(context.Request.AccountId, context.Request.RealmType, context.Request.RequestLanguage);
_wargamingApi.GetPlayerAccountInfo(context.Request.AccountId, context.Request.RealmType, context.Request.RequestLanguage, context.Request.AuthenticationToken);
if (accountInfo == null)
{
@@ -8,7 +8,7 @@ namespace WotBlitzStatisticsPro.Logic
{
Task<AccountInfoResponse> GatherAccountInformation(RealmType realm, long accountId, RequestLanguage requestLanguage);
Task<AccountInfoResponse> GatherAndSaveAccountInformation(RealmType realm, long accountId, RequestLanguage requestLanguage);
Task<AccountInfoResponse> GatherAndSaveAccountInformation(RealmType realm, long accountId, RequestLanguage requestLanguage, string wargamingToken);
Task<AccountInfoHistoryResponse> GetAccountInfoHistory(RealmType realm, long accountId, DateTime startDate,
RequestLanguage requestLanguage);
@@ -20,7 +20,9 @@ namespace WotBlitzStatisticsPro.Logic
_logger = logger;
}
public async Task<AccountInfoResponse> GatherAccountInformation(RealmType realm, long accountId,
public async Task<AccountInfoResponse> GatherAccountInformation(
RealmType realm,
long accountId,
RequestLanguage requestLanguage)
{
var contextData = new AccountInformationPipelineContextData();
@@ -56,13 +58,17 @@ namespace WotBlitzStatisticsPro.Logic
return contextData?.Response ?? new AccountInfoResponse();
}
public async Task<AccountInfoResponse> GatherAndSaveAccountInformation(RealmType realm, long accountId, RequestLanguage requestLanguage)
public async Task<AccountInfoResponse> GatherAndSaveAccountInformation(
RealmType realm,
long accountId,
RequestLanguage requestLanguage,
string wargamingToken)
{
var contextData = new AccountInformationPipelineContextData();
try
{
var context = new OperationContext(new AccountRequest(accountId, realm, requestLanguage));
var context = new OperationContext(new AccountRequest(accountId, realm, requestLanguage, wargamingToken));
context.AddOrReplace(contextData);
var pipeline = new Pipeline<IOperationContext>(_operationFactory);