Convenience wrapper for APIs that paginate with an RFC 5988 Link header (GitHub, GitLab, and most Link-based REST APIs).
Link
By default the header is read from response.headers, so the fetcher can return the raw fetch Response and getItems can be (r) => r.json().
response.headers
fetch
getItems
(r) => r.json()
const { items } = await linkFetch({ url: 'https://api.github.com/users/octocat/repos?per_page=100', fetcher: ({ url }, { signal }) => fetch(url, { signal }), getItems: (response) => response.json(),}); Copy
const { items } = await linkFetch({ url: 'https://api.github.com/users/octocat/repos?per_page=100', fetcher: ({ url }, { signal }) => fetch(url, { signal }), getItems: (response) => response.json(),});
Convenience wrapper for APIs that paginate with an RFC 5988
Linkheader (GitHub, GitLab, and mostLink-based REST APIs).By default the header is read from
response.headers, so the fetcher can return the rawfetchResponse andgetItemscan be(r) => r.json().