Ejemplo n.º 1
0
        /// <summary>
        /// Returns a [cursor-paginated](#api-usage-cursor-pagination) list of
        /// your bank accounts.
        /// </summary>
        /// <param name="request">An optional `CustomerBankAccountListRequest` 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 customer bank account resources</returns>
        public Task <CustomerBankAccountListResponse> ListAsync(CustomerBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null)
        {
            request = request ?? new CustomerBankAccountListRequest();

            var urlParams = new List <KeyValuePair <string, object> >
            {
            };

            return(_goCardlessClient.ExecuteAsync <CustomerBankAccountListResponse>(HttpMethod.Get, "/customer_bank_accounts", urlParams, request, null, null, customiseRequestMessage));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a lazily enumerated list of customer bank accounts.
        /// This acts like the #list method, but paginates for you automatically.
        /// </summary>
        public IEnumerable <Task <IReadOnlyList <CustomerBankAccount> > > AllAsync(CustomerBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null)
        {
            request = request ?? new CustomerBankAccountListRequest();

            return(new TaskEnumerable <IReadOnlyList <CustomerBankAccount>, string>(async after =>
            {
                request.After = after;
                var list = await this.ListAsync(request, customiseRequestMessage);
                return Tuple.Create(list.CustomerBankAccounts, list.Meta?.Cursors?.After);
            }));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get a lazily enumerated list of customer bank accounts.
        /// This acts like the #list method, but paginates for you automatically.
        /// </summary>
        public IEnumerable <CustomerBankAccount> All(CustomerBankAccountListRequest request = null, RequestSettings customiseRequestMessage = null)
        {
            request = request ?? new CustomerBankAccountListRequest();

            string cursor = null;

            do
            {
                request.After = cursor;

                var result = Task.Run(() => ListAsync(request, customiseRequestMessage)).Result;
                foreach (var item in result.CustomerBankAccounts)
                {
                    yield return(item);
                }
                cursor = result.Meta?.Cursors?.After;
            } while (cursor != null);
        }