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

feat: next URL as response body field #3

Open
AndersDJohnson opened this issue May 29, 2019 · 1 comment
Open

feat: next URL as response body field #3

AndersDJohnson opened this issue May 29, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed

Comments

@AndersDJohnson
Copy link
Owner

AndersDJohnson commented May 29, 2019

Support pulling next URL from response body, such as for HATEOAS APIs.

HATEOAS response might look like:

{
  "_links": {
    "self": { "href": "/orders" },
    "next": { "href": "/orders?page=2" },
    "find": { "href": "/orders{?id}", "templated": true }
  },
  "currentlyProcessing": 14,
  "shippedToday": 20
}
fetchPaginate('https://api.example.com', {
  getNextUrl: ({ body }) => body?._links?.next?.href
})

or possibly support a string path (nicer for CLI):

fetchPaginate('https://api.example.com', {
  getNextUrl: '_links.next.href'
})

Not sure how (or whether) to handle templated links.

@AndersDJohnson AndersDJohnson added the enhancement New feature or request label May 29, 2019
@AndersDJohnson AndersDJohnson self-assigned this May 29, 2019
@AndersDJohnson
Copy link
Owner Author

Can this be done today with the next option? Not sure - should check.

@AndersDJohnson AndersDJohnson added the help wanted Extra attention is needed label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant