Skip to main content
List endpoints return paginated results. The SDK provides auto-fetching for convenience and manual page control for large datasets.

Auto-fetch all pages

The list() method automatically fetches all pages and returns a flat array:
const monitors = await client.monitors.list();
// monitors: MonitorDto[] — all monitors, not just the first page
Internally, the SDK requests pages of 200 items and loops until hasNext is false.

Manual page control

Use listPage() when you need control over pagination:
import type { Page } from "@devhelm/sdk";

const page: Page<MonitorDto> = await client.monitors.listPage(0, 50);

console.log(page.data);     // MonitorDto[]
console.log(page.hasNext);  // boolean
console.log(page.hasPrev);  // boolean

Page type

interface Page<T> {
  data: T[];
  hasNext: boolean;
  hasPrev: boolean;
}

Iterate through all pages manually

let page = 0;
const allMonitors: MonitorDto[] = [];

while (true) {
  const result = await client.monitors.listPage(page, 100);
  allMonitors.push(...result.data);
  if (!result.hasNext) break;
  page++;
}

Cursor pagination

Check results use cursor-based pagination for efficient streaming through large result sets:
import type { CursorPage } from "@devhelm/sdk";

const results: CursorPage<CheckResultDto> = await client.monitors.results(42, {
  limit: 50,
});

console.log(results.data);       // CheckResultDto[]
console.log(results.nextCursor); // string | null
console.log(results.hasMore);    // boolean

CursorPage type

interface CursorPage<T> {
  data: T[];
  nextCursor: string | null;
  hasMore: boolean;
}

Iterate with cursor

let cursor: string | undefined;
const allResults: CheckResultDto[] = [];

do {
  const page = await client.monitors.results(42, { cursor, limit: 100 });
  allResults.push(...page.data);
  cursor = page.nextCursor ?? undefined;
} while (cursor);

Which endpoints use which pagination

MethodPagination typeDefault size
*.list()Offset (auto-fetches all)200 per page
*.listPage(page, size)Offset (manual)
monitors.results(id, options)Cursor
monitors.versions(id, options)Offset20

Next steps

Client reference

Full method reference for all namespaces.

Pagination patterns

REST API pagination patterns.