Command Palette

Search for a command to run...

Querying Data

The Node SDK uses the same query API as the Next.js server clientlist(), byId(), select, and filter all work identically.

List entities

example.ts
1 2 3 4 5 6 7 8 9 10 11 const { data, pagination } = await pylo.project.list({ select: { id: true, name: true, created_at: true, }, pagination: { page: 1, per_page: 20 }, }); // data: Array<{ id: string; name: string | null; created_at: string }> // pagination: { total, current_page, per_page, last_page, has_more_pages }

Omit select to get all scalar fields.

Fetch by ID

example.ts
1 2 3 4 5 6 7 8 9 10 11 const project = await pylo.project.byId('project-uuid', { select: { id: true, name: true, customer: { select: { id: true, name: true }, }, }, }); // Returns null if not found

Relations

Include relations with a nested select:

example.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 const { data } = await pylo.project.list({ select: { id: true, name: true, // hasOne customer: { select: { id: true, name: true }, }, // hasMany — with filter and pagination invoices: { select: { id: true, amount_net: true }, pagination: { per_page: 5 }, filter: { sortby: [{ field: 'created_at', order: 'desc' }], }, }, }, });
  • hasOne: { data: { ... } } | null
  • hasMany: { data: [...], pagination: { ... } }

Filtering & Sorting

The filter API supports conditions, AND/OR logic, and sorting. See the Filtering & Sorting reference for the full operator list and examples.

example.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 const { data } = await pylo.invoice.list({ select: { id: true, amount_net: true, status: true }, filter: { query: [{ condition: { field: 'amount_net', operator: 'greaterThan', value: '1000', }, }], sortby: [{ field: 'created_at', order: 'desc' }], }, });