Skip to content
refs
History
25 lines · 780 BRaw
1/** Seconds since the Unix epoch. */
2export type Timestamp = number;
3
4export type Id = string;
5
6export interface Page<T> {
7 readonly items: T[];
8 /** Opaque cursor for the next page, or null when this is the last page. */
9 readonly next: string | null;
10}
11
12export interface PageRequest {
13 readonly cursor?: string;
14 readonly limit?: number;
15}
16
17/** A problem the caller can fix and retry, such as a form validation error. */
18export interface Problem {
19 readonly code: "invalid" | "conflict" | "rate_limited" | "unavailable";
20 readonly message: string;
21 /** The input field the problem refers to, when there is one. */
22 readonly field?: string;
23}
24
25export type Outcome<T = void> = { readonly ok: true; readonly value: T } | { readonly ok: false; readonly problem: Problem };