@linqapp/sdk 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +1 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +1 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/core/error.d.mts +13 -0
  11. package/core/error.d.mts.map +1 -1
  12. package/core/error.d.ts +13 -0
  13. package/core/error.d.ts.map +1 -1
  14. package/core/error.js +5 -1
  15. package/core/error.js.map +1 -1
  16. package/core/error.mjs +5 -1
  17. package/core/error.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/chats/chats.d.mts +68 -24
  20. package/resources/chats/chats.d.mts.map +1 -1
  21. package/resources/chats/chats.d.ts +68 -24
  22. package/resources/chats/chats.d.ts.map +1 -1
  23. package/resources/chats/chats.js +6 -2
  24. package/resources/chats/chats.js.map +1 -1
  25. package/resources/chats/chats.mjs +6 -2
  26. package/resources/chats/chats.mjs.map +1 -1
  27. package/resources/chats/index.d.mts +1 -0
  28. package/resources/chats/index.d.mts.map +1 -1
  29. package/resources/chats/index.d.ts +1 -0
  30. package/resources/chats/index.d.ts.map +1 -1
  31. package/resources/chats/index.js +3 -1
  32. package/resources/chats/index.js.map +1 -1
  33. package/resources/chats/index.mjs +1 -0
  34. package/resources/chats/index.mjs.map +1 -1
  35. package/resources/chats/messages.d.mts +12 -5
  36. package/resources/chats/messages.d.mts.map +1 -1
  37. package/resources/chats/messages.d.ts +12 -5
  38. package/resources/chats/messages.d.ts.map +1 -1
  39. package/resources/chats/messages.js.map +1 -1
  40. package/resources/chats/messages.mjs.map +1 -1
  41. package/resources/chats/polls.d.mts +171 -0
  42. package/resources/chats/polls.d.mts.map +1 -0
  43. package/resources/chats/polls.d.ts +171 -0
  44. package/resources/chats/polls.d.ts.map +1 -0
  45. package/resources/chats/polls.js +95 -0
  46. package/resources/chats/polls.js.map +1 -0
  47. package/resources/chats/polls.mjs +91 -0
  48. package/resources/chats/polls.mjs.map +1 -0
  49. package/resources/index.d.mts +1 -1
  50. package/resources/index.d.mts.map +1 -1
  51. package/resources/index.d.ts +1 -1
  52. package/resources/index.d.ts.map +1 -1
  53. package/resources/index.js +1 -1
  54. package/resources/index.js.map +1 -1
  55. package/resources/index.mjs +1 -1
  56. package/resources/index.mjs.map +1 -1
  57. package/resources/messages/index.d.mts +3 -0
  58. package/resources/messages/index.d.mts.map +1 -0
  59. package/resources/messages/index.d.ts +3 -0
  60. package/resources/messages/index.d.ts.map +1 -0
  61. package/resources/messages/index.js +9 -0
  62. package/resources/messages/index.js.map +1 -0
  63. package/resources/messages/index.mjs +4 -0
  64. package/resources/messages/index.mjs.map +1 -0
  65. package/resources/messages/messages.d.mts +795 -0
  66. package/resources/messages/messages.d.mts.map +1 -0
  67. package/resources/messages/messages.d.ts +795 -0
  68. package/resources/messages/messages.d.ts.map +1 -0
  69. package/resources/messages/messages.js +298 -0
  70. package/resources/messages/messages.js.map +1 -0
  71. package/resources/messages/messages.mjs +293 -0
  72. package/resources/messages/messages.mjs.map +1 -0
  73. package/resources/messages/poll.d.mts +131 -0
  74. package/resources/messages/poll.d.mts.map +1 -0
  75. package/resources/messages/poll.d.ts +131 -0
  76. package/resources/messages/poll.d.ts.map +1 -0
  77. package/resources/messages/poll.js +119 -0
  78. package/resources/messages/poll.js.map +1 -0
  79. package/resources/messages/poll.mjs +115 -0
  80. package/resources/messages/poll.mjs.map +1 -0
  81. package/resources/messages.d.mts +1 -783
  82. package/resources/messages.d.mts.map +1 -1
  83. package/resources/messages.d.ts +1 -783
  84. package/resources/messages.d.ts.map +1 -1
  85. package/resources/messages.js +2 -286
  86. package/resources/messages.js.map +1 -1
  87. package/resources/messages.mjs +1 -284
  88. package/resources/messages.mjs.map +1 -1
  89. package/resources/webhook-events.d.mts +1 -1
  90. package/resources/webhook-events.d.mts.map +1 -1
  91. package/resources/webhook-events.d.ts +1 -1
  92. package/resources/webhook-events.d.ts.map +1 -1
  93. package/resources/webhooks.d.mts +40 -28
  94. package/resources/webhooks.d.mts.map +1 -1
  95. package/resources/webhooks.d.ts +40 -28
  96. package/resources/webhooks.d.ts.map +1 -1
  97. package/src/client.ts +15 -15
  98. package/src/core/error.ts +20 -1
  99. package/src/resources/chats/chats.ts +79 -24
  100. package/src/resources/chats/index.ts +1 -0
  101. package/src/resources/chats/messages.ts +14 -6
  102. package/src/resources/chats/polls.ts +196 -0
  103. package/src/resources/index.ts +1 -1
  104. package/src/resources/messages/index.ts +18 -0
  105. package/src/resources/messages/messages.ts +958 -0
  106. package/src/resources/messages/poll.ts +151 -0
  107. package/src/resources/messages.ts +1 -932
  108. package/src/resources/webhook-events.ts +9 -0
  109. package/src/resources/webhooks.ts +48 -27
  110. package/src/version.ts +1 -1
  111. package/version.d.mts +1 -1
  112. package/version.d.ts +1 -1
  113. package/version.js +1 -1
  114. package/version.mjs +1 -1
