@linqapp/sdk 0.27.1 → 0.28.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.
- package/CHANGELOG.md +14 -0
- package/client.d.mts +59 -9
- package/client.d.mts.map +1 -1
- package/client.d.ts +59 -9
- package/client.d.ts.map +1 -1
- package/client.js +63 -5
- package/client.js.map +1 -1
- package/client.mjs +64 -6
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +0 -3
- package/internal/utils/query.d.mts.map +1 -1
- package/internal/utils/query.d.ts +0 -3
- package/internal/utils/query.d.ts.map +1 -1
- package/internal/utils/query.js +3 -16
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs +2 -16
- package/internal/utils/query.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/attachments.d.mts +1 -1
- package/resources/attachments.d.ts +1 -1
- package/resources/attachments.js +1 -1
- package/resources/attachments.mjs +1 -1
- package/resources/available-number.d.mts +58 -0
- package/resources/available-number.d.mts.map +1 -0
- package/resources/available-number.d.ts +58 -0
- package/resources/available-number.d.ts.map +1 -0
- package/resources/available-number.js +36 -0
- package/resources/available-number.js.map +1 -0
- package/resources/available-number.mjs +32 -0
- package/resources/available-number.mjs.map +1 -0
- package/resources/chats/chats.d.mts +49 -12
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +49 -12
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/location.d.mts +9 -8
- package/resources/chats/location.d.mts.map +1 -1
- package/resources/chats/location.d.ts +9 -8
- package/resources/chats/location.d.ts.map +1 -1
- package/resources/chats/location.js +9 -8
- package/resources/chats/location.js.map +1 -1
- package/resources/chats/location.mjs +9 -8
- package/resources/chats/location.mjs.map +1 -1
- package/resources/chats/messages.d.mts +71 -8
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +71 -8
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js +40 -0
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs +40 -0
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/contact-card.d.mts +1 -2
- package/resources/contact-card.d.mts.map +1 -1
- package/resources/contact-card.d.ts +1 -2
- package/resources/contact-card.d.ts.map +1 -1
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +387 -9
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +387 -9
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +148 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +148 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +107 -21
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +107 -21
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers.js +23 -0
- package/resources/phone-numbers.js.map +1 -1
- package/resources/phone-numbers.mjs +23 -0
- package/resources/phone-numbers.mjs.map +1 -1
- package/resources/webhooks.d.mts +28 -36
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +28 -36
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +94 -8
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/utils/query.ts +2 -18
- package/src/resources/attachments.ts +1 -1
- package/src/resources/available-number.ts +72 -0
- package/src/resources/chats/chats.ts +51 -13
- package/src/resources/chats/location.ts +9 -8
- package/src/resources/chats/messages.ts +71 -9
- package/src/resources/contact-card.ts +1 -2
- package/src/resources/index.ts +15 -1
- package/src/resources/messages.ts +437 -9
- package/src/resources/phone-numbers.ts +127 -21
- package/src/resources/webhooks.ts +30 -44
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { RFC1738 } from './formats';
|
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
|
3
|
+
import { isArray } from '../utils/values';
|
|
4
|
+
|
|
5
|
+
export let has = (obj: object, key: PropertyKey): boolean => (
|
|
6
|
+
(has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
|
|
7
|
+
has(obj, key)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const hex_table = /* @__PURE__ */ (() => {
|
|
11
|
+
const array = [];
|
|
12
|
+
for (let i = 0; i < 256; ++i) {
|
|
13
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return array;
|
|
17
|
+
})();
|
|
18
|
+
|
|
19
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
|
20
|
+
while (queue.length > 1) {
|
|
21
|
+
const item = queue.pop();
|
|
22
|
+
if (!item) continue;
|
|
23
|
+
|
|
24
|
+
const obj = item.obj[item.prop];
|
|
25
|
+
|
|
26
|
+
if (isArray(obj)) {
|
|
27
|
+
const compacted: unknown[] = [];
|
|
28
|
+
|
|
29
|
+
for (let j = 0; j < obj.length; ++j) {
|
|
30
|
+
if (typeof obj[j] !== 'undefined') {
|
|
31
|
+
compacted.push(obj[j]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
item.obj[item.prop] = compacted;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
|
42
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
|
43
|
+
for (let i = 0; i < source.length; ++i) {
|
|
44
|
+
if (typeof source[i] !== 'undefined') {
|
|
45
|
+
obj[i] = source[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function merge(
|
|
53
|
+
target: any,
|
|
54
|
+
source: any,
|
|
55
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
|
56
|
+
) {
|
|
57
|
+
if (!source) {
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof source !== 'object') {
|
|
62
|
+
if (isArray(target)) {
|
|
63
|
+
target.push(source);
|
|
64
|
+
} else if (target && typeof target === 'object') {
|
|
65
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
|
|
66
|
+
target[source] = true;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
return [target, source];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!target || typeof target !== 'object') {
|
|
76
|
+
return [target].concat(source);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mergeTarget = target;
|
|
80
|
+
if (isArray(target) && !isArray(source)) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
mergeTarget = array_to_object(target, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isArray(target) && isArray(source)) {
|
|
86
|
+
source.forEach(function (item, i) {
|
|
87
|
+
if (has(target, i)) {
|
|
88
|
+
const targetItem = target[i];
|
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
90
|
+
target[i] = merge(targetItem, item, options);
|
|
91
|
+
} else {
|
|
92
|
+
target.push(item);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
target[i] = item;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
102
|
+
const value = source[key];
|
|
103
|
+
|
|
104
|
+
if (has(acc, key)) {
|
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
|
106
|
+
} else {
|
|
107
|
+
acc[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return acc;
|
|
110
|
+
}, mergeTarget);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
115
|
+
acc[key] = source[key];
|
|
116
|
+
return acc;
|
|
117
|
+
}, target);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
|
122
|
+
if (charset === 'iso-8859-1') {
|
|
123
|
+
// unescape never throws, no try...catch needed:
|
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
125
|
+
}
|
|
126
|
+
// utf-8
|
|
127
|
+
try {
|
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
return strWithoutPlus;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const limit = 1024;
|
|
135
|
+
|
|
136
|
+
export const encode: (
|
|
137
|
+
str: any,
|
|
138
|
+
defaultEncoder: DefaultEncoder,
|
|
139
|
+
charset: string,
|
|
140
|
+
type: 'key' | 'value',
|
|
141
|
+
format: Format,
|
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
145
|
+
if (str.length === 0) {
|
|
146
|
+
return str;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let string = str;
|
|
150
|
+
if (typeof str === 'symbol') {
|
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
|
152
|
+
} else if (typeof str !== 'string') {
|
|
153
|
+
string = String(str);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (charset === 'iso-8859-1') {
|
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let out = '';
|
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
165
|
+
const arr = [];
|
|
166
|
+
|
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
|
168
|
+
let c = segment.charCodeAt(i);
|
|
169
|
+
if (
|
|
170
|
+
c === 0x2d || // -
|
|
171
|
+
c === 0x2e || // .
|
|
172
|
+
c === 0x5f || // _
|
|
173
|
+
c === 0x7e || // ~
|
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
178
|
+
) {
|
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (c < 0x80) {
|
|
184
|
+
arr[arr.length] = hex_table[c];
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (c < 0x800) {
|
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
194
|
+
arr[arr.length] =
|
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i += 1;
|
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
|
201
|
+
|
|
202
|
+
arr[arr.length] =
|
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
out += arr.join('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export function compact(value: any) {
|
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
|
217
|
+
const refs = [];
|
|
218
|
+
|
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
|
220
|
+
const item = queue[i];
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
const obj = item.obj[item.prop];
|
|
223
|
+
|
|
224
|
+
const keys = Object.keys(obj);
|
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
226
|
+
const key = keys[j]!;
|
|
227
|
+
const val = obj[key];
|
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
229
|
+
queue.push({ obj: obj, prop: key });
|
|
230
|
+
refs.push(val);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
compact_queue(queue);
|
|
236
|
+
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function is_regexp(obj: any) {
|
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function is_buffer(obj: any) {
|
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function combine(a: any, b: any) {
|
|
253
|
+
return [].concat(a, b);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
|
257
|
+
if (isArray(val)) {
|
|
258
|
+
const mapped = [];
|
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
|
260
|
+
mapped.push(fn(val[i]!));
|
|
261
|
+
}
|
|
262
|
+
return mapped;
|
|
263
|
+
}
|
|
264
|
+
return fn(val);
|
|
265
|
+
}
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as qs from '../qs/stringify';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
7
|
-
*/
|
|
8
5
|
export function stringifyQuery(query: object | Record<string, unknown>) {
|
|
9
|
-
return
|
|
10
|
-
.filter(([_, value]) => typeof value !== 'undefined')
|
|
11
|
-
.map(([key, value]) => {
|
|
12
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
13
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
14
|
-
}
|
|
15
|
-
if (value === null) {
|
|
16
|
-
return `${encodeURIComponent(key)}=`;
|
|
17
|
-
}
|
|
18
|
-
throw new LinqAPIV3Error(
|
|
19
|
-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
20
|
-
);
|
|
21
|
-
})
|
|
22
|
-
.join('&');
|
|
6
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
23
7
|
}
|
|
@@ -170,7 +170,7 @@ import { path } from '../internal/utils/path';
|
|
|
170
170
|
* |---|---|---|
|
|
171
171
|
* | Attachment bytes | Retained until you `DELETE` | **Auto-removed after 1 day**, also removable via `DELETE` |
|
|
172
172
|
* | Attachment metadata (id, filename, mime type, size) | Retained until you `DELETE` | Removed alongside the bytes |
|
|
173
|
-
* | Message body & parts | Retained per message-retention policy | Retained per message-retention policy |
|
|
173
|
+
* | Message body & parts | Retained per message-retention policy | Retained per message-retention policy — unless the line also has **ephemeral messages** enabled (see the Messages page), in which case the message and its parts are deleted 24 hours after creation |
|
|
174
174
|
* | Audit log of deletions | Retained per platform retention policy | Retained per platform retention policy |
|
|
175
175
|
*
|
|
176
176
|
* **In transit:** TLS 1.2+ everywhere. **At rest:** AES-256 (server-side encryption).
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { RequestOptions } from '../internal/request-options';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Phone Numbers represent the phone numbers assigned to your partner account.
|
|
9
|
+
*
|
|
10
|
+
* Use the list phone numbers endpoint to discover which phone numbers are available
|
|
11
|
+
* for sending messages.
|
|
12
|
+
*
|
|
13
|
+
* When creating chats, listing chats, or sending a voice memo, use one of your assigned phone numbers
|
|
14
|
+
* in the `from` field.
|
|
15
|
+
*/
|
|
16
|
+
export class AvailableNumber extends APIResource {
|
|
17
|
+
/**
|
|
18
|
+
* Returns the best available line (E.164) to send from, applying smart number
|
|
19
|
+
* assignment. Optionally pass `to` recipients to make the choice "sticky" —
|
|
20
|
+
* reusing the line an existing chat with those recipients is already on. Without
|
|
21
|
+
* `to`, the best healthy line is chosen.
|
|
22
|
+
*
|
|
23
|
+
* This is advisory: it does not reserve the line or change selection state. Pass
|
|
24
|
+
* the returned `phone_number` as `from` when you create the chat to guarantee the
|
|
25
|
+
* same line.
|
|
26
|
+
*
|
|
27
|
+
* Also returns `vcf_url`: a time-limited link to a vCard (`.vcf`) for the chosen
|
|
28
|
+
* line, carrying its contact card (name/photo) with the chosen number as the
|
|
29
|
+
* primary `TEL` and the partner's other healthy lines as backups. Share it with
|
|
30
|
+
* recipients so they can save the line as a contact.
|
|
31
|
+
*/
|
|
32
|
+
retrieve(
|
|
33
|
+
query: AvailableNumberRetrieveParams | null | undefined = {},
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<AvailableNumberRetrieveResponse> {
|
|
36
|
+
return this._client.get('/v3/available_number', { query, ...options });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The line smart number assignment selected, plus a shareable vCard.
|
|
42
|
+
*/
|
|
43
|
+
export interface AvailableNumberRetrieveResponse {
|
|
44
|
+
/**
|
|
45
|
+
* The selected sending line in E.164 format.
|
|
46
|
+
*/
|
|
47
|
+
phone_number: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Time-limited link to a vCard (`.vcf`) for the selected line. The card carries
|
|
51
|
+
* the line's contact details with the selected number as the primary `TEL` and the
|
|
52
|
+
* partner's other healthy lines as backups. The link expires; re-call this
|
|
53
|
+
* endpoint to mint a fresh one.
|
|
54
|
+
*/
|
|
55
|
+
vcf_url: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AvailableNumberRetrieveParams {
|
|
59
|
+
/**
|
|
60
|
+
* Recipient handles (E.164 or email) the message is destined for. When provided,
|
|
61
|
+
* an existing chat with these recipients makes the choice sticky. Repeat the
|
|
62
|
+
* parameter for multiple recipients.
|
|
63
|
+
*/
|
|
64
|
+
to?: Array<string>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export declare namespace AvailableNumber {
|
|
68
|
+
export {
|
|
69
|
+
type AvailableNumberRetrieveResponse as AvailableNumberRetrieveResponse,
|
|
70
|
+
type AvailableNumberRetrieveParams as AvailableNumberRetrieveParams,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -329,6 +329,12 @@ export interface Chat {
|
|
|
329
329
|
*/
|
|
330
330
|
updated_at: string;
|
|
331
331
|
|
|
332
|
+
/**
|
|
333
|
+
* URL of the group chat icon. Only set for group chats that have an icon; `null`
|
|
334
|
+
* otherwise.
|
|
335
|
+
*/
|
|
336
|
+
group_chat_icon?: string | null;
|
|
337
|
+
|
|
332
338
|
/**
|
|
333
339
|
* Messaging service type
|
|
334
340
|
*/
|
|
@@ -519,6 +525,17 @@ export namespace MessageContent {
|
|
|
519
525
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
520
526
|
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
521
527
|
* the card renders as an empty bubble.
|
|
528
|
+
*
|
|
529
|
+
* `image_url` displays a preview image at the top of the card. The image renders
|
|
530
|
+
* on the recipient's card whether or not they have your app installed. The small
|
|
531
|
+
* icon beside the caption is the app's own icon and is not settable here.
|
|
532
|
+
*
|
|
533
|
+
* `* Note - requires a trusted chat w/ inbound activity`
|
|
534
|
+
*
|
|
535
|
+
* `image_title` and `image_subtitle` render as text overlaid on the image (title
|
|
536
|
+
* bold, subtitle beneath it). They only appear when `image_url` is set — without
|
|
537
|
+
* an image there is nothing to overlay — so setting either without `image_url` is
|
|
538
|
+
* rejected.
|
|
522
539
|
*/
|
|
523
540
|
layout: IMessageAppPart.Layout;
|
|
524
541
|
|
|
@@ -527,12 +544,6 @@ export namespace MessageContent {
|
|
|
527
544
|
*/
|
|
528
545
|
type: 'imessage_app';
|
|
529
546
|
|
|
530
|
-
/**
|
|
531
|
-
* Absolute HTTPS URL delivered to the recipient's installed iMessage app when they
|
|
532
|
-
* tap the card. Opaque to Messages.
|
|
533
|
-
*/
|
|
534
|
-
url: string;
|
|
535
|
-
|
|
536
547
|
/**
|
|
537
548
|
* Text shown on surfaces that cannot render the card (notifications, lock screen).
|
|
538
549
|
* Defaults to the caption when omitted.
|
|
@@ -540,10 +551,21 @@ export namespace MessageContent {
|
|
|
540
551
|
fallback_text?: string;
|
|
541
552
|
|
|
542
553
|
/**
|
|
543
|
-
*
|
|
544
|
-
*
|
|
554
|
+
* Whether the card renders as your app's interactive balloon for recipients who
|
|
555
|
+
* have your iMessage app installed. `true` (default) lets your installed extension
|
|
556
|
+
* draw its live, interactive view for those recipients; everyone else sees the
|
|
557
|
+
* static card built from `layout`. `false` always shows the static `layout` card,
|
|
558
|
+
* even to recipients who have the app installed. Recipients without your app
|
|
559
|
+
* always see the static card regardless of this flag.
|
|
560
|
+
*/
|
|
561
|
+
interactive?: boolean;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* URL the recipient's app opens when they tap the card. Either an absolute
|
|
565
|
+
* `https://` URL (capped at 2048 characters) or a `data:` URL carrying inline app
|
|
566
|
+
* state, e.g. a game's encoded state (capped at 16384 characters).
|
|
545
567
|
*/
|
|
546
|
-
|
|
568
|
+
url?: string;
|
|
547
569
|
}
|
|
548
570
|
|
|
549
571
|
export namespace IMessageAppPart {
|
|
@@ -577,6 +599,17 @@ export namespace MessageContent {
|
|
|
577
599
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
578
600
|
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
579
601
|
* the card renders as an empty bubble.
|
|
602
|
+
*
|
|
603
|
+
* `image_url` displays a preview image at the top of the card. The image renders
|
|
604
|
+
* on the recipient's card whether or not they have your app installed. The small
|
|
605
|
+
* icon beside the caption is the app's own icon and is not settable here.
|
|
606
|
+
*
|
|
607
|
+
* `* Note - requires a trusted chat w/ inbound activity`
|
|
608
|
+
*
|
|
609
|
+
* `image_title` and `image_subtitle` render as text overlaid on the image (title
|
|
610
|
+
* bold, subtitle beneath it). They only appear when `image_url` is set — without
|
|
611
|
+
* an image there is nothing to overlay — so setting either without `image_url` is
|
|
612
|
+
* rejected.
|
|
580
613
|
*/
|
|
581
614
|
export interface Layout {
|
|
582
615
|
/**
|
|
@@ -585,18 +618,23 @@ export namespace MessageContent {
|
|
|
585
618
|
caption?: string;
|
|
586
619
|
|
|
587
620
|
/**
|
|
588
|
-
*
|
|
621
|
+
* Text shown below `image_title`, overlaid on the card image. Requires
|
|
622
|
+
* `image_url`.
|
|
589
623
|
*/
|
|
590
624
|
image_subtitle?: string;
|
|
591
625
|
|
|
592
626
|
/**
|
|
593
|
-
*
|
|
627
|
+
* Bold text overlaid on the card image. Requires `image_url` (rejected without
|
|
628
|
+
* it).
|
|
594
629
|
*/
|
|
595
630
|
image_title?: string;
|
|
596
631
|
|
|
597
632
|
/**
|
|
598
|
-
*
|
|
599
|
-
*
|
|
633
|
+
* URL of an image (JPEG, PNG, HEIF, or WebP) to display as the card's preview
|
|
634
|
+
* image; an unreachable or non-image URL returns a validation error. Renders for
|
|
635
|
+
* all recipients regardless of whether they have the app. Note - requires a
|
|
636
|
+
* trusted chat w/ inbound activity. In responses, this is the re-hosted
|
|
637
|
+
* `cdn.linqapp.com` copy of the image you supplied, not your original URL.
|
|
600
638
|
*/
|
|
601
639
|
image_url?: string;
|
|
602
640
|
|
|
@@ -40,16 +40,17 @@ export class Location extends APIResource {
|
|
|
40
40
|
/**
|
|
41
41
|
* Retrieve the current location for contacts sharing with you in a chat.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* The response is wrapped in the standard `{ "success": true, "data": ... }`
|
|
44
|
+
* envelope — the body is **not** a bare GeoJSON document. `data` is a
|
|
45
|
+
* [GeoJSON](https://datatracker.ietf.org/doc/html/rfc7946) `FeatureCollection`
|
|
46
|
+
* with a `Feature` for each participant actively sharing their location.
|
|
46
47
|
*
|
|
47
|
-
* Works for both 1:1 and group chats. In group chats,
|
|
48
|
-
* for each participant who is sharing. Each feature's
|
|
49
|
-
* identifies the user.
|
|
48
|
+
* Works for both 1:1 and group chats. In group chats, `data.features` contains a
|
|
49
|
+
* separate feature for each participant who is sharing. Each feature's
|
|
50
|
+
* `properties.handle` identifies the user.
|
|
50
51
|
*
|
|
51
|
-
* Returns an empty `features` array if no one is sharing or no location data
|
|
52
|
-
* available yet.
|
|
52
|
+
* Returns an empty `data.features` array if no one is sharing or no location data
|
|
53
|
+
* is available yet.
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* ```ts
|
|
@@ -33,6 +33,46 @@ import { path } from '../../internal/utils/path';
|
|
|
33
33
|
* **Limitations:**
|
|
34
34
|
* - A `link` part cannot be combined with other parts in the same message.
|
|
35
35
|
* - Maximum URL length: 2,048 characters.
|
|
36
|
+
*
|
|
37
|
+
* ## Ephemeral Messages (Privacy Tier)
|
|
38
|
+
*
|
|
39
|
+
* 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.
|
|
40
|
+
*
|
|
41
|
+
* You can request it at two scopes:
|
|
42
|
+
*
|
|
43
|
+
* | Scope | Effect |
|
|
44
|
+
* |---|---|
|
|
45
|
+
* | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
|
|
46
|
+
* | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
|
|
47
|
+
*
|
|
48
|
+
* **Behavioral differences vs the standard default:**
|
|
49
|
+
*
|
|
50
|
+
* | Aspect | Standard | Ephemeral |
|
|
51
|
+
* |---|---|---|
|
|
52
|
+
* | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
|
|
53
|
+
* | 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` |
|
|
54
|
+
* | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
|
|
55
|
+
* | Cross-partner isolation | Enforced | Enforced |
|
|
56
|
+
*
|
|
57
|
+
* **How the 24-hour window works:**
|
|
58
|
+
*
|
|
59
|
+
* - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
|
|
60
|
+
* - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
|
|
61
|
+
* - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
|
|
62
|
+
*
|
|
63
|
+
* **What you observe:**
|
|
64
|
+
*
|
|
65
|
+
* - **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.
|
|
66
|
+
* - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
|
|
67
|
+
* - **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.
|
|
68
|
+
*
|
|
69
|
+
* **When to choose ephemeral:**
|
|
70
|
+
*
|
|
71
|
+
* - You have a compliance requirement that the platform must not retain message content beyond a short window.
|
|
72
|
+
* - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
|
|
73
|
+
* - 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.
|
|
74
|
+
*
|
|
75
|
+
* **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.
|
|
36
76
|
*/
|
|
37
77
|
export class Messages extends APIResource {
|
|
38
78
|
/**
|
|
@@ -206,6 +246,17 @@ export namespace SentMessage {
|
|
|
206
246
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
207
247
|
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
208
248
|
* the card renders as an empty bubble.
|
|
249
|
+
*
|
|
250
|
+
* `image_url` displays a preview image at the top of the card. The image renders
|
|
251
|
+
* on the recipient's card whether or not they have your app installed. The small
|
|
252
|
+
* icon beside the caption is the app's own icon and is not settable here.
|
|
253
|
+
*
|
|
254
|
+
* `* Note - requires a trusted chat w/ inbound activity`
|
|
255
|
+
*
|
|
256
|
+
* `image_title` and `image_subtitle` render as text overlaid on the image (title
|
|
257
|
+
* bold, subtitle beneath it). They only appear when `image_url` is set — without
|
|
258
|
+
* an image there is nothing to overlay — so setting either without `image_url` is
|
|
259
|
+
* rejected.
|
|
209
260
|
*/
|
|
210
261
|
layout: IMessageAppPartResponse.Layout;
|
|
211
262
|
|
|
@@ -228,11 +279,6 @@ export namespace SentMessage {
|
|
|
228
279
|
* Fallback text for surfaces that cannot render the card.
|
|
229
280
|
*/
|
|
230
281
|
fallback_text?: string | null;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Client-supplied session identifier, echoed back when provided.
|
|
234
|
-
*/
|
|
235
|
-
session_id?: string | null;
|
|
236
282
|
}
|
|
237
283
|
|
|
238
284
|
export namespace IMessageAppPartResponse {
|
|
@@ -266,6 +312,17 @@ export namespace SentMessage {
|
|
|
266
312
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
267
313
|
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
268
314
|
* the card renders as an empty bubble.
|
|
315
|
+
*
|
|
316
|
+
* `image_url` displays a preview image at the top of the card. The image renders
|
|
317
|
+
* on the recipient's card whether or not they have your app installed. The small
|
|
318
|
+
* icon beside the caption is the app's own icon and is not settable here.
|
|
319
|
+
*
|
|
320
|
+
* `* Note - requires a trusted chat w/ inbound activity`
|
|
321
|
+
*
|
|
322
|
+
* `image_title` and `image_subtitle` render as text overlaid on the image (title
|
|
323
|
+
* bold, subtitle beneath it). They only appear when `image_url` is set — without
|
|
324
|
+
* an image there is nothing to overlay — so setting either without `image_url` is
|
|
325
|
+
* rejected.
|
|
269
326
|
*/
|
|
270
327
|
export interface Layout {
|
|
271
328
|
/**
|
|
@@ -274,18 +331,23 @@ export namespace SentMessage {
|
|
|
274
331
|
caption?: string;
|
|
275
332
|
|
|
276
333
|
/**
|
|
277
|
-
*
|
|
334
|
+
* Text shown below `image_title`, overlaid on the card image. Requires
|
|
335
|
+
* `image_url`.
|
|
278
336
|
*/
|
|
279
337
|
image_subtitle?: string;
|
|
280
338
|
|
|
281
339
|
/**
|
|
282
|
-
*
|
|
340
|
+
* Bold text overlaid on the card image. Requires `image_url` (rejected without
|
|
341
|
+
* it).
|
|
283
342
|
*/
|
|
284
343
|
image_title?: string;
|
|
285
344
|
|
|
286
345
|
/**
|
|
287
|
-
*
|
|
288
|
-
*
|
|
346
|
+
* URL of an image (JPEG, PNG, HEIF, or WebP) to display as the card's preview
|
|
347
|
+
* image; an unreachable or non-image URL returns a validation error. Renders for
|
|
348
|
+
* all recipients regardless of whether they have the app. Note - requires a
|
|
349
|
+
* trusted chat w/ inbound activity. In responses, this is the re-hosted
|
|
350
|
+
* `cdn.linqapp.com` copy of the image you supplied, not your original URL.
|
|
289
351
|
*/
|
|
290
352
|
image_url?: string;
|
|
291
353
|
|
|
@@ -147,8 +147,7 @@ export interface ContactCardCreateParams {
|
|
|
147
147
|
phone_number: string;
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
151
|
-
* is provided.
|
|
150
|
+
* Profile image URL for the contact card.
|
|
152
151
|
*/
|
|
153
152
|
image_url?: string;
|
|
154
153
|
|
package/src/resources/index.ts
CHANGED
|
@@ -8,6 +8,11 @@ export {
|
|
|
8
8
|
type AttachmentRetrieveResponse,
|
|
9
9
|
type AttachmentCreateParams,
|
|
10
10
|
} from './attachments';
|
|
11
|
+
export {
|
|
12
|
+
AvailableNumber,
|
|
13
|
+
type AvailableNumberRetrieveResponse,
|
|
14
|
+
type AvailableNumberRetrieveParams,
|
|
15
|
+
} from './available-number';
|
|
11
16
|
export {
|
|
12
17
|
Capability,
|
|
13
18
|
type HandleCheck,
|
|
@@ -45,13 +50,22 @@ export {
|
|
|
45
50
|
type Message,
|
|
46
51
|
type MessageEffect,
|
|
47
52
|
type ReplyTo,
|
|
53
|
+
type MessageCreateResponse,
|
|
48
54
|
type MessageAddReactionResponse,
|
|
55
|
+
type MessageUpdateAppCardResponse,
|
|
56
|
+
type MessageCreateParams,
|
|
49
57
|
type MessageListMessagesThreadParams,
|
|
50
58
|
type MessageAddReactionParams,
|
|
51
59
|
type MessageUpdateParams,
|
|
60
|
+
type MessageUpdateAppCardParams,
|
|
52
61
|
type MessagesListMessagesPagination,
|
|
53
62
|
} from './messages';
|
|
54
|
-
export {
|
|
63
|
+
export {
|
|
64
|
+
PhoneNumbers,
|
|
65
|
+
type PhoneNumberUpdateResponse,
|
|
66
|
+
type PhoneNumberListResponse,
|
|
67
|
+
type PhoneNumberUpdateParams,
|
|
68
|
+
} from './phone-numbers';
|
|
55
69
|
export { Phonenumbers, type PhonenumberListResponse } from './phonenumbers';
|
|
56
70
|
export { WebhookEvents, type WebhookEventType, type WebhookEventListResponse } from './webhook-events';
|
|
57
71
|
export {
|