Lists

Get one page of a list, or every item in it.

A list is an iterator. Range over it for every item: it asks for the next page as you go, and stops at the first error.

Every item

for customer, err := range client.Customers.List(ctx, goomzo.CustomerListParams{Limit: 200}) {
	if err != nil {
		return err
	}
	syncCustomer(customer)
}

One page

page, err := client.Customers.ListPage(ctx, goomzo.CustomerListParams{Limit: 50})

page.Items      // up to 50 customers
page.NextCursor // "" on the last page; send it as Cursor for the next
page.Total      // how many match, on every page

Note: Limit sets the size of each page, up to 200. A larger page means fewer requests.

Next steps

Last updated