crossbar-client 1.0.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/LICENSE +15 -0
- package/README.md +136 -0
- package/dist/index.cjs +841 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +959 -0
- package/dist/index.d.ts +959 -0
- package/dist/index.js +796 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,959 @@
|
|
|
1
|
+
interface CredentialsAuth {
|
|
2
|
+
type: "credentials";
|
|
3
|
+
credentials: string;
|
|
4
|
+
accountName?: string;
|
|
5
|
+
accountId?: string;
|
|
6
|
+
}
|
|
7
|
+
interface ApiKeyAuth {
|
|
8
|
+
type: "api_key";
|
|
9
|
+
apiKey: string;
|
|
10
|
+
}
|
|
11
|
+
interface TokenAuth {
|
|
12
|
+
type: "token";
|
|
13
|
+
token: string;
|
|
14
|
+
}
|
|
15
|
+
type AuthConfig = CredentialsAuth | ApiKeyAuth | TokenAuth;
|
|
16
|
+
interface RetryConfig {
|
|
17
|
+
/** Number of times to retry on 5xx server errors. Default: 1 */
|
|
18
|
+
maxRetries?: number;
|
|
19
|
+
/** Re-authenticate and retry once on 401 Unauthorized. Requires credentials or api_key auth. Default: true */
|
|
20
|
+
reAuthOn401?: boolean;
|
|
21
|
+
/** Delay in ms between retries. Default: 0 */
|
|
22
|
+
retryDelay?: number;
|
|
23
|
+
}
|
|
24
|
+
interface CrossbarConfig {
|
|
25
|
+
url: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
headers?: Record<string, string>;
|
|
28
|
+
auth?: AuthConfig;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
retry?: RetryConfig;
|
|
31
|
+
}
|
|
32
|
+
interface RequestOptions {
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
35
|
+
timeout?: number;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
38
|
+
interface CrossbarResponse<T = unknown> {
|
|
39
|
+
data: T;
|
|
40
|
+
auth_token?: string;
|
|
41
|
+
status: string;
|
|
42
|
+
request_id: string;
|
|
43
|
+
page_size?: number;
|
|
44
|
+
next_start_key?: string;
|
|
45
|
+
start_key?: string;
|
|
46
|
+
}
|
|
47
|
+
interface ListOptions extends RequestOptions {
|
|
48
|
+
paginate?: boolean;
|
|
49
|
+
}
|
|
50
|
+
declare function mergePaginate(options?: ListOptions): RequestOptions | undefined;
|
|
51
|
+
interface CrossbarHttpClient {
|
|
52
|
+
get<T = unknown>(path: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
53
|
+
put<T = unknown>(path: string, data?: unknown, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
54
|
+
post<T = unknown>(path: string, data?: unknown, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
55
|
+
patch<T = unknown>(path: string, data?: unknown, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
56
|
+
delete<T = unknown>(path: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface CallerIdEntry {
|
|
60
|
+
name?: string;
|
|
61
|
+
number?: string;
|
|
62
|
+
}
|
|
63
|
+
interface CallerId {
|
|
64
|
+
internal?: CallerIdEntry;
|
|
65
|
+
external?: CallerIdEntry;
|
|
66
|
+
emergency?: CallerIdEntry;
|
|
67
|
+
asserted?: CallerIdEntry & {
|
|
68
|
+
realm?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface CallerIdOptions {
|
|
72
|
+
outbound_privacy?: "full" | "name" | "number" | "none";
|
|
73
|
+
show_rate?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface CallRestrictionEntry {
|
|
76
|
+
action?: "inherit" | "deny";
|
|
77
|
+
}
|
|
78
|
+
interface CallRecordingEndpoint {
|
|
79
|
+
enabled?: boolean;
|
|
80
|
+
format?: "mp3" | "wav";
|
|
81
|
+
url?: string;
|
|
82
|
+
time_limit?: number;
|
|
83
|
+
record_on_answer?: boolean;
|
|
84
|
+
record_on_bridge?: boolean;
|
|
85
|
+
record_sample_rate?: number;
|
|
86
|
+
}
|
|
87
|
+
interface CallRecordingDirection {
|
|
88
|
+
onnet?: CallRecordingEndpoint;
|
|
89
|
+
offnet?: CallRecordingEndpoint;
|
|
90
|
+
any?: CallRecordingEndpoint;
|
|
91
|
+
}
|
|
92
|
+
interface CallRecording {
|
|
93
|
+
account?: CallRecordingDirection;
|
|
94
|
+
endpoint?: CallRecordingDirection;
|
|
95
|
+
}
|
|
96
|
+
interface Notifications {
|
|
97
|
+
first_occurrence?: {
|
|
98
|
+
sent_initial_call?: boolean;
|
|
99
|
+
sent_initial_registration?: boolean;
|
|
100
|
+
};
|
|
101
|
+
low_balance?: {
|
|
102
|
+
enabled?: boolean;
|
|
103
|
+
last_notification?: number;
|
|
104
|
+
sent_low_balance?: boolean;
|
|
105
|
+
threshold?: number;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface Account {
|
|
109
|
+
id?: string;
|
|
110
|
+
name: string;
|
|
111
|
+
enabled?: boolean;
|
|
112
|
+
realm?: string;
|
|
113
|
+
language?: string;
|
|
114
|
+
timezone?: string;
|
|
115
|
+
org?: string;
|
|
116
|
+
caller_id?: CallerId;
|
|
117
|
+
caller_id_options?: CallerIdOptions;
|
|
118
|
+
call_recording?: CallRecording;
|
|
119
|
+
call_restriction?: Record<string, CallRestrictionEntry>;
|
|
120
|
+
call_waiting?: {
|
|
121
|
+
enabled?: boolean;
|
|
122
|
+
};
|
|
123
|
+
dial_plan?: Record<string, unknown>;
|
|
124
|
+
do_not_disturb?: {
|
|
125
|
+
enabled?: boolean;
|
|
126
|
+
};
|
|
127
|
+
flags?: string[];
|
|
128
|
+
formatters?: Record<string, unknown>;
|
|
129
|
+
metaflows?: Record<string, unknown>;
|
|
130
|
+
music_on_hold?: {
|
|
131
|
+
media_id?: string;
|
|
132
|
+
};
|
|
133
|
+
notifications?: Notifications;
|
|
134
|
+
preflow?: {
|
|
135
|
+
always?: string;
|
|
136
|
+
};
|
|
137
|
+
ringtones?: {
|
|
138
|
+
internal?: string;
|
|
139
|
+
external?: string;
|
|
140
|
+
};
|
|
141
|
+
topup?: {
|
|
142
|
+
threshold?: number;
|
|
143
|
+
};
|
|
144
|
+
voicemail?: {
|
|
145
|
+
notify?: {
|
|
146
|
+
callback?: Record<string, unknown>;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
zones?: Record<string, unknown>;
|
|
150
|
+
}
|
|
151
|
+
interface AccountSummary {
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
realm?: string;
|
|
155
|
+
}
|
|
156
|
+
interface CallForward {
|
|
157
|
+
enabled?: boolean;
|
|
158
|
+
number?: string;
|
|
159
|
+
require_keypress?: boolean;
|
|
160
|
+
keep_caller_id?: boolean;
|
|
161
|
+
direct_calls_only?: boolean;
|
|
162
|
+
failover?: boolean;
|
|
163
|
+
ignore_early_media?: boolean;
|
|
164
|
+
substitute?: boolean;
|
|
165
|
+
}
|
|
166
|
+
type DeviceType = "sip_device" | "cellphone" | "softphone" | "fax" | "sip_uri" | "smartphone";
|
|
167
|
+
interface SipCredentials {
|
|
168
|
+
username?: string;
|
|
169
|
+
password?: string;
|
|
170
|
+
realm?: string;
|
|
171
|
+
method?: string;
|
|
172
|
+
invite_format?: string;
|
|
173
|
+
route?: string;
|
|
174
|
+
ip?: string;
|
|
175
|
+
custom_sip_headers?: Record<string, string>;
|
|
176
|
+
registration_expiration?: number;
|
|
177
|
+
}
|
|
178
|
+
interface User {
|
|
179
|
+
id?: string;
|
|
180
|
+
username: string;
|
|
181
|
+
first_name?: string;
|
|
182
|
+
last_name?: string;
|
|
183
|
+
email?: string;
|
|
184
|
+
enabled?: boolean;
|
|
185
|
+
priv_level?: "admin" | "user";
|
|
186
|
+
caller_id?: CallerId;
|
|
187
|
+
presence_id?: string;
|
|
188
|
+
call_forward?: CallForward;
|
|
189
|
+
hotdesk?: {
|
|
190
|
+
enabled?: boolean;
|
|
191
|
+
id?: string;
|
|
192
|
+
require_pin?: boolean;
|
|
193
|
+
pin?: string;
|
|
194
|
+
keep_logged_in_elsewhere?: boolean;
|
|
195
|
+
};
|
|
196
|
+
directories?: Record<string, unknown>;
|
|
197
|
+
vm_to_email_enabled?: boolean;
|
|
198
|
+
verified?: boolean;
|
|
199
|
+
timezone?: string;
|
|
200
|
+
language?: string;
|
|
201
|
+
do_not_disturb?: {
|
|
202
|
+
enabled?: boolean;
|
|
203
|
+
};
|
|
204
|
+
call_restriction?: Record<string, CallRestrictionEntry>;
|
|
205
|
+
call_recording?: CallRecording;
|
|
206
|
+
music_on_hold?: {
|
|
207
|
+
media_id?: string;
|
|
208
|
+
};
|
|
209
|
+
ringtones?: {
|
|
210
|
+
internal?: string;
|
|
211
|
+
external?: string;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
interface Device {
|
|
215
|
+
id?: string;
|
|
216
|
+
name: string;
|
|
217
|
+
device_type?: DeviceType;
|
|
218
|
+
enabled?: boolean;
|
|
219
|
+
owner_id?: string;
|
|
220
|
+
sip?: SipCredentials;
|
|
221
|
+
caller_id?: CallerId;
|
|
222
|
+
call_forward?: CallForward;
|
|
223
|
+
media?: {
|
|
224
|
+
bypass_media?: boolean | "auto";
|
|
225
|
+
ignore_early_media?: boolean;
|
|
226
|
+
progress_timeout?: number;
|
|
227
|
+
audio?: {
|
|
228
|
+
codecs?: string[];
|
|
229
|
+
};
|
|
230
|
+
video?: {
|
|
231
|
+
codecs?: string[];
|
|
232
|
+
};
|
|
233
|
+
fax?: {
|
|
234
|
+
option?: string;
|
|
235
|
+
};
|
|
236
|
+
encryption?: {
|
|
237
|
+
enforce_security?: boolean;
|
|
238
|
+
methods?: string[];
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
ringtones?: {
|
|
242
|
+
internal?: string;
|
|
243
|
+
external?: string;
|
|
244
|
+
};
|
|
245
|
+
mac_address?: string;
|
|
246
|
+
provision?: {
|
|
247
|
+
endpoint_brand?: string;
|
|
248
|
+
endpoint_family?: string;
|
|
249
|
+
endpoint_model?: string;
|
|
250
|
+
id?: string;
|
|
251
|
+
};
|
|
252
|
+
do_not_disturb?: {
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
};
|
|
255
|
+
call_restriction?: Record<string, CallRestrictionEntry>;
|
|
256
|
+
music_on_hold?: {
|
|
257
|
+
media_id?: string;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
interface DeviceStatus {
|
|
261
|
+
device_id: string;
|
|
262
|
+
registered: boolean;
|
|
263
|
+
}
|
|
264
|
+
interface CallflowAction {
|
|
265
|
+
module: string;
|
|
266
|
+
data?: Record<string, unknown>;
|
|
267
|
+
children?: Record<string, CallflowAction>;
|
|
268
|
+
}
|
|
269
|
+
interface Callflow {
|
|
270
|
+
id?: string;
|
|
271
|
+
name?: string;
|
|
272
|
+
numbers?: string[];
|
|
273
|
+
patterns?: string[];
|
|
274
|
+
flow?: CallflowAction;
|
|
275
|
+
featurecode?: {
|
|
276
|
+
name?: string;
|
|
277
|
+
number?: string;
|
|
278
|
+
};
|
|
279
|
+
type?: string;
|
|
280
|
+
owner_id?: string;
|
|
281
|
+
}
|
|
282
|
+
interface VoicemailBox {
|
|
283
|
+
id?: string;
|
|
284
|
+
name: string;
|
|
285
|
+
mailbox: string;
|
|
286
|
+
owner_id?: string;
|
|
287
|
+
pin?: string;
|
|
288
|
+
require_pin?: boolean;
|
|
289
|
+
check_if_owner?: boolean;
|
|
290
|
+
skip_greeting?: boolean;
|
|
291
|
+
skip_instructions?: boolean;
|
|
292
|
+
is_setup?: boolean;
|
|
293
|
+
timezone?: string;
|
|
294
|
+
media?: {
|
|
295
|
+
unavailable?: string;
|
|
296
|
+
temporary?: string;
|
|
297
|
+
};
|
|
298
|
+
notify?: {
|
|
299
|
+
callback?: Record<string, unknown>;
|
|
300
|
+
};
|
|
301
|
+
notify_email_addresses?: string[];
|
|
302
|
+
delete_after_notify?: boolean;
|
|
303
|
+
oldest_message_first?: boolean;
|
|
304
|
+
max_message_count?: number;
|
|
305
|
+
max_message_length?: number;
|
|
306
|
+
min_message_size?: number;
|
|
307
|
+
}
|
|
308
|
+
interface VoicemailMessage {
|
|
309
|
+
media_id: string;
|
|
310
|
+
message_id: string;
|
|
311
|
+
from: string;
|
|
312
|
+
to: string;
|
|
313
|
+
caller_id_name?: string;
|
|
314
|
+
caller_id_number?: string;
|
|
315
|
+
folder: "new" | "saved" | "deleted";
|
|
316
|
+
timestamp: number;
|
|
317
|
+
length?: number;
|
|
318
|
+
}
|
|
319
|
+
type PhoneNumberState = "discovery" | "available" | "reserved" | "in_service" | "released" | "disconnected" | "deleted" | "port_in" | "port_out";
|
|
320
|
+
interface PhoneNumber {
|
|
321
|
+
id?: string;
|
|
322
|
+
state?: PhoneNumberState;
|
|
323
|
+
features?: string[];
|
|
324
|
+
used_by?: string;
|
|
325
|
+
assigned_to?: string;
|
|
326
|
+
created?: number;
|
|
327
|
+
updated?: number;
|
|
328
|
+
cnam?: {
|
|
329
|
+
inbound?: {
|
|
330
|
+
display_name?: string;
|
|
331
|
+
};
|
|
332
|
+
outbound?: {
|
|
333
|
+
display_name?: string;
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
e911?: {
|
|
337
|
+
street_address?: string;
|
|
338
|
+
extended_address?: string;
|
|
339
|
+
locality?: string;
|
|
340
|
+
region?: string;
|
|
341
|
+
postal_code?: string;
|
|
342
|
+
plus_four?: string;
|
|
343
|
+
caller_name?: string;
|
|
344
|
+
notification_contact_emails?: string[];
|
|
345
|
+
};
|
|
346
|
+
failover?: {
|
|
347
|
+
e164?: string;
|
|
348
|
+
sip?: string;
|
|
349
|
+
};
|
|
350
|
+
prepend?: {
|
|
351
|
+
enabled?: boolean;
|
|
352
|
+
name?: string;
|
|
353
|
+
number?: string;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
interface Conference {
|
|
357
|
+
id?: string;
|
|
358
|
+
name: string;
|
|
359
|
+
owner_id?: string;
|
|
360
|
+
member?: {
|
|
361
|
+
pins?: string[];
|
|
362
|
+
numbers?: string[];
|
|
363
|
+
join_muted?: boolean;
|
|
364
|
+
join_deaf?: boolean;
|
|
365
|
+
};
|
|
366
|
+
moderator?: {
|
|
367
|
+
pins?: string[];
|
|
368
|
+
numbers?: string[];
|
|
369
|
+
join_muted?: boolean;
|
|
370
|
+
join_deaf?: boolean;
|
|
371
|
+
};
|
|
372
|
+
play_entry_tone?: boolean;
|
|
373
|
+
play_exit_tone?: boolean;
|
|
374
|
+
play_name?: boolean;
|
|
375
|
+
max_participants?: number;
|
|
376
|
+
max_members_media?: string;
|
|
377
|
+
caller_id?: CallerId;
|
|
378
|
+
profile?: Record<string, unknown>;
|
|
379
|
+
conference_numbers?: string[];
|
|
380
|
+
}
|
|
381
|
+
interface ConferenceParticipant {
|
|
382
|
+
call_id: string;
|
|
383
|
+
participant_id: number;
|
|
384
|
+
caller_id_name?: string;
|
|
385
|
+
caller_id_number?: string;
|
|
386
|
+
join_time?: number;
|
|
387
|
+
duration?: number;
|
|
388
|
+
is_moderator?: boolean;
|
|
389
|
+
muted?: boolean;
|
|
390
|
+
deaf?: boolean;
|
|
391
|
+
}
|
|
392
|
+
interface Media {
|
|
393
|
+
id?: string;
|
|
394
|
+
name: string;
|
|
395
|
+
description?: string;
|
|
396
|
+
language?: string;
|
|
397
|
+
media_source?: "recording" | "upload" | "tts";
|
|
398
|
+
source_type?: string;
|
|
399
|
+
source_id?: string;
|
|
400
|
+
streamable?: boolean;
|
|
401
|
+
content_type?: string;
|
|
402
|
+
content_length?: number;
|
|
403
|
+
tts?: {
|
|
404
|
+
text?: string;
|
|
405
|
+
voice?: string;
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
interface Menu {
|
|
409
|
+
id?: string;
|
|
410
|
+
name: string;
|
|
411
|
+
retries?: number;
|
|
412
|
+
timeout?: string;
|
|
413
|
+
max_extension_length?: number;
|
|
414
|
+
media?: {
|
|
415
|
+
greeting?: string;
|
|
416
|
+
invalid_media?: string;
|
|
417
|
+
exit_media?: string;
|
|
418
|
+
transfer_media?: string;
|
|
419
|
+
};
|
|
420
|
+
hunt?: boolean;
|
|
421
|
+
hunt_allow?: string;
|
|
422
|
+
hunt_deny?: string;
|
|
423
|
+
record_pin?: string;
|
|
424
|
+
suppress_media?: boolean;
|
|
425
|
+
}
|
|
426
|
+
interface TemporalRule {
|
|
427
|
+
id?: string;
|
|
428
|
+
name: string;
|
|
429
|
+
cycle?: "date" | "weekly" | "monthly" | "yearly";
|
|
430
|
+
start_date?: number;
|
|
431
|
+
end_date?: number;
|
|
432
|
+
time_window_start?: number;
|
|
433
|
+
time_window_stop?: number;
|
|
434
|
+
wdays?: Array<"monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday">;
|
|
435
|
+
days?: number[];
|
|
436
|
+
interval?: number;
|
|
437
|
+
month?: number;
|
|
438
|
+
ordinal?: "first" | "second" | "third" | "fourth" | "fifth" | "last" | "every";
|
|
439
|
+
timezone?: string;
|
|
440
|
+
enabled?: boolean;
|
|
441
|
+
}
|
|
442
|
+
interface Webhook {
|
|
443
|
+
id?: string;
|
|
444
|
+
name: string;
|
|
445
|
+
uri: string;
|
|
446
|
+
http_verb?: "get" | "post";
|
|
447
|
+
hook?: string;
|
|
448
|
+
retries?: number;
|
|
449
|
+
custom_data?: Record<string, string>;
|
|
450
|
+
include_internal_legs?: boolean;
|
|
451
|
+
include_subaccounts?: boolean;
|
|
452
|
+
enabled?: boolean;
|
|
453
|
+
}
|
|
454
|
+
interface Channel {
|
|
455
|
+
uuid: string;
|
|
456
|
+
call_id?: string;
|
|
457
|
+
answered?: boolean;
|
|
458
|
+
authorizing_id?: string;
|
|
459
|
+
authorizing_type?: string;
|
|
460
|
+
destination?: string;
|
|
461
|
+
direction?: "inbound" | "outbound";
|
|
462
|
+
other_leg?: string;
|
|
463
|
+
owner_id?: string;
|
|
464
|
+
presence_id?: string;
|
|
465
|
+
timestamp?: number;
|
|
466
|
+
username?: string;
|
|
467
|
+
node?: string;
|
|
468
|
+
}
|
|
469
|
+
interface Fax {
|
|
470
|
+
id?: string;
|
|
471
|
+
from_name?: string;
|
|
472
|
+
from_number?: string;
|
|
473
|
+
to_name?: string;
|
|
474
|
+
to_number?: string;
|
|
475
|
+
status?: string;
|
|
476
|
+
pages?: number;
|
|
477
|
+
fax_result_code?: string;
|
|
478
|
+
fax_result_text?: string;
|
|
479
|
+
fax_bad_rows?: number;
|
|
480
|
+
fax_transfer_rate?: number;
|
|
481
|
+
fax_timezone?: string;
|
|
482
|
+
timestamp?: number;
|
|
483
|
+
media_type?: string;
|
|
484
|
+
rx_result?: string;
|
|
485
|
+
tx_result?: string;
|
|
486
|
+
folder?: "inbox" | "outbox" | "sent" | "failed";
|
|
487
|
+
}
|
|
488
|
+
interface Cdr {
|
|
489
|
+
id?: string;
|
|
490
|
+
call_id?: string;
|
|
491
|
+
caller_id_name?: string;
|
|
492
|
+
caller_id_number?: string;
|
|
493
|
+
callee_id_name?: string;
|
|
494
|
+
callee_id_number?: string;
|
|
495
|
+
from?: string;
|
|
496
|
+
to?: string;
|
|
497
|
+
request?: string;
|
|
498
|
+
call_direction?: "inbound" | "outbound";
|
|
499
|
+
duration_seconds?: number;
|
|
500
|
+
billing_seconds?: number;
|
|
501
|
+
ringing_seconds?: number;
|
|
502
|
+
hangup_cause?: string;
|
|
503
|
+
hangup_code?: string;
|
|
504
|
+
disposition?: string;
|
|
505
|
+
timestamp?: number;
|
|
506
|
+
datetime?: string;
|
|
507
|
+
account_id?: string;
|
|
508
|
+
owner_id?: string;
|
|
509
|
+
authorizing_id?: string;
|
|
510
|
+
authorizing_type?: string;
|
|
511
|
+
interaction_id?: string;
|
|
512
|
+
custom_channel_vars?: Record<string, unknown>;
|
|
513
|
+
custom_sip_headers?: Record<string, string>;
|
|
514
|
+
media_recordings?: string[];
|
|
515
|
+
}
|
|
516
|
+
interface TokenInfo {
|
|
517
|
+
account_id: string;
|
|
518
|
+
account_name: string;
|
|
519
|
+
owner_id?: string;
|
|
520
|
+
reseller_id?: string;
|
|
521
|
+
is_reseller?: boolean;
|
|
522
|
+
language?: string;
|
|
523
|
+
method?: string;
|
|
524
|
+
id?: string;
|
|
525
|
+
apps?: Array<{
|
|
526
|
+
id: string;
|
|
527
|
+
name: string;
|
|
528
|
+
api_url?: string;
|
|
529
|
+
label?: string;
|
|
530
|
+
}>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
declare class AccountsResource<T extends Account = Account> {
|
|
534
|
+
private readonly client;
|
|
535
|
+
constructor(client: CrossbarHttpClient);
|
|
536
|
+
get(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
537
|
+
create(parentAccountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
538
|
+
update(accountId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
539
|
+
patch(accountId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
540
|
+
remove(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
541
|
+
children<S extends AccountSummary = AccountSummary>(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<S[]>>;
|
|
542
|
+
descendants<S extends AccountSummary = AccountSummary>(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<S[]>>;
|
|
543
|
+
siblings<S extends AccountSummary = AccountSummary>(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<S[]>>;
|
|
544
|
+
parents(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<string[]>>;
|
|
545
|
+
tree(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<string[]>>;
|
|
546
|
+
getApiKey(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<{
|
|
547
|
+
api_key: string;
|
|
548
|
+
}>>;
|
|
549
|
+
regenerateApiKey(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<{
|
|
550
|
+
api_key: string;
|
|
551
|
+
}>>;
|
|
552
|
+
move(accountId: string, toAccountId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
553
|
+
promoteReseller(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
554
|
+
demoteReseller(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
declare class CallflowsResource<T extends Callflow = Callflow> {
|
|
558
|
+
private readonly client;
|
|
559
|
+
constructor(client: CrossbarHttpClient);
|
|
560
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
561
|
+
get(accountId: string, callflowId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
562
|
+
create(accountId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
563
|
+
update(accountId: string, callflowId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
564
|
+
patch(accountId: string, callflowId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
565
|
+
remove(accountId: string, callflowId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
interface CdrListOptions extends ListOptions {
|
|
569
|
+
created_from?: number;
|
|
570
|
+
created_to?: number;
|
|
571
|
+
}
|
|
572
|
+
declare class CdrsResource<T extends Cdr = Cdr> {
|
|
573
|
+
private readonly client;
|
|
574
|
+
constructor(client: CrossbarHttpClient);
|
|
575
|
+
list(accountId: string, options?: CdrListOptions): Promise<CrossbarResponse<T[]>>;
|
|
576
|
+
get(accountId: string, cdrId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
577
|
+
listByUser(accountId: string, userId: string, options?: CdrListOptions): Promise<CrossbarResponse<T[]>>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare class ChannelsResource {
|
|
581
|
+
private readonly client;
|
|
582
|
+
constructor(client: CrossbarHttpClient);
|
|
583
|
+
list(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<Channel[]>>;
|
|
584
|
+
get(accountId: string, callId: string, options?: RequestOptions): Promise<CrossbarResponse<Channel>>;
|
|
585
|
+
hangup(accountId: string, callId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
declare class ConferencesResource<T extends Conference = Conference> {
|
|
589
|
+
private readonly client;
|
|
590
|
+
constructor(client: CrossbarHttpClient);
|
|
591
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
592
|
+
get(accountId: string, conferenceId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
593
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
594
|
+
update(accountId: string, conferenceId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
595
|
+
patch(accountId: string, conferenceId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
596
|
+
remove(accountId: string, conferenceId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
597
|
+
participants(accountId: string, conferenceId: string, options?: RequestOptions): Promise<CrossbarResponse<ConferenceParticipant[]>>;
|
|
598
|
+
muteParticipant(accountId: string, conferenceId: string, participantId: number, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
599
|
+
unmuteParticipant(accountId: string, conferenceId: string, participantId: number, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
600
|
+
deafParticipant(accountId: string, conferenceId: string, participantId: number, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
601
|
+
undeafParticipant(accountId: string, conferenceId: string, participantId: number, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
602
|
+
kickParticipant(accountId: string, conferenceId: string, participantId: number, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
declare class DevicesResource<T extends Device = Device> {
|
|
606
|
+
private readonly client;
|
|
607
|
+
constructor(client: CrossbarHttpClient);
|
|
608
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
609
|
+
get(accountId: string, deviceId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
610
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
611
|
+
update(accountId: string, deviceId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
612
|
+
patch(accountId: string, deviceId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
613
|
+
remove(accountId: string, deviceId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
614
|
+
status(accountId: string, options?: RequestOptions): Promise<CrossbarResponse<DeviceStatus[]>>;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
declare class FaxesResource<T extends Fax = Fax> {
|
|
618
|
+
private readonly client;
|
|
619
|
+
constructor(client: CrossbarHttpClient);
|
|
620
|
+
listInbox(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
621
|
+
listOutbox(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
622
|
+
getInbox(accountId: string, faxId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
623
|
+
getOutbox(accountId: string, faxId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
624
|
+
send(accountId: string, data: {
|
|
625
|
+
to_number: string;
|
|
626
|
+
from_number?: string;
|
|
627
|
+
document_url?: string;
|
|
628
|
+
}, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
629
|
+
removeInbox(accountId: string, faxId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
630
|
+
removeOutbox(accountId: string, faxId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
declare class MediaResource<T extends Media = Media> {
|
|
634
|
+
private readonly client;
|
|
635
|
+
constructor(client: CrossbarHttpClient);
|
|
636
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
637
|
+
get(accountId: string, mediaId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
638
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
639
|
+
update(accountId: string, mediaId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
640
|
+
patch(accountId: string, mediaId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
641
|
+
remove(accountId: string, mediaId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
declare class MenusResource<T extends Menu = Menu> {
|
|
645
|
+
private readonly client;
|
|
646
|
+
constructor(client: CrossbarHttpClient);
|
|
647
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
648
|
+
get(accountId: string, menuId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
649
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
650
|
+
update(accountId: string, menuId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
651
|
+
patch(accountId: string, menuId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
652
|
+
remove(accountId: string, menuId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
declare class PhoneNumbersResource<T extends PhoneNumber = PhoneNumber> {
|
|
656
|
+
private readonly client;
|
|
657
|
+
constructor(client: CrossbarHttpClient);
|
|
658
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
659
|
+
get(accountId: string, number: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
660
|
+
create(accountId: string, number: string, data?: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
661
|
+
update(accountId: string, number: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
662
|
+
patch(accountId: string, number: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
663
|
+
remove(accountId: string, number: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
664
|
+
activate(accountId: string, number: string, data?: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
665
|
+
reserve(accountId: string, number: string, data?: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
666
|
+
portIn(accountId: string, number: string, data?: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
declare class TemporalRulesResource<T extends TemporalRule = TemporalRule> {
|
|
670
|
+
private readonly client;
|
|
671
|
+
constructor(client: CrossbarHttpClient);
|
|
672
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
673
|
+
get(accountId: string, ruleId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
674
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
675
|
+
update(accountId: string, ruleId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
676
|
+
patch(accountId: string, ruleId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
677
|
+
remove(accountId: string, ruleId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
declare class TokenResource<T extends TokenInfo = TokenInfo> {
|
|
681
|
+
private readonly client;
|
|
682
|
+
constructor(client: CrossbarHttpClient);
|
|
683
|
+
info(options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
684
|
+
invalidate(options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
declare class UsersResource<T extends User = User> {
|
|
688
|
+
private readonly client;
|
|
689
|
+
constructor(client: CrossbarHttpClient);
|
|
690
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
691
|
+
get(accountId: string, userId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
692
|
+
create(accountId: string, data: Partial<T> & Pick<T, "username">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
693
|
+
update(accountId: string, userId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
694
|
+
patch(accountId: string, userId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
695
|
+
remove(accountId: string, userId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
declare class VoicemailsResource<T extends VoicemailBox = VoicemailBox> {
|
|
699
|
+
private readonly client;
|
|
700
|
+
constructor(client: CrossbarHttpClient);
|
|
701
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
702
|
+
get(accountId: string, vmboxId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
703
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name" | "mailbox">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
704
|
+
update(accountId: string, vmboxId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
705
|
+
patch(accountId: string, vmboxId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
706
|
+
remove(accountId: string, vmboxId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
707
|
+
messages(accountId: string, vmboxId: string, options?: RequestOptions): Promise<CrossbarResponse<VoicemailMessage[]>>;
|
|
708
|
+
getMessage(accountId: string, vmboxId: string, messageId: string, options?: RequestOptions): Promise<CrossbarResponse<VoicemailMessage>>;
|
|
709
|
+
updateMessage(accountId: string, vmboxId: string, messageId: string, data: {
|
|
710
|
+
folder: "new" | "saved" | "deleted";
|
|
711
|
+
}, options?: RequestOptions): Promise<CrossbarResponse<VoicemailMessage>>;
|
|
712
|
+
deleteMessage(accountId: string, vmboxId: string, messageId: string, options?: RequestOptions): Promise<CrossbarResponse<unknown>>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
declare class WebhooksResource<T extends Webhook = Webhook> {
|
|
716
|
+
private readonly client;
|
|
717
|
+
constructor(client: CrossbarHttpClient);
|
|
718
|
+
list(accountId: string, options?: ListOptions): Promise<CrossbarResponse<T[]>>;
|
|
719
|
+
get(accountId: string, webhookId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
720
|
+
create(accountId: string, data: Partial<T> & Pick<T, "name" | "uri">, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
721
|
+
update(accountId: string, webhookId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
722
|
+
patch(accountId: string, webhookId: string, data: Partial<T>, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
723
|
+
remove(accountId: string, webhookId: string, options?: RequestOptions): Promise<CrossbarResponse<T>>;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
interface CrossbarTypes {
|
|
727
|
+
account: Account;
|
|
728
|
+
tokenInfo: TokenInfo;
|
|
729
|
+
user: User;
|
|
730
|
+
device: Device;
|
|
731
|
+
callflow: Callflow;
|
|
732
|
+
voicemailBox: VoicemailBox;
|
|
733
|
+
phoneNumber: PhoneNumber;
|
|
734
|
+
cdr: Cdr;
|
|
735
|
+
conference: Conference;
|
|
736
|
+
fax: Fax;
|
|
737
|
+
media: Media;
|
|
738
|
+
menu: Menu;
|
|
739
|
+
temporalRule: TemporalRule;
|
|
740
|
+
webhook: Webhook;
|
|
741
|
+
}
|
|
742
|
+
type WithCrossbarTypes<T extends Partial<CrossbarTypes>> = Omit<CrossbarTypes, keyof T> & T;
|
|
743
|
+
declare class CrossbarClient<T extends CrossbarTypes = CrossbarTypes> {
|
|
744
|
+
private readonly baseUrl;
|
|
745
|
+
private readonly version;
|
|
746
|
+
private readonly defaultHeaders;
|
|
747
|
+
private readonly defaultTimeout;
|
|
748
|
+
private readonly retryConfig;
|
|
749
|
+
private authConfig;
|
|
750
|
+
private authToken;
|
|
751
|
+
private readonly _http;
|
|
752
|
+
private _accounts;
|
|
753
|
+
private _tokenAuth;
|
|
754
|
+
private _users;
|
|
755
|
+
private _devices;
|
|
756
|
+
private _callflows;
|
|
757
|
+
private _voicemails;
|
|
758
|
+
private _phoneNumbers;
|
|
759
|
+
private _cdrs;
|
|
760
|
+
private _channels;
|
|
761
|
+
private _conferences;
|
|
762
|
+
private _faxes;
|
|
763
|
+
private _media;
|
|
764
|
+
private _menus;
|
|
765
|
+
private _temporalRules;
|
|
766
|
+
private _webhooks;
|
|
767
|
+
constructor(config: CrossbarConfig);
|
|
768
|
+
get http(): CrossbarHttpClient;
|
|
769
|
+
get accounts(): AccountsResource<T["account"]>;
|
|
770
|
+
get tokenAuth(): TokenResource<T["tokenInfo"]>;
|
|
771
|
+
get users(): UsersResource<T["user"]>;
|
|
772
|
+
get devices(): DevicesResource<T["device"]>;
|
|
773
|
+
get callflows(): CallflowsResource<T["callflow"]>;
|
|
774
|
+
get voicemails(): VoicemailsResource<T["voicemailBox"]>;
|
|
775
|
+
get phoneNumbers(): PhoneNumbersResource<T["phoneNumber"]>;
|
|
776
|
+
get cdrs(): CdrsResource<T["cdr"]>;
|
|
777
|
+
get channels(): ChannelsResource;
|
|
778
|
+
get conferences(): ConferencesResource<T["conference"]>;
|
|
779
|
+
get faxes(): FaxesResource<T["fax"]>;
|
|
780
|
+
get media(): MediaResource<T["media"]>;
|
|
781
|
+
get menus(): MenusResource<T["menu"]>;
|
|
782
|
+
get temporalRules(): TemporalRulesResource<T["temporalRule"]>;
|
|
783
|
+
get webhooks(): WebhooksResource<T["webhook"]>;
|
|
784
|
+
get token(): string | undefined;
|
|
785
|
+
set token(value: string | undefined);
|
|
786
|
+
authenticate<T = unknown>(): Promise<CrossbarResponse<T>>;
|
|
787
|
+
private request;
|
|
788
|
+
private canReAuth;
|
|
789
|
+
private executeRequest;
|
|
790
|
+
private buildUrl;
|
|
791
|
+
private buildHeaders;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
declare class CrossbarError extends Error {
|
|
795
|
+
message: string;
|
|
796
|
+
status: number;
|
|
797
|
+
requestId?: string | undefined;
|
|
798
|
+
body?: unknown | undefined;
|
|
799
|
+
constructor(message: string, status: number, requestId?: string | undefined, body?: unknown | undefined);
|
|
800
|
+
}
|
|
801
|
+
declare class CrossbarAuthError extends CrossbarError {
|
|
802
|
+
constructor(message: string, requestId?: string, body?: unknown);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/** Fields present on every webhook event payload Kazoo delivers to your endpoint. */
|
|
806
|
+
interface WebhookEventBase {
|
|
807
|
+
hook_event: string;
|
|
808
|
+
event_name: string;
|
|
809
|
+
event_category: string;
|
|
810
|
+
account_id: string;
|
|
811
|
+
account_name?: string;
|
|
812
|
+
/** Gregorian timestamp (seconds since year 0). */
|
|
813
|
+
timestamp: number;
|
|
814
|
+
/** Values from the webhook's `custom_data` configuration. */
|
|
815
|
+
custom_data?: Record<string, string>;
|
|
816
|
+
version?: string;
|
|
817
|
+
}
|
|
818
|
+
interface WebhookChannelBase extends WebhookEventBase {
|
|
819
|
+
call_id: string;
|
|
820
|
+
call_direction: "inbound" | "outbound";
|
|
821
|
+
caller_id_name?: string;
|
|
822
|
+
caller_id_number?: string;
|
|
823
|
+
callee_id_name?: string;
|
|
824
|
+
callee_id_number?: string;
|
|
825
|
+
from?: string;
|
|
826
|
+
to?: string;
|
|
827
|
+
request?: string;
|
|
828
|
+
owner_id?: string;
|
|
829
|
+
authorizing_id?: string;
|
|
830
|
+
authorizing_type?: string;
|
|
831
|
+
}
|
|
832
|
+
interface WebhookChannelCreateEvent extends WebhookChannelBase {
|
|
833
|
+
hook_event: "channel_create";
|
|
834
|
+
}
|
|
835
|
+
interface WebhookChannelAnswerEvent extends WebhookChannelBase {
|
|
836
|
+
hook_event: "channel_answer";
|
|
837
|
+
}
|
|
838
|
+
interface WebhookChannelBridgeEvent extends WebhookChannelBase {
|
|
839
|
+
hook_event: "channel_bridge";
|
|
840
|
+
other_leg_call_id?: string;
|
|
841
|
+
}
|
|
842
|
+
interface WebhookChannelDestroyEvent extends WebhookChannelBase {
|
|
843
|
+
hook_event: "channel_destroy";
|
|
844
|
+
other_leg_call_id?: string;
|
|
845
|
+
hangup_cause?: string;
|
|
846
|
+
hangup_code?: string;
|
|
847
|
+
duration_seconds?: number;
|
|
848
|
+
billing_seconds?: number;
|
|
849
|
+
ringing_seconds?: number;
|
|
850
|
+
disposition?: string;
|
|
851
|
+
}
|
|
852
|
+
/** Union of all channel/call webhook events. */
|
|
853
|
+
type WebhookChannelEvent = WebhookChannelCreateEvent | WebhookChannelAnswerEvent | WebhookChannelBridgeEvent | WebhookChannelDestroyEvent;
|
|
854
|
+
interface WebhookVoicemailBase extends WebhookEventBase {
|
|
855
|
+
voicemail_box_id: string;
|
|
856
|
+
voicemail_id: string;
|
|
857
|
+
call_id?: string;
|
|
858
|
+
caller_id_name?: string;
|
|
859
|
+
caller_id_number?: string;
|
|
860
|
+
from?: string;
|
|
861
|
+
to?: string;
|
|
862
|
+
owner_id?: string;
|
|
863
|
+
/** Message duration in seconds. */
|
|
864
|
+
length?: number;
|
|
865
|
+
}
|
|
866
|
+
interface WebhookVoicemailNewEvent extends WebhookVoicemailBase {
|
|
867
|
+
hook_event: "voicemail_new";
|
|
868
|
+
}
|
|
869
|
+
interface WebhookVoicemailSavedEvent extends WebhookVoicemailBase {
|
|
870
|
+
hook_event: "voicemail_saved";
|
|
871
|
+
}
|
|
872
|
+
interface WebhookVoicemailDeletedEvent extends WebhookVoicemailBase {
|
|
873
|
+
hook_event: "voicemail_deleted";
|
|
874
|
+
}
|
|
875
|
+
/** Union of all voicemail webhook events. */
|
|
876
|
+
type WebhookVoicemailEvent = WebhookVoicemailNewEvent | WebhookVoicemailSavedEvent | WebhookVoicemailDeletedEvent;
|
|
877
|
+
interface WebhookFaxBase extends WebhookEventBase {
|
|
878
|
+
fax_id?: string;
|
|
879
|
+
fax_success?: boolean;
|
|
880
|
+
fax_result_code?: string;
|
|
881
|
+
fax_result_text?: string;
|
|
882
|
+
fax_bad_rows?: number;
|
|
883
|
+
fax_transfer_rate?: number;
|
|
884
|
+
fax_ecm_used?: boolean;
|
|
885
|
+
fax_t38_used?: boolean;
|
|
886
|
+
pages?: number;
|
|
887
|
+
from?: string;
|
|
888
|
+
to?: string;
|
|
889
|
+
owner_id?: string;
|
|
890
|
+
}
|
|
891
|
+
interface WebhookInboundFaxEvent extends WebhookFaxBase {
|
|
892
|
+
hook_event: "inbound_fax";
|
|
893
|
+
}
|
|
894
|
+
interface WebhookOutboundFaxEvent extends WebhookFaxBase {
|
|
895
|
+
hook_event: "outbound_fax";
|
|
896
|
+
}
|
|
897
|
+
interface WebhookInboundFaxErrorEvent extends WebhookFaxBase {
|
|
898
|
+
hook_event: "inbound_fax_error";
|
|
899
|
+
}
|
|
900
|
+
interface WebhookOutboundFaxErrorEvent extends WebhookFaxBase {
|
|
901
|
+
hook_event: "outbound_fax_error";
|
|
902
|
+
}
|
|
903
|
+
/** Union of all fax webhook events. */
|
|
904
|
+
type WebhookFaxEvent = WebhookInboundFaxEvent | WebhookOutboundFaxEvent | WebhookInboundFaxErrorEvent | WebhookOutboundFaxErrorEvent;
|
|
905
|
+
interface WebhookDocumentBase extends WebhookEventBase {
|
|
906
|
+
/** ID of the created/edited/deleted document. */
|
|
907
|
+
object_id: string;
|
|
908
|
+
/** Kazoo document type, e.g. `"device"`, `"user"`, `"callflow"`. */
|
|
909
|
+
object_type: string;
|
|
910
|
+
}
|
|
911
|
+
interface WebhookDocCreatedEvent extends WebhookDocumentBase {
|
|
912
|
+
hook_event: "doc_created";
|
|
913
|
+
}
|
|
914
|
+
interface WebhookDocEditedEvent extends WebhookDocumentBase {
|
|
915
|
+
hook_event: "doc_edited";
|
|
916
|
+
}
|
|
917
|
+
interface WebhookDocDeletedEvent extends WebhookDocumentBase {
|
|
918
|
+
hook_event: "doc_deleted";
|
|
919
|
+
}
|
|
920
|
+
/** Union of all document CRUD webhook events. */
|
|
921
|
+
type WebhookDocumentEvent = WebhookDocCreatedEvent | WebhookDocEditedEvent | WebhookDocDeletedEvent;
|
|
922
|
+
interface WebhookRegistrationBase extends WebhookEventBase {
|
|
923
|
+
username: string;
|
|
924
|
+
realm: string;
|
|
925
|
+
owner_id?: string;
|
|
926
|
+
authorizing_id?: string;
|
|
927
|
+
from_user?: string;
|
|
928
|
+
from_host?: string;
|
|
929
|
+
to_user?: string;
|
|
930
|
+
to_host?: string;
|
|
931
|
+
user_agent?: string;
|
|
932
|
+
contact?: string;
|
|
933
|
+
presence_id?: string;
|
|
934
|
+
network_address?: string;
|
|
935
|
+
network_port?: string;
|
|
936
|
+
/** Registration TTL in seconds. */
|
|
937
|
+
expires?: number;
|
|
938
|
+
}
|
|
939
|
+
interface WebhookRegisterEvent extends WebhookRegistrationBase {
|
|
940
|
+
hook_event: "register";
|
|
941
|
+
}
|
|
942
|
+
interface WebhookDeregisterEvent extends WebhookRegistrationBase {
|
|
943
|
+
hook_event: "deregister";
|
|
944
|
+
}
|
|
945
|
+
/** Union of all registration webhook events. */
|
|
946
|
+
type WebhookRegistrationEvent = WebhookRegisterEvent | WebhookDeregisterEvent;
|
|
947
|
+
/**
|
|
948
|
+
* Discriminated union of all Kazoo webhook event payloads, narrowed via `hook_event`.
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* function handleEvent(event: WebhookEvent) {
|
|
952
|
+
* if (event.hook_event === "channel_destroy") {
|
|
953
|
+
* console.log(event.hangup_cause); // typed
|
|
954
|
+
* }
|
|
955
|
+
* }
|
|
956
|
+
*/
|
|
957
|
+
type WebhookEvent = WebhookChannelEvent | WebhookVoicemailEvent | WebhookFaxEvent | WebhookDocumentEvent | WebhookRegistrationEvent;
|
|
958
|
+
|
|
959
|
+
export { type Account, type AccountSummary, AccountsResource, type ApiKeyAuth, type AuthConfig, type CallForward, type CallRecording, type CallRecordingDirection, type CallRecordingEndpoint, type CallRestrictionEntry, type CallerId, type CallerIdEntry, type CallerIdOptions, type Callflow, type CallflowAction, CallflowsResource, type Cdr, type CdrListOptions, CdrsResource, type Channel, ChannelsResource, type Conference, type ConferenceParticipant, ConferencesResource, type CredentialsAuth, CrossbarAuthError, CrossbarClient, type CrossbarConfig, CrossbarError, type CrossbarHttpClient, type CrossbarResponse, type CrossbarTypes, type Device, type DeviceStatus, type DeviceType, DevicesResource, type Fax, FaxesResource, type ListOptions, type Media, MediaResource, type Menu, MenusResource, type Notifications, type PhoneNumber, type PhoneNumberState, PhoneNumbersResource, type RequestOptions, type RetryConfig, type SipCredentials, type TemporalRule, TemporalRulesResource, type TokenAuth, type TokenInfo, TokenResource, type User, UsersResource, type VoicemailBox, type VoicemailMessage, VoicemailsResource, type Webhook, type WebhookChannelAnswerEvent, type WebhookChannelBridgeEvent, type WebhookChannelCreateEvent, type WebhookChannelDestroyEvent, type WebhookChannelEvent, type WebhookDeregisterEvent, type WebhookDocCreatedEvent, type WebhookDocDeletedEvent, type WebhookDocEditedEvent, type WebhookDocumentEvent, type WebhookEvent, type WebhookEventBase, type WebhookFaxEvent, type WebhookInboundFaxErrorEvent, type WebhookInboundFaxEvent, type WebhookOutboundFaxErrorEvent, type WebhookOutboundFaxEvent, type WebhookRegisterEvent, type WebhookRegistrationEvent, type WebhookVoicemailDeletedEvent, type WebhookVoicemailEvent, type WebhookVoicemailNewEvent, type WebhookVoicemailSavedEvent, WebhooksResource, type WithCrossbarTypes, mergePaginate };
|