Skip to main content

cmind/common/v1/paging.proto

Package: cmind.common.v1

Enums

PageDirection

PageDirection selects a window relative to the cursor; it does not reorder the result. Items always come back in the endpoint's canonical sort order, so paging BACKWARD from a cursor returns the page preceding it, still in reading order. To reverse the order itself, use the endpoint's order_by field.

ValueNumberDescription
PAGE_DIRECTION_UNSPECIFIED0
PAGE_DIRECTION_FORWARD1
PAGE_DIRECTION_BACKWARD2

Messages

PageRequest

PageRequest is embedded in a ListXxxRequest as the page field. PageInfo is embedded in the matching ListXxxResponse. Together they are the platform's one paging shape: every paged endpoint speaks it, whatever the endpoint's backing store is. Cursors are opaque on purpose. A cursor is a keyset position for a SQL-backed list, an in-memory sort position for a list served from the Kubernetes informer cache, and a plain offset for a store that only does offsets (e.g. Keycloak). Callers cannot tell the difference, so a list can change strategy later without a wire change.

FieldTypeNumberDescription
pageSizeint321Maximum items to return. 0 means the server default. The server clamps to its own maximum, so a page may be smaller than requested.
cursorstring2Position to page from, taken from a previous response's start_cursor or end_cursor. Empty means the start of the collection when paging FORWARD, and the end of it when paging BACKWARD. A cursor is only valid against the sort order it was issued for. Replaying one after order_by changed is rejected with INVALID_ARGUMENT rather than silently returning a wrong window. Bounded well above any cursor a server issues, so that a hostile value is rejected at the edge rather than base64-decoded and JSON-parsed first.
directionPageDirection3Which side of the cursor to read. UNSPECIFIED is treated as FORWARD.

PageInfo

FieldTypeNumberDescription
startCursorstring1Cursor for the first item of this page. Empty when the page is empty.
endCursorstring2Cursor for the last item of this page. Empty when the page is empty.
hasNextPagebool3Whether items exist after end_cursor. Exact when paging FORWARD — traversal terminates on it, so it is always computed from a real over-fetch rather than inferred. When paging BACKWARD it is advisory: the server errs towards true when it cannot answer cheaply, since a page fetch that comes back empty is a far better failure than a collection that silently ends early.
hasPreviousPagebool4Whether items exist before start_cursor. Exact when paging BACKWARD, advisory when paging FORWARD, on the same reasoning as has_next_page.