@linqapp/sdk 0.34.0 → 0.35.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 (54) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/client.d.mts +11 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +11 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +11 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +11 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/attachments.d.mts +2 -1
  12. package/resources/attachments.d.mts.map +1 -1
  13. package/resources/attachments.d.ts +2 -1
  14. package/resources/attachments.d.ts.map +1 -1
  15. package/resources/blocked-handles.d.mts +99 -0
  16. package/resources/blocked-handles.d.mts.map +1 -0
  17. package/resources/blocked-handles.d.ts +99 -0
  18. package/resources/blocked-handles.d.ts.map +1 -0
  19. package/resources/blocked-handles.js +69 -0
  20. package/resources/blocked-handles.js.map +1 -0
  21. package/resources/blocked-handles.mjs +65 -0
  22. package/resources/blocked-handles.mjs.map +1 -0
  23. package/resources/chats/chats.d.mts +16 -16
  24. package/resources/chats/chats.d.ts +16 -16
  25. package/resources/index.d.mts +1 -0
  26. package/resources/index.d.mts.map +1 -1
  27. package/resources/index.d.ts +1 -0
  28. package/resources/index.d.ts.map +1 -1
  29. package/resources/index.js +3 -1
  30. package/resources/index.js.map +1 -1
  31. package/resources/index.mjs +1 -0
  32. package/resources/index.mjs.map +1 -1
  33. package/resources/messages/messages.d.mts +39 -0
  34. package/resources/messages/messages.d.mts.map +1 -1
  35. package/resources/messages/messages.d.ts +39 -0
  36. package/resources/messages/messages.d.ts.map +1 -1
  37. package/resources/messages/messages.js.map +1 -1
  38. package/resources/messages/messages.mjs.map +1 -1
  39. package/resources/webhooks.d.mts +50 -27
  40. package/resources/webhooks.d.mts.map +1 -1
  41. package/resources/webhooks.d.ts +50 -27
  42. package/resources/webhooks.d.ts.map +1 -1
  43. package/src/client.ts +27 -0
  44. package/src/resources/attachments.ts +2 -1
  45. package/src/resources/blocked-handles.ts +129 -0
  46. package/src/resources/chats/chats.ts +16 -16
  47. package/src/resources/index.ts +8 -0
  48. package/src/resources/messages/messages.ts +41 -0
  49. package/src/resources/webhooks.ts +53 -27
  50. package/src/version.ts +1 -1
  51. package/version.d.mts +1 -1
  52. package/version.d.ts +1 -1
  53. package/version.js +1 -1
  54. package/version.mjs +1 -1
@@ -435,7 +435,8 @@ export interface AttachmentCreateResponse {
435
435
  /**
436
436
  * Presigned URL for uploading the file. PUT the raw binary file content to this
437
437
  * URL with the `required_headers`. Do not JSON-encode or multipart-wrap the body.
438
- * Expires after 15 minutes.
438
+ * Expires after 15 minutes. Treat the URL as opaque — the hostname depends on
439
+ * partner configuration and is the same across sandbox and production.
439
440
  */
440
441
  upload_url: string;
441
442
  }
