2020-04-14 11:16:51 +02:00
|
|
|
using System.Collections.Generic;
|
2020-02-15 16:00:42 +03:00
|
|
|
using System.Threading.Tasks;
|
2020-04-14 11:16:51 +02:00
|
|
|
using WotBlitzStatisticsPro.Common.Model;
|
2020-02-15 16:00:42 +03:00
|
|
|
using WotBlitzStatisticsPro.WgApiClient;
|
|
|
|
|
|
|
|
|
|
namespace WotBlitzStatistics.GraphQl.Query
|
|
|
|
|
{
|
|
|
|
|
public class WotBlitzStatisticsQuery
|
|
|
|
|
{
|
|
|
|
|
private readonly IWargamingApiClient _wargamingApiClient;
|
|
|
|
|
|
|
|
|
|
public WotBlitzStatisticsQuery(IWargamingApiClient wargamingApiClient)
|
|
|
|
|
{
|
|
|
|
|
_wargamingApiClient = wargamingApiClient;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-14 11:16:51 +02:00
|
|
|
//public Task<AccountInfo> GetPlayerInfo(long accountId)
|
|
|
|
|
//{
|
|
|
|
|
// return _wargamingApiClient.GetPlayerAccountInfo(accountId);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public async Task<AccountsSearchResponse> FindAccounts(string accountNick)
|
2020-02-15 16:00:42 +03:00
|
|
|
{
|
2020-04-14 11:16:51 +02:00
|
|
|
var response = await _wargamingApiClient.FindAccounts(accountNick);
|
|
|
|
|
// ToDo: Use auto mapper
|
|
|
|
|
var result = new AccountsSearchResponse
|
|
|
|
|
{
|
|
|
|
|
AccountsCount = response.Count,
|
|
|
|
|
Accounts = new List<AccountsSearchResponseItem>()
|
|
|
|
|
};
|
|
|
|
|
response.ForEach(r => result.Accounts.Add(new AccountsSearchResponseItem {AccountId = r.AccountId.Value, Nickname = r.Nickname}));
|
|
|
|
|
return result;
|
2020-02-15 16:00:42 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|