/// <summary> /// Query receipts /// </summary> /// <param name="filter">Request filter parameters</param> /// <param name="cancellationToken"><see cref="CancellationToken"/></param> /// <returns><see cref="ReceiptInformation"/></returns> public IEnumerable <ReceiptInformation> GetReceipts(GetReceiptsFilter filter = null, CancellationToken cancellationToken = default) { string cursor = null; do { cancellationToken.ThrowIfCancellationRequested(); var batch = Query <ReceiptInformationResponse>("GET", null, filter.CreateRequestUrl(cursor), null); foreach (var item in batch.Items) { cancellationToken.ThrowIfCancellationRequested(); yield return(item); } cursor = batch.NextCursor; } while (!string.IsNullOrEmpty(cursor)); }
/// <summary> /// Query receipts /// </summary> /// <param name="filter">Request filter parameters</param> /// <param name="cancellationToken"><see cref="CancellationToken"/></param> /// <returns><see cref="ReceiptInformation"/></returns> public async IAsyncEnumerable <ReceiptInformation> GetReceiptsAsync(GetReceiptsFilter filter = null, [EnumeratorCancellation] CancellationToken cancellationToken = default) { string cursor = null; do { var batch = await QueryAsync <ReceiptInformationResponse>(HttpMethod.Get, null, filter.CreateRequestUrl(cursor), null, cancellationToken); foreach (var item in batch.Items) { cancellationToken.ThrowIfCancellationRequested(); yield return(item); } cursor = batch.NextCursor; } while (!string.IsNullOrEmpty(cursor)); }