Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List API changes #322

Merged
merged 6 commits into from
Jun 19, 2023
Merged

List API changes #322

merged 6 commits into from
Jun 19, 2023

Conversation

Pimm
Copy link
Collaborator

@Pimm Pimm commented Jun 19, 2023

Plain array return types

Changed the return type of methods.list, orderShipments.list, and permissions.list to (plain) arrays.

Previously, the object returned by those methods had optional properties, including nextPage:

const methods = await methods.list();
await methods.nextPage?.();

As the underlying endpoints are not paginated, nextPage was always undefined anyway. Removing the nextPage property communicates this better.

Iterator return types

Changed the return type of several helper functions to iterators, including customer.getPayments.

This forces users to handle the scenario in which the items do not fit on a single page, e.g. one customer has more than 250 payments. See #291.

Renames

Renamed types and methods to solidify the distinction between (exhaustive) lists and pages. This does not affect the public-facing API (unless you count the exported TypeScript types).


Some changes are breaking. The next release will be 4.0.0.

@edorivai
Copy link
Collaborator

LGTM, only note I have is that I would make this part of a major version upgrade since it will break TS builds.

@Pimm
Copy link
Collaborator Author

Pimm commented Jun 19, 2023

[…] I would make this part of a major version upgrade since it will break TS builds.

Yes! I changed the description of the PR accordingly.

@Pimm Pimm merged commit ed321e0 into master Jun 19, 2023
@Pimm Pimm deleted the pimm/spring-cleaning branch June 19, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants