@linqapp/sdk 0.32.1 → 0.33.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 (203) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +82 -112
  3. package/client.d.mts +42 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +42 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +39 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +39 -3
  10. package/client.mjs.map +1 -1
  11. package/core/error.d.mts +13 -0
  12. package/core/error.d.mts.map +1 -1
  13. package/core/error.d.ts +13 -0
  14. package/core/error.d.ts.map +1 -1
  15. package/core/error.js +5 -1
  16. package/core/error.js.map +1 -1
  17. package/core/error.mjs +5 -1
  18. package/core/error.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resources/available-number.d.mts +13 -1
  21. package/resources/available-number.d.mts.map +1 -1
  22. package/resources/available-number.d.ts +13 -1
  23. package/resources/available-number.d.ts.map +1 -1
  24. package/resources/available-number.js +2 -1
  25. package/resources/available-number.js.map +1 -1
  26. package/resources/available-number.mjs +2 -1
  27. package/resources/available-number.mjs.map +1 -1
  28. package/resources/chats/chats.d.mts +175 -70
  29. package/resources/chats/chats.d.mts.map +1 -1
  30. package/resources/chats/chats.d.ts +175 -70
  31. package/resources/chats/chats.d.ts.map +1 -1
  32. package/resources/chats/chats.js +65 -61
  33. package/resources/chats/chats.js.map +1 -1
  34. package/resources/chats/chats.mjs +65 -61
  35. package/resources/chats/chats.mjs.map +1 -1
  36. package/resources/chats/index.d.mts +3 -2
  37. package/resources/chats/index.d.mts.map +1 -1
  38. package/resources/chats/index.d.ts +3 -2
  39. package/resources/chats/index.d.ts.map +1 -1
  40. package/resources/chats/index.js +3 -1
  41. package/resources/chats/index.js.map +1 -1
  42. package/resources/chats/index.mjs +1 -0
  43. package/resources/chats/index.mjs.map +1 -1
  44. package/resources/chats/location.d.mts +25 -25
  45. package/resources/chats/location.d.mts.map +1 -1
  46. package/resources/chats/location.d.ts +25 -25
  47. package/resources/chats/location.d.ts.map +1 -1
  48. package/resources/chats/location.js +27 -27
  49. package/resources/chats/location.js.map +1 -1
  50. package/resources/chats/location.mjs +27 -27
  51. package/resources/chats/location.mjs.map +1 -1
  52. package/resources/chats/messages.d.mts +28 -21
  53. package/resources/chats/messages.d.mts.map +1 -1
  54. package/resources/chats/messages.d.ts +28 -21
  55. package/resources/chats/messages.d.ts.map +1 -1
  56. package/resources/chats/messages.js +16 -16
  57. package/resources/chats/messages.js.map +1 -1
  58. package/resources/chats/messages.mjs +16 -16
  59. package/resources/chats/messages.mjs.map +1 -1
  60. package/resources/chats/polls.d.mts +171 -0
  61. package/resources/chats/polls.d.mts.map +1 -0
  62. package/resources/chats/polls.d.ts +171 -0
  63. package/resources/chats/polls.d.ts.map +1 -0
  64. package/resources/chats/polls.js +95 -0
  65. package/resources/chats/polls.js.map +1 -0
  66. package/resources/chats/polls.mjs +91 -0
  67. package/resources/chats/polls.mjs.map +1 -0
  68. package/resources/contact-card.d.mts +29 -28
  69. package/resources/contact-card.d.mts.map +1 -1
  70. package/resources/contact-card.d.ts +29 -28
  71. package/resources/contact-card.d.ts.map +1 -1
  72. package/resources/contact-card.js +23 -22
  73. package/resources/contact-card.js.map +1 -1
  74. package/resources/contact-card.mjs +23 -22
  75. package/resources/contact-card.mjs.map +1 -1
  76. package/resources/experiences.d.mts +91 -0
  77. package/resources/experiences.d.mts.map +1 -0
  78. package/resources/experiences.d.ts +91 -0
  79. package/resources/experiences.d.ts.map +1 -0
  80. package/resources/experiences.js +29 -0
  81. package/resources/experiences.js.map +1 -0
  82. package/resources/experiences.mjs +25 -0
  83. package/resources/experiences.mjs.map +1 -0
  84. package/resources/index.d.mts +7 -3
  85. package/resources/index.d.mts.map +1 -1
  86. package/resources/index.d.ts +7 -3
  87. package/resources/index.d.ts.map +1 -1
  88. package/resources/index.js +10 -2
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs +5 -1
  91. package/resources/index.mjs.map +1 -1
  92. package/resources/messages/index.d.mts +3 -0
  93. package/resources/messages/index.d.mts.map +1 -0
  94. package/resources/messages/index.d.ts +3 -0
  95. package/resources/messages/index.d.ts.map +1 -0
  96. package/resources/messages/index.js +9 -0
  97. package/resources/messages/index.js.map +1 -0
  98. package/resources/messages/index.mjs +4 -0
  99. package/resources/messages/index.mjs.map +1 -0
  100. package/resources/messages/messages.d.mts +795 -0
  101. package/resources/messages/messages.d.mts.map +1 -0
  102. package/resources/messages/messages.d.ts +795 -0
  103. package/resources/messages/messages.d.ts.map +1 -0
  104. package/resources/messages/messages.js +298 -0
  105. package/resources/messages/messages.js.map +1 -0
  106. package/resources/messages/messages.mjs +293 -0
  107. package/resources/messages/messages.mjs.map +1 -0
  108. package/resources/messages/poll.d.mts +131 -0
  109. package/resources/messages/poll.d.mts.map +1 -0
  110. package/resources/messages/poll.d.ts +131 -0
  111. package/resources/messages/poll.d.ts.map +1 -0
  112. package/resources/messages/poll.js +119 -0
  113. package/resources/messages/poll.js.map +1 -0
  114. package/resources/messages/poll.mjs +115 -0
  115. package/resources/messages/poll.mjs.map +1 -0
  116. package/resources/messages.d.mts +1 -747
  117. package/resources/messages.d.mts.map +1 -1
  118. package/resources/messages.d.ts +1 -747
  119. package/resources/messages.d.ts.map +1 -1
  120. package/resources/messages.js +2 -275
  121. package/resources/messages.js.map +1 -1
  122. package/resources/messages.mjs +1 -273
  123. package/resources/messages.mjs.map +1 -1
  124. package/resources/payment-handles.d.mts +87 -0
  125. package/resources/payment-handles.d.mts.map +1 -0
  126. package/resources/payment-handles.d.ts +87 -0
  127. package/resources/payment-handles.d.ts.map +1 -0
  128. package/resources/payment-handles.js +76 -0
  129. package/resources/payment-handles.js.map +1 -0
  130. package/resources/payment-handles.mjs +72 -0
  131. package/resources/payment-handles.mjs.map +1 -0
  132. package/resources/payment-providers.d.mts +58 -0
  133. package/resources/payment-providers.d.mts.map +1 -0
  134. package/resources/payment-providers.d.ts +58 -0
  135. package/resources/payment-providers.d.ts.map +1 -0
  136. package/resources/payment-providers.js +45 -0
  137. package/resources/payment-providers.js.map +1 -0
  138. package/resources/payment-providers.mjs +41 -0
  139. package/resources/payment-providers.mjs.map +1 -0
  140. package/resources/payment-requests.d.mts +2 -2
  141. package/resources/payment-requests.d.ts +2 -2
  142. package/resources/payment-requests.js +2 -2
  143. package/resources/payment-requests.mjs +2 -2
  144. package/resources/payments.d.mts +116 -0
  145. package/resources/payments.d.mts.map +1 -0
  146. package/resources/payments.d.ts +116 -0
  147. package/resources/payments.d.ts.map +1 -0
  148. package/resources/payments.js +70 -0
  149. package/resources/payments.js.map +1 -0
  150. package/resources/payments.mjs +66 -0
  151. package/resources/payments.mjs.map +1 -0
  152. package/resources/phone-numbers.d.mts +11 -11
  153. package/resources/phone-numbers.d.mts.map +1 -1
  154. package/resources/phone-numbers.d.ts +11 -11
  155. package/resources/phone-numbers.d.ts.map +1 -1
  156. package/resources/phone-numbers.js +13 -13
  157. package/resources/phone-numbers.js.map +1 -1
  158. package/resources/phone-numbers.mjs +13 -13
  159. package/resources/phone-numbers.mjs.map +1 -1
  160. package/resources/webhook-events.d.mts +1 -1
  161. package/resources/webhook-events.d.mts.map +1 -1
  162. package/resources/webhook-events.d.ts +1 -1
  163. package/resources/webhook-events.d.ts.map +1 -1
  164. package/resources/webhook-subscriptions.d.mts +11 -11
  165. package/resources/webhook-subscriptions.d.mts.map +1 -1
  166. package/resources/webhook-subscriptions.d.ts +11 -11
  167. package/resources/webhook-subscriptions.d.ts.map +1 -1
  168. package/resources/webhook-subscriptions.js +13 -13
  169. package/resources/webhook-subscriptions.js.map +1 -1
  170. package/resources/webhook-subscriptions.mjs +13 -13
  171. package/resources/webhook-subscriptions.mjs.map +1 -1
  172. package/resources/webhooks.d.mts +72 -1
  173. package/resources/webhooks.d.mts.map +1 -1
  174. package/resources/webhooks.d.ts +72 -1
  175. package/resources/webhooks.d.ts.map +1 -1
  176. package/src/client.ts +91 -20
  177. package/src/core/error.ts +20 -1
  178. package/src/resources/available-number.ts +14 -1
  179. package/src/resources/chats/chats.ts +203 -85
  180. package/src/resources/chats/index.ts +3 -2
  181. package/src/resources/chats/location.ts +28 -28
  182. package/src/resources/chats/messages.ts +40 -32
  183. package/src/resources/chats/polls.ts +196 -0
  184. package/src/resources/contact-card.ts +36 -35
  185. package/src/resources/experiences.ts +118 -0
  186. package/src/resources/index.ts +23 -5
  187. package/src/resources/messages/index.ts +18 -0
  188. package/src/resources/messages/messages.ts +958 -0
  189. package/src/resources/messages/poll.ts +151 -0
  190. package/src/resources/messages.ts +1 -894
  191. package/src/resources/payment-handles.ts +114 -0
  192. package/src/resources/payment-providers.ts +81 -0
  193. package/src/resources/payment-requests.ts +2 -2
  194. package/src/resources/payments.ts +163 -0
  195. package/src/resources/phone-numbers.ts +14 -14
  196. package/src/resources/webhook-events.ts +9 -0
  197. package/src/resources/webhook-subscriptions.ts +14 -14
  198. package/src/resources/webhooks.ts +82 -0
  199. package/src/version.ts +1 -1
  200. package/version.d.mts +1 -1
  201. package/version.d.ts +1 -1
  202. package/version.js +1 -1
  203. package/version.mjs +1 -1
