@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
@@ -9,35 +9,28 @@ export type ListPreOrdersQuery = NonNullable<paths['/v1/pre-orders']['get']['par
9
9
  export type PatchPreOrderBody = components['schemas']['PatchPreOrder'];
10
10
  export declare class PreOrdersResource extends BaseResource {
11
11
  /**
12
- * `POST /v1/pre-orders` — place a pre-order for a rental tier with no
13
- * in-stock inventory. Set `inbound_only: true` to request the inbound-only
14
- * rental variant. `billing_tier` is optional and ORTHOGONAL to that plan —
15
- * omitting it means `rental_iphone`, the only tier this flow mints, and
16
- * `rental_iphone` covers BOTH rental products (`inbound_only` is what picks
17
- * between them), so naming both is never a contradiction. When named it is
18
- * answered rather than discarded (WHA-2949): `rental_android` is a
19
- * `400 android_rental_not_purchasable` — no Android product exists in the
20
- * Stripe catalogue — and a BYOD / virtual-shared / pool tier is a
21
- * `400 tier_not_pre_orderable` whose message names the endpoint that
22
- * acquires it instead. Returns a `draft` pre-order and NOTHING else: no
23
- * line, no fulfillment task, no ops notification, no Stripe charge, and
24
- * `stripe_client_secret` is always `null`. A draft costs nothing to place
25
- * and binds nobody — call `confirm()` to engage the month and start
26
- * procurement.
12
+ * `POST /v1/pre-orders`: create a pre-order for one rented iPhone line, as a
13
+ * `draft`. A draft creates no line, takes no payment and starts no purchase:
14
+ * call `confirm()` to place the order.
15
+ *
16
+ * Every field is optional. `preferred_area_codes` lists up to 5 area codes in
17
+ * your order of preference. `inbound_only: true` orders an inbound-only line.
18
+ * `billing_tier` accepts `rental_iphone` or no value: any other tier is a
19
+ * `BadRequestError` (400).
27
20
  */
28
21
  create(body: CreatePreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
29
22
  /**
30
- * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
31
- * binding step: engages the one-month commitment (full month, no proration).
23
+ * `POST /v1/pre-orders/{id}/confirm`: confirm a `draft` pre-order. The
24
+ * binding step: it commits you to one month, full, with no proration.
32
25
  *
33
- * A wholesale partner (billed at the end of the month) gets the pre-order
34
- * back in `provisioning`: the line is being built, and the
35
- * `pre_order.fulfilled` webhook fires when it is live.
26
+ * A wholesale partner pays nothing at confirm: the pre-order comes back in
27
+ * `provisioning`, the line is being built, and `pre_order.fulfilled` fires
28
+ * when the line is live.
36
29
  *
37
- * A direct account gets it back in `awaiting_payment` with
30
+ * Any other account gets the pre-order back in `awaiting_payment`, with
38
31
  * `stripe_client_secret`, the client secret of the first-month payment, to
39
32
  * confirm with the Stripe Payment Element (card only). Nothing is built until
40
- * that payment succeeds; the pre-order then moves to `provisioning`: read it
33
+ * that payment succeeds. The pre-order then moves to `provisioning`: read it
41
34
  * with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
42
35
  * while it is `awaiting_payment` returns the same secret. When the first
43
36
  * month is already paid (the account's credit balance covers it, or
@@ -56,46 +49,48 @@ export declare class PreOrdersResource extends BaseResource {
56
49
  * call can be repeated (the SDK retries it). A `ConflictError` with 409
57
50
  * `payment_setup_failed` means the payment provider refused the request for
58
51
  * the account: it is not retried, and repeating it does not help.
52
+ *
53
+ * A `confirm()` call that runs at the same time as another `confirm()` or a
54
+ * `cancel()` of the same pre-order, and loses, is a `ConflictError` (409
55
+ * `pre_order_not_draft`).
59
56
  */
60
57
  confirm(id: string, opts?: RequestOptions): Promise<PreOrder>;
61
58
  /**
62
- * `GET /v1/pre-orders` — returns ONE PAGE of the caller's pre-orders.
63
- *
64
- * The endpoint is cursor-paginated; this method is not. Unlike `messages.list` and `chats.list`,
65
- * which return an `AsyncIterable` via `paginate()`, this hands back a single page plus `has_more`
66
- * / `next_cursor` for the caller to drive. Saying only "cursor-paginated" was true of the ENDPOINT
67
- * and false of the METHOD, and a partner reading the docstring alone writes a `for await` and gets
68
- * a runtime `TypeError` — the same class of break §5.2 was corrected for (WHA-2278).
59
+ * `GET /v1/pre-orders`: one page of your pre-orders, newest first.
69
60
  *
70
- * Iterate it yourself by passing the returned `next_cursor` back in `query.cursor` until
71
- * `has_more` is false.
61
+ * This method is not an iterator, unlike `messages.list` and `chats.list`.
62
+ * It resolves with one page, `{ items, has_more, next_cursor }`: pass
63
+ * `next_cursor` back as `cursor` until `has_more` is `false`. `limit` is 1 to
64
+ * 100, default 25.
72
65
  */
73
66
  list(query?: ListPreOrdersQuery, opts?: RequestOptions): Promise<PreOrderListData>;
74
67
  /**
75
- * `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
76
- * pre-order that is `awaiting_payment` checks its first-month payment: once
77
- * it has succeeded, the pre-order comes back in `provisioning`.
78
- * `stripe_client_secret` is always `null` here.
68
+ * `GET /v1/pre-orders/{id}`: one pre-order. Reading a pre-order that is
69
+ * `awaiting_payment` checks its first-month payment: once it has succeeded,
70
+ * the pre-order comes back in `provisioning`. `stripe_client_secret` is
71
+ * always `null` here.
79
72
  */
80
73
  get(id: string, opts?: RequestOptions): Promise<PreOrder>;
81
74
  /**
82
- * `PATCH /v1/pre-orders/{id}` — merge `metadata` into the pre-order's tags.
83
- * A key you send overwrites, a key sent as `null` is deleted, every other key
84
- * is kept. Allowed in every status, `fulfilled` and `cancelled` included.
85
- * Every `pre_order.*` webhook emitted afterwards carries the new tags as
86
- * `data.metadata`; one already emitted keeps the tags it was emitted with.
87
- * The tags are not copied onto the line the pre-order produces. A pre-order
88
- * placed by another account is a `NotFoundError` (404).
75
+ * `PATCH /v1/pre-orders/{id}`: merge `metadata` into the pre-order's
76
+ * metadata. A key you send overwrites, a key sent as `null` is deleted, every
77
+ * other key is kept. Allowed in every status, `fulfilled` and `cancelled`
78
+ * included. Every `pre_order.*` event sent afterward carries the new
79
+ * metadata as `data.metadata`; an event already sent keeps the metadata it
80
+ * was sent with. The metadata is not copied onto the line the pre-order
81
+ * produces. A pre-order of another account is a `NotFoundError` (404).
89
82
  */
90
83
  update(id: string, body: PatchPreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
91
84
  /**
92
- * `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
85
+ * `POST /v1/pre-orders/{id}/cancel`: cancel a `draft` or `awaiting_payment`
93
86
  * pre-order. Free: nothing is charged or built in either status. For an
94
87
  * `awaiting_payment` pre-order the first-month payment is voided first, so
95
- * its client secret can no longer charge; a first month already paid throws
96
- * a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
97
- * `provisioning`, `fulfilled` or already `cancelled` is refused (400
98
- * `pre_order_already_confirmed`).
88
+ * its client secret can no longer charge; a first month already paid is a
89
+ * `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
90
+ * `provisioning`, `fulfilled` or already `cancelled` is a `BadRequestError`
91
+ * (400 `pre_order_already_confirmed`). A cancel that runs at the same time as
92
+ * a confirm or another cancel of the same pre-order, and loses, is a
93
+ * `ConflictError` (409 `pre_order_already_confirmed`).
99
94
  */
100
95
  cancel(id: string, opts?: RequestOptions): Promise<PreOrder>;
101
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.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,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAC1C,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC/C,CAAC,SAAS,CAAC,CAAC,k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CAAC,QAAQ,CAAC;IASzD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASrF;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ7D"}
@@ -1,37 +1,30 @@
1
1
  import { BaseResource } from './base.js';
2
2
  export class PreOrdersResource extends BaseResource {
3
3
  /**
4
- * `POST /v1/pre-orders` — place a pre-order for a rental tier with no
5
- * in-stock inventory. Set `inbound_only: true` to request the inbound-only
6
- * rental variant. `billing_tier` is optional and ORTHOGONAL to that plan —
7
- * omitting it means `rental_iphone`, the only tier this flow mints, and
8
- * `rental_iphone` covers BOTH rental products (`inbound_only` is what picks
9
- * between them), so naming both is never a contradiction. When named it is
10
- * answered rather than discarded (WHA-2949): `rental_android` is a
11
- * `400 android_rental_not_purchasable` — no Android product exists in the
12
- * Stripe catalogue — and a BYOD / virtual-shared / pool tier is a
13
- * `400 tier_not_pre_orderable` whose message names the endpoint that
14
- * acquires it instead. Returns a `draft` pre-order and NOTHING else: no
15
- * line, no fulfillment task, no ops notification, no Stripe charge, and
16
- * `stripe_client_secret` is always `null`. A draft costs nothing to place
17
- * and binds nobody — call `confirm()` to engage the month and start
18
- * procurement.
4
+ * `POST /v1/pre-orders`: create a pre-order for one rented iPhone line, as a
5
+ * `draft`. A draft creates no line, takes no payment and starts no purchase:
6
+ * call `confirm()` to place the order.
7
+ *
8
+ * Every field is optional. `preferred_area_codes` lists up to 5 area codes in
9
+ * your order of preference. `inbound_only: true` orders an inbound-only line.
10
+ * `billing_tier` accepts `rental_iphone` or no value: any other tier is a
11
+ * `BadRequestError` (400).
19
12
  */
20
13
  create(body, opts) {
21
14
  return this.client.request('POST', '/v1/pre-orders', body, opts);
22
15
  }
23
16
  /**
24
- * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
25
- * binding step: engages the one-month commitment (full month, no proration).
17
+ * `POST /v1/pre-orders/{id}/confirm`: confirm a `draft` pre-order. The
18
+ * binding step: it commits you to one month, full, with no proration.
26
19
  *
27
- * A wholesale partner (billed at the end of the month) gets the pre-order
28
- * back in `provisioning`: the line is being built, and the
29
- * `pre_order.fulfilled` webhook fires when it is live.
20
+ * A wholesale partner pays nothing at confirm: the pre-order comes back in
21
+ * `provisioning`, the line is being built, and `pre_order.fulfilled` fires
22
+ * when the line is live.
30
23
  *
31
- * A direct account gets it back in `awaiting_payment` with
24
+ * Any other account gets the pre-order back in `awaiting_payment`, with
32
25
  * `stripe_client_secret`, the client secret of the first-month payment, to
33
26
  * confirm with the Stripe Payment Element (card only). Nothing is built until
34
- * that payment succeeds; the pre-order then moves to `provisioning`: read it
27
+ * that payment succeeds. The pre-order then moves to `provisioning`: read it
35
28
  * with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
36
29
  * while it is `awaiting_payment` returns the same secret. When the first
37
30
  * month is already paid (the account's credit balance covers it, or
@@ -50,21 +43,21 @@ export class PreOrdersResource extends BaseResource {
50
43
  * call can be repeated (the SDK retries it). A `ConflictError` with 409
51
44
  * `payment_setup_failed` means the payment provider refused the request for
52
45
  * the account: it is not retried, and repeating it does not help.
46
+ *
47
+ * A `confirm()` call that runs at the same time as another `confirm()` or a
48
+ * `cancel()` of the same pre-order, and loses, is a `ConflictError` (409
49
+ * `pre_order_not_draft`).
53
50
  */
54
51
  confirm(id, opts) {
55
52
  return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/confirm`, undefined, opts);
56
53
  }
57
54
  /**
58
- * `GET /v1/pre-orders` — returns ONE PAGE of the caller's pre-orders.
59
- *
60
- * The endpoint is cursor-paginated; this method is not. Unlike `messages.list` and `chats.list`,
61
- * which return an `AsyncIterable` via `paginate()`, this hands back a single page plus `has_more`
62
- * / `next_cursor` for the caller to drive. Saying only "cursor-paginated" was true of the ENDPOINT
63
- * and false of the METHOD, and a partner reading the docstring alone writes a `for await` and gets
64
- * a runtime `TypeError` — the same class of break §5.2 was corrected for (WHA-2278).
55
+ * `GET /v1/pre-orders`: one page of your pre-orders, newest first.
65
56
  *
66
- * Iterate it yourself by passing the returned `next_cursor` back in `query.cursor` until
67
- * `has_more` is false.
57
+ * This method is not an iterator, unlike `messages.list` and `chats.list`.
58
+ * It resolves with one page, `{ items, has_more, next_cursor }`: pass
59
+ * `next_cursor` back as `cursor` until `has_more` is `false`. `limit` is 1 to
60
+ * 100, default 25.
68
61
  */
69
62
  list(query = {}, opts) {
70
63
  return this.client.request('GET', '/v1/pre-orders', undefined, {
@@ -73,34 +66,36 @@ export class PreOrdersResource extends BaseResource {
73
66
  });
74
67
  }
75
68
  /**
76
- * `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
77
- * pre-order that is `awaiting_payment` checks its first-month payment: once
78
- * it has succeeded, the pre-order comes back in `provisioning`.
79
- * `stripe_client_secret` is always `null` here.
69
+ * `GET /v1/pre-orders/{id}`: one pre-order. Reading a pre-order that is
70
+ * `awaiting_payment` checks its first-month payment: once it has succeeded,
71
+ * the pre-order comes back in `provisioning`. `stripe_client_secret` is
72
+ * always `null` here.
80
73
  */
81
74
  get(id, opts) {
82
75
  return this.client.request('GET', `/v1/pre-orders/${encodeURIComponent(id)}`, undefined, opts);
83
76
  }
84
77
  /**
85
- * `PATCH /v1/pre-orders/{id}` — merge `metadata` into the pre-order's tags.
86
- * A key you send overwrites, a key sent as `null` is deleted, every other key
87
- * is kept. Allowed in every status, `fulfilled` and `cancelled` included.
88
- * Every `pre_order.*` webhook emitted afterwards carries the new tags as
89
- * `data.metadata`; one already emitted keeps the tags it was emitted with.
90
- * The tags are not copied onto the line the pre-order produces. A pre-order
91
- * placed by another account is a `NotFoundError` (404).
78
+ * `PATCH /v1/pre-orders/{id}`: merge `metadata` into the pre-order's
79
+ * metadata. A key you send overwrites, a key sent as `null` is deleted, every
80
+ * other key is kept. Allowed in every status, `fulfilled` and `cancelled`
81
+ * included. Every `pre_order.*` event sent afterward carries the new
82
+ * metadata as `data.metadata`; an event already sent keeps the metadata it
83
+ * was sent with. The metadata is not copied onto the line the pre-order
84
+ * produces. A pre-order of another account is a `NotFoundError` (404).
92
85
  */
93
86
  update(id, body, opts) {
94
87
  return this.client.request('PATCH', `/v1/pre-orders/${encodeURIComponent(id)}`, body, opts);
95
88
  }
96
89
  /**
97
- * `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
90
+ * `POST /v1/pre-orders/{id}/cancel`: cancel a `draft` or `awaiting_payment`
98
91
  * pre-order. Free: nothing is charged or built in either status. For an
99
92
  * `awaiting_payment` pre-order the first-month payment is voided first, so
100
- * its client secret can no longer charge; a first month already paid throws
101
- * a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
102
- * `provisioning`, `fulfilled` or already `cancelled` is refused (400
103
- * `pre_order_already_confirmed`).
93
+ * its client secret can no longer charge; a first month already paid is a
94
+ * `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
95
+ * `provisioning`, `fulfilled` or already `cancelled` is a `BadRequestError`
96
+ * (400 `pre_order_already_confirmed`). A cancel that runs at the same time as
97
+ * a confirm or another cancel of the same pre-order, and loses, is a
98
+ * `ConflictError` (409 `pre_order_already_confirmed`).
104
99
  */
105
100
  cancel(id, opts) {
106
101
  return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/cancel`, undefined, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAW,MAA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H,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACjD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
@@ -11,42 +11,51 @@ export type Trial = components['schemas']['Trial'];
11
11
  export type PatchTrialBody = components['schemas']['PatchTrial'];
12
12
  export declare class TrialResource extends BaseResource {
13
13
  /**
14
- * `POST /v1/trial/init` — create a new trial session. Returns the pool
15
- * line phone number the partner must text from their device to pair
16
- * within the 15-minute window, the opaque `token` to fetch status, and
17
- * the `instructions_url` to deep-link the user.
14
+ * `POST /v1/trial/init`: start a trial. Resolves with `trial_id`, `token`
15
+ * (the pairing code), `pool_line_number`, `pairing_expires_at` (15 minutes
16
+ * after the call), `instructions_url` and `metadata`. The prospect pairs by
17
+ * sending a message that contains the code to `pool_line_number`. The trial
18
+ * key is not in this result: read it with `status()` within 60 minutes of
19
+ * the pairing.
18
20
  */
19
21
  init(body?: TrialInitBody, opts?: RequestOptions): Promise<TrialInitData>;
20
22
  /**
21
- * `GET /v1/trial/status?token=...` — poll status during the
22
- * pairing-pending window or to retrieve the trial API key after
23
- * pairing succeeds.
23
+ * `GET /v1/trial/status`: the state of a trial, by its pairing code. The
24
+ * first call made within 60 minutes of the pairing, while the trial is
25
+ * `active`, returns `trial_api_key`, once: later calls omit it, an automatic
26
+ * retry after a lost response included. After those 60 minutes the key can
27
+ * no longer be read. Call it with `{ maxRetries: 0 }`, from a client whose
28
+ * `timeoutMs` leaves time for the answer. If a call returns an `active` or
29
+ * `dormant` trial without `trial_api_key` and you do not hold the key, the
30
+ * key is lost: revoke the trial and start another. The operation needs no
31
+ * credential, and the code travels in the request URL.
24
32
  */
25
33
  status(token: string, opts?: RequestOptions): Promise<TrialStatusData>;
26
34
  /**
27
- * `GET /v1/trial/activity` — current send/receive counters + dormancy
28
- * remaining. Auth-gated by the trial API key issued from `init`/`status`.
35
+ * `GET /v1/trial/activity`: the trial's sent and received counts, and how
36
+ * many sends remain before it becomes `dormant`. It accepts a trial key
37
+ * only: call it from a client created with the trial key. With an account
38
+ * API key it returns `401`.
29
39
  */
30
40
  activity(opts?: RequestOptions): Promise<TrialActivityData>;
31
41
  /**
32
- * `POST /v1/trial/{trial_id}/revoke` — terminate a trial session. Frees its
33
- * pool-line slot so the same handle can immediately start a fresh trial, and
34
- * invalidates the trial API key. Idempotent — revoking an already-revoked
35
- * trial resolves with `already_revoked: true`. Authenticated as the trial's
36
- * OWNER (dashboard JWT or the `isnap_live_*` key that created it), not the
37
- * trial key.
42
+ * `POST /v1/trial/{trial_id}/revoke`: end a trial. The trial key stops
43
+ * working and the prospect's handle can pair again immediately. Revoking a
44
+ * trial that is already revoked resolves with `already_revoked: true`. Only
45
+ * the account that owns the trial can revoke it: call it with an account API
46
+ * key, not with the trial key.
38
47
  */
39
48
  revoke(trialId: string, body?: TrialRevokeBody, opts?: RequestOptions): Promise<TrialRevokeData>;
40
49
  /**
41
- * `GET /v1/trial/{trial_id}` — one trial you own, with its `metadata`.
42
- * Authenticated as the trial's OWNER, like `revoke`; a trial owned by another
43
- * account is `404`.
50
+ * `GET /v1/trial/{trial_id}`: one trial you own, with its `metadata`. Call
51
+ * it with an account API key, like `revoke`. A trial of another account
52
+ * returns `404`.
44
53
  */
45
54
  get(trialId: string, opts?: RequestOptions): Promise<Trial>;
46
55
  /**
47
- * `PATCH /v1/trial/{trial_id}` — merge `metadata` into the trial's tags. A key
48
- * you send overwrites, a key sent as `null` is deleted, every other key is
49
- * kept. The tags are echoed as `data.metadata` on every `trial.*` webhook.
56
+ * `PATCH /v1/trial/{trial_id}`: merge `metadata` into the trial's metadata. A
57
+ * key you send overwrites, a key sent as `null` is deleted, every other key
58
+ * is kept. The metadata arrives as `data.metadata` on every `trial.*` event.
50
59
  */
51
60
  update(trialId: string, body: PatchTrialBody, opts?: RequestOptions): Promise<Trial>;
52
61
  }
@@ -1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,CAAC,CAAC,YAAY,CAAC,CAAA;AAEhE,qBAAa,aAAc,SAAQ,YAAY;IAC7C;;;;;;;OAOG;IACH,IAAI,CAAC,IAAI,GAAE,aAAkB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAI7E;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAOtE;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI3D;;;;;;OAMG;IACH,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,eAAoB,EAC1B,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC;IAS3B;;;;OAIG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC;IAS3D;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC;CAQrF"}
@@ -1,18 +1,26 @@
1
1
  import { BaseResource } from './base.js';
2
2
  export class TrialResource extends BaseResource {
3
3
  /**
4
- * `POST /v1/trial/init` — create a new trial session. Returns the pool
5
- * line phone number the partner must text from their device to pair
6
- * within the 15-minute window, the opaque `token` to fetch status, and
7
- * the `instructions_url` to deep-link the user.
4
+ * `POST /v1/trial/init`: start a trial. Resolves with `trial_id`, `token`
5
+ * (the pairing code), `pool_line_number`, `pairing_expires_at` (15 minutes
6
+ * after the call), `instructions_url` and `metadata`. The prospect pairs by
7
+ * sending a message that contains the code to `pool_line_number`. The trial
8
+ * key is not in this result: read it with `status()` within 60 minutes of
9
+ * the pairing.
8
10
  */
9
11
  init(body = {}, opts) {
10
12
  return this.client.request('POST', '/v1/trial/init', body, opts);
11
13
  }
12
14
  /**
13
- * `GET /v1/trial/status?token=...` — poll status during the
14
- * pairing-pending window or to retrieve the trial API key after
15
- * pairing succeeds.
15
+ * `GET /v1/trial/status`: the state of a trial, by its pairing code. The
16
+ * first call made within 60 minutes of the pairing, while the trial is
17
+ * `active`, returns `trial_api_key`, once: later calls omit it, an automatic
18
+ * retry after a lost response included. After those 60 minutes the key can
19
+ * no longer be read. Call it with `{ maxRetries: 0 }`, from a client whose
20
+ * `timeoutMs` leaves time for the answer. If a call returns an `active` or
21
+ * `dormant` trial without `trial_api_key` and you do not hold the key, the
22
+ * key is lost: revoke the trial and start another. The operation needs no
23
+ * credential, and the code travels in the request URL.
16
24
  */
17
25
  status(token, opts) {
18
26
  return this.client.request('GET', '/v1/trial/status', undefined, {
@@ -21,35 +29,36 @@ export class TrialResource extends BaseResource {
21
29
  });
22
30
  }
23
31
  /**
24
- * `GET /v1/trial/activity` — current send/receive counters + dormancy
25
- * remaining. Auth-gated by the trial API key issued from `init`/`status`.
32
+ * `GET /v1/trial/activity`: the trial's sent and received counts, and how
33
+ * many sends remain before it becomes `dormant`. It accepts a trial key
34
+ * only: call it from a client created with the trial key. With an account
35
+ * API key it returns `401`.
26
36
  */
27
37
  activity(opts) {
28
38
  return this.client.request('GET', '/v1/trial/activity', undefined, opts);
29
39
  }
30
40
  /**
31
- * `POST /v1/trial/{trial_id}/revoke` — terminate a trial session. Frees its
32
- * pool-line slot so the same handle can immediately start a fresh trial, and
33
- * invalidates the trial API key. Idempotent — revoking an already-revoked
34
- * trial resolves with `already_revoked: true`. Authenticated as the trial's
35
- * OWNER (dashboard JWT or the `isnap_live_*` key that created it), not the
36
- * trial key.
41
+ * `POST /v1/trial/{trial_id}/revoke`: end a trial. The trial key stops
42
+ * working and the prospect's handle can pair again immediately. Revoking a
43
+ * trial that is already revoked resolves with `already_revoked: true`. Only
44
+ * the account that owns the trial can revoke it: call it with an account API
45
+ * key, not with the trial key.
37
46
  */
38
47
  revoke(trialId, body = {}, opts) {
39
48
  return this.client.request('POST', `/v1/trial/${encodeURIComponent(trialId)}/revoke`, body, opts);
40
49
  }
41
50
  /**
42
- * `GET /v1/trial/{trial_id}` — one trial you own, with its `metadata`.
43
- * Authenticated as the trial's OWNER, like `revoke`; a trial owned by another
44
- * account is `404`.
51
+ * `GET /v1/trial/{trial_id}`: one trial you own, with its `metadata`. Call
52
+ * it with an account API key, like `revoke`. A trial of another account
53
+ * returns `404`.
45
54
  */
46
55
  get(trialId, opts) {
47
56
  return this.client.request('GET', `/v1/trial/${encodeURIComponent(trialId)}`, undefined, opts);
48
57
  }
49
58
  /**
50
- * `PATCH /v1/trial/{trial_id}` — merge `metadata` into the trial's tags. A key
51
- * you send overwrites, a key sent as `null` is deleted, every other key is
52
- * kept. The tags are echoed as `data.metadata` on every `trial.*` webhook.
59
+ * `PATCH /v1/trial/{trial_id}`: merge `metadata` into the trial's metadata. A
60
+ * key you send overwrites, a key sent as `null` is deleted, every other key
61
+ * is kept. The metadata arrives as `data.metadata` on every `trial.*` event.
53
62
  */
54
63
  update(trialId, body, opts) {
55
64
  return this.client.request('PATCH', `/v1/trial/${encodeURIComponent(trialId)}`, body, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"trial.js","sourceRoot":"","sources":["../../src/resources/trial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAWxC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C;;;;;OAKG;IACH,IAAI,CAAC,OAAsB,EAAE,EAAE,IAAqB;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgB,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACjF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAa,EAAE,IAAqB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAkB,KAAK,EAAE,kBAAkB,EAAE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AA;IACjF,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAa,EAAE,IAAqB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAkB,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE;YAChF,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;SACjC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAqB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAoB,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7F,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CACJ,OAAe,EACf,OAAwB,EAAE,EAC1B,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,aAAa,kBAAkB,CAAC,OAAO,CAAC,SAAS,EACjD,IAAI,EACJ,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,OAAe,EAAE,IAAqB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,aAAa,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAC1C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAe,EAAE,IAAoB,EAAE,IAAqB;QACjE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,aAAa,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAC1C,IAAI,EACJ,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
@@ -12,46 +12,63 @@ export type UpdateWebhookBody = NonNullable<paths['/v1/webhooks/{id}']['patch'][
12
12
  export type ListDeliveriesQuery = NonNullable<paths['/v1/webhooks/{id}/deliveries']['get']['parameters']['query']>;
13
13
  export type ListEventsQuery = paths['/v1/webhooks/events']['get']['parameters']['query'];
14
14
  export declare class WebhooksResource extends BaseResource {
15
- /** `GET /v1/webhooks` — list all webhook subscriptions for the calling account. */
15
+ /** `GET /v1/webhooks`: every webhook subscription of your account, in one response. */
16
16
  list(opts?: RequestOptions): Promise<WebhookList>;
17
17
  /**
18
- * `POST /v1/webhooks` — create a subscription. Plaintext `secret` is
19
- * returned ONCE in the create response; persist it then. Subsequent
20
- * GETs do not include it.
18
+ * `POST /v1/webhooks`: create a webhook subscription. The signing `secret`
19
+ * is in this result: store it. Apart from `rotateSecret`, no other operation
20
+ * returns it.
21
+ *
22
+ * The API does not deduplicate this call: a retry after a lost response
23
+ * creates a second subscription.
21
24
  */
22
25
  create(body: CreateWebhookBody, opts?: RequestOptions): Promise<Webhook>;
23
- /** `GET /v1/webhooks/{id}` — fetch a single webhook subscription. */
26
+ /** `GET /v1/webhooks/{id}`: one webhook subscription. */
24
27
  get(id: string, opts?: RequestOptions): Promise<Webhook>;
25
- /** `PATCH /v1/webhooks/{id}` — partial update of url / events / line_ids / active flag. */
28
+ /** `PATCH /v1/webhooks/{id}`: change the `url`, `events`, `line_ids` or `active` of a subscription. */
26
29
  update(id: string, body: UpdateWebhookBody, opts?: RequestOptions): Promise<Webhook>;
27
- /** `DELETE /v1/webhooks/{id}` — delete a subscription. Returns 204. */
30
+ /**
31
+ * `DELETE /v1/webhooks/{id}`: delete a subscription, with its secret and its
32
+ * delivery records. Resolves with `undefined`.
33
+ */
28
34
  delete(id: string, opts?: RequestOptions): Promise<void>;
29
35
  /**
30
- * `POST /v1/webhooks/{id}/rotate-secret` — mint a new `whsec_*` secret.
31
- * Old secret stays valid for 5 minutes (`old_secret_expires_at`) so the
32
- * caller can roll their verification code without dropping events.
33
- * Plaintext secret is returned ONCE.
36
+ * `POST /v1/webhooks/{id}/rotate-secret`: replace the signing secret.
37
+ * Resolves with `{ id, secret, old_secret_expires_at }`: store the new
38
+ * `secret`, which no later call returns.
39
+ *
40
+ * The rotation takes effect immediately. Every request iSnap sends after it,
41
+ * retries and replays included, is signed with the new secret only.
42
+ * `old_secret_expires_at` has no effect on what iSnap sends.
43
+ *
44
+ * The API does not deduplicate this call: when it runs twice, the secret is
45
+ * replaced twice and the last result holds the secret in force.
34
46
  */
35
47
  rotateSecret(id: string, opts?: RequestOptions): Promise<WebhookRotateSecret>;
36
48
  /**
37
- * `GET /v1/webhooks/{id}/deliveries` — cursor-paginated AsyncIterable
38
- * over delivery attempts for a subscription. Filters: status (pending/
39
- * success/failed), event type, since/until timestamps.
49
+ * `GET /v1/webhooks/{id}/deliveries`: the delivery records of a
50
+ * subscription, as an `AsyncIterable`. Filter with `status` (`pending`,
51
+ * `success` or `failed`), `event`, `since` and `until`.
40
52
  */
41
53
  deliveries(id: string, filters?: Omit<ListDeliveriesQuery, 'cursor'>, opts?: RequestOptions): AsyncIterable<WebhookDelivery>;
42
54
  /**
43
- * `POST /v1/webhooks/{id}/deliveries/{delivery_id}/replay` — re-fire a
44
- * past delivery. Server preserves the original `event_id` so consumers
45
- * still dedupe.
55
+ * `POST /v1/webhooks/{id}/deliveries/{delivery_id}/replay`: replay one
56
+ * delivery. It takes a subscription id and a delivery id, not an event id.
57
+ * The replay is a new delivery with the same `event_id`, so a receiver that
58
+ * deduplicates on `event_id` recognizes it. Only a delivery whose `status`
59
+ * is `success` or `failed` can be replayed.
60
+ *
61
+ * The API does not deduplicate this call: a retry after a lost response
62
+ * creates a second replay.
46
63
  */
47
64
  replay(webhookId: string, deliveryId: string, opts?: RequestOptions): Promise<WebhookDeliveryReplay>;
48
65
  /**
49
- * `GET /v1/webhooks/events` — cursor-paginated reconciliation pull.
50
- * Returns events that would have been delivered to the caller's
51
- * subscriptions within the 72h retention window. Used to recover from
52
- * webhook outages without missing signal.
66
+ * `GET /v1/webhooks/events`: the events recorded for your account in a time
67
+ * window, newest first, as an `AsyncIterable`. The feed covers the last 72
68
+ * hours. An event is in the feed only if, when it occurred, it matched at
69
+ * least one of your subscriptions that was active and not suspended.
53
70
  *
54
- * `since` is required by the contract.
71
+ * `since` is required.
55
72
  */
56
73
  events(filters: Omit<NonNullable<ListEventsQuery>, 'cursor'>, opts?: RequestOptions): AsyncIterable<WebhookEventItem>;
57
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks.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,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAA;AACxD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,CAAA;AAC9D,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,qBAAqB,CAAC,CAAA;AAC9E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAA;AACxE,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,uBAAuB,CAAC,CAAA;AAClF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAExE,MAAM,MAAM,iBAAiB,GAAG,WAAW,CACzC,KAAK,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC7C,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CACzC,KAAK,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CACnD,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,mBAAmB,GAAG,WA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