using System; using System.Collections.Generic; using System.Threading.Tasks; using HotChocolate.Types; using Microsoft.Extensions.Logging; using WotBlitzStatisticsPro.Common.Model; using WotBlitzStatisticsPro.Logic; namespace WotBlitzStatisticsPro.GraphQl.Query { [ExtendObjectType(Name = "Query")] public class WotBlitzStatisticsQuery { // 571050560 - mboga Eu // 90277267 - Mboga Ru private readonly IWargamingSearch _wargamingSearcher; private readonly IWargamingAccounts _wargamingAccounts; public WotBlitzStatisticsQuery(IWargamingSearch wargamingSearcher, IWargamingAccounts wargamingAccounts) { _wargamingSearcher = wargamingSearcher; _wargamingAccounts = wargamingAccounts; } /// /// Finds Wargaming accounts by nick /// /// Search string. /// Wargaming Realm. /// Language for the output data. /// public Task?> Players( string accountNick, RealmType? realmType, RequestLanguage? language) { return _wargamingSearcher.FindAccounts(accountNick, realmType ?? RealmType.Ru, language ?? RequestLanguage.En); } /// /// Finds clans by search string /// /// Search string. /// Wargaming Realm. /// Language for the output data. /// public Task?> Clans( string searchString, RealmType? realmType, RequestLanguage? language) { return _wargamingSearcher.FindClans(searchString, realmType ?? RealmType.Ru, language ?? RequestLanguage.En); } /// /// Gathers all account information /// /// Account region /// AccountId /// Request language public Task AccountInfo( long accountId, RealmType? realmType, RequestLanguage? requestLanguage ) { return _wargamingAccounts.GatherAccountInformation(realmType ?? RealmType.Ru, accountId, requestLanguage ?? RequestLanguage.En); } /// /// Account statistics history for period since "startDate" /// /// AccountId /// Date from history started /// Account region /// Request language /// public Task AccountInfoHistory( long accountId, DateTime startDate, RealmType? realmType, RequestLanguage? requestLanguage) { return _wargamingAccounts.GetAccountInfoHistory(realmType ?? RealmType.Ru, accountId, startDate, requestLanguage ?? RequestLanguage.En); } /// /// Tank statistics history for period since "startDate" /// /// AccountId /// TankId /// Date from history started /// Account region /// Request language /// public Task TankInfoHistory( long accountId, long tankId, DateTime startDate, RealmType? realmType, RequestLanguage? requestLanguage) { return _wargamingAccounts.GetTankInfoHistory(realmType ?? RealmType.Ru, accountId, tankId, startDate, requestLanguage ?? RequestLanguage.En); } } }