static public async Task <List <Customer> > GetCustomersAsync() { List <Customer> customers = new List <Customer>(); CustomersApi api = new CustomersApi(); string cursor = null; do { ListCustomersResponse resp = await api.ListCustomersAsync(cursor); customers.AddRange(resp.Customers); cursor = resp.Cursor; } while (cursor != null); return(customers); }
static public async Task <Customer> GetCustomer(string lastName, string firstName) { Customer retval = null; ListCustomersResponse resp = null; CustomersApi api = new CustomersApi(); string cursor = null; do { resp = await api.ListCustomersAsync(cursor); retval = resp.Customers.FirstOrDefault(c => c.FamilyName == lastName && c.GivenName == firstName); cursor = resp.Cursor; } while (retval == null && resp.Cursor != null); return(retval); }