@@ -0,0 +1,171 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as Shared from "../shared.js";
3
+ import { APIPromise } from "../../core/api-promise.js";
4
+ import { RequestOptions } from "../../internal/request-options.js";
5
+ /**
6
+ * Messages are individual communications within a chat thread.
7
+ *
8
+ * Messages can include text, media attachments, rich link previews, special effects
9
+ * (like confetti or fireworks), and reactions. All messages are associated with a
10
+ * specific chat and sent from a phone number you own.
11
+ *
12
+ * Messages support delivery status tracking, read receipts, and editing capabilities.
13
+ *
14
+ * ## Rich Link Previews
15
+ *
16
+ * Send a URL as a `link` part to deliver it with a rich preview card showing the
17
+ * page's title, description, and image (when available). A `link` part must be the
18
+ * **only** part in the message — it cannot be combined with text or media parts.
19
+ * To send a URL without a preview card, include it in a `text` part instead.
20
+ *
21
+ * **Limitations:**
22
+ * - A `link` part cannot be combined with other parts in the same message.
23
+ * - Maximum URL length: 2,048 characters.
24
+ *
25
+ * ## Ephemeral Messages (Privacy Tier)
26
+ *
27
+ * For regulated or sensitive conversations, opt in to the **ephemeral messages** tier by contacting your Linq support contact. When enabled, every message on the covered phone numbers is automatically given a fixed **24-hour retention window** — after that window the platform permanently deletes the message from Linq storage. There is no per-message flag; ephemerality is applied automatically based on your configuration.
28
+ *
29
+ * You can request it at two scopes:
30
+ *
31
+ * | Scope | Effect |
32
+ * |---|---|
33
+ * | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
34
+ * | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
35
+ *
36
+ * **Behavioral differences vs the standard default:**
37
+ *
38
+ * | Aspect | Standard | Ephemeral |
39
+ * |---|---|---|
40
+ * | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
41
+ * | After expiry | Message stays retrievable | Message is permanently deleted — `GET /v3/messages/{messageId}` returns `404` and it no longer appears in `GET /v3/chats/{chatId}/messages` |
42
+ * | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
43
+ * | Cross-partner isolation | Enforced | Enforced |
44
+ *
45
+ * **How the 24-hour window works:**
46
+ *
47
+ * - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
48
+ * - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
49
+ * - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
50
+ *
51
+ * **What you observe:**
52
+ *
53
+ * - **No expiry timestamp is exposed.** API responses and webhook payloads do not include the deletion time. If you need it, compute `created_at + 24h` yourself.
54
+ * - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
55
+ * - **Delivery is unaffected.** Ephemeral messages send, deliver, and fire the usual `message.sent` / `message.received` and status webhooks exactly like standard messages. Only retention changes.
56
+ *
57
+ * **When to choose ephemeral:**
58
+ *
59
+ * - You have a compliance requirement that the platform must not retain message content beyond a short window.
60
+ * - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
61
+ * - Your application is the system of record — you capture what you need from the delivery webhook in real time and do not rely on reading message history back from Linq later.
62
+ *
63
+ * **Important:** ephemeral applies in *both directions* — messages you send **and** messages received by the phone numbers in that scope. Because Linq can no longer return the message after 24 hours, persist anything you need to keep from the webhook payload at the time it is delivered.
64
+ */
65
+ export declare class Polls extends APIResource {
66
+ /**
67
+ * Create an iMessage poll in an existing chat and send it. Polls are
68
+ * iMessage-only.
69
+ *
70
+ * The chat must already exist — **a poll cannot be the first message of a new
71
+ * chat** (use `POST /v3/chats` for that). Options are **add-only and immutable**:
72
+ * you can add options later via `POST /v3/messages/{messageId}/poll/options`, but
73
+ * never edit or remove them.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const pollEnvelope = await client.chats.polls.create(
78
+ * '550e8400-e29b-41d4-a716-446655440000',
79
+ * {
80
+ * poll: {
81
+ * options: [{ text: 'Tacos' }, { text: 'Sushi' }],
82
+ * idempotency_key: 'poll-abc123',
83
+ * },
84
+ * },
85
+ * );
86
+ * ```
87
+ */
88
+ create(chatID: string, body: PollCreateParams, options?: RequestOptions): APIPromise<PollEnvelope>;
89
+ }
90
+ /**
91
+ * Poll content — options and the aggregate voter count.
92
+ */
93
+ export interface Poll {
94
+ options: Array<Poll.Option>;
95
+ /**
96
+ * Distinct participants across the whole poll (a voter picking two options counts
97
+ * once).
98
+ */
99
+ total_voters: number;
100
+ }
101
+ export declare namespace Poll {
102
+ interface Option {
103
+ can_be_edited: boolean;
104
+ /**
105
+ * The participant who added this option (poll creator for the initial options;
106
+ * whoever added later ones).
107
+ */
108
+ creator_handle: Shared.ChatHandle;
109
+ option_id: string;
110
+ text: string;
111
+ /**
112
+ * Participants who voted for this option (vote_count = voters.length).
113
+ */
114
+ voters: Array<Option.Voter>;
115
+ }
116
+ namespace Option {
117
+ interface Voter {
118
+ handle: string;
119
+ voted_at: string;
120
+ }
121
+ }
122
+ }
123
+ /**
124
+ * Message-level envelope returned by every poll endpoint.
125
+ */
126
+ export interface PollEnvelope {
127
+ chat_id: string;
128
+ created_at: string;
129
+ /**
130
+ * The poll-definition message's ID — reference this poll by it.
131
+ */
132
+ message_id: string;
133
+ /**
134
+ * Poll content — options and the aggregate voter count.
135
+ */
136
+ poll: Poll;
137
+ /**
138
+ * Tapbacks/stickers on the whole poll (message part 0).
139
+ */
140
+ reactions: Array<Shared.Reaction>;
141
+ updated_at: string;
142
+ }
143
+ export interface PollCreateParams {
144
+ /**
145
+ * Poll content to create. A poll needs at least two options. Options are add-only
146
+ * and immutable — there is no title/question (send that as a normal text message).
147
+ */
148
+ poll: PollCreateParams.Poll;
149
+ }
150
+ export declare namespace PollCreateParams {
151
+ /**
152
+ * Poll content to create. A poll needs at least two options. Options are add-only
153
+ * and immutable — there is no title/question (send that as a normal text message).
154
+ */
155
+ interface Poll {
156
+ options: Array<Poll.Option>;
157
+ /**
158
+ * Optional key to deduplicate the poll creation.
159
+ */
160
+ idempotency_key?: string;
161
+ }
162
+ namespace Poll {
163
+ interface Option {
164
+ text: string;
165
+ }
166
+ }
167
+ }
168
+ export declare namespace Polls {
169
+ export { type Poll as Poll, type PollEnvelope as PollEnvelope, type PollCreateParams as PollCreateParams };
170
+ }
171
+ //# sourceMappingURL=polls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polls.d.ts","sourceRoot":"","sources":["../../src/resources/chats/polls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,MAAM,qBAAkB;AACpC,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;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AM,CAAC;KAC1B;IAED,UAAiB,IAAI,CAAC;QACpB,UAAiB,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC;SACd;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,IAAI,IAAI,IAAI,EAAE,KAAK,YAAY,IAAI,YAAY,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;CAC5G"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Polls = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const path_1 = require("../../internal/utils/path.js");
7
+ /**
8
+ * Messages are individual communications within a chat thread.
9
+ *
10
+ * Messages can include text, media attachments, rich link previews, special effects
11
+ * (like confetti or fireworks), and reactions. All messages are associated with a
12
+ * specific chat and sent from a phone number you own.
13
+ *
14
+ * Messages support delivery status tracking, read receipts, and editing capabilities.
15
+ *
16
+ * ## Rich Link Previews
17
+ *
18
+ * Send a URL as a `link` part to deliver it with a rich preview card showing the
19
+ * page's title, description, and image (when available). A `link` part must be the
20
+ * **only** part in the message — it cannot be combined with text or media parts.
21
+ * To send a URL without a preview card, include it in a `text` part instead.
22
+ *
23
+ * **Limitations:**
24
+ * - A `link` part cannot be combined with other parts in the same message.
25
+ * - Maximum URL length: 2,048 characters.
26
+ *
27
+ * ## Ephemeral Messages (Privacy Tier)
28
+ *
29
+ * For regulated or sensitive conversations, opt in to the **ephemeral messages** tier by contacting your Linq support contact. When enabled, every message on the covered phone numbers is automatically given a fixed **24-hour retention window** — after that window the platform permanently deletes the message from Linq storage. There is no per-message flag; ephemerality is applied automatically based on your configuration.
30
+ *
31
+ * You can request it at two scopes:
32
+ *
33
+ * | Scope | Effect |
34
+ * |---|---|
35
+ * | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
36
+ * | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
37
+ *
38
+ * **Behavioral differences vs the standard default:**
39
+ *
40
+ * | Aspect | Standard | Ephemeral |
41
+ * |---|---|---|
42
+ * | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
43
+ * | After expiry | Message stays retrievable | Message is permanently deleted — `GET /v3/messages/{messageId}` returns `404` and it no longer appears in `GET /v3/chats/{chatId}/messages` |
44
+ * | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
45
+ * | Cross-partner isolation | Enforced | Enforced |
46
+ *
47
+ * **How the 24-hour window works:**
48
+ *
49
+ * - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
50
+ * - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
51
+ * - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
52
+ *
53
+ * **What you observe:**
54
+ *
55
+ * - **No expiry timestamp is exposed.** API responses and webhook payloads do not include the deletion time. If you need it, compute `created_at + 24h` yourself.
56
+ * - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
57
+ * - **Delivery is unaffected.** Ephemeral messages send, deliver, and fire the usual `message.sent` / `message.received` and status webhooks exactly like standard messages. Only retention changes.
58
+ *
59
+ * **When to choose ephemeral:**
60
+ *
61
+ * - You have a compliance requirement that the platform must not retain message content beyond a short window.
62
+ * - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
63
+ * - Your application is the system of record — you capture what you need from the delivery webhook in real time and do not rely on reading message history back from Linq later.
64
+ *
65
+ * **Important:** ephemeral applies in *both directions* — messages you send **and** messages received by the phone numbers in that scope. Because Linq can no longer return the message after 24 hours, persist anything you need to keep from the webhook payload at the time it is delivered.
66
+ */
67
+ class Polls extends resource_1.APIResource {
68
+ /**
69
+ * Create an iMessage poll in an existing chat and send it. Polls are
70
+ * iMessage-only.
71
+ *
72
+ * The chat must already exist — **a poll cannot be the first message of a new
73
+ * chat** (use `POST /v3/chats` for that). Options are **add-only and immutable**:
74
+ * you can add options later via `POST /v3/messages/{messageId}/poll/options`, but
75
+ * never edit or remove them.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const pollEnvelope = await client.chats.polls.create(
80
+ * '550e8400-e29b-41d4-a716-446655440000',
81
+ * {
82
+ * poll: {
83
+ * options: [{ text: 'Tacos' }, { text: 'Sushi' }],
84
+ * idempotency_key: 'poll-abc123',
85
+ * },
86
+ * },
87
+ * );
88
+ * ```
89
+ */
90
+ create(chatID, body, options) {
91
+ return this._client.post((0, path_1.path) `/v3/chats/${chatID}/polls`, { body, ...options });
92
+ }
93
+ }
94
+ exports.Polls = Polls;
95
+ //# sourceMappingURL=polls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polls.js","sourceRoot":"","sources":["../../src/resources/chats/polls.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,MAAc,EAAE,IAAsB,EAAE,OAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,MAAM,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AA1BD,sBA0BC"}
@@ -0,0 +1,91 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { path } from "../../internal/utils/path.mjs";
4
+ /**
5
+ * Messages are individual communications within a chat thread.
6
+ *
7
+ * Messages can include text, media attachments, rich link previews, special effects
8
+ * (like confetti or fireworks), and reactions. All messages are associated with a
9
+ * specific chat and sent from a phone number you own.
10
+ *
11
+ * Messages support delivery status tracking, read receipts, and editing capabilities.
12
+ *
13
+ * ## Rich Link Previews
14
+ *
15
+ * Send a URL as a `link` part to deliver it with a rich preview card showing the
16
+ * page's title, description, and image (when available). A `link` part must be the
17
+ * **only** part in the message — it cannot be combined with text or media parts.
18
+ * To send a URL without a preview card, include it in a `text` part instead.
19
+ *
20
+ * **Limitations:**
21
+ * - A `link` part cannot be combined with other parts in the same message.
22
+ * - Maximum URL length: 2,048 characters.
23
+ *
24
+ * ## Ephemeral Messages (Privacy Tier)
25
+ *
26
+ * For regulated or sensitive conversations, opt in to the **ephemeral messages** tier by contacting your Linq support contact. When enabled, every message on the covered phone numbers is automatically given a fixed **24-hour retention window** — after that window the platform permanently deletes the message from Linq storage. There is no per-message flag; ephemerality is applied automatically based on your configuration.
27
+ *
28
+ * You can request it at two scopes:
29
+ *
30
+ * | Scope | Effect |
31
+ * |---|---|
32
+ * | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
33
+ * | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
34
+ *
35
+ * **Behavioral differences vs the standard default:**
36
+ *
37
+ * | Aspect | Standard | Ephemeral |
38
+ * |---|---|---|
39
+ * | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
40
+ * | After expiry | Message stays retrievable | Message is permanently deleted — `GET /v3/messages/{messageId}` returns `404` and it no longer appears in `GET /v3/chats/{chatId}/messages` |
41
+ * | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
42
+ * | Cross-partner isolation | Enforced | Enforced |
43
+ *
44
+ * **How the 24-hour window works:**
45
+ *
46
+ * - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
47
+ * - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
48
+ * - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
49
+ *
50
+ * **What you observe:**
51
+ *
52
+ * - **No expiry timestamp is exposed.** API responses and webhook payloads do not include the deletion time. If you need it, compute `created_at + 24h` yourself.
53
+ * - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
54
+ * - **Delivery is unaffected.** Ephemeral messages send, deliver, and fire the usual `message.sent` / `message.received` and status webhooks exactly like standard messages. Only retention changes.
55
+ *
56
+ * **When to choose ephemeral:**
57
+ *
58
+ * - You have a compliance requirement that the platform must not retain message content beyond a short window.
59
+ * - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
60
+ * - Your application is the system of record — you capture what you need from the delivery webhook in real time and do not rely on reading message history back from Linq later.
61
+ *
62
+ * **Important:** ephemeral applies in *both directions* — messages you send **and** messages received by the phone numbers in that scope. Because Linq can no longer return the message after 24 hours, persist anything you need to keep from the webhook payload at the time it is delivered.
63
+ */
64
+ export class Polls extends APIResource {
65
+ /**
66
+ * Create an iMessage poll in an existing chat and send it. Polls are
67
+ * iMessage-only.
68
+ *
69
+ * The chat must already exist — **a poll cannot be the first message of a new
70
+ * chat** (use `POST /v3/chats` for that). Options are **add-only and immutable**:
71
+ * you can add options later via `POST /v3/messages/{messageId}/poll/options`, but
72
+ * never edit or remove them.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const pollEnvelope = await client.chats.polls.create(
77
+ * '550e8400-e29b-41d4-a716-446655440000',
78
+ * {
79
+ * poll: {
80
+ * options: [{ text: 'Tacos' }, { text: 'Sushi' }],
81
+ * idempotency_key: 'poll-abc123',
82
+ * },
83
+ * },
84
+ * );
85
+ * ```
86
+ */
87
+ create(chatID, body, options) {
88
+ return this._client.post(path `/v3/chats/${chatID}/polls`, { body, ...options });
89
+ }
90
+ }
91
+ //# sourceMappingURL=polls.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polls.mjs","sourceRoot":"","sources":["../../src/resources/chats/polls.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAIlD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,MAAc,EAAE,IAAsB,EAAE,OAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,MAAM,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;CACF"}
@@ -11,26 +11,16 @@ import { RequestOptions } from "../internal/request-options.mjs";
11
11
  * **Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
