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

Remove endpoint aliases #315

Merged
merged 2 commits into from
May 26, 2023
Merged

Remove endpoint aliases #315

merged 2 commits into from
May 26, 2023

Conversation

Pimm
Copy link
Collaborator

@Pimm Pimm commented Mar 10, 2023

These endpoint aliases (such as client.payments.delete for client.payments.cancel) were deprecated in #234. The first version to include this deprecation is 3.6.0, released on 10 February 2022.

This PR removes the aliases.

Rationale:

  • I suspect the aliases were introduced with the idea that "someone might misremember and accidentally type delete instead of cancel". We now live in the era of TypeScript, we no longer rely on memory; we rely on code completion. When one relies on code completion, aliases introduce confusion: "delete sounds like what I need, but so does cancel… what's the difference between the two? When should I use which? Why am I using delete while this snippet on StackOverflow uses cancel?"
  • The all aliases have always been deceptive. Instead of returning all objects in an array, they were aliases for page and thus returned the first page in an array.
  • Because a binder now has either page or list, you can see whether the result will be paginated or not.

The change is breaking. The next release will be 4.0.0.

These endpoint aliases were deprecated in #234. The first version to include this deprecation is 3.6.0, released on 10 February 2022.

In the era of TypeScript, I feel the confusion caused by having two (or sometimes three) separate functions in the type definition outweighs the backwards compatibility. Consumers of an API expect every part of it to be significant.
Copy link
Collaborator

@edorivai edorivai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, nice cleanup

@Pimm Pimm merged commit 1a62d66 into master May 26, 2023
@Pimm Pimm deleted the pimm/spring-cleaning branch May 26, 2023 15:18
Pimm added a commit that referenced this pull request Jul 9, 2024
We removed aliases for endpoints here: #315. This commit re-introduces the aliases, this time unenumerable and non-existent in the TypeScript types.
Pimm added a commit that referenced this pull request Jul 9, 2024
We removed aliases for endpoints here: #315. This commit re-introduces the aliases, this time unenumerable and non-existent in the TypeScript types.
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