mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 03:40:07 +02:00
Some Data loader stuff
This commit is contained in:
1 parent
d643c323b3
commit
83628d21bd
5 files changed
+61
-14
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using GreenDonut;
|
||||
using WotBlitzStatisticsPro.WgApiClient;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
namespace WotBlitzStatistics.GraphQl.DataLoaders
|
||||
{
|
||||
public class ClanDataLoader : DataLoaderBase<long, ClanInfo>
|
||||
{
|
||||
private readonly IWargamingApiClient _wgApiClient;
|
||||
|
||||
public ClanDataLoader(IWargamingApiClient wgApiClient)
|
||||
{
|
||||
_wgApiClient = wgApiClient;
|
||||
}
|
||||
|
||||
protected override async Task<IReadOnlyList<Result<ClanInfo>>> FetchAsync(
|
||||
IReadOnlyList<long> keys,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var result = new List<Result<ClanInfo>>();
|
||||
foreach (var key in keys)
|
||||
{
|
||||
result.Add(await _wgApiClient.GetClanInfo(key));
|
||||
}
|
||||
|
||||
return result.AsReadOnly();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user