12
12
  */
13
13
  export declare class ContactCard extends APIResource {
14
- /**
15
- * Returns the contact card for a specific phone number, or all contact cards for
16
- * the authenticated partner if no `phone_number` is provided.
17
- *
18
- * @example
19
- * ```ts
20
- * const contactCard = await client.contactCard.retrieve();
21
- * ```
22
- */
23
- retrieve(query?: ContactCardRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<ContactCardRetrieveResponse>;
24
14
  /**
25
15
  * Creates a contact card for a phone number. This endpoint is intended for
26
16
  * initial, one-time setup only.
27
17
  *
28
- * The contact card is stored in an inactive state first. Once it's applied
29
- * successfully, it is activated and `is_active` is returned as `true`. On failure,
30
- * `is_active` is `false`.
18
+ * If setup does not complete, the response is `500` (`2022`) call this endpoint
19
+ * again.
31
20
  *
32
- * **Note:** To update an existing contact card after setup, use
33
- * `PATCH /v3/contact_card` instead.
21
+ * **Note:** once a card is active, this endpoint returns `409` (`2014`) so an
22
+ * existing card is never overwritten by accident. Use `PATCH /v3/contact_card` to
23
+ * change it.
34
24
  *
35
25
  * @example
36
26
  * ```ts
@@ -45,13 +35,24 @@ export declare class ContactCard extends APIResource {
45
35
  */
46
36
  create(body: ContactCardCreateParams, options?: RequestOptions): APIPromise<SetContactCard>;
47
37
  /**
48
- * Partially updates an existing active contact card for a phone number.
38
+ * Returns the contact card for a specific phone number, or all contact cards for
39
+ * the authenticated partner if no `phone_number` is provided.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const contactCard = await client.contactCard.retrieve();
44
+ * ```
45
+ */
46
+ retrieve(query?: ContactCardRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<ContactCardRetrieveResponse>;
47
+ /**
48
+ * Partially updates the contact card for a phone number.
49
49
  *
50
- * Fetches the current active contact card and merges the provided fields. Only
51
- * fields present in the request body are updated; omitted fields retain their
52
- * existing values.
50
+ * Fetches the current contact card and merges the provided fields. Only fields
51
+ * present in the request body are updated; omitted fields retain their existing
52
+ * values.
53
53
  *
54
- * Requires an active contact card to exist for the phone number.
54
+ * If the update does not complete, the response is `500` (`2022`) — call this
55
+ * endpoint again.
55
56
  *
56
57
  * @example
57
58
  * ```ts
@@ -100,13 +101,6 @@ export declare namespace ContactCardRetrieveResponse {
100
101
  last_name?: string;
101
102
  }
102
103
  }
103
- export interface ContactCardRetrieveParams {
104
- /**
105
- * E.164 phone number to filter by. If omitted, all my cards for the partner are
106
- * returned.
107
- */
108
- phone_number?: string;
109
- }
110
104
  export interface ContactCardCreateParams {
111
105
  /**
112
106
  * First name for the contact card. Required.
@@ -125,6 +119,13 @@ export interface ContactCardCreateParams {
125
119
  */
126
120
  last_name?: string;
127
121
  }
122
+ export interface ContactCardRetrieveParams {
123
+ /**
124
+ * E.164 phone number to filter by. If omitted, all my cards for the partner are
125
+ * returned.
126
+ */
127
+ phone_number?: string;
128
+ }
128
129
  export interface ContactCardUpdateParams {
129
130
  /**
130
131
  * Query param: E.164 phone number of the contact card to update
@@ -144,6 +145,6 @@ export interface ContactCardUpdateParams {
144
145
  last_name?: string;
145
146
  }
146
147
  export declare namespace ContactCard {
147
- export { type SetContactCard as SetContactCard, type ContactCardRetrieveResponse as ContactCardRetrieveResponse, type ContactCardRetrieveParams as ContactCardRetrieveParams, type ContactCardCreateParams as ContactCardCreateParams, type ContactCardUpdateParams as ContactCardUpdateParams, };
148
+ export { type SetContactCard as SetContactCard, type ContactCardRetrieveResponse as ContactCardRetrieveResponse, type ContactCardCreateParams as ContactCardCreateParams, type ContactCardRetrieveParams as ContactCardRetrieveParams, type ContactCardUpdateParams as ContactCardUpdateParams, };
148
149
  }
149
150
  //# sourceMappingURL=contact-card.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contact-card.d.mts","sourceRoot":"","sources":["../src/resources/contact-card.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAE7D;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;OAQG;IACH,QAAQ,CACN,KAAK,GAAE,yBAAyB,GAAG,IAAI,GAAG,SAAc,EACxD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2BAA2B,CAAC;IAI1C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IAI3F;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;CAI9F;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,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AAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -11,26 +11,16 @@ import { RequestOptions } from "../internal/request-options.js";
11
11
  * **Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
12
12
  */
13
13
  export declare class ContactCard extends APIResource {
14
- /**
15
- * Returns the contact card for a specific phone number, or all contact cards for
16
- * the authenticated partner if no `phone_number` is provided.
17
- *
18
- * @example
19
- * ```ts
20
- * const contactCard = await client.contactCard.retrieve();
21
- * ```
22
- */
23
- retrieve(query?: ContactCardRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<ContactCardRetrieveResponse>;
24
14
  /**
25
15
  * Creates a contact card for a phone number. This endpoint is intended for
26
16
  * initial, one-time setup only.
27
17
  *
28
- * The contact card is stored in an inactive state first. Once it's applied
29
- * successfully, it is activated and `is_active` is returned as `true`. On failure,
30
- * `is_active` is `false`.
18
+ * If setup does not complete, the response is `500` (`2022`) call this endpoint
19
+ * again.
31
20
  *
32
- * **Note:** To update an existing contact card after setup, use
33
- * `PATCH /v3/contact_card` instead.
21
+ * **Note:** once a card is active, this endpoint returns `409` (`2014`) so an
22
+ * existing card is never overwritten by accident. Use `PATCH /v3/contact_card` to
23
+ * change it.
34
24
  *
35
25
  * @example
36
26
  * ```ts
@@ -45,13 +35,24 @@ export declare class ContactCard extends APIResource {
45
35
  */
46
36
  create(body: ContactCardCreateParams, options?: RequestOptions): APIPromise<SetContactCard>;
47
37
  /**
48
- * Partially updates an existing active contact card for a phone number.
38
+ * Returns the contact card for a specific phone number, or all contact cards for
39
+ * the authenticated partner if no `phone_number` is provided.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const contactCard = await client.contactCard.retrieve();
44
+ * ```
45
+ */
46
+ retrieve(query?: ContactCardRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<ContactCardRetrieveResponse>;
47
+ /**
48
+ * Partially updates the contact card for a phone number.
49
49
  *
50
- * Fetches the current active contact card and merges the provided fields. Only
51
- * fields present in the request body are updated; omitted fields retain their
52
- * existing values.
50
+ * Fetches the current contact card and merges the provided fields. Only fields
51
+ * present in the request body are updated; omitted fields retain their existing
52
+ * values.
53
53
  *
54
- * Requires an active contact card to exist for the phone number.
54
+ * If the update does not complete, the response is `500` (`2022`) — call this
55
+ * endpoint again.
55
56
  *
56
57
  * @example
57
58
  * ```ts
@@ -100,13 +101,6 @@ export declare namespace ContactCardRetrieveResponse {
100
101
  last_name?: string;
101
102
  }
102
103
  }
103
- export interface ContactCardRetrieveParams {
104
- /**
105
- * E.164 phone number to filter by. If omitted, all my cards for the partner are
106
- * returned.
107
- */
108
- phone_number?: string;
109
- }
110
104
  export interface ContactCardCreateParams {
111
105
  /**
112
106
  * First name for the contact card. Required.
@@ -125,6 +119,13 @@ export interface ContactCardCreateParams {
125
119
  */
126
120
  last_name?: string;
127
121
  }
122
+ export interface ContactCardRetrieveParams {
123
+ /**
124
+ * E.164 phone number to filter by. If omitted, all my cards for the partner are
125
+ * returned.
126
+ */
127
+ phone_number?: string;
128
+ }
128
129
  export interface ContactCardUpdateParams {
129
130
  /**
130
131
  * Query param: E.164 phone number of the contact card to update
@@ -144,6 +145,6 @@ export interface ContactCardUpdateParams {
144
145
  last_name?: string;
145
146
  }
146
147
  export declare namespace ContactCard {
147
- export { type SetContactCard as SetContactCard, type ContactCardRetrieveResponse as ContactCardRetrieveResponse, type ContactCardRetrieveParams as ContactCardRetrieveParams, type ContactCardCreateParams as ContactCardCreateParams, type ContactCardUpdateParams as ContactCardUpdateParams, };
148
+ export { type SetContactCard as SetContactCard, type ContactCardRetrieveResponse as ContactCardRetrieveResponse, type ContactCardCreateParams as ContactCardCreateParams, type ContactCardRetrieveParams as ContactCardRetrieveParams, type ContactCardUpdateParams as ContactCardUpdateParams, };
148
149
  }
149
150
  //# sourceMappingURL=contact-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contact-card.d.ts","sourceRoot":"","sources":["../src/resources/contact-card.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAE7D;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;OAQG;IACH,QAAQ,CACN,KAAK,GAAE,yBAAyB,GAAG,IAAI,GAAG,SAAc,EACxD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,2BAA2B,CAAC;IAI1C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IAI3F;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;CAI9F;AAED,MAAM,WAAW,cA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AAE,MAAM,CAAC;QAErB,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -13,28 +13,16 @@ const resource_1 = require("../core/resource.js");
13
13
  * **Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
14
14
  */
15
15
  class ContactCard extends resource_1.APIResource {
16
- /**
17
- * Returns the contact card for a specific phone number, or all contact cards for
18
- * the authenticated partner if no `phone_number` is provided.
19
- *
20
- * @example
21
- * ```ts
22
- * const contactCard = await client.contactCard.retrieve();
23
- * ```
24
- */
25
- retrieve(query = {}, options) {
26
- return this._client.get('/v3/contact_card', { query, ...options });
27
- }
28
16
  /**
29
17
  * Creates a contact card for a phone number. This endpoint is intended for
30
18
  * initial, one-time setup only.
31
19
  *
32
- * The contact card is stored in an inactive state first. Once it's applied
33
- * successfully, it is activated and `is_active` is returned as `true`. On failure,
34
- * `is_active` is `false`.
20
+ * If setup does not complete, the response is `500` (`2022`) call this endpoint
21
+ * again.
35
22
  *
36
- * **Note:** To update an existing contact card after setup, use
37
- * `PATCH /v3/contact_card` instead.
23
+ * **Note:** once a card is active, this endpoint returns `409` (`2014`) so an
24
+ * existing card is never overwritten by accident. Use `PATCH /v3/contact_card` to
25
+ * change it.
38
26
  *
39
27
  * @example
40
28
  * ```ts
@@ -51,13 +39,26 @@ class ContactCard extends resource_1.APIResource {
51
39
  return this._client.post('/v3/contact_card', { body, ...options });
52
40
  }
53
41
  /**
54
- * Partially updates an existing active contact card for a phone number.
42
+ * Returns the contact card for a specific phone number, or all contact cards for
43
+ * the authenticated partner if no `phone_number` is provided.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const contactCard = await client.contactCard.retrieve();
48
+ * ```
49
+ */
50
+ retrieve(query = {}, options) {
51
+ return this._client.get('/v3/contact_card', { query, ...options });
52
+ }
53
+ /**
54
+ * Partially updates the contact card for a phone number.
55
55
  *
56
- * Fetches the current active contact card and merges the provided fields. Only
57
- * fields present in the request body are updated; omitted fields retain their
58
- * existing values.
56
+ * Fetches the current contact card and merges the provided fields. Only fields
57
+ * present in the request body are updated; omitted fields retain their existing
58
+ * values.
59
59
  *
60
- * Requires an active contact card to exist for the phone number.
60
+ * If the update does not complete, the response is `500` (`2022`) — call this
61
+ * endpoint again.
61
62
  *
62
63
  * @example
63
64
  * ```ts