We plastered a few versions of this behaviour in Contentful internal packages, so clearly there is a need for it. This is why we want to start having a single source of truth for it.
Description
The introduced fetchAll method can handle offset-based and cursor-based endpoints by inspecting the initial response.
We have one caveat though: As we have inconsistent ways of handling how we pass down optional query parameters (sometimes as distinct query property, sometimes mingled with mandatory properties). I opted for the more explicit version of using a distinct property. In case there is a need downstream the endpoint method that can't be handled automatically simply need to be wrapped.
An example for the raw.get method looks like this:
Summary
We plastered a few versions of this behaviour in Contentful internal packages, so clearly there is a need for it. This is why we want to start having a single source of truth for it.
Description
The introduced
fetchAll
method can handle offset-based and cursor-based endpoints by inspecting the initial response.We have one caveat though: As we have inconsistent ways of handling how we pass down optional query parameters (sometimes as distinct
query
property, sometimes mingled with mandatory properties). I opted for the more explicit version of using a distinct property. In case there is a need downstream the endpoint method that can't be handled automatically simply need to be wrapped.An example for the raw.get method looks like this: