@isnap/sdk 2.3.0 → 2.3.1-next.43435188216.1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +65 -40
  2. package/README.md +360 -167
  3. package/dist/client.d.ts +35 -49
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +44 -58
  6. package/dist/client.js.map +1 -1
  7. package/dist/config.d.ts +6 -6
  8. package/dist/config.js +6 -6
  9. package/dist/generated/openapi.d.ts +403 -14
  10. package/dist/internal/sleep.d.ts +2 -2
  11. package/dist/internal/sleep.js +5 -5
  12. package/dist/internal/sleep.js.map +1 -1
  13. package/dist/resources/apps.d.ts +11 -18
  14. package/dist/resources/apps.d.ts.map +1 -1
  15. package/dist/resources/apps.js +11 -18
  16. package/dist/resources/apps.js.map +1 -1
  17. package/dist/resources/area-codes.d.ts +5 -6
  18. package/dist/resources/area-codes.d.ts.map +1 -1
  19. package/dist/resources/area-codes.js +5 -6
  20. package/dist/resources/area-codes.js.map +1 -1
  21. package/dist/resources/attachments.d.ts +51 -17
  22. package/dist/resources/attachments.d.ts.map +1 -1
  23. package/dist/resources/attachments.js +42 -22
  24. package/dist/resources/attachments.js.map +1 -1
  25. package/dist/resources/byod.d.ts +14 -4
  26. package/dist/resources/byod.d.ts.map +1 -1
  27. package/dist/resources/byod.js +14 -4
  28. package/dist/resources/byod.js.map +1 -1
  29. package/dist/resources/chats.d.ts +30 -22
  30. package/dist/resources/chats.d.ts.map +1 -1
  31. package/dist/resources/chats.js +29 -21
  32. package/dist/resources/chats.js.map +1 -1
  33. package/dist/resources/lines.d.ts +240 -266
  34. package/dist/resources/lines.d.ts.map +1 -1
  35. package/dist/resources/lines.js +240 -266
  36. package/dist/resources/lines.js.map +1 -1
  37. package/dist/resources/lookup.d.ts +10 -13
  38. package/dist/resources/lookup.d.ts.map +1 -1
  39. package/dist/resources/lookup.js +10 -13
  40. package/dist/resources/lookup.js.map +1 -1
  41. package/dist/resources/macos-sessions.d.ts +42 -36
  42. package/dist/resources/macos-sessions.d.ts.map +1 -1
  43. package/dist/resources/macos-sessions.js +24 -22
  44. package/dist/resources/macos-sessions.js.map +1 -1
  45. package/dist/resources/messages.d.ts +35 -25
  46. package/dist/resources/messages.d.ts.map +1 -1
  47. package/dist/resources/messages.js +30 -19
  48. package/dist/resources/messages.js.map +1 -1
  49. package/dist/resources/preorders.d.ts +42 -47
  50. package/dist/resources/preorders.d.ts.map +1 -1
  51. package/dist/resources/preorders.js +42 -47
  52. package/dist/resources/preorders.js.map +1 -1
  53. package/dist/resources/trial.d.ts +30 -21
  54. package/dist/resources/trial.d.ts.map +1 -1
  55. package/dist/resources/trial.js +30 -21
  56. package/dist/resources/trial.js.map +1 -1
  57. package/dist/resources/webhooks.d.ts +39 -22
  58. package/dist/resources/webhooks.d.ts.map +1 -1
  59. package/dist/resources/webhooks.js +39 -22
  60. package/dist/resources/webhooks.js.map +1 -1
  61. package/dist/retry.d.ts +9 -10
  62. package/dist/retry.d.ts.map +1 -1
  63. package/dist/retry.js +11 -12
  64. package/dist/retry.js.map +1 -1
  65. package/dist/types.d.ts +10 -0
  66. package/dist/types.d.ts.map +1 -1
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.d.ts.map +1 -1
  69. package/dist/version.js +13 -37
  70. package/dist/version.js.map +1 -1
  71. package/dist/webhooks/parse.d.ts +10 -9
  72. package/dist/webhooks/parse.d.ts.map +1 -1
  73. package/dist/webhooks/parse.js +14 -13
  74. package/dist/webhooks/parse.js.map +1 -1
  75. package/dist/webhooks/types.d.ts +74 -110
  76. package/dist/webhooks/types.d.ts.map +1 -1
  77. package/dist/webhooks/types.js.map +1 -1
  78. package/dist/webhooks/verify.d.ts +27 -29
  79. package/dist/webhooks/verify.d.ts.map +1 -1
  80. package/dist/webhooks/verify.js +29 -35
  81. package/dist/webhooks/verify.js.map +1 -1
  82. package/examples/handle-webhook.ts +146 -0
  83. package/examples/paginate-messages.ts +54 -0
  84. package/examples/send-message.ts +37 -0
  85. package/examples/upload-attachment.ts +91 -0
  86. package/package.json +4 -8
