@linqapp/sdk 0.28.0 → 0.28.2
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 +59 -11
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +59 -11
- 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 +84 -6
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +84 -6
- 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 +400 -7
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +400 -7
- 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 +68 -23
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +68 -23
- 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 +14 -14
- package/resources/webhooks.d.ts +14 -14
- 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 +64 -12
- package/src/resources/chats/location.ts +9 -8
- package/src/resources/chats/messages.ts +87 -6
- package/src/resources/contact-card.ts +1 -2
- package/src/resources/index.ts +15 -1
- package/src/resources/messages.ts +453 -6
- package/src/resources/phone-numbers.ts +85 -23
- package/src/resources/webhooks.ts +14 -14
- 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,71 @@
|
|
|
1
|
+
export type Format = 'RFC1738' | 'RFC3986';
|
|
2
|
+
|
|
3
|
+
export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
|
|
4
|
+
export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string;
|
|
5
|
+
|
|
6
|
+
export type BooleanOptional = boolean | undefined;
|
|
7
|
+
|
|
8
|
+
export type StringifyBaseOptions = {
|
|
9
|
+
delimiter?: string;
|
|
10
|
+
allowDots?: boolean;
|
|
11
|
+
encodeDotInKeys?: boolean;
|
|
12
|
+
strictNullHandling?: boolean;
|
|
13
|
+
skipNulls?: boolean;
|
|
14
|
+
encode?: boolean;
|
|
15
|
+
encoder?: (
|
|
16
|
+
str: any,
|
|
17
|
+
defaultEncoder: DefaultEncoder,
|
|
18
|
+
charset: string,
|
|
19
|
+
type: 'key' | 'value',
|
|
20
|
+
format?: Format,
|
|
21
|
+
) => string;
|
|
22
|
+
filter?: Array<PropertyKey> | ((prefix: PropertyKey, value: any) => any);
|
|
23
|
+
arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
|
|
24
|
+
indices?: boolean;
|
|
25
|
+
sort?: ((a: PropertyKey, b: PropertyKey) => number) | null;
|
|
26
|
+
serializeDate?: (d: Date) => string;
|
|
27
|
+
format?: 'RFC1738' | 'RFC3986';
|
|
28
|
+
formatter?: (str: PropertyKey) => string;
|
|
29
|
+
encodeValuesOnly?: boolean;
|
|
30
|
+
addQueryPrefix?: boolean;
|
|
31
|
+
charset?: 'utf-8' | 'iso-8859-1';
|
|
32
|
+
charsetSentinel?: boolean;
|
|
33
|
+
allowEmptyArrays?: boolean;
|
|
34
|
+
commaRoundTrip?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type StringifyOptions = StringifyBaseOptions;
|
|
38
|
+
|
|
39
|
+
export type ParseBaseOptions = {
|
|
40
|
+
comma?: boolean;
|
|
41
|
+
delimiter?: string | RegExp;
|
|
42
|
+
depth?: number | false;
|
|
43
|
+
decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any;
|
|
44
|
+
arrayLimit?: number;
|
|
45
|
+
parseArrays?: boolean;
|
|
46
|
+
plainObjects?: boolean;
|
|
47
|
+
allowPrototypes?: boolean;
|
|
48
|
+
allowSparse?: boolean;
|
|
49
|
+
parameterLimit?: number;
|
|
50
|
+
strictDepth?: boolean;
|
|
51
|
+
strictNullHandling?: boolean;
|
|
52
|
+
ignoreQueryPrefix?: boolean;
|
|
53
|
+
charset?: 'utf-8' | 'iso-8859-1';
|
|
54
|
+
charsetSentinel?: boolean;
|
|
55
|
+
interpretNumericEntities?: boolean;
|
|
56
|
+
allowEmptyArrays?: boolean;
|
|
57
|
+
duplicates?: 'combine' | 'first' | 'last';
|
|
58
|
+
allowDots?: boolean;
|
|
59
|
+
decodeDotInKeys?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type ParseOptions = ParseBaseOptions;
|
|
63
|
+
|
|
64
|
+
export type ParsedQs = {
|
|
65
|
+
[key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Type to remove null or undefined union from each property
|
|
69
|
+
export type NonNullableProperties<T> = {
|
|
70
|
+
[K in keyof T]-?: Exclude<T[K], undefined | null>;
|
|
71
|
+
};
|
|
@@ -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
|
+
}
|
|
@@ -523,9 +523,19 @@ export namespace MessageContent {
|
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
526
|
-
* `trailing_caption`, or `
|
|
527
|
-
* renders as an empty bubble.
|
|
528
|
-
*
|
|
526
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
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.
|
|
529
539
|
*/
|
|
530
540
|
layout: IMessageAppPart.Layout;
|
|
531
541
|
|
|
@@ -534,17 +544,28 @@ export namespace MessageContent {
|
|
|
534
544
|
*/
|
|
535
545
|
type: 'imessage_app';
|
|
536
546
|
|
|
537
|
-
/**
|
|
538
|
-
* Absolute HTTPS URL delivered to the recipient's installed iMessage app when they
|
|
539
|
-
* tap the card. Opaque to Messages.
|
|
540
|
-
*/
|
|
541
|
-
url: string;
|
|
542
|
-
|
|
543
547
|
/**
|
|
544
548
|
* Text shown on surfaces that cannot render the card (notifications, lock screen).
|
|
545
549
|
* Defaults to the caption when omitted.
|
|
546
550
|
*/
|
|
547
551
|
fallback_text?: string;
|
|
552
|
+
|
|
553
|
+
/**
|
|
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).
|
|
567
|
+
*/
|
|
568
|
+
url?: string;
|
|
548
569
|
}
|
|
549
570
|
|
|
550
571
|
export namespace IMessageAppPart {
|
|
@@ -576,9 +597,19 @@ export namespace MessageContent {
|
|
|
576
597
|
|
|
577
598
|
/**
|
|
578
599
|
* Visible layout of the card. At least one of `caption`, `subcaption`,
|
|
579
|
-
* `trailing_caption`, or `
|
|
580
|
-
* renders as an empty bubble.
|
|
581
|
-
*
|
|
600
|
+
* `trailing_caption`, `trailing_subcaption`, or `image_url` must be set, otherwise
|
|
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.
|
|
582
613
|
*/
|
|
583
614
|
export interface Layout {
|
|
584
615
|
/**
|
|
@@ -586,6 +617,27 @@ export namespace MessageContent {
|
|
|
586
617
|
*/
|
|
587
618
|
caption?: string;
|
|
588
619
|
|
|
620
|
+
/**
|
|
621
|
+
* Text shown below `image_title`, overlaid on the card image. Requires
|
|
622
|
+
* `image_url`.
|
|
623
|
+
*/
|
|
624
|
+
image_subtitle?: string;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Bold text overlaid on the card image. Requires `image_url` (rejected without
|
|
628
|
+
* it).
|
|
629
|
+
*/
|
|
630
|
+
image_title?: string;
|
|
631
|
+
|
|
632
|
+
/**
|
|
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.
|
|
638
|
+
*/
|
|
639
|
+
image_url?: string;
|
|
640
|
+
|
|
589
641
|
/**
|
|
590
642
|
* Secondary label, below `caption` on the left.
|
|
591
643
|
*/
|
|
@@ -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
|