@@ -0,0 +1,129 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { buildHeaders } from '../internal/headers';
6
+ import { RequestOptions } from '../internal/request-options';
7
+
8
+ /**
9
+ * Block handles — phone numbers, email addresses, SMS short codes, or
10
+ * sender IDs. Inbound messages from a blocked handle are dropped before
11
+ * they reach your webhooks, and direct sends to a blocked handle are
12
+ * rejected with `403` (error code `2026`). Group sends that include
13
+ * unblocked members are not restricted.
14
+ */
15
+ export class BlockedHandles extends APIResource {
16
+ /**
17
+ * Returns all handles you have blocked. Inbound messages from a blocked handle are
18
+ * dropped and produce no webhooks, and direct sends to a blocked handle are
19
+ * rejected with `403` (error code `2026`). Group sends that include unblocked
20
+ * members are not restricted.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const blockedHandles = await client.blockedHandles.list();
25
+ * ```
26
+ */
27
+ list(options?: RequestOptions): APIPromise<BlockedHandleListResponse> {
28
+ return this._client.get('/v3/blocked_handles', options);
29
+ }
30
+
31
+ /**
32
+ * Blocks a handle — an E.164 phone number, an email address (iMessage sender), an
33
+ * SMS short code (e.g. `262966`), or an alphanumeric sender ID. Inbound messages
34
+ * from it are dropped and produce no webhooks, and direct sends to it are rejected
35
+ * with `403` (error code `2026`); group sends that include unblocked members are
36
+ * not restricted. Blocking is idempotent — re-blocking an already blocked handle
37
+ * returns the existing entry.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.blockedHandles.block({
42
+ * handle: '+12025551234',
43
+ * reason: 'spam',
44
+ * });
45
+ * ```
46
+ */
47
+ block(body: BlockedHandleBlockParams, options?: RequestOptions): APIPromise<BlockedHandleBlockResponse> {
48
+ return this._client.post('/v3/blocked_handles', { body, ...options });
49
+ }
50
+
51
+ /**
52
+ * Removes a handle from your blocklist. Inbound messages from it will be delivered
53
+ * again and sends to it are allowed again. The handle goes in the request body,
54
+ * mirroring block — no URL encoding needed.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * await client.blockedHandles.unblock({
59
+ * handle: '+12025551234',
60
+ * });
61
+ * ```
62
+ */
63
+ unblock(body: BlockedHandleUnblockParams, options?: RequestOptions): APIPromise<void> {
64
+ return this._client.delete('/v3/blocked_handles', {
65
+ body,
66
+ ...options,
67
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
68
+ });
69
+ }
70
+ }
71
+
72
+ export interface BlockedHandleEntry {
73
+ /**
74
+ * When the handle was blocked
75
+ */
76
+ blocked_at: string;
77
+
78
+ /**
79
+ * The blocked handle, normalized (E.164 phone, lowercased email, short code, or
80
+ * sender ID)
81
+ */
82
+ handle: string;
83
+
84
+ /**
85
+ * Optional note recorded when the handle was blocked
86
+ */
87
+ reason?: string;
88
+ }
89
+
90
+ export interface BlockedHandleListResponse {
91
+ /**
92
+ * All handles blocked by the partner, newest first
93
+ */
94
+ blocked_handles: Array<BlockedHandleEntry>;
95
+ }
96
+
97
+ export interface BlockedHandleBlockResponse {
98
+ blocked_handle: BlockedHandleEntry;
99
+ }
100
+
101
+ export interface BlockedHandleBlockParams {
102
+ /**
103
+ * The handle to block: an E.164 phone number, an email address, an SMS short code
104
+ * (3-8 digits), or an alphanumeric sender ID.
105
+ */
106
+ handle: string;
107
+
108
+ /**
109
+ * Optional free-text note on why the handle was blocked
110
+ */
111
+ reason?: string;
112
+ }
113
+
114
+ export interface BlockedHandleUnblockParams {
115
+ /**
116
+ * The handle to unblock
117
+ */
118
+ handle: string;
119
+ }
120
+
121
+ export declare namespace BlockedHandles {
122
+ export {
123
+ type BlockedHandleEntry as BlockedHandleEntry,
124
+ type BlockedHandleListResponse as BlockedHandleListResponse,
125
+ type BlockedHandleBlockResponse as BlockedHandleBlockResponse,
126
+ type BlockedHandleBlockParams as BlockedHandleBlockParams,
127
+ type BlockedHandleUnblockParams as BlockedHandleUnblockParams,
128
+ };
129
+ }
@@ -387,14 +387,14 @@ export namespace Chat {
387
387
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
388
388
  * to react. `doc_url` deep-links to the relevant section.
389
389
  *
390
- * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
391
- * `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
392
- * part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
393
- * match exactly, including case. `OPT OUT` is the exception — it matches in any
394
- * casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
395
- * `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
396
- * or if they keep replying on the chatsustained two-way conversation is treated
397
- * as a sign the stop keyword was a false positive.
390
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
391
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
392
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
393
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
394
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
395
+ * count. It clears as soon as they reply again: any later message from them that
396
+ * is not itself an opt-out keyword opts them back in immediately a reply in any
397
+ * conversation with you counts, the same way the block does.
398
398
  *
399
399
  * Linq enforces this: while a recipient is opted out, every send to them is
400
400
  * rejected with `403` (error code `2024`) before the message is queued, across
@@ -875,14 +875,14 @@ export namespace ChatCreateResponse {
875
875
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
876
876
  * to react. `doc_url` deep-links to the relevant section.
877
877
  *
878
- * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
879
- * `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
880
- * part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
881
- * match exactly, including case. `OPT OUT` is the exception — it matches in any
882
- * casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
883
- * `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
884
- * or if they keep replying on the chatsustained two-way conversation is treated
885
- * as a sign the stop keyword was a false positive.
878
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
879
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
880
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
881
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
882
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
883
+ * count. It clears as soon as they reply again: any later message from them that
884
+ * is not itself an opt-out keyword opts them back in immediately a reply in any
885
+ * conversation with you counts, the same way the block does.
886
886
  *
887
887
  * Linq enforces this: while a recipient is opted out, every send to them is
888
888
  * rejected with `403` (error code `2024`) before the message is queued, across
@@ -13,6 +13,14 @@ export {
13
13
  type AvailableNumberRetrieveResponse,
14
14
  type AvailableNumberRetrieveParams,
15
15
  } from './available-number';
16
+ export {
17
+ BlockedHandles,
18
+ type BlockedHandleEntry,
19
+ type BlockedHandleListResponse,
20
+ type BlockedHandleBlockResponse,
21
+ type BlockedHandleBlockParams,
22
+ type BlockedHandleUnblockParams,
23
+ } from './blocked-handles';
16
24
  export {
17
25
  Capability,
18
26
  type HandleCheck,
@@ -846,6 +846,16 @@ export interface MessageUpdateAppCardParams {
846
846
  */
847
847
  layout: MessageUpdateAppCardParams.Layout;
848
848
 
849
+ /**
850
+ * Invokes an action on an experience — a third party that renders inside Linq's
851
+ * iMessage app. Linq resolves the recipient's connection, mints any session the
852
+ * action needs, composes the card and sends it; none of that is visible to you.
853
+ *
854
+ * Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
855
+ * fields each accepts.
856
+ */
857
+ action?: MessageUpdateAppCardParams.Action;
858
+
849
859
  /**
850
860
  * Text shown on surfaces that cannot render the card (notifications, lock screen).
851
861
  * Defaults to the caption when omitted.
@@ -867,6 +877,8 @@ export interface MessageUpdateAppCardParams {
867
877
 
868
878
  /**
869
879
  * URL the recipient's app opens when they tap the updated card.
880
+ *
881
+ * Mutually exclusive with `action` and `raw_payload_data`.
870
882
  */
871
883
  url?: string;
872
884
  }
@@ -930,6 +942,35 @@ export namespace MessageUpdateAppCardParams {
930
942
  */
931
943
  trailing_subcaption?: string;
932
944
  }
945
+
946
+ /**
947
+ * Invokes an action on an experience — a third party that renders inside Linq's
948
+ * iMessage app. Linq resolves the recipient's connection, mints any session the
949
+ * action needs, composes the card and sends it; none of that is visible to you.
950
+ *
951
+ * Call `GET /v3/experiences/{experience}` for the actions you may invoke and the
952
+ * fields each accepts.
953
+ */
954
+ export interface Action {
955
+ /**
956
+ * Which of its actions, e.g. `attach_card`.
957
+ */
958
+ action: string;
959
+
960
+ /**
961
+ * The experience to invoke, e.g. `agentcard`.
962
+ */
963
+ experience: string;
964
+
965
+ /**
966
+ * Values for the fields this action exposes. Keys are exactly the field names
967
+ * listed for the action — no mapping, no nesting.
968
+ *
969
+ * Display copy only, except a `url`-type field — that value sets the destination,
970
+ * and must be an absolute `https` URL.
971
+ */
972
+ params?: { [key: string]: unknown };
973
+ }
933
974
  }
934
975
 
935
976
  Messages.Poll = Poll;
@@ -185,14 +185,14 @@ export namespace MessageEventV2 {
185
185
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
186
186
  * to react. `doc_url` deep-links to the relevant section.
187
187
  *
188
- * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
189
- * `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
190
- * part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
191
- * match exactly, including case. `OPT OUT` is the exception — it matches in any
192
- * casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
193
- * `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
194
- * or if they keep replying on the chatsustained two-way conversation is treated
195
- * as a sign the stop keyword was a false positive.
188
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
189
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
190
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
191
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
192
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
193
+ * count. It clears as soon as they reply again: any later message from them that
194
+ * is not itself an opt-out keyword opts them back in immediately a reply in any
195
+ * conversation with you counts, the same way the block does.
196
196
  *
197
197
  * Linq enforces this: while a recipient is opted out, every send to them is
198
198
  * rejected with `403` (error code `2024`) before the message is queued, across
@@ -1021,7 +1021,10 @@ export namespace MessageFailedWebhookEvent {
1021
1021
  */
1022
1022
  export interface Data {
1023
1023
  /**
1024
- * Error codes in webhook failure events (3007, 4001, 4005).
1024
+ * Error codes in webhook failure events. The possible set varies by event:
1025
+ * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1026
+ * update failure events (chat.group_name_update_failed,
1027
+ * chat.group_icon_update_failed) carry 3007 or 4001.
1025
1028
  */
1026
1029
  code: number;
1027
1030
 
@@ -1035,15 +1038,32 @@ export namespace MessageFailedWebhookEvent {
1035
1038
  */
1036
1039
  chat_id?: string;
1037
1040
 
1041
+ /**
1042
+ * Opaque diagnostic code identifying the specific failure class within `code`.
1043
+ * Values are not enumerated and may change without notice — log it and include it
1044
+ * in support requests, but do not branch on it.
1045
+ */
1046
+ detail_code?: number | null;
1047
+
1038
1048
  /**
1039
1049
  * Message identifier (UUID)
1040
1050
  */
1041
1051
  message_id?: string;
1042
1052
 
1053
+ /**
1054
+ * Preferred messaging service type. Includes "auto" for default fallback behavior.
1055
+ */
1056
+ preferred_service?: 'iMessage' | 'SMS' | 'RCS' | 'auto' | null;
1057
+
1043
1058
  /**
1044
1059
  * Human-readable description of the failure
1045
1060
  */
1046
1061
  reason?: string;
1062
+
1063
+ /**
1064
+ * Messaging service type
1065
+ */
1066
+ service?: Shared.ServiceType | null;
1047
1067
  }
1048
1068
  }
1049
1069
 
@@ -1201,14 +1221,14 @@ export namespace MessageEditedWebhookEvent {
1201
1221
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1202
1222
  * to react. `doc_url` deep-links to the relevant section.
1203
1223
  *
1204
- * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
1205
- * `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
1206
- * part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
1207
- * match exactly, including case. `OPT OUT` is the exception — it matches in any
1208
- * casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
1209
- * `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
1210
- * or if they keep replying on the chatsustained two-way conversation is treated
1211
- * as a sign the stop keyword was a false positive.
1224
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
1225
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
1226
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
1227
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
1228
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
1229
+ * count. It clears as soon as they reply again: any later message from them that
1230
+ * is not itself an opt-out keyword opts them back in immediately a reply in any
1231
+ * conversation with you counts, the same way the block does.
1212
1232
  *
1213
1233
  * Linq enforces this: while a recipient is opted out, every send to them is
1214
1234
  * rejected with `403` (error code `2024`) before the message is queued, across
@@ -1638,14 +1658,14 @@ export namespace ChatCreatedWebhookEvent {
1638
1658
  * [Chat Health guide](/guides/chats/chat-health) for what each value means and how
1639
1659
  * to react. `doc_url` deep-links to the relevant section.
1640
1660
  *
1641
- * `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
1642
- * `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
1643
- * part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
1644
- * match exactly, including case. `OPT OUT` is the exception — it matches in any
1645
- * casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
1646
- * `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
1647
- * or if they keep replying on the chatsustained two-way conversation is treated
1648
- * as a sign the stop keyword was a false positive.
1661
+ * `OPTED_OUT` — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`, `CANCEL`,
1662
+ * `END`, or `QUIT`. The keyword must be the whole trimmed message, never part of a
1663
+ * longer one: `STOP` counts, `please stop` does not. Most keywords must match
1664
+ * exactly, including case. `OPT OUT` is the exception — it matches in any casing,
1665
+ * with or without the space or a hyphen, so `opt out`, `Opt-Out` and `optout` all
1666
+ * count. It clears as soon as they reply again: any later message from them that
1667
+ * is not itself an opt-out keyword opts them back in immediately a reply in any
1668
+ * conversation with you counts, the same way the block does.
1649
1669
  *
1650
1670
  * Linq enforces this: while a recipient is opted out, every send to them is
1651
1671
  * rejected with `403` (error code `2024`) before the message is queued, across
@@ -1895,7 +1915,10 @@ export namespace ChatGroupNameUpdateFailedWebhookEvent {
1895
1915
  chat_id: string;
1896
1916
 
1897
1917
  /**
1898
- * Error codes in webhook failure events (3007, 4001, 4005).
1918
+ * Error codes in webhook failure events. The possible set varies by event:
1919
+ * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
1920
+ * update failure events (chat.group_name_update_failed,
1921
+ * chat.group_icon_update_failed) carry 3007 or 4001.
1899
1922
  */
1900
1923
  error_code: number;
1901
1924
 
@@ -1972,7 +1995,10 @@ export namespace ChatGroupIconUpdateFailedWebhookEvent {
1972
1995
  chat_id: string;
1973
1996
 
1974
1997
  /**
1975
- * Error codes in webhook failure events (3007, 4001, 4005).
1998
+ * Error codes in webhook failure events. The possible set varies by event:
1999
+ * message.failed can carry 3007, 4001, 4002, 4005, 4006, 4007, or 4008; the group
2000
+ * update failure events (chat.group_name_update_failed,
2001
+ * chat.group_icon_update_failed) carry 3007 or 4001.
1976
2002
  */
1977
2003
  error_code: number;
1978
2004
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.34.0'; // x-release-please-version
1
+ export const VERSION = '0.35.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.34.0";
1
+ export declare const VERSION = "0.35.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.34.0";
1
+ export declare const VERSION = "0.35.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.34.0'; // x-release-please-version
4
+ exports.VERSION = '0.35.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.34.0'; // x-release-please-version
1
+ export const VERSION = '0.35.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map