@suqo/sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/index.cjs +876 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1045 -0
- package/dist/index.d.ts +1045 -0
- package/dist/index.js +858 -0
- package/dist/index.js.map +1 -0
- package/package.json +75 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1045 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The full `SuqoError` hierarchy (SDK-SPEC.md §7).
|
|
3
|
+
*
|
|
4
|
+
* Every error thrown by this SDK is an instance of `SuqoError` — but the base class itself is
|
|
5
|
+
* never thrown directly; the SDK always throws one of the subclasses below.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/** Options accepted by every {@link SuqoError} subclass constructor. */
|
|
10
|
+
interface SuqoErrorOptions {
|
|
11
|
+
/** HTTP status code this error was mapped from, if any (absent for `SuqoConfigError`/`NetworkError` — there was no response). */
|
|
12
|
+
status?: number;
|
|
13
|
+
/** The raw, parsed response body this error was mapped from, if any. */
|
|
14
|
+
rawBody?: unknown;
|
|
15
|
+
/**
|
|
16
|
+
* The backend's request id for this call, if the response included one — ties a failure to a
|
|
17
|
+
* specific server-side log line. Nice-to-have: SUQO backend confirmation on whether/how this is
|
|
18
|
+
* exposed is still pending (docs/implementation-plan.md Ticket 0 item 3) — always optional,
|
|
19
|
+
* never assumed present.
|
|
20
|
+
*/
|
|
21
|
+
requestId?: string;
|
|
22
|
+
/** The underlying cause (e.g. the original `fetch` rejection), for debugging — never surfaced to end users directly. */
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Base class for every error thrown by the SDK (SDK-SPEC.md §7). Never thrown directly — always
|
|
27
|
+
* one of the subclasses below.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* try {
|
|
32
|
+
* await suqo.subscriptions.create({ ... });
|
|
33
|
+
* } catch (err) {
|
|
34
|
+
* if (err instanceof SuqoError) {
|
|
35
|
+
* console.error(err.name, err.message, err.status);
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare class SuqoError extends Error {
|
|
41
|
+
/** HTTP status code this error was mapped from, if any. */
|
|
42
|
+
readonly status?: number;
|
|
43
|
+
/** The raw, parsed response body this error was mapped from, if any. */
|
|
44
|
+
readonly rawBody?: unknown;
|
|
45
|
+
/** The backend's request id for this call, if one was returned. See {@link SuqoErrorOptions.requestId}. */
|
|
46
|
+
readonly requestId?: string;
|
|
47
|
+
constructor(message: string, options?: SuqoErrorOptions);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Construction-time configuration problems: a malformed API key, or an explicit `baseUrl`
|
|
51
|
+
* override that disagrees with the key's prefix (SDK-SPEC.md §2, §7). Thrown before any request
|
|
52
|
+
* is made — analogous to a syntax error in the integration, not an HTTP failure. Never carries
|
|
53
|
+
* `status`/`rawBody`; there was no request to map one from.
|
|
54
|
+
*/
|
|
55
|
+
declare class SuqoConfigError extends SuqoError {
|
|
56
|
+
constructor(message: string, options?: {
|
|
57
|
+
cause?: unknown;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** 401 — the API key is missing, malformed, or inactive (SDK-SPEC.md §7). */
|
|
61
|
+
declare class AuthenticationError extends SuqoError {
|
|
62
|
+
}
|
|
63
|
+
/** Options accepted by {@link KycRequiredError}. */
|
|
64
|
+
interface KycRequiredErrorOptions extends SuqoErrorOptions {
|
|
65
|
+
/**
|
|
66
|
+
* The KYC status code from the response body's `status_code` field (openapi.yaml `KycError`).
|
|
67
|
+
* Named `kycStatus`, not `statusCode` — per SDK Naming Map v1.1's rename register, `status_code`
|
|
68
|
+
* "reads as an HTTP status but carries a KYC status," and sits right next to the base class's
|
|
69
|
+
* real HTTP `status` field, so the two must stay visibly distinct.
|
|
70
|
+
*/
|
|
71
|
+
kycStatus?: string;
|
|
72
|
+
}
|
|
73
|
+
/** 403 — the owning seller has not completed KYC verification (SDK-SPEC.md §7). */
|
|
74
|
+
declare class KycRequiredError extends SuqoError {
|
|
75
|
+
/** The KYC status code from the response body, if present. See {@link KycRequiredErrorOptions.kycStatus}. */
|
|
76
|
+
readonly kycStatus?: string;
|
|
77
|
+
constructor(message: string, options?: KycRequiredErrorOptions);
|
|
78
|
+
}
|
|
79
|
+
/** Field-keyed validation messages, normalized to string arrays regardless of wire shape. */
|
|
80
|
+
type FieldErrors = Record<string, string[]>;
|
|
81
|
+
/** Options accepted by {@link ValidationError}. */
|
|
82
|
+
interface ValidationErrorOptions extends SuqoErrorOptions {
|
|
83
|
+
/** Field-keyed validation messages. Empty if the 400 used the `detail` shape instead. */
|
|
84
|
+
fieldErrors?: FieldErrors;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 400 — request validation failed (SDK-SPEC.md §7). The API uses two different 400 body shapes;
|
|
88
|
+
* {@link mapHttpError} normalizes both into this one class so consumers rely on `instanceof`,
|
|
89
|
+
* never the wire shape:
|
|
90
|
+
* - A field-keyed body (`{ field: ["msg"] }`) populates {@link fieldErrors}.
|
|
91
|
+
* - A `detail`-shaped body (`{ detail: "msg" }`, e.g. the duplicate-active-subscription case)
|
|
92
|
+
* populates `message` instead, with `fieldErrors` left empty.
|
|
93
|
+
*/
|
|
94
|
+
declare class ValidationError extends SuqoError {
|
|
95
|
+
/** Field-keyed validation messages. Empty (not undefined) when the 400 used the `detail` shape. */
|
|
96
|
+
readonly fieldErrors: FieldErrors;
|
|
97
|
+
constructor(message: string, options?: ValidationErrorOptions);
|
|
98
|
+
}
|
|
99
|
+
/** 404 — the resource doesn't exist, or doesn't belong to the authenticated seller (SDK-SPEC.md §7). */
|
|
100
|
+
declare class NotFoundError extends SuqoError {
|
|
101
|
+
}
|
|
102
|
+
/** Options accepted by {@link RateLimitError}. */
|
|
103
|
+
interface RateLimitErrorOptions extends SuqoErrorOptions {
|
|
104
|
+
/**
|
|
105
|
+
* Suggested backoff derived from a `Retry-After` header, in milliseconds, if present. Named
|
|
106
|
+
* `retryAfter`, not `retryAfterMs` — per SDK Naming Map v1.1, SDK-surface fields drop the `Ms`
|
|
107
|
+
* suffix; the unit is documented, not encoded in the name.
|
|
108
|
+
*/
|
|
109
|
+
retryAfter?: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 429 — rate limited (SDK-SPEC.md §7). **Reserved**: the API does not enforce rate limiting yet
|
|
113
|
+
* and never emits 429 today; this class exists so the SDK is forward-ready the moment it does
|
|
114
|
+
* (SDK-SPEC.md §10).
|
|
115
|
+
*/
|
|
116
|
+
declare class RateLimitError extends SuqoError {
|
|
117
|
+
/** Suggested backoff derived from a `Retry-After` header, in milliseconds, if present. See {@link RateLimitErrorOptions.retryAfter}. */
|
|
118
|
+
readonly retryAfter?: number;
|
|
119
|
+
constructor(message: string, options?: RateLimitErrorOptions);
|
|
120
|
+
}
|
|
121
|
+
/** 5xx — the SUQO API failed unexpectedly (SDK-SPEC.md §7). */
|
|
122
|
+
declare class ServerError extends SuqoError {
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Transport failure or timeout — the request never got a response at all (SDK-SPEC.md §7). Covers
|
|
126
|
+
* timeouts too; there is no separate timeout class. Thrown directly by `http.ts` (Ticket 2) when
|
|
127
|
+
* `fetch` rejects or an `AbortSignal` fires — never produced by {@link mapHttpError}, since
|
|
128
|
+
* there's no HTTP status to map in that case.
|
|
129
|
+
*/
|
|
130
|
+
declare class NetworkError extends SuqoError {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The shape {@link mapHttpError} needs from a completed HTTP response. Deliberately not a
|
|
135
|
+
* `Response` itself — `http.ts` (Ticket 2) reads the status, parses the body, and extracts
|
|
136
|
+
* headers itself, keeping this module free of any transport-layer dependency.
|
|
137
|
+
*/
|
|
138
|
+
interface HttpErrorInput {
|
|
139
|
+
/** The response's HTTP status code. */
|
|
140
|
+
status: number;
|
|
141
|
+
/** The response's HTTP status text, if available — used only for the generic fallback message. */
|
|
142
|
+
statusText?: string;
|
|
143
|
+
/**
|
|
144
|
+
* The parsed response body, if the response had one and it parsed as JSON. Expected to be one
|
|
145
|
+
* of `openapi.yaml`'s three error shapes (`FieldError`, `DetailError`, `KycError`) — the shape
|
|
146
|
+
* is detected here, never assumed from the status code alone.
|
|
147
|
+
*/
|
|
148
|
+
body?: unknown;
|
|
149
|
+
/** The backend's request id for this call, if one was returned (nice-to-have — Ticket 0 item 3). */
|
|
150
|
+
requestId?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Suggested backoff derived from a `Retry-After` header, in milliseconds. Parsed for any status
|
|
153
|
+
* (found in review: HttpClient's retry loop needs it on retryable 5xxs too, not just 429), but
|
|
154
|
+
* only ever surfaced on the thrown error itself for `RateLimitError` (429) below.
|
|
155
|
+
*/
|
|
156
|
+
retryAfter?: number;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The single, centralized status-code-to-error-class mapper (SDK-SPEC.md §7). Every HTTP response
|
|
160
|
+
* with a non-2xx status is mapped to the correct {@link SuqoError} subclass through this
|
|
161
|
+
* function — no other place in the SDK is allowed to make that decision.
|
|
162
|
+
*
|
|
163
|
+
* Handles both documented 400 body shapes: a field-keyed body populates
|
|
164
|
+
* `ValidationError.fieldErrors`; a `detail`-shaped body (e.g. the duplicate-active-subscription
|
|
165
|
+
* case) populates `ValidationError.message` instead, with `fieldErrors` left empty. A field-keyed
|
|
166
|
+
* body's `client` key (the wire name for the subscription customer payload) is renamed to
|
|
167
|
+
* `customer` and flattened into dot-path keys (`customer.phone`) — SDK Naming Map v1.1 Open
|
|
168
|
+
* Question A, resolved: yes, translate.
|
|
169
|
+
*
|
|
170
|
+
* Does not handle `fetch` throwing or an `AbortSignal` firing — those have no HTTP status and are
|
|
171
|
+
* constructed directly as `NetworkError` by `http.ts` (Ticket 2).
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const response = await fetch(url);
|
|
176
|
+
* if (!response.ok) {
|
|
177
|
+
* throw mapHttpError({ status: response.status, body: await response.json().catch(() => undefined) });
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
declare function mapHttpError(input: HttpErrorInput): SuqoError;
|
|
182
|
+
|
|
183
|
+
/** The two environments a key prefix resolves to. Never selected explicitly — always inferred. */
|
|
184
|
+
type SuqoEnvironment = "sandbox" | "live";
|
|
185
|
+
|
|
186
|
+
/** Input accepted by {@link SdkConfig} — the same shape `SuqoClient`'s constructor takes (addendum §5). */
|
|
187
|
+
interface SdkConfigInput {
|
|
188
|
+
/** The seller's API key. Its prefix determines the environment (SDK-SPEC.md §2) — never passed separately. */
|
|
189
|
+
apiKey: string;
|
|
190
|
+
/**
|
|
191
|
+
* Optional explicit override. If set AND it disagrees with the key prefix, the constructor
|
|
192
|
+
* throws `SuqoConfigError`. Normally omit this.
|
|
193
|
+
*/
|
|
194
|
+
baseUrl?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Per-client default request timeout in milliseconds; per-call override also allowed by
|
|
197
|
+
* `http.ts` (Ticket 2). Default 30_000. Named `timeout`, not `timeoutMs` — per SDK Naming Map
|
|
198
|
+
* v1.1, SDK-surface fields drop the `Ms` suffix; the unit is documented, not encoded in the name.
|
|
199
|
+
*/
|
|
200
|
+
timeout?: number;
|
|
201
|
+
/** Read-retry tuning (reads only — writes are never retried, SDK-SPEC.md §8, §12). Default 2. */
|
|
202
|
+
maxRetries?: number;
|
|
203
|
+
/** Advanced: custom undici dispatcher for pool tuning, passed through opaquely to `fetch` (Ticket 2). */
|
|
204
|
+
dispatcher?: unknown;
|
|
205
|
+
}
|
|
206
|
+
/** The `util.inspect` custom-inspection symbol, referenced by key so this file never needs to `import "node:util"`. */
|
|
207
|
+
declare const NODE_INSPECT_CUSTOM: unique symbol;
|
|
208
|
+
/**
|
|
209
|
+
* Resolved, immutable SDK configuration (SDK-SPEC.md §2, §4).
|
|
210
|
+
*
|
|
211
|
+
* Validated at construction time — a malformed key or a conflicting `baseUrl` override throws
|
|
212
|
+
* `SuqoConfigError` immediately, before any request is ever made. The API key is stored in a
|
|
213
|
+
* private class field, never a public/enumerable property, so it can never leak through
|
|
214
|
+
* `JSON.stringify`, `console.log`, or `util.inspect` (SDK-SPEC.md §4) — `toJSON` and the
|
|
215
|
+
* `util.inspect` custom-inspection symbol both redact it explicitly as well, so redaction holds
|
|
216
|
+
* even if a future refactor adds an enumerable field.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const config = new SdkConfig({ apiKey: "su_test_key_..." });
|
|
221
|
+
* config.baseUrl; // => "https://test-be.suqo.ai"
|
|
222
|
+
* config.environment; // => "sandbox"
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare class SdkConfig {
|
|
226
|
+
#private;
|
|
227
|
+
/** `"sandbox" | "live"` — inferred from the key prefix, never selected explicitly. */
|
|
228
|
+
readonly environment: SuqoEnvironment;
|
|
229
|
+
/** The resolved base URL for this environment (or the caller's override, if it agreed). */
|
|
230
|
+
readonly baseUrl: string;
|
|
231
|
+
/** Request timeout in milliseconds, per-client default (`http.ts` in Ticket 2 allows a per-call override). */
|
|
232
|
+
readonly timeout: number;
|
|
233
|
+
/** Max retry attempts for idempotent reads. Writes are never retried regardless of this value. */
|
|
234
|
+
readonly maxRetries: number;
|
|
235
|
+
/** Opaque custom dispatcher for pool tuning, if supplied. Passed through to `fetch` unexamined. */
|
|
236
|
+
readonly dispatcher: unknown;
|
|
237
|
+
constructor(input: SdkConfigInput);
|
|
238
|
+
/** The raw API key, for building the `Authorization: Bearer <key>` header (`http.ts`, Ticket 2). Never logged. */
|
|
239
|
+
get apiKey(): string;
|
|
240
|
+
/** Redacts the key so it never appears in `JSON.stringify` output (SDK-SPEC.md §4). */
|
|
241
|
+
toJSON(): Record<string, unknown>;
|
|
242
|
+
/** Redacts the key so it never appears in `util.inspect`/`console.log` output (SDK-SPEC.md §4). */
|
|
243
|
+
[NODE_INSPECT_CUSTOM](): Record<string, unknown>;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* URL construction with the trailing slash structurally guaranteed (SDK-SPEC.md §3).
|
|
248
|
+
*
|
|
249
|
+
* @packageDocumentation
|
|
250
|
+
*/
|
|
251
|
+
/** Query parameter values accepted by {@link buildUrl}. `undefined` values are omitted entirely. */
|
|
252
|
+
type QueryParams = Record<string, string | number | boolean | undefined>;
|
|
253
|
+
|
|
254
|
+
/** Fields shared by every request, regardless of method. */
|
|
255
|
+
interface HttpRequestOptionsBase {
|
|
256
|
+
/** The route path, e.g. `/api/v1/products` — the trailing slash is guaranteed by `buildUrl`; don't add it yourself. */
|
|
257
|
+
path: string;
|
|
258
|
+
/** Query params, appended after the trailing slash. `undefined` values are skipped. */
|
|
259
|
+
query?: QueryParams;
|
|
260
|
+
/** Per-call timeout override, in milliseconds. Defaults to `SdkConfig.timeout`. */
|
|
261
|
+
timeoutMs?: number;
|
|
262
|
+
/**
|
|
263
|
+
* Optional caller-supplied signal for cancelling an in-flight request — e.g. the host
|
|
264
|
+
* application's own request lifecycle ending, or an overall operation deadline spanning
|
|
265
|
+
* multiple SDK calls. Combined with the internal timeout signal (whichever fires first wins)
|
|
266
|
+
* during the fetch itself, *and* observed during any retry backoff wait — cancelling mid-sleep
|
|
267
|
+
* doesn't have to wait for the sleep to finish first. An explicit caller cancellation is never
|
|
268
|
+
* retried, even for an otherwise-retryable read — retrying after the caller said "stop" would
|
|
269
|
+
* ignore what they asked for.
|
|
270
|
+
*/
|
|
271
|
+
signal?: AbortSignal;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Options for a `GET` request. Never carries a body — every read in this API is `GET`
|
|
275
|
+
* (SDK-SPEC.md §1), and `fetch` itself rejects a body on `GET`. Enforced at the type level, not
|
|
276
|
+
* just by convention, so this can't be gotten wrong from a `TBody`-typed call site by accident.
|
|
277
|
+
*/
|
|
278
|
+
interface HttpGetRequestOptions extends HttpRequestOptionsBase {
|
|
279
|
+
method: "GET";
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Options for a `POST` request. Generic on `TBody` so a call site can pass a concrete request
|
|
283
|
+
* type (e.g. `CreateSubscriptionParams`, wired up in Ticket 4 — the SDK-surface type for
|
|
284
|
+
* `openapi.yaml`'s `CreateSubscriptionRequest` schema; SDK Naming Map v1.1 renames every
|
|
285
|
+
* `*Request` wire schema to `*Params` on the surface, since "Request" reads as an HTTP request
|
|
286
|
+
* object, not an SDK input) and have it checked at compile time — `unknown` is only the *default*
|
|
287
|
+
* for callers that don't specify one, never a signal that bodies go untyped by design.
|
|
288
|
+
*/
|
|
289
|
+
interface HttpPostRequestOptions<TBody = unknown> extends HttpRequestOptionsBase {
|
|
290
|
+
method: "POST";
|
|
291
|
+
/** JSON-serializable request body. Omit entirely for a bodyless write (e.g. `cancel`). */
|
|
292
|
+
body?: TBody;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Options accepted by {@link HttpClient.request}. `HttpClient` itself is internal (not exported
|
|
296
|
+
* from `src/index.ts`); the SDK's actual typed, consumer-facing contract lives one layer up, in
|
|
297
|
+
* each resource method's own public signature.
|
|
298
|
+
*/
|
|
299
|
+
type HttpRequestOptions<TBody = unknown> = HttpGetRequestOptions | HttpPostRequestOptions<TBody>;
|
|
300
|
+
/** Options accepted by {@link HttpClient}'s constructor. */
|
|
301
|
+
interface HttpClientOptions {
|
|
302
|
+
/**
|
|
303
|
+
* Injectable sleep implementation, so tests can skip real backoff delays. @internal — not part
|
|
304
|
+
* of the public contract; defaults to a real `setTimeout`-based wait in production.
|
|
305
|
+
*/
|
|
306
|
+
sleep?: (ms: number) => Promise<void>;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The fetch wrapper every resource calls through (SDK-SPEC.md §3, §4, §8; addendum §2, §10).
|
|
310
|
+
*
|
|
311
|
+
* Handles, in one place: the trailing-slash URL guarantee, the `Authorization`/`Content-Type`
|
|
312
|
+
* headers, per-call timeout via `AbortSignal.timeout`, caller-supplied cancellation (`options.
|
|
313
|
+
* signal`, combined with the timeout during the fetch and also observed during any retry backoff
|
|
314
|
+
* wait), the read-only retry policy (exponential backoff + jitter, honoring `Retry-After`,
|
|
315
|
+
* clamped so a misconfigured server can't stall a request indefinitely), and feeding every
|
|
316
|
+
* non-2xx response through `mapHttpError()` so callers only ever see a typed `SuqoError`
|
|
317
|
+
* subclass — never a raw `fetch` rejection or an unparsed error body.
|
|
318
|
+
*
|
|
319
|
+
* Not wired into `SuqoClient`/any resource yet — that lands in Ticket 4.
|
|
320
|
+
*/
|
|
321
|
+
declare class HttpClient {
|
|
322
|
+
#private;
|
|
323
|
+
constructor(config: SdkConfig, options?: HttpClientOptions);
|
|
324
|
+
/**
|
|
325
|
+
* Sends a request and returns the parsed 2xx body, or throws the `SuqoError` subclass
|
|
326
|
+
* `mapHttpError` maps a non-2xx response to. Writes are never retried (SDK-SPEC.md §8, §12);
|
|
327
|
+
* reads retry on network failure, `429`, or `5xx`, bounded by `SdkConfig.maxRetries`.
|
|
328
|
+
*
|
|
329
|
+
* Generic on both `TResponse` and `TBody` — e.g.
|
|
330
|
+
* `request<CreateSubscriptionResponse, CreateSubscriptionParams>({ body, ... })` — so a
|
|
331
|
+
* resource method (Ticket 4) gets its request body checked against the exact shape it means to
|
|
332
|
+
* send, not just `unknown`.
|
|
333
|
+
*/
|
|
334
|
+
request<TResponse, TBody = unknown>(options: HttpRequestOptions<TBody>): Promise<TResponse>;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The common paginated-list envelope every list endpoint returns (SDK-SPEC.md §6).
|
|
339
|
+
*
|
|
340
|
+
* @packageDocumentation
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* The page-number pagination envelope common to every list endpoint (SDK-SPEC.md §6).
|
|
344
|
+
* Named `Page` per the cross-language SDK Naming Map v1.1 §06 (mirrors `openapi.yaml`'s
|
|
345
|
+
* `PaginationEnvelope` schema, renamed on the SDK surface only — the wire shape is unaffected).
|
|
346
|
+
*/
|
|
347
|
+
interface Page<T> {
|
|
348
|
+
/** Total row count across every page, not just this one. */
|
|
349
|
+
count: number;
|
|
350
|
+
/** URL of the next page, or `null` on the last page. */
|
|
351
|
+
next: string | null;
|
|
352
|
+
/** URL of the previous page, or `null` on the first page. */
|
|
353
|
+
previous: string | null;
|
|
354
|
+
results: T[];
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The four extra status counts the Subscriptions list adds on top of the common envelope
|
|
358
|
+
* (SDK-SPEC.md §6, `openapi.yaml`'s `SubscriptionListEnvelope`).
|
|
359
|
+
*/
|
|
360
|
+
interface SubscriptionStatusCounts {
|
|
361
|
+
totalSubscriptions: number;
|
|
362
|
+
activeSubscriptions: number;
|
|
363
|
+
dueSubscriptions: number;
|
|
364
|
+
inactiveSubscriptions: number;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The Subscriptions list envelope: the common shape plus the four extra counts, surfaced
|
|
368
|
+
* alongside `results` rather than replacing the common envelope shape (SDK-SPEC.md §6). Generic
|
|
369
|
+
* over `T` so this file doesn't need to know about the `Subscription` type — Ticket 4 supplies it.
|
|
370
|
+
* Named `SubscriptionPage` per the Naming Map §06 (mirrors `openapi.yaml`'s
|
|
371
|
+
* `SubscriptionListEnvelope`, renamed on the SDK surface only).
|
|
372
|
+
*/
|
|
373
|
+
type SubscriptionPage<T> = Page<T> & SubscriptionStatusCounts;
|
|
374
|
+
/** Manual pagination params a caller can pass instead of using `listAll`. */
|
|
375
|
+
interface PageParams {
|
|
376
|
+
/** 1-indexed page number. Server default is 1 if omitted. */
|
|
377
|
+
page?: number;
|
|
378
|
+
/** Results per page (server max 100, server default 20 if omitted). */
|
|
379
|
+
pageSize?: number;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Maps {@link PageParams}' camelCase fields to the wire's snake_case query params
|
|
383
|
+
* (`pageSize` → `page_size`), so every future paginated resource method shares one mapping
|
|
384
|
+
* instead of re-deriving it. `undefined` fields are omitted, matching `buildUrl`'s own
|
|
385
|
+
* omission rule (Ticket 2) — a caller can pass `{ page, pageSize }` straight through unfiltered.
|
|
386
|
+
*/
|
|
387
|
+
declare function toPageQuery(params?: PageParams): QueryParams;
|
|
388
|
+
/**
|
|
389
|
+
* Maps a {@link Page}'s `results` through `deserializeItem`, leaving `count`/`next`/`previous`
|
|
390
|
+
* untouched — those three field names already match the wire exactly (`openapi.yaml`
|
|
391
|
+
* `PaginationEnvelope`), only `results`' items need any per-resource field mapping. Shared by
|
|
392
|
+
* every paginated resource so each one only has to supply its own item deserializer, not
|
|
393
|
+
* re-implement unwrapping the envelope.
|
|
394
|
+
*/
|
|
395
|
+
declare function deserializePage<TWireItem, T>(wire: Page<TWireItem>, deserializeItem: (item: TWireItem) => T): Page<T>;
|
|
396
|
+
/**
|
|
397
|
+
* Auto-iterates every row across every page, following `next` until it's `null` (SDK-SPEC.md §6),
|
|
398
|
+
* without requiring manual page math. Deliberately decoupled from `HttpClient`/any resource: the
|
|
399
|
+
* caller supplies the already-fetched first page and a `fetchNext` callback that turns a `next`
|
|
400
|
+
* URL into the following page. This keeps pagination testable and reusable across every future
|
|
401
|
+
* paginated resource (Ticket 4) without this file needing to know how HTTP requests are made.
|
|
402
|
+
*
|
|
403
|
+
* Manual `page`/`pageSize` access (via {@link toPageQuery}) remains available independently —
|
|
404
|
+
* this iterator is additive, not a replacement (SDK-SPEC.md §6 requires both to keep working).
|
|
405
|
+
*
|
|
406
|
+
* Guards against a `fetchNext` (or a server) that never reaches `next: null` — a real bug caught
|
|
407
|
+
* in review, not hypothetical, since the loop would otherwise trust the sequence to terminate
|
|
408
|
+
* forever. After `maxPages` pages, throws instead of hanging silently.
|
|
409
|
+
*
|
|
410
|
+
* @param maxPages - Safety cap on how many pages to follow before giving up. Defaults to a limit
|
|
411
|
+
* generous enough for any realistic result set (10,000 pages — millions of rows at the max page
|
|
412
|
+
* size) while still catching a genuine stuck loop quickly.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```ts
|
|
416
|
+
* const firstPage = await suqo.subscriptions.list({ pageSize: 100 });
|
|
417
|
+
* for await (const subscription of listAll(firstPage, fetchNextPage)) {
|
|
418
|
+
* // subscription: Subscription
|
|
419
|
+
* }
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
declare function listAll<T>(firstPage: Page<T>, fetchNext: (nextUrl: string) => Promise<Page<T>>, maxPages?: number): AsyncIterableIterator<T>;
|
|
423
|
+
/**
|
|
424
|
+
* Bridges {@link listAll} to a resource's public `.autoPaging()` method (SDK Naming Map v1.1 §04
|
|
425
|
+
* — the public name is `.autoPaging()`; `listAll` stays this file's own internal engine name, per
|
|
426
|
+
* Ticket 3's design doc). Named `bridgeAutoPaging`, not `autoPaging`, specifically so it never
|
|
427
|
+
* shares a name with the public method that calls it — the two would still resolve correctly
|
|
428
|
+
* either way (a class method name isn't a lexical binding inside its own body), but a distinct
|
|
429
|
+
* name means nobody has to reason through that to be sure.
|
|
430
|
+
*
|
|
431
|
+
* Takes the first page as a **thunk** (`() => Promise<Page<T>>`), not an already-started
|
|
432
|
+
* `Promise` — this is deliberate, not a style choice. A resource method's `.autoPaging()` calls
|
|
433
|
+
* `this.list(params)` to build that first request; if that call happened eagerly (i.e. the caller
|
|
434
|
+
* passed the `Promise` itself), it would start firing the instant `.autoPaging()` is invoked, not
|
|
435
|
+
* when the caller actually begins iterating — and a rejection sitting unhandled between those two
|
|
436
|
+
* moments is a genuine `unhandledRejection`, which terminates a Node process by default (found in
|
|
437
|
+
* review, reproduced: calling `.autoPaging()` then doing anything else before iterating, on a
|
|
438
|
+
* request that fails, crashes the process — confirmed both with and without a handler attached).
|
|
439
|
+
* Wrapping the call in a thunk (`() => this.list(params)`) defers it until the async generator
|
|
440
|
+
* body actually runs `fetchFirstPage()`, which only happens once the caller starts iterating —
|
|
441
|
+
* matching every other async generator's behavior for real, not just by the doc comment's claim.
|
|
442
|
+
*
|
|
443
|
+
* Still fully decoupled from `HttpClient`/any resource, same as {@link listAll} — this file never
|
|
444
|
+
* imports anything from the HTTP layer.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* autoPaging(params?: PageParams): AsyncIterableIterator<Product> {
|
|
449
|
+
* return bridgeAutoPaging(() => this.list(params), (nextUrl) =>
|
|
450
|
+
* this.#http.request<Page<Product>>({ method: "GET", path: nextUrl }),
|
|
451
|
+
* );
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
declare function bridgeAutoPaging<T>(fetchFirstPage: () => Promise<Page<T>>, fetchNext: (nextUrl: string) => Promise<Page<T>>, maxPages?: number): AsyncIterableIterator<T>;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* The `products` resource's model types (`specs/openapi.yaml` `Product`/`Plan`/`BillingPeriod` —
|
|
459
|
+
* SDK-SPEC.md §5). Field names are camelCase per R3; nothing here is renamed from the wire (R5) —
|
|
460
|
+
* these three schemas aren't in the naming map's rename register.
|
|
461
|
+
*
|
|
462
|
+
* @packageDocumentation
|
|
463
|
+
*/
|
|
464
|
+
/** VAT configuration for a {@link Product}, if any. */
|
|
465
|
+
interface ProductVat {
|
|
466
|
+
isVatActive: boolean;
|
|
467
|
+
vatType: string;
|
|
468
|
+
/** Decimal string (e.g. `"13.00"`). Never coerced to a number — SDK-SPEC.md §5. */
|
|
469
|
+
vatPercentage: string;
|
|
470
|
+
}
|
|
471
|
+
/** A seller's product, as returned by `products.list()` (`openapi.yaml` `Product`). */
|
|
472
|
+
interface Product {
|
|
473
|
+
productId: string;
|
|
474
|
+
name: string;
|
|
475
|
+
description: string;
|
|
476
|
+
type: string;
|
|
477
|
+
isActive: boolean;
|
|
478
|
+
termsAndConditions: string;
|
|
479
|
+
featuresAndBenefits: string;
|
|
480
|
+
vat: ProductVat | null;
|
|
481
|
+
/** Ordered images; blank images already excluded server-side. */
|
|
482
|
+
productImage: string[];
|
|
483
|
+
plan: Plan[];
|
|
484
|
+
/** Count of active subscribers. Sent as a string on the wire — kept as one, never coerced (SDK-SPEC.md §5). */
|
|
485
|
+
totalSubscribers: string;
|
|
486
|
+
createdAt: string;
|
|
487
|
+
updatedAt: string;
|
|
488
|
+
}
|
|
489
|
+
/** A billing plan on a {@link Product} (`openapi.yaml` `Plan`). */
|
|
490
|
+
interface Plan {
|
|
491
|
+
planId: string;
|
|
492
|
+
planName: string;
|
|
493
|
+
description: string;
|
|
494
|
+
billingPeriods: BillingPeriod[];
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* One billable period on a {@link Plan} (`openapi.yaml` `BillingPeriod`). Its `pbpId` is what
|
|
498
|
+
* `subscriptions.create()` expects as `pbpId` (SDK-SPEC.md §5).
|
|
499
|
+
*/
|
|
500
|
+
interface BillingPeriod {
|
|
501
|
+
/** Public id — pass this to `subscriptions.create({ pbpId, ... })`. */
|
|
502
|
+
pbpId: string;
|
|
503
|
+
intervalType: string;
|
|
504
|
+
intervalCount: number;
|
|
505
|
+
label: string;
|
|
506
|
+
/** Decimal string. Never coerced to a number — SDK-SPEC.md §5. */
|
|
507
|
+
price: string;
|
|
508
|
+
currency: string;
|
|
509
|
+
isCurrent: boolean;
|
|
510
|
+
isLimited: boolean;
|
|
511
|
+
isArchived: boolean;
|
|
512
|
+
/** Wire schema is an empty item type (`items: {}`) — shape not yet specified by the API. */
|
|
513
|
+
offers: unknown[];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Every customer-shaped type in the SDK (SDK Naming Map v1.1 §11 "Customer boundary", §12 rename
|
|
518
|
+
* register). The wire field is `client` everywhere (`openapi.yaml`'s `ClientRead`/`ClientWrite`)
|
|
519
|
+
* — it collides with the SDK's own client object in every target language, so the surface renames
|
|
520
|
+
* it to `customer`, translated at the serializer boundary only. `rawBody` is never translated
|
|
521
|
+
* (R1). Three distinct types come out of this, not one — the read shape, the write shape, and the
|
|
522
|
+
* real `customers` resource's own full record are genuinely different shapes:
|
|
523
|
+
*
|
|
524
|
+
* - {@link SubscriptionCustomer} — read, embedded on a `Subscription` (was `ClientRead`).
|
|
525
|
+
* - {@link CustomerInput} — write, passed to `subscriptions.create()` (was `ClientWrite`).
|
|
526
|
+
* - {@link Customer} — the `customers` resource's own full record (was reserved; now live).
|
|
527
|
+
*
|
|
528
|
+
* @packageDocumentation
|
|
529
|
+
*/
|
|
530
|
+
/**
|
|
531
|
+
* The nested `billing`/`shipping` sub-objects use different wire key prefixes on read vs. write
|
|
532
|
+
* (`openapi.yaml` `ClientRead`/`ClientWrite`) — this isn't a naming inconsistency to fix, it's
|
|
533
|
+
* what the backend actually sends/expects; the serialization boundary (Ticket 4 step 3) maps each
|
|
534
|
+
* side to/from its own wire keys independently.
|
|
535
|
+
*/
|
|
536
|
+
interface SubscriptionCustomerBilling {
|
|
537
|
+
businessName?: string;
|
|
538
|
+
email?: string;
|
|
539
|
+
address?: string;
|
|
540
|
+
panVat?: string;
|
|
541
|
+
}
|
|
542
|
+
interface SubscriptionCustomerShipping {
|
|
543
|
+
phone?: string;
|
|
544
|
+
fullName?: string;
|
|
545
|
+
email?: string;
|
|
546
|
+
address?: string;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* The read shape embedded on a {@link import("./Subscription.js").Subscription}'s `customer`
|
|
550
|
+
* field (`openapi.yaml` `ClientRead`, renamed). None of its fields are marked required on the
|
|
551
|
+
* wire, so all are optional here rather than assumed present.
|
|
552
|
+
*/
|
|
553
|
+
interface SubscriptionCustomer {
|
|
554
|
+
phone?: string;
|
|
555
|
+
fullName?: string;
|
|
556
|
+
email?: string;
|
|
557
|
+
address?: string;
|
|
558
|
+
billing?: SubscriptionCustomerBilling | null;
|
|
559
|
+
shipping?: SubscriptionCustomerShipping | null;
|
|
560
|
+
}
|
|
561
|
+
/** The write shape of `CustomerInput.billing`, if provided (`openapi.yaml` `ClientWrite.billing`). */
|
|
562
|
+
interface CustomerInputBilling {
|
|
563
|
+
businessName: string;
|
|
564
|
+
email: string;
|
|
565
|
+
address: string;
|
|
566
|
+
/** 9 digits. */
|
|
567
|
+
panVat?: string;
|
|
568
|
+
}
|
|
569
|
+
/** The write shape of `CustomerInput.shipping`, if provided (`openapi.yaml` `ClientWrite.shipping`). */
|
|
570
|
+
interface CustomerInputShipping {
|
|
571
|
+
phone: string;
|
|
572
|
+
fullName: string;
|
|
573
|
+
email: string;
|
|
574
|
+
address?: string;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* What `subscriptions.create({ ..., customer })` accepts (`openapi.yaml` `ClientWrite`, renamed).
|
|
578
|
+
* When `billing` is omitted, billing info is filled from the buyer's own profile server-side; on a
|
|
579
|
+
* reused subscription (SDK-SPEC.md §5's reuse behavior), only the non-null fields overwrite.
|
|
580
|
+
*/
|
|
581
|
+
interface CustomerInput {
|
|
582
|
+
/** Buyer identity — matches or creates the buyer. */
|
|
583
|
+
phone: string;
|
|
584
|
+
fullName: string;
|
|
585
|
+
email: string;
|
|
586
|
+
address: string;
|
|
587
|
+
billing?: CustomerInputBilling;
|
|
588
|
+
shipping?: CustomerInputShipping;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* A seller's own customer record, as returned by `customers.list()`/`customers.retrieve()`
|
|
592
|
+
* (`openapi.yaml` `Customer`, confirmed live 2026-08-18). Distinct from {@link SubscriptionCustomer}
|
|
593
|
+
* and {@link CustomerInput} — see this file's module doc.
|
|
594
|
+
*
|
|
595
|
+
* Uses `buyer*`-prefixed field names, not the `client.*` nesting Subscriptions uses — a genuinely
|
|
596
|
+
* different resource with its own confirmed convention, carried through as-is.
|
|
597
|
+
*/
|
|
598
|
+
interface Customer {
|
|
599
|
+
/** Integer, not a UUID — breaks from the UUID convention every other resource uses. */
|
|
600
|
+
id: number;
|
|
601
|
+
buyerPhone: string | null;
|
|
602
|
+
buyerEmail: string | null;
|
|
603
|
+
fullName: string | null;
|
|
604
|
+
createdAt: string;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* `Subscription`'s model types (`specs/openapi.yaml` `Subscription`/`SubscriptionProduct`/
|
|
609
|
+
* `SubscriptionStatus` — SDK-SPEC.md §5).
|
|
610
|
+
*
|
|
611
|
+
* @packageDocumentation
|
|
612
|
+
*/
|
|
613
|
+
/**
|
|
614
|
+
* The subscription lifecycle enum (`openapi.yaml` `SubscriptionStatus`). Wire values are
|
|
615
|
+
* invariant (R1); this is a constant object + derived union, not a TypeScript `enum` — a plain
|
|
616
|
+
* union alone can't be iterated/round-tripped the way SDK Naming Map v1.1 §10 requires: "decoders
|
|
617
|
+
* must round-trip an unknown value rather than raising," so an unrecognized status the API adds
|
|
618
|
+
* later (before this SDK's next release) passes through as a plain string instead of throwing.
|
|
619
|
+
*/
|
|
620
|
+
declare const SubscriptionStatus: {
|
|
621
|
+
/** Newly created; the buyer hasn't paid yet. */
|
|
622
|
+
readonly PendingCheckout: "pending_checkout";
|
|
623
|
+
/** Currently active. */
|
|
624
|
+
readonly Active: "active";
|
|
625
|
+
/** `nextBillingCycle` passed with no payment yet. */
|
|
626
|
+
readonly Due: "due";
|
|
627
|
+
/** Cancelled immediately (user-prompted). */
|
|
628
|
+
readonly Cancelled: "cancelled";
|
|
629
|
+
/** Scheduled to cancel at the end of the current billing cycle — see SDK-SPEC.md §5's `cancel` note. */
|
|
630
|
+
readonly PendingCancellation: "pending_cancellation";
|
|
631
|
+
/** Auto-ended after a grace period without payment. */
|
|
632
|
+
readonly Inactive: "inactive";
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* Any known {@link SubscriptionStatus} wire value, OR an arbitrary string. The `& {}` intersection
|
|
636
|
+
* is deliberate, not a typo — a bare `string` union member would collapse the whole type to
|
|
637
|
+
* `string` and lose autocomplete for the known values; this keeps both: editor autocomplete
|
|
638
|
+
* suggests the six known values, but an unrecognized one the API adds later still assigns without
|
|
639
|
+
* a cast, satisfying the module doc's round-trip requirement at the type level too, not just at
|
|
640
|
+
* runtime.
|
|
641
|
+
*/
|
|
642
|
+
type SubscriptionStatus = (typeof SubscriptionStatus)[keyof typeof SubscriptionStatus] | (string & {});
|
|
643
|
+
/** The product summary embedded on a {@link Subscription} (`openapi.yaml` `SubscriptionProduct`) — a summary, not the full {@link import("./Product.js").Product} record. */
|
|
644
|
+
interface SubscriptionProduct {
|
|
645
|
+
productId: string;
|
|
646
|
+
name: string;
|
|
647
|
+
planName: string;
|
|
648
|
+
/** Pass this to `subscriptions.create({ pbpId, ... })`. */
|
|
649
|
+
pbpId: string;
|
|
650
|
+
label: string;
|
|
651
|
+
/** Decimal string. Never coerced to a number — SDK-SPEC.md §5. */
|
|
652
|
+
price: string;
|
|
653
|
+
currency: string;
|
|
654
|
+
}
|
|
655
|
+
/** A seller's subscription (`openapi.yaml` `Subscription`). */
|
|
656
|
+
interface Subscription {
|
|
657
|
+
subscriptionId: string;
|
|
658
|
+
status: SubscriptionStatus;
|
|
659
|
+
/** `true` iff `status === SubscriptionStatus.Active`. */
|
|
660
|
+
isActive: boolean;
|
|
661
|
+
/** The buyer, in the read shape — renamed from the wire's `client` (SDK Naming Map v1.1 §11). */
|
|
662
|
+
customer: SubscriptionCustomer;
|
|
663
|
+
/** `null` if the backend omits or nulls this field — `openapi.yaml` declares no required fields on `Subscription` (found in review). */
|
|
664
|
+
product: SubscriptionProduct | null;
|
|
665
|
+
currentPeriodStart: string | null;
|
|
666
|
+
/** Equals `nextBillingCycle`. */
|
|
667
|
+
currentPeriodEnd: string | null;
|
|
668
|
+
/** The date this subscription bills next (same value as `currentPeriodEnd`). */
|
|
669
|
+
nextBillingCycle: string | null;
|
|
670
|
+
createdAt: string;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Input/response shapes for the `subscriptions` write methods (`specs/openapi.yaml`
|
|
675
|
+
* `CreateSubscriptionRequest`/`CreateSubscriptionResponse`/`UpdateBillingCycleRequest`). The two
|
|
676
|
+
* input types are named `*Params`, not `*Request` — SDK Naming Map v1.1 §12: "Request" reads as
|
|
677
|
+
* an HTTP request object, not an SDK input. `CreateSubscriptionResponse` is unaffected; the rename
|
|
678
|
+
* only applies to inbound shapes.
|
|
679
|
+
*
|
|
680
|
+
* @packageDocumentation
|
|
681
|
+
*/
|
|
682
|
+
/**
|
|
683
|
+
* What `subscriptions.create(params)` accepts (`openapi.yaml` `CreateSubscriptionRequest`,
|
|
684
|
+
* renamed).
|
|
685
|
+
*/
|
|
686
|
+
interface CreateSubscriptionParams {
|
|
687
|
+
/** Plan billing period public id — from `products.list()`'s `plan[].billingPeriods[].pbpId`. */
|
|
688
|
+
pbpId: string;
|
|
689
|
+
/** Where the buyer returns after checkout. Not proof of payment — SDK-SPEC.md §5. */
|
|
690
|
+
returnUrl: string;
|
|
691
|
+
/** The buyer — renamed from the wire's `client` (SDK Naming Map v1.1 §11). */
|
|
692
|
+
customer: CustomerInput;
|
|
693
|
+
}
|
|
694
|
+
/** What `subscriptions.create()` returns (`openapi.yaml` `CreateSubscriptionResponse` — name unchanged). */
|
|
695
|
+
interface CreateSubscriptionResponse {
|
|
696
|
+
subscriptionId: string;
|
|
697
|
+
/** Echoed back from the request. */
|
|
698
|
+
pbpId: string;
|
|
699
|
+
/** Always this value immediately after creation. */
|
|
700
|
+
status: typeof SubscriptionStatus.PendingCheckout;
|
|
701
|
+
/** `<FRONTEND_URL>/pay/<subscriptionId>` — redirect the buyer here. Not proof of payment. */
|
|
702
|
+
checkoutUrl: string;
|
|
703
|
+
/** `null` until payment. */
|
|
704
|
+
nextBillingCycle: string | null;
|
|
705
|
+
createdAt: string;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* What `subscriptions.updateBillingCycle(params)` accepts (`openapi.yaml`
|
|
709
|
+
* `UpdateBillingCycleRequest`, renamed). Collection-level action — the id travels in the body,
|
|
710
|
+
* not the path, mirroring the wire (SDK Naming Map v1.1 §04).
|
|
711
|
+
*/
|
|
712
|
+
interface UpdateBillingCycleParams {
|
|
713
|
+
/** Must belong to the authenticated seller. */
|
|
714
|
+
subscriptionId: string;
|
|
715
|
+
/** `YYYY-MM-DD` — today or a future date. */
|
|
716
|
+
nextBillingCycle: string;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* What `subscriptions.cancel()`, `subscriptions.updateBillingCycle()`, and
|
|
721
|
+
* `subscriptions.resume()` all return (`specs/openapi.yaml` `Message`, renamed). Named
|
|
722
|
+
* `MessageResponse`, not `Message` — SDK Naming Map v1.1 §12: `Message` collides with the
|
|
723
|
+
* `message` property every {@link import("../errors/SuqoError.js").SuqoError} subclass already
|
|
724
|
+
* carries.
|
|
725
|
+
*
|
|
726
|
+
* @packageDocumentation
|
|
727
|
+
*/
|
|
728
|
+
interface MessageResponse {
|
|
729
|
+
message: string;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* The confirmed webhook event payload shapes: the original three (Ticket 0 item 2) plus four
|
|
734
|
+
* `api_key.*` events added 2026-09-03, each confirmed against a real delivery or a backend-
|
|
735
|
+
* confirmed sample — not the event catalog's names alone.
|
|
736
|
+
*
|
|
737
|
+
* Deliberately **snake_case**, unlike every other model in this SDK — `webhooks.verify()`
|
|
738
|
+
* (Ticket 5) only checks the signature and returns a `boolean`; it never parses the body itself
|
|
739
|
+
* (SDK-SPEC.md §9). A caller runs `JSON.parse(rawBody)` on their own, and that call genuinely
|
|
740
|
+
* produces snake_case keys, since nothing in this SDK converts them. Typing these as camelCase
|
|
741
|
+
* would describe a shape that doesn't exist at runtime — the same class of bug already found and
|
|
742
|
+
* fixed twice in the resource layer (Ticket 4), just avoided here from the start.
|
|
743
|
+
*
|
|
744
|
+
* @packageDocumentation
|
|
745
|
+
*/
|
|
746
|
+
/**
|
|
747
|
+
* Fields shared by every *subscription-related* webhook event (2026-08-25).
|
|
748
|
+
* Deliberately named for **subscription** events specifically, not a generic `BaseWebhookEvent` —
|
|
749
|
+
* `subscription_id` is common to these three because all three happen to be about a subscription,
|
|
750
|
+
* not because every webhook event SUQO will ever send is guaranteed to carry one. A future event
|
|
751
|
+
* about a different resource (e.g. a customer- or payout-level event) would need its own base, not
|
|
752
|
+
* be forced through this one. SDK Naming Map v1.1 has no coverage of this at all — same gap as the
|
|
753
|
+
* event fields themselves.
|
|
754
|
+
*/
|
|
755
|
+
interface SubscriptionWebhookEventBase {
|
|
756
|
+
subscription_id: string;
|
|
757
|
+
}
|
|
758
|
+
/** A successful checkout. `status` is always `"succeeded"` on this event — never anything else. */
|
|
759
|
+
interface CheckoutSucceededEvent extends SubscriptionWebhookEventBase {
|
|
760
|
+
event: "checkout.succeeded";
|
|
761
|
+
/** Decimal string. Never coerced to a number — SDK-SPEC.md §9. */
|
|
762
|
+
amount: string;
|
|
763
|
+
status: "succeeded";
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* A failed checkout. `status` is always `"failed"` — the platform deliberately omits the specific
|
|
767
|
+
* failure reason from this payload.
|
|
768
|
+
*/
|
|
769
|
+
interface CheckoutFailedEvent extends SubscriptionWebhookEventBase {
|
|
770
|
+
event: "checkout.failed";
|
|
771
|
+
/** Decimal string. Never coerced to a number — SDK-SPEC.md §9. */
|
|
772
|
+
amount: string;
|
|
773
|
+
status: "failed";
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* A subscription's status changed. No `amount` field — this is a status transition, not a
|
|
777
|
+
* payment. Named `subscription.status_changed` on the wire (underscore, past tense) — SDK-SPEC.md
|
|
778
|
+
* §9's prose still says `subscription.status.change`; that's the doc that's stale, not this type
|
|
779
|
+
* (docs/implementation-plan.md Ticket 0 item 2).
|
|
780
|
+
*/
|
|
781
|
+
interface SubscriptionStatusChangedEvent extends SubscriptionWebhookEventBase {
|
|
782
|
+
event: "subscription.status_changed";
|
|
783
|
+
previous_status: SubscriptionStatus;
|
|
784
|
+
current_status: SubscriptionStatus;
|
|
785
|
+
/** ISO 8601 timestamp. */
|
|
786
|
+
changed_at: string;
|
|
787
|
+
}
|
|
788
|
+
/** Fields shared by every API-key-related webhook event — separate base, no `subscription_id`. */
|
|
789
|
+
interface ApiKeyWebhookEventBase {
|
|
790
|
+
/** Sent as a string on the wire (e.g. `"305"`), not a number — never coerce it. */
|
|
791
|
+
api_key_id: string;
|
|
792
|
+
name: string;
|
|
793
|
+
/** Never the real key — always pre-masked by the backend (e.g. `"su_key_ca9...bf9e"`). */
|
|
794
|
+
masked_key: string;
|
|
795
|
+
/** `YYYY-MM-DD`, date-only — no time component, unlike `created_at`/`deleted_at`. */
|
|
796
|
+
expires_at: string;
|
|
797
|
+
/** ISO 8601 timestamp. */
|
|
798
|
+
created_at: string;
|
|
799
|
+
}
|
|
800
|
+
/** A new API key was created. */
|
|
801
|
+
interface ApiKeyCreatedEvent extends ApiKeyWebhookEventBase {
|
|
802
|
+
event: "api_key.created";
|
|
803
|
+
}
|
|
804
|
+
/** An API key was deleted. */
|
|
805
|
+
interface ApiKeyDeletedEvent extends ApiKeyWebhookEventBase {
|
|
806
|
+
event: "api_key.deleted";
|
|
807
|
+
/** ISO 8601 timestamp. */
|
|
808
|
+
deleted_at: string;
|
|
809
|
+
}
|
|
810
|
+
/** An API key's `expires_at` date has passed. */
|
|
811
|
+
interface ApiKeyExpiredEvent extends ApiKeyWebhookEventBase {
|
|
812
|
+
event: "api_key.expired";
|
|
813
|
+
}
|
|
814
|
+
/** An API key is nearing its `expires_at` date — fires ahead of `api_key.expired`. */
|
|
815
|
+
interface ApiKeyExpiringSoonEvent extends ApiKeyWebhookEventBase {
|
|
816
|
+
event: "api_key.expiring_soon";
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Any confirmed webhook event. Not exhaustive of everything SUQO might ever send — narrow on
|
|
820
|
+
* `event` before trusting the rest of the shape, the same way you'd handle any tagged union from
|
|
821
|
+
* an external source.
|
|
822
|
+
*/
|
|
823
|
+
type WebhookEvent = CheckoutSucceededEvent | CheckoutFailedEvent | SubscriptionStatusChangedEvent | ApiKeyCreatedEvent | ApiKeyDeletedEvent | ApiKeyExpiredEvent | ApiKeyExpiringSoonEvent;
|
|
824
|
+
/**
|
|
825
|
+
* Every event name the SDK currently knows the shape of — derived from {@link WebhookEvent}, not
|
|
826
|
+
* hand-duplicated, so it can never drift out of sync with the union above. Same standalone
|
|
827
|
+
* flat-union-of-event-names pattern as other SDKs' `WebhookEventType`.
|
|
828
|
+
*/
|
|
829
|
+
type WebhookEventType = WebhookEvent["event"];
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* `client.products` (SDK-SPEC.md §5, §6; `openapi.yaml` `listProducts`). The only resource that
|
|
833
|
+
* works before KYC verification — no `KycRequiredError` case to handle here.
|
|
834
|
+
*/
|
|
835
|
+
declare class ProductsResource {
|
|
836
|
+
#private;
|
|
837
|
+
constructor(http: HttpClient);
|
|
838
|
+
/** Lists the authenticated seller's active products. Paginated (SDK-SPEC.md §6). */
|
|
839
|
+
list(params?: PageParams): Promise<Page<Product>>;
|
|
840
|
+
/**
|
|
841
|
+
* Auto-iterates every product across every page, following `next` until it's `null`
|
|
842
|
+
* (SDK-SPEC.md §6). Manual `list({ page, pageSize })` remains available independently — this is
|
|
843
|
+
* additive, not a replacement.
|
|
844
|
+
*/
|
|
845
|
+
autoPaging(params?: PageParams): AsyncIterableIterator<Product>;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* `client.subscriptions` (SDK-SPEC.md §5, §6, §7; `openapi.yaml` `listSubscriptions`/
|
|
850
|
+
* `createSubscription`/`cancelSubscription`/`updateBillingCycle`/`resumeSubscription`).
|
|
851
|
+
*
|
|
852
|
+
* `retrieve(id)` is deliberately **not** implemented — still blocked on a real sample response
|
|
853
|
+
* from backend (docs/implementation-plan.md Ticket 4). Every other operation here is confirmed.
|
|
854
|
+
*/
|
|
855
|
+
declare class SubscriptionsResource {
|
|
856
|
+
#private;
|
|
857
|
+
constructor(http: HttpClient);
|
|
858
|
+
/**
|
|
859
|
+
* Lists the seller's subscriptions. Paginated, with four extra status counts alongside the
|
|
860
|
+
* common envelope (SDK-SPEC.md §6).
|
|
861
|
+
*/
|
|
862
|
+
list(params?: PageParams): Promise<SubscriptionPage<Subscription>>;
|
|
863
|
+
/**
|
|
864
|
+
* Auto-iterates every subscription across every page, following `next` until it's `null`
|
|
865
|
+
* (SDK-SPEC.md §6). Manual `list({ page, pageSize })` remains available independently.
|
|
866
|
+
*/
|
|
867
|
+
autoPaging(params?: PageParams): AsyncIterableIterator<Subscription>;
|
|
868
|
+
/**
|
|
869
|
+
* Creates a subscription in `pending_checkout` state and returns a checkout URL for the buyer
|
|
870
|
+
* to pay (SDK-SPEC.md §5). Redirect the buyer to `checkoutUrl`; the return is **not** proof of
|
|
871
|
+
* payment — learn the real outcome via the `checkout.succeeded`/`checkout.failed` webhooks.
|
|
872
|
+
*
|
|
873
|
+
* Reuse behavior: an inactive/expired subscription for the same buyer + product + billing
|
|
874
|
+
* period is reactivated rather than duplicated; only a currently `active` one triggers the
|
|
875
|
+
* duplicate-subscription `ValidationError`.
|
|
876
|
+
*
|
|
877
|
+
* Not auto-retryable — writes never retry until idempotency ships (SDK-SPEC.md §8, §12).
|
|
878
|
+
*/
|
|
879
|
+
create(params: CreateSubscriptionParams): Promise<CreateSubscriptionResponse>;
|
|
880
|
+
/**
|
|
881
|
+
* Schedules cancellation for the end of the current billing period — **not** immediate
|
|
882
|
+
* (confirmed with backend 2026-08-17; immediate cancellation is a future capability). Status
|
|
883
|
+
* moves to `pending_cancellation`; the subscription stays active until the period ends.
|
|
884
|
+
*
|
|
885
|
+
* Not auto-retryable — writes never retry until idempotency ships (SDK-SPEC.md §8, §12).
|
|
886
|
+
*/
|
|
887
|
+
cancel(id: string): Promise<MessageResponse>;
|
|
888
|
+
/**
|
|
889
|
+
* Sets a subscription's next billing date. Collection-level action — the subscription id
|
|
890
|
+
* travels in the body, not the path, mirroring the wire (SDK Naming Map v1.1 §04).
|
|
891
|
+
*
|
|
892
|
+
* Not auto-retryable — writes never retry until idempotency ships (SDK-SPEC.md §8, §12).
|
|
893
|
+
*/
|
|
894
|
+
updateBillingCycle(params: UpdateBillingCycleParams): Promise<MessageResponse>;
|
|
895
|
+
/**
|
|
896
|
+
* Resumes a subscription. Confirmed public with backend (2026-08-18); the response shape
|
|
897
|
+
* follows Swagger's `{ message }` example but — unlike Customers — isn't independently
|
|
898
|
+
* confirmed, so treat it as likely-correct-but-unverified (docs/implementation-plan.md Ticket 4).
|
|
899
|
+
*
|
|
900
|
+
* Not auto-retryable — writes never retry until idempotency ships (SDK-SPEC.md §8, §12).
|
|
901
|
+
*/
|
|
902
|
+
resume(id: string): Promise<MessageResponse>;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* `client.customers` (SDK-SPEC.md §5, §6; `openapi.yaml` `listCustomers`/`retrieveCustomer`).
|
|
907
|
+
* Read-only — no create/update/delete exists on this resource.
|
|
908
|
+
*/
|
|
909
|
+
declare class CustomersResource {
|
|
910
|
+
#private;
|
|
911
|
+
constructor(http: HttpClient);
|
|
912
|
+
/** Lists the authenticated seller's customers. Paginated (SDK-SPEC.md §6). */
|
|
913
|
+
list(params?: PageParams): Promise<Page<Customer>>;
|
|
914
|
+
/**
|
|
915
|
+
* Auto-iterates every customer across every page, following `next` until it's `null`
|
|
916
|
+
* (SDK-SPEC.md §6). Manual `list({ page, pageSize })` remains available independently — this is
|
|
917
|
+
* additive, not a replacement.
|
|
918
|
+
*/
|
|
919
|
+
autoPaging(params?: PageParams): AsyncIterableIterator<Customer>;
|
|
920
|
+
/**
|
|
921
|
+
* Retrieves a single customer by id. Unlike every other resource in this API, `id` is an
|
|
922
|
+
* **integer**, not a UUID (SDK-SPEC.md §5 naming note; `openapi.yaml` `Customer.id`).
|
|
923
|
+
*/
|
|
924
|
+
retrieve(id: number): Promise<Customer>;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* `client.webhooks` (SDK-SPEC.md §5, §9). Makes **no** network calls and stores no secret — the
|
|
929
|
+
* host application passes its own signing secret into every call. Verifies an inbound delivery
|
|
930
|
+
* genuinely came from SUQO and hasn't been tampered with or replayed; it does **not** parse the
|
|
931
|
+
* event body itself (see `models/WebhookEvent.ts` for why the event types stay snake_case).
|
|
932
|
+
*
|
|
933
|
+
* @packageDocumentation
|
|
934
|
+
*/
|
|
935
|
+
/** Options accepted by {@link WebhooksResource.verify}. */
|
|
936
|
+
interface VerifyWebhookOptions {
|
|
937
|
+
/**
|
|
938
|
+
* The **raw, unparsed** request body — exactly the bytes SUQO sent, before any JSON-parsing
|
|
939
|
+
* middleware touches it. SDK-SPEC.md §9 rule 1: verifying against a parsed-then-reserialized
|
|
940
|
+
* body is the single most common cause of "signature never matches" — whitespace, key order,
|
|
941
|
+
* and number formatting can all change silently on a round-trip through `JSON.parse`/
|
|
942
|
+
* `JSON.stringify`, even though the *meaning* of the body didn't change at all.
|
|
943
|
+
*/
|
|
944
|
+
rawBody: string | Buffer;
|
|
945
|
+
/** The `X-SUQO-Signature` header value, verbatim — e.g. `"sha256=<hex>"`. */
|
|
946
|
+
signature: string;
|
|
947
|
+
/** The `X-SUQO-Timestamp` header value, verbatim — Unix seconds, as a string. */
|
|
948
|
+
timestamp: string;
|
|
949
|
+
/** The webhook signing secret, provided by the host application. Never logged, never stored. */
|
|
950
|
+
secret: string;
|
|
951
|
+
/**
|
|
952
|
+
* Maximum age, in seconds, before a delivery is rejected as stale (defeats replay — SDK-SPEC.md
|
|
953
|
+
* §9 rule 3). Default 300 (~5 minutes).
|
|
954
|
+
*/
|
|
955
|
+
toleranceSec?: number;
|
|
956
|
+
}
|
|
957
|
+
declare class WebhooksResource {
|
|
958
|
+
/**
|
|
959
|
+
* Verifies an inbound webhook delivery's signature. Returns `false` for any failure mode —
|
|
960
|
+
* malformed signature, expired timestamp, or a genuine mismatch — never throws, so a caller
|
|
961
|
+
* never needs a `try`/`catch` just to check a delivery.
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```ts
|
|
965
|
+
* // Express: mount express.raw() on this route so req.body is a Buffer, not parsed JSON.
|
|
966
|
+
* const ok = suqo.webhooks.verify({
|
|
967
|
+
* rawBody: req.body,
|
|
968
|
+
* signature: req.header("X-SUQO-Signature")!,
|
|
969
|
+
* timestamp: req.header("X-SUQO-Timestamp")!,
|
|
970
|
+
* secret: process.env.SUQO_WEBHOOK_SECRET!,
|
|
971
|
+
* });
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
974
|
+
verify(options: VerifyWebhookOptions): boolean;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/** Options accepted by {@link SuqoClient}'s constructor (SDK-SPEC.md §2, §4; addendum §5). */
|
|
978
|
+
interface SuqoClientOptions {
|
|
979
|
+
/** The seller's API key. Its prefix determines sandbox vs. live — see SDK-SPEC.md §2. */
|
|
980
|
+
apiKey: string;
|
|
981
|
+
/**
|
|
982
|
+
* Optional explicit override. If set AND it disagrees with the key's inferred environment, the
|
|
983
|
+
* constructor throws `SuqoConfigError`. Normally omit this.
|
|
984
|
+
*/
|
|
985
|
+
baseUrl?: string;
|
|
986
|
+
/**
|
|
987
|
+
* Per-client default request timeout in milliseconds; per-call override also allowed by
|
|
988
|
+
* `http.ts` (Ticket 2). Default 30_000. Named `timeout`, not `timeoutMs` — per SDK Naming Map
|
|
989
|
+
* v1.1, SDK-surface fields drop the `Ms` suffix.
|
|
990
|
+
*/
|
|
991
|
+
timeout?: number;
|
|
992
|
+
/** Max retry attempts for idempotent reads (reads only — writes are never retried, SDK-SPEC.md §8, §12). Default 2. */
|
|
993
|
+
maxRetries?: number;
|
|
994
|
+
/** Advanced: custom undici dispatcher for connection-pool tuning, passed through opaquely (Ticket 2). */
|
|
995
|
+
dispatcher?: unknown;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* The SUQO SDK client (SDK-SPEC.md §5).
|
|
999
|
+
*
|
|
1000
|
+
* ```ts
|
|
1001
|
+
* const suqo = new SuqoClient({ apiKey: process.env.SUQO_API_KEY! });
|
|
1002
|
+
* ```
|
|
1003
|
+
*
|
|
1004
|
+
* The environment (sandbox vs. live) is inferred automatically from the key's prefix — nothing
|
|
1005
|
+
* else to configure in the common case (SDK-SPEC.md §2). Construction throws `SuqoConfigError`
|
|
1006
|
+
* immediately on a malformed key, or on a `baseUrl` override that disagrees with the key.
|
|
1007
|
+
*
|
|
1008
|
+
* `.products`/`.subscriptions`/`.customers` all share this one instance's `HttpClient` — same
|
|
1009
|
+
* `baseUrl`/`apiKey`/`timeout`/`maxRetries` for every call, regardless of which resource makes it.
|
|
1010
|
+
* `.webhooks` is deliberately **not** wired to that shared `HttpClient` — it makes no network
|
|
1011
|
+
* call and needs no key at all (SDK-SPEC.md §9), so it's constructed independently.
|
|
1012
|
+
*/
|
|
1013
|
+
declare class SuqoClient {
|
|
1014
|
+
#private;
|
|
1015
|
+
/** Browse the seller's active products (SDK-SPEC.md §5, §6). The only resource that works pre-KYC. */
|
|
1016
|
+
readonly products: ProductsResource;
|
|
1017
|
+
/** Create, list, and manage subscriptions (SDK-SPEC.md §5, §6, §7). */
|
|
1018
|
+
readonly subscriptions: SubscriptionsResource;
|
|
1019
|
+
/** List and retrieve the seller's customers — read-only (SDK-SPEC.md §5, §6). */
|
|
1020
|
+
readonly customers: CustomersResource;
|
|
1021
|
+
/** Verify inbound webhook deliveries (SDK-SPEC.md §9). Makes no network call, needs no key. */
|
|
1022
|
+
readonly webhooks: WebhooksResource;
|
|
1023
|
+
constructor(options: SuqoClientOptions);
|
|
1024
|
+
/** `"sandbox" | "live"` — inferred from the key prefix, never selected explicitly (SDK-SPEC.md §2). */
|
|
1025
|
+
get environment(): SuqoEnvironment;
|
|
1026
|
+
/** The resolved base URL this client sends requests to. */
|
|
1027
|
+
get baseUrl(): string;
|
|
1028
|
+
/** The effective request timeout in milliseconds (default 30_000). */
|
|
1029
|
+
get timeout(): number;
|
|
1030
|
+
/** The effective max retry count for idempotent reads (default 2). */
|
|
1031
|
+
get maxRetries(): number;
|
|
1032
|
+
/** Redacts the key so it never appears in `JSON.stringify` output (SDK-SPEC.md §4). */
|
|
1033
|
+
toJSON(): Record<string, unknown>;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* SDK entry point — the single, complete public export surface (SDK-SPEC.md §5).
|
|
1038
|
+
* Nothing outside this file's exports is part of the public contract.
|
|
1039
|
+
*
|
|
1040
|
+
* @packageDocumentation
|
|
1041
|
+
*/
|
|
1042
|
+
/** SDK version, stamped into request headers (keep in sync with package.json). */
|
|
1043
|
+
declare const VERSION = "1.0.0";
|
|
1044
|
+
|
|
1045
|
+
export { type ApiKeyCreatedEvent, type ApiKeyDeletedEvent, type ApiKeyExpiredEvent, type ApiKeyExpiringSoonEvent, AuthenticationError, type BillingPeriod, type CheckoutFailedEvent, type CheckoutSucceededEvent, type CreateSubscriptionParams, type CreateSubscriptionResponse, type Customer, type CustomerInput, type CustomerInputBilling, type CustomerInputShipping, type FieldErrors, type HttpErrorInput, KycRequiredError, type KycRequiredErrorOptions, type MessageResponse, NetworkError, NotFoundError, type Page, type PageParams, type Plan, type Product, type ProductVat, RateLimitError, type RateLimitErrorOptions, ServerError, type Subscription, type SubscriptionCustomer, type SubscriptionCustomerBilling, type SubscriptionCustomerShipping, type SubscriptionPage, type SubscriptionProduct, SubscriptionStatus, type SubscriptionStatusChangedEvent, type SubscriptionStatusCounts, SuqoClient, type SuqoClientOptions, SuqoConfigError, type SuqoEnvironment, SuqoError, type SuqoErrorOptions, type UpdateBillingCycleParams, VERSION, ValidationError, type ValidationErrorOptions, type VerifyWebhookOptions, type WebhookEvent, type WebhookEventType, bridgeAutoPaging, deserializePage, listAll, mapHttpError, toPageQuery };
|