@@ -5,26 +5,19 @@ export type AppManifest = components['schemas']['AppManifestResponse'];
5
5
  export type AppDownloadEntry = components['schemas']['AppDownloadEntry'];
6
6
  export declare class AppsResource extends BaseResource {
7
7
  /**
8
- * `GET /v1/apps` — the app/bridge download manifest: per-platform installer
9
- * URL, the version currently published for that platform, and whether this
10
- * deployment has an artifact configured for it. Public (no auth) and, unlike
11
- * `byod.pair`, requires no pairing in flight — use it for setup guides,
12
- * "add a device" flows, reinstalls, and update prompts (compare `version`
13
- * against the version the device reports).
8
+ * `GET /v1/apps`: where to download the bridge app. One entry for `macos`,
9
+ * with `url`, `version`, `version_status` and `available`. The operation
10
+ * needs no credential.
14
11
  *
15
- * The URLs are the same stable redirects `byod.pair` returns in
16
- * `download_urls` — one builder server-side, so they cannot drift.
12
+ * `url` is a stable link that redirects to the current installer. It is the
13
+ * link `byod.pair` returns in `download_urls`. When `available` is `false`,
14
+ * no installer is offered for that platform and `url` returns `404`: do not
15
+ * show the link.
17
16
  *
18
- * `version` is `string | null`. It is read from the release feed beside the
19
- * artifact `url` resolves to, so the number and the file cannot name
20
- * different releases, and it is `null` when that feed publishes nothing.
21
- * Render the absence ("version not published"); never substitute a number,
22
- * and do not treat `null` as an error. It is deliberately NOT the
23
- * `bridge_version` string `byod.pair` returns — that field is a separate,
24
- * device-facing value (WHA-2538).
25
- *
26
- * A platform with `available: false` still appears in the response; hide the
27
- * affordance rather than offering a link that 404s on click.
17
+ * `version` is a string exactly when `version_status` is `published`, and
18
+ * `null` otherwise. Show that no version is published: do not substitute a
19
+ * number, and do not treat `null` as an error. It is not the
20
+ * `bridge_version` that `byod.pair` returns.
28
21
  */
29
22
  manifest(opts?: RequestOptions): Promise<AppManifest>;
30
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAA;AACtE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;CAGtD"}
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAA;AACtE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;CAGtD"}
@@ -1,26 +1,19 @@
1
1
  import { BaseResource } from './base.js';
2
2
  export class AppsResource extends BaseResource {
3
3
  /**
4
- * `GET /v1/apps` — the app/bridge download manifest: per-platform installer
5
- * URL, the version currently published for that platform, and whether this
6
- * deployment has an artifact configured for it. Public (no auth) and, unlike
7
- * `byod.pair`, requires no pairing in flight — use it for setup guides,
8
- * "add a device" flows, reinstalls, and update prompts (compare `version`
9
- * against the version the device reports).
4
+ * `GET /v1/apps`: where to download the bridge app. One entry for `macos`,
5
+ * with `url`, `version`, `version_status` and `available`. The operation
6
+ * needs no credential.
10
7
  *
11
- * The URLs are the same stable redirects `byod.pair` returns in
12
- * `download_urls` — one builder server-side, so they cannot drift.
8
+ * `url` is a stable link that redirects to the current installer. It is the
9
+ * link `byod.pair` returns in `download_urls`. When `available` is `false`,
10
+ * no installer is offered for that platform and `url` returns `404`: do not
11
+ * show the link.
13
12
  *
14
- * `version` is `string | null`. It is read from the release feed beside the
15
- * artifact `url` resolves to, so the number and the file cannot name
16
- * different releases, and it is `null` when that feed publishes nothing.
17
- * Render the absence ("version not published"); never substitute a number,
18
- * and do not treat `null` as an error. It is deliberately NOT the
19
- * `bridge_version` string `byod.pair` returns — that field is a separate,
20
- * device-facing value (WHA-2538).
21
- *
22
- * A platform with `available: false` still appears in the response; hide the
23
- * affordance rather than offering a link that 404s on click.
13
+ * `version` is a string exactly when `version_status` is `published`, and
14
+ * `null` otherwise. Show that no version is published: do not substitute a
15
+ * number, and do not treat `null` as an error. It is not the
16
+ * `bridge_version` that `byod.pair` returns.
24
17
  */
25
18
  manifest(opts) {
26
19
  return this.client.request('GET', '/v1/apps', undefined, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,IAAqB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAc,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7E,CAAC;CACF"}
1
+ {"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/resources/apps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAqB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAc,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7E,CAAC;CACF"}
@@ -7,12 +7,11 @@ export type Country = components['schemas']['Country'];
7
7
  export type ListAreaCodesQuery = NonNullable<paths['/v1/area-codes']['get']['parameters']['query']>;
8
8
  export declare class AreaCodesResource extends BaseResource {
9
9
  /**
10
- * `GET /v1/area-codes` — list the selectable area codes a customer can
11
- * request as `preferred_area_codes` on a pre-order, for rendering an
12
- * area-code picker. Public (no auth required). Pass `{ country }` (ISO 3166-1
13
- * alpha-2, case-insensitive) to filter the area-code list; the `countries`
14
- * list in the response is always the full selectable set so it can drive a
15
- * country dropdown in the same round-trip.
10
+ * `GET /v1/area-codes`: the area codes that can be requested as
11
+ * `preferred_area_codes` on a pre-order, and the countries they belong to.
12
+ * It does not list the lines in stock. The operation needs no credential.
13
+ * Pass `{ country }` (ISO 3166-1 alpha-2, case-insensitive) to keep the area
14
+ * codes of one country; `countries` is never filtered.
16
15
  */
17
16
  list(query?: ListAreaCodesQuery, opts?: RequestOptions): Promise<AreaCodes>;
18
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"area-codes.d.ts","sourceRoot":"","sources":["../../src/resources/area-codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAA;AAC1D,MAAM,MAAM,QAAQ,GAAG,UA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BaseResource } from './base.js';
2
2
  export class AreaCodesResource extends BaseResource {
3
3
  /**
4
- * `GET /v1/area-codes` — list the selectable area codes a customer can
5
- * request as `preferred_area_codes` on a pre-order, for rendering an
6
- * area-code picker. Public (no auth required). Pass `{ country }` (ISO 3166-1
7
- * alpha-2, case-insensitive) to filter the area-code list; the `countries`
8
- * list in the response is always the full selectable set so it can drive a
9
- * country dropdown in the same round-trip.
4
+ * `GET /v1/area-codes`: the area codes that can be requested as
5
+ * `preferred_area_codes` on a pre-order, and the countries they belong to.
6
+ * It does not list the lines in stock. The operation needs no credential.
7
+ * Pass `{ country }` (ISO 3166-1 alpha-2, case-insensitive) to keep the area
8
+ * codes of one country; `countries` is never filtered.
10
9
  */
11
10
  list(query = {}, opts) {
12
11
  return this.client.request('GET', '/v1/area-codes', undefined, {
@@ -1 +1 @@
1
- {"version":3,"file":"area-codes.js","sourceRoot":"","sources":["../../src/resources/area-codes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AASxC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;OAOG;IACH,IAAI,CAAC,QAA4B,EAAE,EAAE,IAAqB;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAY,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE;YACxE,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;SACpC,CAAC,CAAA;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"area-codes.js","sourceRoot":"","sources":["../../src/resources/area-codes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AASxC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;OAMG;IACH,IAAI,CAAC,QAA4B,EAAE,EAAE,IAAqB;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAY,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE;YACxE,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;SACpC,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -10,35 +10,69 @@ export interface UploadMetadata {
10
10
  contentType: string;
11
11
  }
12
12
  export interface UploadOptions extends RequestOptions {
13
- /** Override the polling interval in ms while waiting for `status: ready`. Default 500. */
13
+ /**
14
+ * Wait between two reads of the attachment, in milliseconds. Default 500.
15
+ * Each read is one request and counts toward the request-rate limit. To wait
16
+ * longer for an attachment, raise this value to between 2,000 and 5,000.
17
+ */
14
18
  pollIntervalMs?: number;
15
- /** Override the maximum number of polls before giving up. Default 60 (≈30s at 500ms). */
19
+ /**
20
+ * Number of reads of the attachment before `upload()` gives up. Default 60:
21
+ * with the default interval, 30 seconds plus request time. iSnap confirms a
22
+ * finished upload on a 30-second cycle and converts an audio file before it
23
+ * is `ready`, so the default can run out on an upload that succeeds. To wait
24
+ * longer, raise `pollIntervalMs`, not this value alone: at the default
25
+ * interval the reads reach up to 120 per minute, above the request-rate
26
+ * limit of 100.
27
+ */
16
28
  maxPolls?: number;
17
29
  }
18
30
  export declare class AttachmentsResource extends BaseResource {
19
31
  /**
20
- * `POST /v1/attachments` — register an attachment and receive a
21
- * presigned R2 upload URL. Step 1 of the 3-step upload flow; prefer the
22
- * high-level `upload()` unless you need control over each step.
32
+ * `POST /v1/attachments`: register an attachment and get the URL to upload
33
+ * its bytes to (`upload_url`, with `required_headers`). It is the first step
34
+ * of an upload; `upload()` runs the whole upload in one call.
23
35
  *
24
- * Note: the contract has no DELETE /v1/attachments/{id} endpoint — rows
25
- * auto-expire after 72h via the retention worker. Don't add a delete
26
- * method here unless the backend ships one.
36
+ * The API has no operation that deletes an attachment. An attachment expires
37
+ * 72 hours after this call.
27
38
  */
28
39
  create(body: CreateAttachmentBody, opts?: RequestOptions): Promise<CreateAttachmentResponse>;
29
- /** `GET /v1/attachments/{id}` — fetch an attachment's status and download URL. */
40
+ /**
41
+ * `GET /v1/attachments/{id}`: one attachment, with its `status`.
42
+ * `download_url` is set only when `status` is `ready`.
43
+ */
30
44
  get(id: string, opts?: RequestOptions): Promise<Attachment>;
31
45
  /**
32
- * Transparent 3-step attachment upload:
33
- * 1. `POST /v1/attachments` to register the file and get a presigned R2 URL
34
- * 2. `PUT` the body directly to R2 with the required headers
35
- * 3. Poll `GET /v1/attachments/{id}` every `pollIntervalMs` until `status === 'ready'`
46
+ * Upload a file in one call:
47
+ * 1. `POST /v1/attachments` registers the attachment and returns an upload
48
+ * URL.
49
+ * 2. One `PUT` sends the bytes to that URL. This request is sent once: it is
50
+ * not retried.
51
+ * 3. `GET /v1/attachments/{id}` is read every `pollIntervalMs` until `status`
52
+ * is `ready`, at most `maxPolls` times.
53
+ *
54
+ * Resolves with the attachment once it is `ready`. `file` is a `Blob`, an
55
+ * `ArrayBuffer` or a `Uint8Array` (a Node.js `Buffer` qualifies): the whole
56
+ * file is held in memory. Each call registers a new attachment, unless you
57
+ * pass an `opts.idempotencyKey` that an earlier call used.
36
58
  *
37
59
  * Throws:
38
- * - `BadRequestError` if `size_bytes` exceeds the 5 GB cap
39
- * - `APIError` (`upload_failed`) if the R2 PUT returns non-2xx
40
- * - `APIError` (`upload_failed`) if the server transitions to `status: failed`
41
- * - `APIError` (`upload_timeout`) if `status` is still `uploading` after `maxPolls × pollIntervalMs`
60
+ * - `TypeError` when `file` is none of these types.
61
+ * - `APIError` with status 413 and code `attachment_exceeds_storage_limit`
62
+ * when the file is larger than 5 GB (5,368,709,120 bytes), before any
63
+ * request.
64
+ * - `APIConnectionError` when the upload request fails or times out.
65
+ * - `APIError` with code `upload_failed` when the upload request is refused
66
+ * (with the status of that response), or when `status` becomes `failed`
67
+ * (with status 422).
68
+ * - `APIError` with status 504 and code `upload_timeout` when the attachment
69
+ * is not `ready` after `maxPolls` reads. The attachment is not canceled.
70
+ *
71
+ * On `upload_timeout`, and on `upload_failed` after `status` became
72
+ * `failed`, the attachment id is only in the error message. When the upload
73
+ * request is refused, the error carries no id. To keep the id, call
74
+ * `create()`, upload the bytes yourself, and read `get()` until `status` is
75
+ * `ready`.
42
76
  */
43
77
  upload(file: UploadInput, metadata: UploadMetadata, opts?: UploadOptions): Promise<Attachment>;
44
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/resources/attachments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAA;AAC5D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAC5E,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,0BAA0B,CAAC,CAAA;AAExF,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,CAAA;AAEzD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAeD,qBAAa,mBAAoB,SAAQ,YAAY;IACnD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI5F,kFAAkF;IAClF,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,E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,UAAU,CAAC;IAS3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,MAAM,CACV,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,cAAc,EACxB,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC,UAAU,CAAC;CA8EvB"}
@@ -17,32 +17,54 @@ function computeSize(file) {
17
17
  }
18
18
  export class AttachmentsResource extends BaseResource {
19
19
  /**
20
- * `POST /v1/attachments` — register an attachment and receive a
21
- * presigned R2 upload URL. Step 1 of the 3-step upload flow; prefer the
22
- * high-level `upload()` unless you need control over each step.
20
+ * `POST /v1/attachments`: register an attachment and get the URL to upload
21
+ * its bytes to (`upload_url`, with `required_headers`). It is the first step
22
+ * of an upload; `upload()` runs the whole upload in one call.
23
23
  *
24
- * Note: the contract has no DELETE /v1/attachments/{id} endpoint — rows
25
- * auto-expire after 72h via the retention worker. Don't add a delete
26
- * method here unless the backend ships one.
24
+ * The API has no operation that deletes an attachment. An attachment expires
25
+ * 72 hours after this call.
27
26
  */
28
27
  create(body, opts) {
29
28
  return this.client.request('POST', '/v1/attachments', body, opts);
30
29
  }
31
- /** `GET /v1/attachments/{id}` — fetch an attachment's status and download URL. */
30
+ /**
31
+ * `GET /v1/attachments/{id}`: one attachment, with its `status`.
32
+ * `download_url` is set only when `status` is `ready`.
33
+ */
32
34
  get(id, opts) {
33
35
  return this.client.request('GET', `/v1/attachments/${encodeURIComponent(id)}`, undefined, opts);
34
36
  }
35
37
  /**
36
- * Transparent 3-step attachment upload:
37
- * 1. `POST /v1/attachments` to register the file and get a presigned R2 URL
38
- * 2. `PUT` the body directly to R2 with the required headers
39
- * 3. Poll `GET /v1/attachments/{id}` every `pollIntervalMs` until `status === 'ready'`
38
+ * Upload a file in one call:
39
+ * 1. `POST /v1/attachments` registers the attachment and returns an upload
40
+ * URL.
41
+ * 2. One `PUT` sends the bytes to that URL. This request is sent once: it is
42
+ * not retried.
43
+ * 3. `GET /v1/attachments/{id}` is read every `pollIntervalMs` until `status`
44
+ * is `ready`, at most `maxPolls` times.
45
+ *
46
+ * Resolves with the attachment once it is `ready`. `file` is a `Blob`, an
47
+ * `ArrayBuffer` or a `Uint8Array` (a Node.js `Buffer` qualifies): the whole
48
+ * file is held in memory. Each call registers a new attachment, unless you
49
+ * pass an `opts.idempotencyKey` that an earlier call used.
40
50
  *
41
51
  * Throws:
42
- * - `BadRequestError` if `size_bytes` exceeds the 5 GB cap
43
- * - `APIError` (`upload_failed`) if the R2 PUT returns non-2xx
44
- * - `APIError` (`upload_failed`) if the server transitions to `status: failed`
45
- * - `APIError` (`upload_timeout`) if `status` is still `uploading` after `maxPolls × pollIntervalMs`
52
+ * - `TypeError` when `file` is none of these types.
53
+ * - `APIError` with status 413 and code `attachment_exceeds_storage_limit`
54
+ * when the file is larger than 5 GB (5,368,709,120 bytes), before any
55
+ * request.
56
+ * - `APIConnectionError` when the upload request fails or times out.
57
+ * - `APIError` with code `upload_failed` when the upload request is refused
58
+ * (with the status of that response), or when `status` becomes `failed`
59
+ * (with status 422).
60
+ * - `APIError` with status 504 and code `upload_timeout` when the attachment
61
+ * is not `ready` after `maxPolls` reads. The attachment is not canceled.
62
+ *
63
+ * On `upload_timeout`, and on `upload_failed` after `status` became
64
+ * `failed`, the attachment id is only in the error message. When the upload
65
+ * request is refused, the error carries no id. To keep the id, call
66
+ * `create()`, upload the bytes yourself, and read `get()` until `status` is
67
+ * `ready`.
46
68
  */
47
69
  async upload(file, metadata, opts = {}) {
48
70
  const size = computeSize(file);
@@ -60,13 +82,11 @@ export class AttachmentsResource extends BaseResource {
60
82
  content_type: metadata.contentType,
61
83
  size_bytes: size
62
84
  }, opts);
63
- // Build PUT headers via the Headers constructor so case-insensitive
64
- // dedup happens for us — the server may return `required_headers` with
65
- // any casing of `content-type` / `content-length`, and a plain
66
- // `Record<string, string>` spread would emit duplicate-cased keys that
67
- // some R2 deploys reject as `SignatureDoesNotMatch`. We trust the
68
- // server's `required_headers` because R2 ignores non-AWS keys, so a
69
- // compromised value cannot be used to inject auth into the upload.
85
+ // Build the upload headers with the Headers constructor, which merges
86
+ // names case-insensitively: `required_headers` can carry any casing of
87
+ // `content-type` and `content-length`, and a plain object spread would
88
+ // send the same header twice, which the upload URL can refuse.
89
+ // `required_headers` comes from the API response and is sent as given.
70
90
  const putHeaders = new Headers(created.required_headers);
71
91
  putHeaders.set('Content-Type', metadata.contentType);
72
92
  putHeaders.set('Content-Length', String(size));
@@ -1 +1 @@
1
- {"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/resources/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAoBxC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AACtC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AACpC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAE5B,SAAS,WAAW,CAAC,IAAiB;IACpC,IAAI,IAAI,YAAY,UAAU;QAAE,OAAO,IAAI,CAAC,UAAU,CAAA;IACtD,IAAI,IAAI,YAAY,WAAW;QAAE,OAAO,IAAI,CAAC,UAAU,CAAA;IACvD,uEAAuE;IACvE,yCAAyC;IACzC,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,YAAY,IAAI;QAAE,OAAO,IAAI,CAAC,IAAI,CAAA;IACzE,MAAM,IAAI,SAAS,CAAC,mEAAmE,CAAC,CAAA;AAC1F,CAAC;AAED,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IACnD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAA0B,EAAE,IAAqB;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA2B,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;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C,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC5B,MAAM,IAAI,QAAQ,CAAC;oBACjB,MAAM,EAAE,GAAG;oBACX,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,cAAc,OAAO,CAAC,EAAE,iCAAiC;oBAClE,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,EAAE;iBACd,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC;YACjB,MAAM,EAAE,GAAG;YACX,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,cAAc,OAAO,CAAC,EAAE,gCAAgC,QAAQ,GAAG,cAAc,IAAI;YAC9F,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;SACd,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -5,10 +5,20 @@ export type ByodPairBody = components['schemas']['ByodPairBody'];
5
5
  export type ByodPairResponse = components['schemas']['ByodPairResponse'];
6
6
  export declare class ByodResource extends BaseResource {
7
7
  /**
8
- * `POST /v1/byod/pair` — mint a 5-minute activation code and presigned
9
- * bridge installer URL for a customer-owned device. Returns 402 if the
10
- * caller has no available BYOD slot. After the customer runs the bridge
11
- * and pairs, `device.activate` mints the BYOD line server-side.
8
+ * `POST /v1/byod/pair`: issue an activation code for a BYOD pairing.
9
+ * Resolves with `activation_code` (single use, valid 5 minutes),
10
+ * `expires_at`, `download_urls` and `bridge_version`. The body takes an
11
+ * optional `metadata`, copied onto the line the pairing creates.
12
+ *
13
+ * The line appears on your account, already `active`, when the bridge app
14
+ * completes the pairing with the code.
15
+ *
16
+ * An account that is not a wholesale partner needs a free BYOD slot. With no
17
+ * BYOD subscription the call is a `PaymentRequiredError` (402
18
+ * `payment_required`); with every slot used it is a `NotFoundError` (404
19
+ * `no_slot_available`).
20
+ *
21
+ * The API does not deduplicate this call: a retry issues another code.
12
22
  */
13
23
  pair(body: ByodPairBody, opts?: RequestOptions): Promise<ByodPairResponse>;
14
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"byod.d.ts","sourceRoot":"","sources":["../../src/resources/byod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG3E"}
1
+ {"version":3,"file":"byod.d.ts","sourceRoot":"","sources":["../../src/resources/byod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG3E"}
@@ -1,10 +1,20 @@
1
1
  import { BaseResource } from './base.js';
2
2
  export class ByodResource extends BaseResource {
3
3
  /**
4
- * `POST /v1/byod/pair` — mint a 5-minute activation code and presigned
5
- * bridge installer URL for a customer-owned device. Returns 402 if the
6
- * caller has no available BYOD slot. After the customer runs the bridge
7
- * and pairs, `device.activate` mints the BYOD line server-side.
4
+ * `POST /v1/byod/pair`: issue an activation code for a BYOD pairing.
5
+ * Resolves with `activation_code` (single use, valid 5 minutes),
6
+ * `expires_at`, `download_urls` and `bridge_version`. The body takes an
7
+ * optional `metadata`, copied onto the line the pairing creates.
8
+ *
9
+ * The line appears on your account, already `active`, when the bridge app
10
+ * completes the pairing with the code.
11
+ *
12
+ * An account that is not a wholesale partner needs a free BYOD slot. With no
13
+ * BYOD subscription the call is a `PaymentRequiredError` (402
14
+ * `payment_required`); with every slot used it is a `NotFoundError` (404
15
+ * `no_slot_available`).
16
+ *
17
+ * The API does not deduplicate this call: a retry issues another code.
8
18
  */
9
19
  pair(body, opts) {
10
20
  return this.client.request('POST', '/v1/byod/pair', body, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"byod.js","sourceRoot":"","sources":["../../src/resources/byod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;OAKG;IACH,IAAI,CAAC,IAAkB,EAAE,IAAqB;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACnF,CAAC;CACF"}
1
+ {"version":3,"file":"byod.js","sourceRoot":"","sources":["../../src/resources/byod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,IAAkB,EAAE,IAAqB;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACnF,CAAC;CACF"}
@@ -1,7 +1,7 @@
1
1
  import type { components, paths } from '../generated/openapi.js';
2
2
  import type { RequestOptions } from '../types.js';
3
3
  import { BaseResource } from './base.js';
4
- /** Conversation shape returned by list/get (contract §2.3), incl. `outbound_number`. */
4
+ /** A chat, as `list` and `get` return it. */
5
5
  export type Chat = components['schemas']['Chat'];
6
6
  export type ChatTypingStart = components['schemas']['ChatTypingStart'];
7
7
  export type ChatTypingStop = components['schemas']['ChatTypingStop'];
@@ -13,38 +13,46 @@ export type MarkReadBody = NonNullable<paths['/v1/chats/{chat_id}/read']['post']
13
13
  export type ShareContactCardBody = NonNullable<paths['/v1/chats/{chat_id}/share-contact-card']['post']['requestBody']>['content']['application/json'];
14
14
  export declare class ChatsResource extends BaseResource {
15
15
  /**
16
- * `GET /v1/chats/{chat_id}` — fetch a single conversation by its
17
- * `chat_<base62>` id. Same shape as the list items, including
18
- * `outbound_number` for shared-plan lines (§2.3). Cross-account and
19
- * out-of-scope ids resolve 404.
16
+ * `GET /v1/chats/{chat_id}`: one chat, by its `chat_` id. An unknown id, a
17
+ * chat of another account and a chat outside the lines of a line-scoped key
18
+ * all return `404`.
20
19
  */
21
20
  get(chatId: string, opts?: RequestOptions): Promise<Chat>;
22
21
  /**
23
- * `GET /v1/chats` — cursor-paginated list of the caller's conversations,
24
- * newest activity first, as an AsyncIterable. The iterator threads
25
- * `next_cursor` across pages so the consumer can
26
- * `for await (const chat of client.chats.list({...}))` and get every
27
- * matching chat. Filter by `line_id`, bound the activity window with
28
- * `since` / `until` (ISO-8601, inclusive), and tune the page size with
29
- * `limit` (1–100). On shared-plan lines each chat carries
30
- * `outbound_number` — the physical number currently serving that
31
- * contact; `null` on non-shared lines or once the binding is released.
22
+ * `GET /v1/chats`: your chats, most recent activity first, as an
23
+ * `AsyncIterable`. A `for await` loop receives every matching chat; the SDK
24
+ * fetches the next page when the current one is consumed. Filter by
25
+ * `line_id`, bound the last activity time with `since` and `until` (ISO 8601,
26
+ * inclusive), and set the page size with `limit` (1 to 100, default 20).
27
+ *
28
+ * On a shared line, `outbound_number` is the number that serves the contact,
29
+ * or `null` when none is assigned. On every other line it is `null`.
32
30
  */
33
31
  list(filters?: Omit<ListChatsQuery, 'cursor'>, opts?: RequestOptions): AsyncIterable<Chat>;
34
32
  /**
35
- * `POST /v1/chats/{chat_id}/typing` — start an explicit typing indicator
36
- * on a chat. The dots stay visible until `typingStop` is called or a
37
- * message is sent (see contract §2.3 — explicit overrides
38
- * `use_typing_indicator`).
33
+ * `POST /v1/chats/{chat_id}/typing`: ask the line's device to show the typing
34
+ * indicator to the chat's contact. Resolves with `chat_id`, `started_at` and
35
+ * `expires_at`, which is 15 seconds after `started_at`. Call it again to keep
36
+ * the indicator, or call `typingStop` to clear it.
39
37
  */
40
38
  typingStart(chatId: string, body: TypingStartBody, opts?: RequestOptions): Promise<ChatTypingStart>;
41
- /** `DELETE /v1/chats/{chat_id}/typing` — stop the explicit typing indicator. */
39
+ /** `DELETE /v1/chats/{chat_id}/typing`: ask the line's device to clear the typing indicator. */
42
40
  typingStop(chatId: string, opts?: RequestOptions): Promise<ChatTypingStop>;
43
- /** `POST /v1/chats/{chat_id}/read` — mark messages up to a given message as read. */
41
+ /**
42
+ * `POST /v1/chats/{chat_id}/read`: mark every unread inbound message of the
43
+ * chat as read and ask the line's device to send read receipts. Resolves with
44
+ * `chat_id`, `read_at` and `marked_count`.
45
+ */
44
46
  markRead(chatId: string, body: MarkReadBody, opts?: RequestOptions): Promise<ChatMarkRead>;
45
47
  /**
46
- * `POST /v1/chats/{chat_id}/share-contact-card` — share an Apple
47
- * contact-card vCard attachment with the recipient.
48
+ * `POST /v1/chats/{chat_id}/share-contact-card`: send a contact card (a
49
+ * vCard file) to the chat's contact, as a message with one attachment.
50
+ *
51
+ * Once a call has queued the card, a repeat with the same idempotency key
52
+ * returns `409 idempotency_conflict` instead of the first result. The
53
+ * automatic retries of the SDK reuse the key: call this method with
54
+ * `{ maxRetries: 0 }`, and after an error read the messages of the chat's
55
+ * line before you send the card again.
48
56
  */
49
57
  shareContactCard(chatId: string, body: ShareContactCardBody, opts?: RequestOptions): Promise<ShareContactCardResult>;
50
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chats.d.ts","sourceRoot":"","sources":["../../src/resources/chats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,wFAAwF;AACxF,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAA;AACtE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AACpE,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AAChE,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,wBAAwB,CAAC,CAAA;AAEpF,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAC1F,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,KAAK,CAAC,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC3D,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,YAAY,GAAG,WAAW,CACpC,KAAK,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CACzD,CAAC,SAAS,CAAC,CAAC,kBAAkB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AAI,CAAC,cAAc,EAAE,QAAQ,CAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,IAAI,CAAC;IAW9F;;;;;OAKG;IACH,WAAW,CACT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,eAAe,EACrB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC;IAS3B,gGAAgG;IAChG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAS1E;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAS1F;;;;;;;;;OASG;IACH,gBAAgB,CACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,oBAAoB,EAC1B,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,sBAAsB,CAAC;CAQnC"}
@@ -2,24 +2,22 @@ import { paginate } from '../pagination.js';
2
2
  import { BaseResource } from './base.js';
3
3
  export class ChatsResource extends BaseResource {
4
4
  /**
5
- * `GET /v1/chats/{chat_id}` — fetch a single conversation by its
6
- * `chat_<base62>` id. Same shape as the list items, including
7
- * `outbound_number` for shared-plan lines (§2.3). Cross-account and
8
- * out-of-scope ids resolve 404.
5
+ * `GET /v1/chats/{chat_id}`: one chat, by its `chat_` id. An unknown id, a
6
+ * chat of another account and a chat outside the lines of a line-scoped key
7
+ * all return `404`.
9
8
  */
10
9
  get(chatId, opts) {
11
10
  return this.client.request('GET', `/v1/chats/${encodeURIComponent(chatId)}`, undefined, opts);
12
11
  }
13
12
  /**
14
- * `GET /v1/chats` — cursor-paginated list of the caller's conversations,
15
- * newest activity first, as an AsyncIterable. The iterator threads
16
- * `next_cursor` across pages so the consumer can
17
- * `for await (const chat of client.chats.list({...}))` and get every
18
- * matching chat. Filter by `line_id`, bound the activity window with
19
- * `since` / `until` (ISO-8601, inclusive), and tune the page size with
20
- * `limit` (1–100). On shared-plan lines each chat carries
21
- * `outbound_number` — the physical number currently serving that
22
- * contact; `null` on non-shared lines or once the binding is released.
13
+ * `GET /v1/chats`: your chats, most recent activity first, as an
14
+ * `AsyncIterable`. A `for await` loop receives every matching chat; the SDK
15
+ * fetches the next page when the current one is consumed. Filter by
16
+ * `line_id`, bound the last activity time with `since` and `until` (ISO 8601,
17
+ * inclusive), and set the page size with `limit` (1 to 100, default 20).
18
+ *
19
+ * On a shared line, `outbound_number` is the number that serves the contact,
20
+ * or `null` when none is assigned. On every other line it is `null`.
23
21
  */
24
22
  list(filters = {}, opts) {
25
23
  return paginate((cursor) => this.client.request('GET', '/v1/chats', undefined, {
@@ -28,25 +26,35 @@ export class ChatsResource extends BaseResource {
28
26
  }), { signal: opts?.signal });
29
27
  }
30
28
  /**
31
- * `POST /v1/chats/{chat_id}/typing` — start an explicit typing indicator
32
- * on a chat. The dots stay visible until `typingStop` is called or a
33
- * message is sent (see contract §2.3 — explicit overrides
34
- * `use_typing_indicator`).
29
+ * `POST /v1/chats/{chat_id}/typing`: ask the line's device to show the typing
30
+ * indicator to the chat's contact. Resolves with `chat_id`, `started_at` and
31
+ * `expires_at`, which is 15 seconds after `started_at`. Call it again to keep
32
+ * the indicator, or call `typingStop` to clear it.
35
33
  */
36
34
  typingStart(chatId, body, opts) {
37
35
  return this.client.request('POST', `/v1/chats/${encodeURIComponent(chatId)}/typing`, body, opts);
38
36
  }
39
- /** `DELETE /v1/chats/{chat_id}/typing` — stop the explicit typing indicator. */
37
+ /** `DELETE /v1/chats/{chat_id}/typing`: ask the line's device to clear the typing indicator. */
40
38
  typingStop(chatId, opts) {
41
39
  return this.client.request('DELETE', `/v1/chats/${encodeURIComponent(chatId)}/typing`, undefined, opts);
42
40
  }
43
- /** `POST /v1/chats/{chat_id}/read` — mark messages up to a given message as read. */
41
+ /**
42
+ * `POST /v1/chats/{chat_id}/read`: mark every unread inbound message of the
43
+ * chat as read and ask the line's device to send read receipts. Resolves with
44
+ * `chat_id`, `read_at` and `marked_count`.
45
+ */
44
46
  markRead(chatId, body, opts) {
45
47
  return this.client.request('POST', `/v1/chats/${encodeURIComponent(chatId)}/read`, body, opts);
46
48
  }
47
49
  /**
48
- * `POST /v1/chats/{chat_id}/share-contact-card` — share an Apple
49
- * contact-card vCard attachment with the recipient.
50
+ * `POST /v1/chats/{chat_id}/share-contact-card`: send a contact card (a
51
+ * vCard file) to the chat's contact, as a message with one attachment.
52
+ *
53
+ * Once a call has queued the card, a repeat with the same idempotency key
54
+ * returns `409 idempotency_conflict` instead of the first result. The
55
+ * automatic retries of the SDK reuse the key: call this method with
56
+ * `{ maxRetries: 0 }`, and after an error read the messages of the chat's
57
+ * line before you send the card again.
50
58
  */
51
59
  shareContactCard(chatId, body, opts) {
52
60
  return this.client.request('POST', `/v1/chats/${encodeURIComponent(chatId)}/share-contact-card`, body, opts);