@linqapp/sdk 0.1.5 → 0.4.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.
- package/CHANGELOG.md +36 -0
- package/README.md +31 -0
- package/client.d.mts +299 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +299 -7
- package/client.d.ts.map +1 -1
- package/client.js +294 -12
- package/client.js.map +1 -1
- package/client.mjs +294 -12
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +69 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +69 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +125 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +118 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/tslib.js +18 -18
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/attachments.d.mts +64 -0
- package/resources/attachments.d.mts.map +1 -1
- package/resources/attachments.d.ts +64 -0
- package/resources/attachments.d.ts.map +1 -1
- package/resources/attachments.js +64 -0
- package/resources/attachments.js.map +1 -1
- package/resources/attachments.mjs +64 -0
- package/resources/attachments.mjs.map +1 -1
- package/resources/capability.d.mts +12 -9
- package/resources/capability.d.mts.map +1 -1
- package/resources/capability.d.ts +12 -9
- package/resources/capability.d.ts.map +1 -1
- package/resources/capability.js +7 -4
- package/resources/capability.js.map +1 -1
- package/resources/capability.mjs +7 -4
- package/resources/capability.mjs.map +1 -1
- package/resources/chats/chats.d.mts +76 -97
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +76 -97
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js +8 -4
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs +9 -5
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/index.d.mts +2 -2
- package/resources/chats/index.d.mts.map +1 -1
- package/resources/chats/index.d.ts +2 -2
- package/resources/chats/index.d.ts.map +1 -1
- package/resources/chats/index.js.map +1 -1
- package/resources/chats/index.mjs.map +1 -1
- package/resources/chats/messages.d.mts +21 -25
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +21 -25
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js +16 -3
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs +16 -3
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/chats/participants.d.mts +18 -0
- package/resources/chats/participants.d.mts.map +1 -1
- package/resources/chats/participants.d.ts +18 -0
- package/resources/chats/participants.d.ts.map +1 -1
- package/resources/chats/participants.js +18 -0
- package/resources/chats/participants.js.map +1 -1
- package/resources/chats/participants.mjs +18 -0
- package/resources/chats/participants.mjs.map +1 -1
- package/resources/chats/typing.d.mts +18 -0
- package/resources/chats/typing.d.mts.map +1 -1
- package/resources/chats/typing.d.ts +18 -0
- package/resources/chats/typing.d.ts.map +1 -1
- package/resources/chats/typing.js +18 -0
- package/resources/chats/typing.js.map +1 -1
- package/resources/chats/typing.mjs +18 -0
- package/resources/chats/typing.mjs.map +1 -1
- package/resources/index.d.mts +4 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- 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 +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +37 -72
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +37 -72
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +34 -4
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +34 -4
- package/resources/messages.mjs.map +1 -1
- package/resources/phone-numbers.d.mts +9 -0
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +9 -0
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/phone-numbers.js +9 -0
- package/resources/phone-numbers.js.map +1 -1
- package/resources/phone-numbers.mjs +9 -0
- package/resources/phone-numbers.mjs.map +1 -1
- package/resources/phonenumbers.d.mts +9 -0
- package/resources/phonenumbers.d.mts.map +1 -1
- package/resources/phonenumbers.d.ts +9 -0
- package/resources/phonenumbers.d.ts.map +1 -1
- package/resources/phonenumbers.js +9 -0
- package/resources/phonenumbers.js.map +1 -1
- package/resources/phonenumbers.mjs +9 -0
- package/resources/phonenumbers.mjs.map +1 -1
- package/resources/shared.d.mts +51 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +51 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/webhook-events.d.mts +90 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +90 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/resources/webhook-events.js +89 -0
- package/resources/webhook-events.js.map +1 -1
- package/resources/webhook-events.mjs +89 -0
- package/resources/webhook-events.mjs.map +1 -1
- package/resources/webhook-subscriptions.d.mts +89 -0
- package/resources/webhook-subscriptions.d.mts.map +1 -1
- package/resources/webhook-subscriptions.d.ts +89 -0
- package/resources/webhook-subscriptions.d.ts.map +1 -1
- package/resources/webhook-subscriptions.js +89 -0
- package/resources/webhook-subscriptions.js.map +1 -1
- package/resources/webhook-subscriptions.mjs +89 -0
- package/resources/webhook-subscriptions.mjs.map +1 -1
- package/resources/webhooks.d.mts +2506 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +2506 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +12 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +8 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/client.ts +443 -37
- package/src/core/pagination.ts +212 -0
- package/src/index.ts +1 -0
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/attachments.ts +64 -0
- package/src/resources/capability.ts +17 -14
- package/src/resources/chats/chats.ts +86 -115
- package/src/resources/chats/index.ts +4 -3
- package/src/resources/chats/messages.ts +30 -30
- package/src/resources/chats/participants.ts +18 -0
- package/src/resources/chats/typing.ts +18 -0
- package/src/resources/index.ts +55 -10
- package/src/resources/messages.ts +49 -90
- package/src/resources/phone-numbers.ts +9 -0
- package/src/resources/phonenumbers.ts +9 -0
- package/src/resources/shared.ts +62 -0
- package/src/resources/webhook-events.ts +90 -0
- package/src/resources/webhook-subscriptions.ts +89 -0
- package/src/resources/webhooks.ts +3089 -0
- 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,212 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { LinqAPIV3Error } from './error';
|
|
4
|
+
import { FinalRequestOptions } from '../internal/request-options';
|
|
5
|
+
import { defaultParseResponse } from '../internal/parse';
|
|
6
|
+
import { type LinqAPIV3 } from '../client';
|
|
7
|
+
import { APIPromise } from './api-promise';
|
|
8
|
+
import { type APIResponseProps } from '../internal/parse';
|
|
9
|
+
import { maybeObj } from '../internal/utils/values';
|
|
10
|
+
|
|
11
|
+
export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
|
|
12
|
+
|
|
13
|
+
export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
14
|
+
#client: LinqAPIV3;
|
|
15
|
+
protected options: FinalRequestOptions;
|
|
16
|
+
|
|
17
|
+
protected response: Response;
|
|
18
|
+
protected body: unknown;
|
|
19
|
+
|
|
20
|
+
constructor(client: LinqAPIV3, response: Response, body: unknown, options: FinalRequestOptions) {
|
|
21
|
+
this.#client = client;
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.response = response;
|
|
24
|
+
this.body = body;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
abstract nextPageRequestOptions(): PageRequestOptions | null;
|
|
28
|
+
|
|
29
|
+
abstract getPaginatedItems(): Item[];
|
|
30
|
+
|
|
31
|
+
hasNextPage(): boolean {
|
|
32
|
+
const items = this.getPaginatedItems();
|
|
33
|
+
if (!items.length) return false;
|
|
34
|
+
return this.nextPageRequestOptions() != null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async getNextPage(): Promise<this> {
|
|
38
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
39
|
+
if (!nextOptions) {
|
|
40
|
+
throw new LinqAPIV3Error(
|
|
41
|
+
'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return await this.#client.requestAPIList(this.constructor as any, nextOptions);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async *iterPages(): AsyncGenerator<this> {
|
|
49
|
+
let page: this = this;
|
|
50
|
+
yield page;
|
|
51
|
+
while (page.hasNextPage()) {
|
|
52
|
+
page = await page.getNextPage();
|
|
53
|
+
yield page;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
58
|
+
for await (const page of this.iterPages()) {
|
|
59
|
+
for (const item of page.getPaginatedItems()) {
|
|
60
|
+
yield item;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
68
|
+
*
|
|
69
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
70
|
+
*
|
|
71
|
+
* for await (const item of client.items.list()) {
|
|
72
|
+
* console.log(item)
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
export class PagePromise<
|
|
76
|
+
PageClass extends AbstractPage<Item>,
|
|
77
|
+
Item = ReturnType<PageClass['getPaginatedItems']>[number],
|
|
78
|
+
>
|
|
79
|
+
extends APIPromise<PageClass>
|
|
80
|
+
implements AsyncIterable<Item>
|
|
81
|
+
{
|
|
82
|
+
constructor(
|
|
83
|
+
client: LinqAPIV3,
|
|
84
|
+
request: Promise<APIResponseProps>,
|
|
85
|
+
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
|
86
|
+
) {
|
|
87
|
+
super(
|
|
88
|
+
client,
|
|
89
|
+
request,
|
|
90
|
+
async (client, props) =>
|
|
91
|
+
new Page(client, props.response, await defaultParseResponse(client, props), props.options),
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
97
|
+
*
|
|
98
|
+
* for await (const item of client.items.list()) {
|
|
99
|
+
* console.log(item)
|
|
100
|
+
* }
|
|
101
|
+
*/
|
|
102
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
103
|
+
const page = await this;
|
|
104
|
+
for await (const item of page) {
|
|
105
|
+
yield item;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ListChatsPaginationResponse<Item> {
|
|
111
|
+
chats: Array<Item>;
|
|
112
|
+
|
|
113
|
+
next_cursor: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ListChatsPaginationParams {
|
|
117
|
+
cursor?: string;
|
|
118
|
+
|
|
119
|
+
limit?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export class ListChatsPagination<Item>
|
|
123
|
+
extends AbstractPage<Item>
|
|
124
|
+
implements ListChatsPaginationResponse<Item>
|
|
125
|
+
{
|
|
126
|
+
chats: Array<Item>;
|
|
127
|
+
|
|
128
|
+
next_cursor: string;
|
|
129
|
+
|
|
130
|
+
constructor(
|
|
131
|
+
client: LinqAPIV3,
|
|
132
|
+
response: Response,
|
|
133
|
+
body: ListChatsPaginationResponse<Item>,
|
|
134
|
+
options: FinalRequestOptions,
|
|
135
|
+
) {
|
|
136
|
+
super(client, response, body, options);
|
|
137
|
+
|
|
138
|
+
this.chats = body.chats || [];
|
|
139
|
+
this.next_cursor = body.next_cursor || '';
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
getPaginatedItems(): Item[] {
|
|
143
|
+
return this.chats ?? [];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
nextPageRequestOptions(): PageRequestOptions | null {
|
|
147
|
+
const cursor = this.next_cursor;
|
|
148
|
+
if (!cursor) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
...this.options,
|
|
154
|
+
query: {
|
|
155
|
+
...maybeObj(this.options.query),
|
|
156
|
+
cursor,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface ListMessagesPaginationResponse<Item> {
|
|
163
|
+
messages: Array<Item>;
|
|
164
|
+
|
|
165
|
+
next_cursor: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ListMessagesPaginationParams {
|
|
169
|
+
cursor?: string;
|
|
170
|
+
|
|
171
|
+
limit?: number;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class ListMessagesPagination<Item>
|
|
175
|
+
extends AbstractPage<Item>
|
|
176
|
+
implements ListMessagesPaginationResponse<Item>
|
|
177
|
+
{
|
|
178
|
+
messages: Array<Item>;
|
|
179
|
+
|
|
180
|
+
next_cursor: string;
|
|
181
|
+
|
|
182
|
+
constructor(
|
|
183
|
+
client: LinqAPIV3,
|
|
184
|
+
response: Response,
|
|
185
|
+
body: ListMessagesPaginationResponse<Item>,
|
|
186
|
+
options: FinalRequestOptions,
|
|
187
|
+
) {
|
|
188
|
+
super(client, response, body, options);
|
|
189
|
+
|
|
190
|
+
this.messages = body.messages || [];
|
|
191
|
+
this.next_cursor = body.next_cursor || '';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
getPaginatedItems(): Item[] {
|
|
195
|
+
return this.messages ?? [];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
nextPageRequestOptions(): PageRequestOptions | null {
|
|
199
|
+
const cursor = this.next_cursor;
|
|
200
|
+
if (!cursor) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return {
|
|
205
|
+
...this.options,
|
|
206
|
+
query: {
|
|
207
|
+
...maybeObj(this.options.query),
|
|
208
|
+
cursor,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { LinqAPIV3 as default } from './client';
|
|
|
5
5
|
export { type Uploadable, toFile } from './core/uploads';
|
|
6
6
|
export { APIPromise } from './core/api-promise';
|
|
7
7
|
export { LinqAPIV3, type ClientOptions } from './client';
|
|
8
|
+
export { PagePromise } from './core/pagination';
|
|
8
9
|
export {
|
|
9
10
|
LinqAPIV3Error,
|
|
10
11
|
APIError,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { LinqAPIV3Error } from '../../core/error';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
7
|
+
*/
|
|
8
|
+
export function stringifyQuery(query: object | Record<string, unknown>) {
|
|
9
|
+
return Object.entries(query)
|
|
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('&');
|
|
23
|
+
}
|
package/src/internal/utils.ts
CHANGED
|
@@ -5,6 +5,70 @@ import { APIPromise } from '../core/api-promise';
|
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
import { path } from '../internal/utils/path';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Send files (images, videos, documents, audio) with messages by providing a URL in a media part.
|
|
10
|
+
* Pre-uploading via `POST /v3/attachments` is **optional** and only needed for specific optimization scenarios.
|
|
11
|
+
*
|
|
12
|
+
* ## Sending Media via URL (up to 10MB)
|
|
13
|
+
*
|
|
14
|
+
* Provide a publicly accessible HTTPS URL with a [supported media type](#supported-file-types) in the `url` field of a media part.
|
|
15
|
+
*
|
|
16
|
+
* ```json
|
|
17
|
+
* {
|
|
18
|
+
* "parts": [
|
|
19
|
+
* { "type": "media", "url": "https://your-cdn.com/images/photo.jpg" }
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* This works with any URL you already host — no pre-upload step required. **Maximum file size: 10MB.**
|
|
25
|
+
*
|
|
26
|
+
* ## Pre-Upload (required for files over 10MB)
|
|
27
|
+
*
|
|
28
|
+
* Use `POST /v3/attachments` when you want to:
|
|
29
|
+
* - **Send files larger than 10MB** (up to 100MB) — URL-based downloads are limited to 10MB
|
|
30
|
+
* - **Send the same file to many recipients** — upload once, reuse the `attachment_id` without re-downloading each time
|
|
31
|
+
* - **Reduce message send latency** — the file is already stored, so sending is faster
|
|
32
|
+
*
|
|
33
|
+
* **How it works:**
|
|
34
|
+
* 1. `POST /v3/attachments` with file metadata → returns a presigned `upload_url` (valid for **15 minutes**) and a permanent `attachment_id`
|
|
35
|
+
* 2. PUT the raw file bytes to the `upload_url` with the `required_headers` (no JSON or multipart — just the binary content)
|
|
36
|
+
* 3. Reference the `attachment_id` in your media part when sending messages (no expiration)
|
|
37
|
+
*
|
|
38
|
+
* **Key difference:** When you provide an external `url`, we download and process the file on every send.
|
|
39
|
+
* When you use a pre-uploaded `attachment_id`, the file is already stored — so repeated sends skip the download step entirely.
|
|
40
|
+
*
|
|
41
|
+
* ## Domain Allowlisting
|
|
42
|
+
*
|
|
43
|
+
* Attachment URLs in API responses are served from `cdn.linqapp.com`. This includes:
|
|
44
|
+
* - `url` fields in media and voice memo message parts
|
|
45
|
+
* - `download_url` fields in attachment and upload response objects
|
|
46
|
+
*
|
|
47
|
+
* If your application enforces domain allowlists (e.g., for SSRF protection), add:
|
|
48
|
+
*
|
|
49
|
+
* ```
|
|
50
|
+
* cdn.linqapp.com
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ## Supported File Types
|
|
54
|
+
*
|
|
55
|
+
* - **Images:** JPEG, PNG, GIF, HEIC, HEIF, TIFF, BMP
|
|
56
|
+
* - **Videos:** MP4, MOV, M4V
|
|
57
|
+
* - **Audio:** M4A, AAC, MP3, WAV, AIFF, CAF, AMR
|
|
58
|
+
* - **Documents:** PDF, TXT, RTF, CSV, Office formats, ZIP
|
|
59
|
+
* - **Contact & Calendar:** VCF, ICS
|
|
60
|
+
*
|
|
61
|
+
* ## Audio: Attachment vs Voice Memo
|
|
62
|
+
*
|
|
63
|
+
* Audio files sent as media parts appear as **downloadable file attachments** in iMessage.
|
|
64
|
+
* To send audio as an **iMessage voice memo bubble** (with native inline playback UI),
|
|
65
|
+
* use the dedicated `POST /v3/chats/{chatId}/voicememo` endpoint instead.
|
|
66
|
+
*
|
|
67
|
+
* ## File Size Limits
|
|
68
|
+
*
|
|
69
|
+
* - **URL-based (`url` field):** 10MB maximum
|
|
70
|
+
* - **Pre-upload (`attachment_id`):** 100MB maximum
|
|
71
|
+
*/
|
|
8
72
|
export class Attachments extends APIResource {
|
|
9
73
|
/**
|
|
10
74
|
* **This endpoint is optional.** You can send media by simply providing a URL in
|
|
@@ -4,6 +4,9 @@ import { APIResource } from '../core/resource';
|
|
|
4
4
|
import { APIPromise } from '../core/api-promise';
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a recipient address supports iMessage or RCS before sending a message.
|
|
9
|
+
*/
|
|
7
10
|
export class Capability extends APIResource {
|
|
8
11
|
/**
|
|
9
12
|
* Check whether a recipient address (phone number or email) is reachable via
|
|
@@ -11,15 +14,15 @@ export class Capability extends APIResource {
|
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```ts
|
|
14
|
-
* const response = await client.capability.
|
|
17
|
+
* const response = await client.capability.checkiMessage({
|
|
15
18
|
* address: '+15551234567',
|
|
16
19
|
* });
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
19
|
-
|
|
20
|
-
body:
|
|
22
|
+
checkiMessage(
|
|
23
|
+
body: CapabilityCheckiMessageParams,
|
|
21
24
|
options?: RequestOptions,
|
|
22
|
-
): APIPromise<
|
|
25
|
+
): APIPromise<CapabilityCheckiMessageResponse> {
|
|
23
26
|
return this._client.post('/v3/capability/check_imessage', { body, ...options });
|
|
24
27
|
}
|
|
25
28
|
|
|
@@ -28,17 +31,17 @@ export class Capability extends APIResource {
|
|
|
28
31
|
*
|
|
29
32
|
* @example
|
|
30
33
|
* ```ts
|
|
31
|
-
* const response = await client.capability.
|
|
34
|
+
* const response = await client.capability.checkRCS({
|
|
32
35
|
* address: '+15551234567',
|
|
33
36
|
* });
|
|
34
37
|
* ```
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
checkRCS(body: CapabilityCheckRCSParams, options?: RequestOptions): APIPromise<CapabilityCheckRCSResponse> {
|
|
37
40
|
return this._client.post('/v3/capability/check_rcs', { body, ...options });
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
export interface
|
|
44
|
+
export interface CapabilityCheckiMessageResponse {
|
|
42
45
|
/**
|
|
43
46
|
* The recipient address that was checked
|
|
44
47
|
*/
|
|
@@ -50,7 +53,7 @@ export interface CapabilityCheckImessageResponse {
|
|
|
50
53
|
available: boolean;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
export interface
|
|
56
|
+
export interface CapabilityCheckRCSResponse {
|
|
54
57
|
/**
|
|
55
58
|
* The recipient address that was checked
|
|
56
59
|
*/
|
|
@@ -62,7 +65,7 @@ export interface CapabilityCheckRcsResponse {
|
|
|
62
65
|
available: boolean;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
export interface
|
|
68
|
+
export interface CapabilityCheckiMessageParams {
|
|
66
69
|
/**
|
|
67
70
|
* The recipient phone number or email address to check
|
|
68
71
|
*/
|
|
@@ -75,7 +78,7 @@ export interface CapabilityCheckImessageParams {
|
|
|
75
78
|
from?: string;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
export interface
|
|
81
|
+
export interface CapabilityCheckRCSParams {
|
|
79
82
|
/**
|
|
80
83
|
* The recipient phone number or email address to check
|
|
81
84
|
*/
|
|
@@ -90,9 +93,9 @@ export interface CapabilityCheckRcsParams {
|
|
|
90
93
|
|
|
91
94
|
export declare namespace Capability {
|
|
92
95
|
export {
|
|
93
|
-
type
|
|
94
|
-
type
|
|
95
|
-
type
|
|
96
|
-
type
|
|
96
|
+
type CapabilityCheckiMessageResponse as CapabilityCheckiMessageResponse,
|
|
97
|
+
type CapabilityCheckRCSResponse as CapabilityCheckRCSResponse,
|
|
98
|
+
type CapabilityCheckiMessageParams as CapabilityCheckiMessageParams,
|
|
99
|
+
type CapabilityCheckRCSParams as CapabilityCheckRCSParams,
|
|
97
100
|
};
|
|
98
101
|
}
|