@@ -0,0 +1,131 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as PollsAPI from "../chats/polls.mjs";
3
+ import { APIPromise } from "../../core/api-promise.mjs";
4
+ import { RequestOptions } from "../../internal/request-options.mjs";
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 Poll extends APIResource {
66
+ /**
67
+ * Return a poll's current results — its options, each option's voters, and the
68
+ * distinct total number of voters — by the poll-definition message's ID.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const pollEnvelope = await client.messages.poll.retrieve(
73
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
74
+ * );
75
+ * ```
76
+ */
77
+ retrieve(messageID: string, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
78
+ /**
79
+ * Add one or more options to an existing poll. Options are **add-only and
80
+ * immutable** — you can append options but never edit or remove them (Apple
81
+ * constraint). Returns the full poll.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const pollEnvelope = await client.messages.poll.addOptions(
86
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
87
+ * { options: [{ text: 'Pizza' }] },
88
+ * );
89
+ * ```
90
+ */
91
+ addOptions(messageID: string, body: PollAddOptionsParams, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
92
+ /**
93
+ * Add or remove your line's vote on **one** poll option (per-option toggle —
94
+ * iMessage polls are toggled one option at a time). Returns the poll reflecting
95
+ * the toggle.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const pollEnvelope = await client.messages.poll.vote(
100
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
101
+ * {
102
+ * operation: 'add',
103
+ * option_id: '97ce8c17-7ef6-4bbc-a89a-6b93d189712f',
104
+ * },
105
+ * );
106
+ * ```
107
+ */
108
+ vote(messageID: string, body: PollVoteParams, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
109
+ }
110
+ export interface PollAddOptionsParams {
111
+ options: Array<PollAddOptionsParams.Option>;
112
+ }
113
+ export declare namespace PollAddOptionsParams {
114
+ interface Option {
115
+ text: string;
116
+ }
117
+ }
118
+ export interface PollVoteParams {
119
+ /**
120
+ * Add or remove your line's vote on the option.
121
+ */
122
+ operation: 'add' | 'remove';
123
+ /**
124
+ * The option to toggle a vote on.
125
+ */
126
+ option_id: string;
127
+ }
128
+ export declare namespace Poll {
129
+ export { type PollAddOptionsParams as PollAddOptionsParams, type PollVoteParams as PollVoteParams };
130
+ }
131
+ //# sourceMappingURL=poll.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.d.mts","sourceRoot":"","sources":["../../src/resources/messages/poll.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,QAAQ,2BAAuB;AAC3C,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAIxF;;;;;;;;;;;;OAYG;IACH,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAIpC;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;CAG3G;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC;KACd;CACF;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EAAE,KAAK,oBAAoB,IAAI,oBAAoB,EAAE,KAAK,cAAc,IAAI,cAAc,EAAE,CAAC;CACrG"}
@@ -0,0 +1,131 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as PollsAPI from "../chats/polls.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 Poll extends APIResource {
66
+ /**
67
+ * Return a poll's current results — its options, each option's voters, and the
68
+ * distinct total number of voters — by the poll-definition message's ID.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const pollEnvelope = await client.messages.poll.retrieve(
73
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
74
+ * );
75
+ * ```
76
+ */
77
+ retrieve(messageID: string, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
78
+ /**
79
+ * Add one or more options to an existing poll. Options are **add-only and
80
+ * immutable** — you can append options but never edit or remove them (Apple
81
+ * constraint). Returns the full poll.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const pollEnvelope = await client.messages.poll.addOptions(
86
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
87
+ * { options: [{ text: 'Pizza' }] },
88
+ * );
89
+ * ```
90
+ */
91
+ addOptions(messageID: string, body: PollAddOptionsParams, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
92
+ /**
93
+ * Add or remove your line's vote on **one** poll option (per-option toggle —
94
+ * iMessage polls are toggled one option at a time). Returns the poll reflecting
95
+ * the toggle.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * const pollEnvelope = await client.messages.poll.vote(
100
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
101
+ * {
102
+ * operation: 'add',
103
+ * option_id: '97ce8c17-7ef6-4bbc-a89a-6b93d189712f',
104
+ * },
105
+ * );
106
+ * ```
107
+ */
108
+ vote(messageID: string, body: PollVoteParams, options?: RequestOptions): APIPromise<PollsAPI.PollEnvelope>;
109
+ }
110
+ export interface PollAddOptionsParams {
111
+ options: Array<PollAddOptionsParams.Option>;
112
+ }
113
+ export declare namespace PollAddOptionsParams {
114
+ interface Option {
115
+ text: string;
116
+ }
117
+ }
118
+ export interface PollVoteParams {
119
+ /**
120
+ * Add or remove your line's vote on the option.
121
+ */
122
+ operation: 'add' | 'remove';
123
+ /**
124
+ * The option to toggle a vote on.
125
+ */
126
+ option_id: string;
127
+ }
128
+ export declare namespace Poll {
129
+ export { type PollAddOptionsParams as PollAddOptionsParams, type PollVoteParams as PollVoteParams };
130
+ }
131
+ //# sourceMappingURL=poll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.d.ts","sourceRoot":"","sources":["../../src/resources/messages/poll.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,QAAQ,0BAAuB;AAC3C,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAIxF;;;;;;;;;;;;OAYG;IACH,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAIpC;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;CAG3G;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC;KACd;CACF;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;IAE5B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EAAE,KAAK,oBAAoB,IAAI,oBAAoB,EAAE,KAAK,cAAc,IAAI,cAAc,EAAE,CAAC;CACrG"}
@@ -0,0 +1,119 @@
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.Poll = 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 Poll extends resource_1.APIResource {
68
+ /**
69
+ * Return a poll's current results — its options, each option's voters, and the
70
+ * distinct total number of voters — by the poll-definition message's ID.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const pollEnvelope = await client.messages.poll.retrieve(
75
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
76
+ * );
77
+ * ```
78
+ */
79
+ retrieve(messageID, options) {
80
+ return this._client.get((0, path_1.path) `/v3/messages/${messageID}/poll`, options);
81
+ }
82
+ /**
83
+ * Add one or more options to an existing poll. Options are **add-only and
84
+ * immutable** — you can append options but never edit or remove them (Apple
85
+ * constraint). Returns the full poll.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const pollEnvelope = await client.messages.poll.addOptions(
90
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
91
+ * { options: [{ text: 'Pizza' }] },
92
+ * );
93
+ * ```
94
+ */
95
+ addOptions(messageID, body, options) {
96
+ return this._client.post((0, path_1.path) `/v3/messages/${messageID}/poll/options`, { body, ...options });
97
+ }
98
+ /**
99
+ * Add or remove your line's vote on **one** poll option (per-option toggle —
100
+ * iMessage polls are toggled one option at a time). Returns the poll reflecting
101
+ * the toggle.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const pollEnvelope = await client.messages.poll.vote(
106
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
107
+ * {
108
+ * operation: 'add',
109
+ * option_id: '97ce8c17-7ef6-4bbc-a89a-6b93d189712f',
110
+ * },
111
+ * );
112
+ * ```
113
+ */
114
+ vote(messageID, body, options) {
115
+ return this._client.post((0, path_1.path) `/v3/messages/${messageID}/poll/votes`, { body, ...options });
116
+ }
117
+ }
118
+ exports.Poll = Poll;
119
+ //# sourceMappingURL=poll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/resources/messages/poll.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,OAAO,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,UAAU,CACR,SAAiB,EACjB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,SAAiB,EAAE,IAAoB,EAAE,OAAwB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;CACF;AAxDD,oBAwDC"}
@@ -0,0 +1,115 @@
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 Poll extends APIResource {
65
+ /**
66
+ * Return a poll's current results — its options, each option's voters, and the
67
+ * distinct total number of voters — by the poll-definition message's ID.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const pollEnvelope = await client.messages.poll.retrieve(
72
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
73
+ * );
74
+ * ```
75
+ */
76
+ retrieve(messageID, options) {
77
+ return this._client.get(path `/v3/messages/${messageID}/poll`, options);
78
+ }
79
+ /**
80
+ * Add one or more options to an existing poll. Options are **add-only and
81
+ * immutable** — you can append options but never edit or remove them (Apple
82
+ * constraint). Returns the full poll.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const pollEnvelope = await client.messages.poll.addOptions(
87
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
88
+ * { options: [{ text: 'Pizza' }] },
89
+ * );
90
+ * ```
91
+ */
92
+ addOptions(messageID, body, options) {
93
+ return this._client.post(path `/v3/messages/${messageID}/poll/options`, { body, ...options });
94
+ }
95
+ /**
96
+ * Add or remove your line's vote on **one** poll option (per-option toggle —
97
+ * iMessage polls are toggled one option at a time). Returns the poll reflecting
98
+ * the toggle.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const pollEnvelope = await client.messages.poll.vote(
103
+ * '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
104
+ * {
105
+ * operation: 'add',
106
+ * option_id: '97ce8c17-7ef6-4bbc-a89a-6b93d189712f',
107
+ * },
108
+ * );
109
+ * ```
110
+ */
111
+ vote(messageID, body, options) {
112
+ return this._client.post(path `/v3/messages/${messageID}/poll/votes`, { body, ...options });
113
+ }
114
+ }
115
+ //# sourceMappingURL=poll.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.mjs","sourceRoot":"","sources":["../../src/resources/messages/poll.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAIlD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,SAAS,OAAO,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,UAAU,CACR,SAAiB,EACjB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,SAAiB,EAAE,IAAoB,EAAE,OAAwB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;CACF"}