Last active
February 5, 2024 13:14
-
-
Save ikenna/22fcd79c76f0490326d2c61e2268be91 to your computer and use it in GitHub Desktop.
Cursor based pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Cursor Pagination API | |
version: 1.0.0 | |
paths: | |
/items: | |
get: | |
summary: Get a list of items | |
parameters: | |
- name: cursor | |
in: query | |
description: Cursor for pagination | |
required: false | |
schema: | |
type: string | |
maxLength: 50 | |
- name: limit | |
in: query | |
description: Limit the number of items returned | |
required: false | |
schema: | |
type: integer | |
format: int32 | |
responses: | |
'200': | |
description: A list of items | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
pagination: | |
type: object | |
properties: | |
first: | |
type: string | |
description: The cursor for the first page of results | |
example: "cursor1" | |
maxLength: 50 | |
last: | |
type: string | |
description: The cursor for the last page of results | |
example: "cursor10" | |
maxLength: 50 | |
prev: | |
type: string | |
description: The cursor for the previous page of results | |
example: "cursor3" | |
maxLength: 50 | |
self: | |
type: string | |
description: The cursor for the current page of results | |
example: "cursor4" | |
maxLength: 50 | |
items: | |
type: array | |
items: | |
type: object | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment