/// <summary> /// Returns a [cursor-paginated](#api-usage-cursor-pagination) list of /// your creditor bank accounts. /// </summary> /// <param name="request">An optional `CreditorBankAccountListRequest` representing the query parameters for this list request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A set of creditor bank account resources</returns> public Task <CreditorBankAccountListResponse> ListAsync(CreditorBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new CreditorBankAccountListRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <CreditorBankAccountListResponse>("GET", "/creditor_bank_accounts", urlParams, request, null, null, customiseRequestMessage)); }
/// <summary> /// Get a lazily enumerated list of creditor bank accounts. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <Task <IReadOnlyList <CreditorBankAccount> > > AllAsync(CreditorBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new CreditorBankAccountListRequest(); return(new TaskEnumerable <IReadOnlyList <CreditorBankAccount>, string>(async after => { request.After = after; var list = await this.ListAsync(request, customiseRequestMessage); return Tuple.Create(list.CreditorBankAccounts, list.Meta?.Cursors?.After); })); }
/// <summary> /// Get a lazily enumerated list of creditor bank accounts. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <CreditorBankAccount> All(CreditorBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new CreditorBankAccountListRequest(); string cursor = null; do { request.After = cursor; var result = Task.Run(() => ListAsync(request, customiseRequestMessage)).Result; foreach (var item in result.CreditorBankAccounts) { yield return(item); } cursor = result.Meta?.Cursors?.After; } while (cursor != null); }