import { type ClientConfig } from './config.js'; import { AppsResource } from './resources/apps.js'; import { AreaCodesResource } from './resources/area-codes.js'; import { AttachmentsResource } from './resources/attachments.js'; import { ByodResource } from './resources/byod.js'; import { ChatsResource } from './resources/chats.js'; import { LinesResource } from './resources/lines.js'; import { LookupResource } from './resources/lookup.js'; import { MessagesResource } from './resources/messages.js'; import { PreOrdersResource } from './resources/preorders.js'; import { TrialResource } from './resources/trial.js'; import { WebhooksResource } from './resources/webhooks.js'; import type { components } from './generated/openapi.js'; import type { HttpMethod, RequestOptions } from './types.js'; /** * `GET /v1/version` payload, unwrapped from its response envelope: the deployed * backend's `API_SCHEMA_VERSION`. */ export type VersionInfo = components['schemas']['VersionResponse']['data']; /** * `GET /v1/health` bare-body payload: `{ status, timestamp, checks }`. `status` * is `'ok'` on a 200 and `'degraded'` on a 503. */ export type HealthStatus = components['schemas']['HealthResponse']; /** * Test-only escape hatch to clear the per-process dedup set between test * cases. Not part of the public stability contract — flagged @internal so * IDE auto-import doesn't surface it to consumers. * * @internal */ export declare function _resetDeprecationWarnings(): void; export declare class ISnapClient { private readonly config; readonly apps: AppsResource; readonly areaCodes: AreaCodesResource; readonly attachments: AttachmentsResource; readonly byod: ByodResource; readonly chats: ChatsResource; readonly lines: LinesResource; readonly lookup: LookupResource; readonly messages: MessagesResource; readonly preOrders: PreOrdersResource; readonly trial: TrialResource; readonly webhooks: WebhooksResource; constructor(config: ClientConfig); /** * Direct fetch with no SDK auth, no envelope parsing, no retry — used * internally by resource methods that must call URLs OUTSIDE the iSnap * API surface (e.g. presigned R2 PUTs during `attachments.upload`). * * The leading underscore signals "internal but unavoidably public": it * lives on the public class because resource classes cannot reach the * private `config.fetch` otherwise. SDK consumers should use the typed * resource methods or `request()` for everything in `/v1/*` — calling * this directly bypasses the SDK contract. * * Applies the same `config.timeoutMs` ceiling as `request()` so a * stalled R2 PUT cannot hang the upload indefinitely. * * @internal */ _externalFetch(url: string, init?: RequestInit): Promise; /** * Low-level request method. Resource classes wrap this with typed camelCase METHOD NAMES over the * generated snake_case BODY types; advanced users can call it directly for endpoints not yet * covered by a resource. * * The split matters and used to be one word doing two jobs (WHA-2278). This method is a bare * `JSON.stringify(body)` — it converts NOTHING. Read as "camelCase signatures", that ambiguity * grew in §5.2's preamble into "method names are camelCase in TypeScript but send snake_case on * the wire", which has no mechanism behind it, and that one sentence produced a family of wrong * request examples (`fromLineId`, `lineIds`, `replyToMessageId`) partners would have copied * verbatim into 400s. Send the keys the generated types declare. */ request(method: HttpMethod, path: string, body?: unknown, opts?: RequestOptions): Promise; /** * `GET /v1/version` — the deployed backend's `API_SCHEMA_VERSION`. Enveloped * like every other `/v1` response, so it resolves to the unwrapped * `{ version }`. The route is `security: []` (public), but the SDK still * sends `Authorization` (the backend ignores it here) and `resolveConfig` * still requires a non-empty `apiKey`. */ version(opts?: RequestOptions): Promise; /** * `GET /v1/health` — the backend's health probe. Returns a BARE body (no * `{success,data,error}` envelope): `{ status, timestamp, checks }` on a 200, * and the SAME shape with `status: 'degraded'` on a 503. A degraded backend * is DATA, not a failure — so a 503 resolves rather than throwing, and is NOT * retried by default (`maxRetries: 0`, overridable via `opts.maxRetries`). A * non-JSON body, or any status other than 200/503, throws * (`ServiceUnavailableError` for `>= 500`, `APIError` otherwise). Like * `version()`, this route is `security: []` yet still receives `Authorization` * and still requires a non-empty `apiKey`. * * This is the GLOBAL system probe. For the health of a specific line use * `client.lines.health(lineId)` (`GET /v1/lines/{id}/health`) — a different * endpoint on a different object. */ health(opts?: RequestOptions): Promise; private dispatch; /** * Like `request`, but for the BARE `/v1` probes (`/v1/health`) whose body * carries no `{success,data,error}` envelope. Returns the parsed JSON * verbatim for 200 and 503 (a degraded 503 is data, not an error) and throws * for any other status or a non-JSON body. Defaults to `maxRetries: 0` — a * degraded probe is an answer, not a transient failure to retry — but honours * an explicit `opts.maxRetries` (a genuinely retryable throwing status like a * non-JSON 500 is then retried like any other request). */ private requestBare; private dispatchBare; private buildUrl; private buildHeaders; private warnIfDeprecated; private connectionErrorMessage; } //# sourceMappingURL=client.d.ts.map