contentful 11.9.0 → 11.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,8 +31,8 @@
31
31
  <a href="LICENSE">
32
32
  <img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License" />
33
33
  </a>
34
- <a href="https://circleci.com/gh/contentful/contentful.js">
35
- <img src="https://circleci.com/gh/contentful/contentful.js.svg?style=svg" alt="Build Status">
34
+ <a href="https://github.com/contentful/contentful.js/actions?query=branch%3Amaster">
35
+ <img src="https://github.com/contentful/contentful.js/actions/workflows/main.yaml/badge.svg">
36
36
  </a>
37
37
  <a href="https://www.npmjs.com/package/contentful">
38
38
  <img src="https://img.shields.io/npm/v/contentful.svg" alt="NPM">
@@ -68,12 +68,13 @@ JavaScript library for the Contentful [Content Delivery API](https://www.content
68
68
  - [Your first request](#your-first-request)
69
69
  - [Using this library with the Preview API](#using-this-library-with-the-preview-api)
70
70
  - [Authentication](#authentication)
71
+ - [Cursor-based Pagination](#cursor-based-pagination)
71
72
  - [Documentation \& References](#documentation--references)
72
73
  - [Configuration](#configuration)
73
- - [Request configuration options](#request-configuration-options)
74
- - [Response configuration options](#response-configuration-options)
74
+ - [Request configuration options](#request-configuration-options)
75
+ - [Response configuration options](#response-configuration-options)
75
76
  - [Timeline Preview](#timeline-preview)
76
- - [Example](#example)
77
+ - [Example](#example)
77
78
  - [Client chain modifiers](#client-chain-modifiers)
78
79
  - [Entries](#entries)
79
80
  - [Example](#example-1)
@@ -135,6 +136,7 @@ In order to get started with the Contentful JS library you'll need not only to i
135
136
  - [Your first request](#your-first-request)
136
137
  - [Using this library with the Preview API](#using-this-library-with-the-preview-api)
137
138
  - [Authentication](#authentication)
139
+ - [Cursor-based pagination](#cursor-based-pagination)
138
140
  - [Documentation & References](#documentation--references)
139
141
 
140
142
  ### Installation
@@ -229,6 +231,29 @@ Don't forget to also get your Space ID.
229
231
 
230
232
  For more information, check the [Contentful REST API reference on Authentication](https://www.contentful.com/developers/docs/references/authentication/).
231
233
 
234
+ ### Cursor-based Pagination
235
+
236
+ Cursor-based pagination is supported on collection endpoints for entries and assets:
237
+
238
+ ```js
239
+ const response = await client.getEntriesWithCursor({ limit: 10 })
240
+ console.log(response.items) // Array of items
241
+ console.log(response.pages?.next) // Cursor for next page
242
+ ```
243
+
244
+ Use the value from `response.pages.next` to fetch the next page or `response.pages.prev` to fetch the previous page.
245
+
246
+ ```js
247
+ const nextPageResponse = await client.getEntriesWithCursor({
248
+ limit: 10,
249
+ pageNext: response.pages?.next,
250
+ })
251
+
252
+ console.log(nextPageResponse.items) // Array of items
253
+ console.log(nextPageResponse.pages?.next) // Cursor for next page
254
+ console.log(nextPageResponse.pages?.prev) // Cursor for prev page
255
+ ```
256
+
232
257
  ## Documentation & References
233
258
 
234
259
  - [Configuration](#configuration)