public IAsyncEnumerable <string> GetJsonSkinsByIds( IReadOnlyCollection <int> itemIds, IProgress <ICollectionContext>?progress = default, CancellationToken cancellationToken = default ) { var producer = SplitQuery.Create <int, string>( async(range, ct) => { var request = new BulkRequest("/v2/skins") { Ids = range }; var json = await request.SendAsync(http, ct); return(json.Indent(false) .RootElement.EnumerateArray() .Select( item => item.ToString() ?? throw new InvalidOperationException("Unexpected null in JSON array.") ) .ToList()); }, progress ); return(producer.QueryAsync(itemIds, cancellationToken: cancellationToken)); }
public async Task <List <string> > GetAllJsonFloors(int continentId) { var request = new BulkRequest($"/v2/continents/{continentId}/floors"); var json = await request.SendAsync(http, CancellationToken.None).ConfigureAwait(false); return(json.Indent(false) .RootElement.EnumerateArray() .Select( item => item.ToString() ?? throw new InvalidOperationException("Unexpected null in JSON array.") ) .ToList()); }