@twilio/conversations 2.0.1 → 2.1.0-rc.6
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 +74 -0
- package/NOTICE.txt +679 -0
- package/builds/browser.js +889 -619
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +384 -129
- package/builds/lib.js +889 -619
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +1065 -939
- package/builds/twilio-conversations.min.js +2 -14
- package/dist/aggregated-delivery-receipt.js +6 -1
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/client.js +165 -142
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +16 -14
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -10
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +232 -159
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +82 -78
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +43 -39
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +100 -78
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +24 -22
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +1 -1
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/interfaces/attributes.js +147 -0
- package/dist/interfaces/attributes.js.map +1 -0
- package/dist/interfaces/notification-types.js +5 -5
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/logger.js +36 -15
- package/dist/logger.js.map +1 -1
- package/dist/media.js +21 -9
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +56 -3
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +157 -78
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +101 -50
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +16 -6
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +18 -14
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +20 -17
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +87 -60
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +3 -1
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +6 -6
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +0 -102
- package/docs/classes/Client.html +24 -132
- package/docs/classes/Conversation.html +37 -132
- package/docs/classes/DetailedDeliveryReceipt.html +1 -103
- package/docs/classes/Media.html +0 -102
- package/docs/classes/Message.html +73 -109
- package/docs/classes/MessageBuilder.html +78 -104
- package/docs/classes/Participant.html +37 -110
- package/docs/classes/PushNotification.html +0 -102
- package/docs/classes/RestPaginator.html +0 -102
- package/docs/classes/UnsentMessage.html +0 -102
- package/docs/classes/User.html +7 -109
- package/docs/index.html +93 -3
- package/docs/interfaces/ClientOptions.html +0 -102
- package/docs/interfaces/ConversationBindings.html +3001 -0
- package/docs/interfaces/ConversationEmailBinding.html +3001 -0
- package/docs/interfaces/ConversationState.html +0 -102
- package/docs/interfaces/CreateConversationOptions.html +1 -103
- package/docs/interfaces/LastMessage.html +0 -102
- package/docs/interfaces/Paginator.html +0 -102
- package/docs/interfaces/ParticipantBindings.html +3001 -0
- package/docs/interfaces/ParticipantEmailBinding.html +3001 -0
- package/docs/interfaces/PushNotificationData.html +0 -102
- package/docs/interfaces/SendEmailOptions.html +0 -102
- package/docs/interfaces/SendMediaOptions.html +0 -102
- package/docs/modules.html +93 -3
- package/package.json +23 -17
package/builds/lib.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
import { Transport, TwilsockClient, InitRegistration } from "twilsock";
|
1
|
+
import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
|
2
|
+
import { LogLevelDesc } from "loglevel";
|
3
|
+
import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
|
4
4
|
import { ConnectionState as TwilsockConnectionState } from "twilsock";
|
5
5
|
import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
|
6
6
|
import { ChannelType, Notifications } from "@twilio/notifications";
|
@@ -42,8 +42,8 @@ declare class Logger {
|
|
42
42
|
private prefix;
|
43
43
|
private constructor();
|
44
44
|
static scope(prefix: string): Logger;
|
45
|
-
setLevel(level:
|
46
|
-
static setLevel(level:
|
45
|
+
setLevel(level: LogLevelDesc): void;
|
46
|
+
static setLevel(level: LogLevelDesc): void;
|
47
47
|
trace(...args: any[]): void;
|
48
48
|
debug(...args: any[]): void;
|
49
49
|
info(...args: any[]): void;
|
@@ -55,7 +55,7 @@ declare class Logger {
|
|
55
55
|
static warn(...args: any[]): void;
|
56
56
|
static error(...args: any[]): void;
|
57
57
|
}
|
58
|
-
interface
|
58
|
+
interface ConversationLimits {
|
59
59
|
mediaAttachmentsCountLimit: number;
|
60
60
|
mediaAttachmentSizeLimitInMb: number;
|
61
61
|
mediaAttachmentsTotalSizeLimitInMb: number;
|
@@ -78,7 +78,7 @@ declare class Configuration {
|
|
78
78
|
mediaSetService: string;
|
79
79
|
messagesReceipts: string;
|
80
80
|
};
|
81
|
-
readonly limits:
|
81
|
+
readonly limits: ConversationLimits;
|
82
82
|
readonly productId?: string;
|
83
83
|
readonly typingIndicatorTimeoutOverride?: number;
|
84
84
|
readonly typingIndicatorTimeoutDefault: number;
|
@@ -91,7 +91,7 @@ declare class Configuration {
|
|
91
91
|
readonly userIdentity: string;
|
92
92
|
readonly userInfo: string;
|
93
93
|
readonly myConversations: string;
|
94
|
-
constructor(options:
|
94
|
+
constructor(options: ClientOptions, configurationResponse: ConfigurationResponse, logger: Logger);
|
95
95
|
}
|
96
96
|
interface CommandExecutorServices {
|
97
97
|
transport: Transport;
|
@@ -106,6 +106,20 @@ declare class CommandExecutor {
|
|
106
106
|
fetchResource<REQ = void, RESP = void>(url: string, requestBody?: REQ): Promise<RESP>;
|
107
107
|
mutateResource<REQ = void, RESP = void>(method: "post" | "delete", url: string, requestBody?: REQ): Promise<RESP>;
|
108
108
|
}
|
109
|
+
/**
|
110
|
+
* Represents a JSON value.
|
111
|
+
*/
|
112
|
+
type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
|
113
|
+
/**
|
114
|
+
* Represents a JSON object.
|
115
|
+
*/
|
116
|
+
type JSONObject = {
|
117
|
+
[x: string]: JSONValue;
|
118
|
+
};
|
119
|
+
/**
|
120
|
+
* Represents a JSON array.
|
121
|
+
*/
|
122
|
+
type JSONArray = JSONValue[];
|
109
123
|
type UserEvents = {
|
110
124
|
updated: (data: {
|
111
125
|
user: User;
|
@@ -181,25 +195,29 @@ declare class User extends ReplayEventEmitter<UserEvents> {
|
|
181
195
|
/**
|
182
196
|
* Custom attributes of the user.
|
183
197
|
*/
|
184
|
-
get attributes():
|
198
|
+
get attributes(): JSONValue;
|
185
199
|
/**
|
186
200
|
* Friendly name of the user, null if not set.
|
187
201
|
*/
|
188
|
-
get friendlyName(): string;
|
202
|
+
get friendlyName(): string | null;
|
189
203
|
/**
|
190
204
|
* Status of the real-time conversation connection of the user.
|
191
205
|
*/
|
192
|
-
get isOnline(): boolean;
|
206
|
+
get isOnline(): boolean | null;
|
193
207
|
/**
|
194
208
|
* User push notification registration status.
|
195
209
|
*/
|
196
|
-
get isNotifiable(): boolean;
|
210
|
+
get isNotifiable(): boolean | null;
|
197
211
|
/**
|
198
212
|
* True if this user is receiving real-time status updates.
|
199
213
|
*/
|
200
214
|
get isSubscribed(): boolean;
|
201
215
|
// Handles service updates
|
202
|
-
_update(key: string, value:
|
216
|
+
_update(key: string, value: {
|
217
|
+
value: string;
|
218
|
+
notifiable: boolean | null;
|
219
|
+
online: boolean | null;
|
220
|
+
}): Promise<void>;
|
203
221
|
// Fetch reachability info
|
204
222
|
private _updateReachabilityInfo;
|
205
223
|
// Fetch user
|
@@ -209,7 +227,7 @@ declare class User extends ReplayEventEmitter<UserEvents> {
|
|
209
227
|
* Edit user attributes.
|
210
228
|
* @param attributes New attributes.
|
211
229
|
*/
|
212
|
-
updateAttributes(attributes:
|
230
|
+
updateAttributes(attributes: JSONValue): Promise<User>;
|
213
231
|
/**
|
214
232
|
* Update the friendly name of the user.
|
215
233
|
* @param friendlyName New friendly name.
|
@@ -233,7 +251,7 @@ declare class Network {
|
|
233
251
|
private cleanupCache;
|
234
252
|
pokeTimer(): void;
|
235
253
|
private executeWithRetry;
|
236
|
-
get(url: string): Promise<
|
254
|
+
get<T>(url: string): Promise<TransportResult<T>>;
|
237
255
|
}
|
238
256
|
type UsersEvents = {
|
239
257
|
userUpdated: (data: {
|
@@ -265,7 +283,7 @@ declare class Users extends ReplayEventEmitter<UsersEvents> {
|
|
265
283
|
* if not - then subscribes and adds user to the FIFO stack
|
266
284
|
* @returns {Promise<User>} Fully initialized user
|
267
285
|
*/
|
268
|
-
getUser(identity
|
286
|
+
getUser(identity?: string, entityName?: string): Promise<User>;
|
269
287
|
/**
|
270
288
|
* @returns {Promise<Array<User>>} returns list of subscribed User objects {@see User}
|
271
289
|
*/
|
@@ -284,15 +302,16 @@ type ParticipantEvents = {
|
|
284
302
|
}) => void;
|
285
303
|
};
|
286
304
|
interface ParticipantDescriptor {
|
287
|
-
attributes?:
|
288
|
-
dateCreated:
|
289
|
-
dateUpdated:
|
305
|
+
attributes?: JSONValue;
|
306
|
+
dateCreated: Date | null;
|
307
|
+
dateUpdated: Date | null;
|
290
308
|
identity: string;
|
291
309
|
roleSid?: string;
|
292
|
-
lastConsumedMessageIndex: number;
|
310
|
+
lastConsumedMessageIndex: number | null;
|
293
311
|
lastConsumptionTimestamp: number;
|
294
312
|
type: ParticipantType;
|
295
313
|
userInfo: string;
|
314
|
+
bindings?: ParticipantBindings;
|
296
315
|
}
|
297
316
|
interface ParticipantServices {
|
298
317
|
users: Users;
|
@@ -304,15 +323,35 @@ interface ParticipantLinks {
|
|
304
323
|
/**
|
305
324
|
* The reason for the `updated` event being emitted by a participant.
|
306
325
|
*/
|
307
|
-
type ParticipantUpdateReason = "attributes" | "dateCreated" | "dateUpdated" | "roleSid" | "lastReadMessageIndex" | "lastReadTimestamp";
|
326
|
+
type ParticipantUpdateReason = "attributes" | "dateCreated" | "dateUpdated" | "roleSid" | "lastReadMessageIndex" | "lastReadTimestamp" | "bindings";
|
308
327
|
/**
|
309
328
|
* Type of a participant.
|
310
329
|
*/
|
311
|
-
type ParticipantType = "chat" | "sms" | "whatsapp";
|
330
|
+
type ParticipantType = "chat" | "sms" | "whatsapp" | "email";
|
312
331
|
interface ParticipantUpdatedEventArgs {
|
313
332
|
participant: Participant;
|
314
333
|
updateReasons: ParticipantUpdateReason[];
|
315
334
|
}
|
335
|
+
/**
|
336
|
+
* Bindings for conversation participant.
|
337
|
+
*/
|
338
|
+
interface ParticipantBindings {
|
339
|
+
email?: ParticipantEmailBinding;
|
340
|
+
}
|
341
|
+
/**
|
342
|
+
* Email participation level.
|
343
|
+
* to = to/from
|
344
|
+
* cc = cc
|
345
|
+
*/
|
346
|
+
type ParticipantEmailLevel = "to" | "cc";
|
347
|
+
/**
|
348
|
+
* Bindings for email participant.
|
349
|
+
*/
|
350
|
+
interface ParticipantEmailBinding {
|
351
|
+
name: string;
|
352
|
+
address: string;
|
353
|
+
level: ParticipantEmailLevel;
|
354
|
+
}
|
316
355
|
/**
|
317
356
|
* A participant represents a remote client in a conversation.
|
318
357
|
*/
|
@@ -331,19 +370,19 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
|
|
331
370
|
/**
|
332
371
|
* Custom attributes of the participant.
|
333
372
|
*/
|
334
|
-
get attributes():
|
373
|
+
get attributes(): JSONValue;
|
335
374
|
/**
|
336
375
|
* Date this participant was created on.
|
337
376
|
*/
|
338
|
-
get dateCreated(): Date;
|
377
|
+
get dateCreated(): Date | null;
|
339
378
|
/**
|
340
379
|
* Date this participant was last updated on.
|
341
380
|
*/
|
342
|
-
get dateUpdated(): Date;
|
381
|
+
get dateUpdated(): Date | null;
|
343
382
|
/**
|
344
383
|
* Identity of the participant.
|
345
384
|
*/
|
346
|
-
get identity(): string;
|
385
|
+
get identity(): string | null;
|
347
386
|
/**
|
348
387
|
* Indicates whether the participant is currently typing.
|
349
388
|
*/
|
@@ -358,12 +397,22 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
|
|
358
397
|
/**
|
359
398
|
* Date of the most recent read horizon update.
|
360
399
|
*/
|
361
|
-
get lastReadTimestamp(): Date;
|
400
|
+
get lastReadTimestamp(): Date | null;
|
362
401
|
get roleSid(): string;
|
363
402
|
/**
|
364
|
-
*
|
403
|
+
* Type of the participant.
|
365
404
|
*/
|
366
405
|
get type(): ParticipantType;
|
406
|
+
/**
|
407
|
+
* Get the bindings mapping for the current participant.
|
408
|
+
* Available binding depends on the participant type.
|
409
|
+
* You could access it as `participant.bindings.sms?.address` or
|
410
|
+
* using the type dynamically `participant.bindings[participant.type]`
|
411
|
+
* just be aware that the binding information has different structure for
|
412
|
+
* each participant type.
|
413
|
+
* See also {ParticipantEmailBinding}, the only available currently binding descriptor.
|
414
|
+
*/
|
415
|
+
get bindings(): ParticipantBindings;
|
367
416
|
/**
|
368
417
|
* @internal
|
369
418
|
*/
|
@@ -421,7 +470,30 @@ declare class Participant extends ReplayEventEmitter<ParticipantEvents> {
|
|
421
470
|
* Update the attributes of the participant.
|
422
471
|
* @param attributes New attributes.
|
423
472
|
*/
|
424
|
-
updateAttributes(attributes:
|
473
|
+
updateAttributes(attributes: JSONValue): Promise<Participant>;
|
474
|
+
}
|
475
|
+
interface ParticipantResponse {
|
476
|
+
account_sid: string;
|
477
|
+
chat_service_sid: string;
|
478
|
+
conversation_sid: string;
|
479
|
+
role_sid: string;
|
480
|
+
sid: string;
|
481
|
+
attributes: string;
|
482
|
+
date_created: string;
|
483
|
+
date_updated: string;
|
484
|
+
identity: string | null;
|
485
|
+
messaging_binding: {
|
486
|
+
type: string;
|
487
|
+
address: string;
|
488
|
+
proxy_address: string;
|
489
|
+
} | null;
|
490
|
+
url: string;
|
491
|
+
links: {
|
492
|
+
conversation: string;
|
493
|
+
};
|
494
|
+
}
|
495
|
+
interface ParticipantBindingOptions {
|
496
|
+
email?: ParticipantEmailBinding;
|
425
497
|
}
|
426
498
|
/**
|
427
499
|
* Category of media. Possible values are as follows:
|
@@ -433,7 +505,7 @@ type MediaCategory$0 = McsMediaCategory;
|
|
433
505
|
interface MediaState {
|
434
506
|
sid: string;
|
435
507
|
category: MediaCategory$0;
|
436
|
-
filename
|
508
|
+
filename: string | null;
|
437
509
|
contentType: string;
|
438
510
|
size: number;
|
439
511
|
}
|
@@ -458,7 +530,7 @@ declare class Media {
|
|
458
530
|
/**
|
459
531
|
* File name. Null if absent.
|
460
532
|
*/
|
461
|
-
get filename(): string;
|
533
|
+
get filename(): string | null;
|
462
534
|
/**
|
463
535
|
* Content type of the media.
|
464
536
|
*/
|
@@ -478,7 +550,7 @@ declare class Media {
|
|
478
550
|
* If the URL becomes expired, you need to request a new one.
|
479
551
|
* Each call to this function produces a new temporary URL.
|
480
552
|
*/
|
481
|
-
getContentTemporaryUrl(): Promise<string>;
|
553
|
+
getContentTemporaryUrl(): Promise<string | null>;
|
482
554
|
/**
|
483
555
|
* Returns cached direct content URL for the media.
|
484
556
|
*
|
@@ -488,7 +560,7 @@ declare class Media {
|
|
488
560
|
*
|
489
561
|
* @returns {Promise<String>}
|
490
562
|
*/
|
491
|
-
getCachedTemporaryUrl(): Promise<string>;
|
563
|
+
getCachedTemporaryUrl(): Promise<string | null>;
|
492
564
|
private _fetchMcsMedia;
|
493
565
|
}
|
494
566
|
/**
|
@@ -583,7 +655,7 @@ interface DetailedDeliveryReceiptDescriptor {
|
|
583
655
|
channel_message_sid: string;
|
584
656
|
participant_sid: string;
|
585
657
|
status: DeliveryStatus;
|
586
|
-
error_code:
|
658
|
+
error_code: string | null;
|
587
659
|
date_created: string;
|
588
660
|
date_updated: string;
|
589
661
|
}
|
@@ -619,7 +691,7 @@ declare class DetailedDeliveryReceipt {
|
|
619
691
|
* Numeric error code mapped from Status callback code. Information about the error codes can be found
|
620
692
|
* [here](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors).
|
621
693
|
*/
|
622
|
-
errorCode:
|
694
|
+
errorCode: string | 0;
|
623
695
|
/**
|
624
696
|
* Date this delivery receipt was created on.
|
625
697
|
*/
|
@@ -661,6 +733,21 @@ interface MessageUpdatedEventArgs {
|
|
661
733
|
message: Message;
|
662
734
|
updateReasons: MessageUpdateReason[];
|
663
735
|
}
|
736
|
+
interface MessageData {
|
737
|
+
sid: string;
|
738
|
+
text?: string;
|
739
|
+
type?: MessageType;
|
740
|
+
author: string | null;
|
741
|
+
subject: string | null;
|
742
|
+
lastUpdatedBy?: string | null;
|
743
|
+
attributes?: JSONValue;
|
744
|
+
dateUpdated: string;
|
745
|
+
timestamp?: string;
|
746
|
+
medias?: Media[];
|
747
|
+
media?: Media;
|
748
|
+
memberSid?: string;
|
749
|
+
delivery?: AggregatedDeliveryDescriptor;
|
750
|
+
}
|
664
751
|
/**
|
665
752
|
* A message in a conversation.
|
666
753
|
*/
|
@@ -676,7 +763,7 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
676
763
|
/**
|
677
764
|
* @internal
|
678
765
|
*/
|
679
|
-
constructor(index: number, data:
|
766
|
+
constructor(index: number, data: MessageData, conversation: Conversation, links: MessageLinks, configuration: Configuration, services: MessageServices);
|
680
767
|
/**
|
681
768
|
* Fired when the properties or the body of the message has been updated.
|
682
769
|
*
|
@@ -693,7 +780,7 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
693
780
|
/**
|
694
781
|
* Name of the user that sent the message.
|
695
782
|
*/
|
696
|
-
get author(): string;
|
783
|
+
get author(): string | null;
|
697
784
|
/**
|
698
785
|
* Message subject. Used only in email conversations.
|
699
786
|
*/
|
@@ -701,11 +788,11 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
701
788
|
/**
|
702
789
|
* Body of the message.
|
703
790
|
*/
|
704
|
-
get body(): string;
|
791
|
+
get body(): string | null;
|
705
792
|
/**
|
706
793
|
* Date this message was last updated on.
|
707
794
|
*/
|
708
|
-
get dateUpdated(): Date;
|
795
|
+
get dateUpdated(): Date | null;
|
709
796
|
/**
|
710
797
|
* Index of the message in the conversation's messages list.
|
711
798
|
* By design of the Conversations system, the message indices may have arbitrary gaps between them,
|
@@ -721,24 +808,24 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
721
808
|
/**
|
722
809
|
* Identity of the last user that updated the message.
|
723
810
|
*/
|
724
|
-
get lastUpdatedBy(): string;
|
811
|
+
get lastUpdatedBy(): string | null;
|
725
812
|
/**
|
726
813
|
* Date this message was created on.
|
727
814
|
*/
|
728
|
-
get dateCreated(): Date;
|
815
|
+
get dateCreated(): Date | null;
|
729
816
|
/**
|
730
817
|
* Custom attributes of the message.
|
731
818
|
*/
|
732
|
-
get attributes():
|
819
|
+
get attributes(): JSONValue;
|
733
820
|
/**
|
734
|
-
*
|
821
|
+
* Type of the message.
|
735
822
|
*/
|
736
823
|
get type(): MessageType;
|
737
824
|
/**
|
738
|
-
* One of the attached media.
|
825
|
+
* One of the attached media (if present).
|
739
826
|
* @deprecated Use attachedMedia instead. Note that the latter is now an array.
|
740
827
|
*/
|
741
|
-
get media(): Media;
|
828
|
+
get media(): Media | null;
|
742
829
|
/**
|
743
830
|
* Return all media attachments, except email body/history attachments, without temporary urls.
|
744
831
|
*/
|
@@ -746,7 +833,7 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
746
833
|
/**
|
747
834
|
* The server-assigned unique identifier of the authoring participant.
|
748
835
|
*/
|
749
|
-
get participantSid(): string;
|
836
|
+
get participantSid(): string | null;
|
750
837
|
/**
|
751
838
|
* Aggregated information about the message delivery statuses across all participants of a conversation..
|
752
839
|
*/
|
@@ -758,6 +845,18 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
758
845
|
* @returns Array of media descriptors matching given categories.
|
759
846
|
*/
|
760
847
|
getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null;
|
848
|
+
/**
|
849
|
+
* Get a media descriptor for an email body attachment of a provided type.
|
850
|
+
* Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
|
851
|
+
* @param type Type of email body to request, defaults to `text/plain`.
|
852
|
+
*/
|
853
|
+
getEmailBody(type?: string): Media | null;
|
854
|
+
/**
|
855
|
+
* Get a media descriptor for an email history attachment of a provided type.
|
856
|
+
* Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
|
857
|
+
* @param type Type of email history to request, defaults to `text/plain`.
|
858
|
+
*/
|
859
|
+
getEmailHistory(type?: string): Media | null;
|
761
860
|
_update(data: any): void;
|
762
861
|
/**
|
763
862
|
* Get the participant who is the author of the message.
|
@@ -780,12 +879,12 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
780
879
|
* Edit the message attributes.
|
781
880
|
* @param attributes New attributes.
|
782
881
|
*/
|
783
|
-
updateAttributes(attributes:
|
882
|
+
updateAttributes(attributes: JSONValue): Promise<Message>;
|
784
883
|
/**
|
785
884
|
* Get content URLs for all media attachments in the given set using single operation.
|
786
885
|
* @param contentSet Set of media attachments to query for content URL.
|
787
886
|
*/
|
788
|
-
attachTemporaryUrlsFor(contentSet: Media[]): Promise<Media[]>;
|
887
|
+
attachTemporaryUrlsFor(contentSet: Media[] | null): Promise<Media[]>;
|
789
888
|
private _getDetailedDeliveryReceiptsPaginator;
|
790
889
|
}
|
791
890
|
/**
|
@@ -867,9 +966,9 @@ declare class TypingIndicator {
|
|
867
966
|
declare class UnsentMessage {
|
868
967
|
private messagesEntity;
|
869
968
|
text?: string;
|
870
|
-
attributes:
|
969
|
+
attributes: JSONValue;
|
871
970
|
mediaContent: [MediaCategory, FormData | SendMediaOptions][];
|
872
|
-
emailOptions
|
971
|
+
emailOptions: SendEmailOptions;
|
873
972
|
/**
|
874
973
|
* @internal
|
875
974
|
*/
|
@@ -878,7 +977,154 @@ declare class UnsentMessage {
|
|
878
977
|
* Send the prepared message to the conversation.
|
879
978
|
* @returns Index of the new message in the conversation.
|
880
979
|
*/
|
881
|
-
send(): Promise<number>;
|
980
|
+
send(): Promise<number | null>;
|
981
|
+
}
|
982
|
+
/**
|
983
|
+
* Pagination helper class.
|
984
|
+
*/
|
985
|
+
declare class RestPaginator<T> implements Paginator<T> {
|
986
|
+
private state;
|
987
|
+
/**
|
988
|
+
* Indicates the existence of the next page.
|
989
|
+
*/
|
990
|
+
get hasNextPage(): boolean;
|
991
|
+
/**
|
992
|
+
* Indicates the existence of the previous page
|
993
|
+
*/
|
994
|
+
get hasPrevPage(): boolean;
|
995
|
+
/**
|
996
|
+
* Array of elements on the current page.
|
997
|
+
*/
|
998
|
+
get items(): T[];
|
999
|
+
/**
|
1000
|
+
* @internal
|
1001
|
+
*/
|
1002
|
+
constructor(items: any, source: any, prevToken: any, nextToken: any);
|
1003
|
+
/**
|
1004
|
+
* Request the next page. Does not modify the existing object.
|
1005
|
+
*/
|
1006
|
+
nextPage(): Promise<RestPaginator<T>>;
|
1007
|
+
/**
|
1008
|
+
* Request the previous page. Does not modify the existing object.
|
1009
|
+
*/
|
1010
|
+
prevPage(): Promise<RestPaginator<T>>;
|
1011
|
+
}
|
1012
|
+
/**
|
1013
|
+
* @classdesc Pagination helper class for Sync
|
1014
|
+
*
|
1015
|
+
* @property {Array} items Array of elements on current page
|
1016
|
+
* @property {boolean} hasNextPage
|
1017
|
+
* @property {boolean} hasPrevPage
|
1018
|
+
*/
|
1019
|
+
declare class SyncPaginator<T> implements Paginator<T> {
|
1020
|
+
private state;
|
1021
|
+
hasNextPage: boolean;
|
1022
|
+
hasPrevPage: boolean;
|
1023
|
+
get items(): T[];
|
1024
|
+
/**
|
1025
|
+
* @param {Array} items Array of element for current page
|
1026
|
+
* @param {Object} params
|
1027
|
+
*/
|
1028
|
+
constructor(items: any, pageSize: any, anchor: any, direction: any, source: any);
|
1029
|
+
nextPage(): Promise<RestPaginator<T>>;
|
1030
|
+
prevPage(): Promise<SyncPaginator<T> | RestPaginator<T>>;
|
1031
|
+
}
|
1032
|
+
interface MessageResponse {
|
1033
|
+
account_sid: string;
|
1034
|
+
chat_service_sid: string;
|
1035
|
+
conversation_sid: string;
|
1036
|
+
sid: string;
|
1037
|
+
index: number;
|
1038
|
+
attributes: string;
|
1039
|
+
author: string;
|
1040
|
+
participant_sid: string;
|
1041
|
+
body: string;
|
1042
|
+
subject: string;
|
1043
|
+
date_created: string;
|
1044
|
+
date_updated: string;
|
1045
|
+
url: string;
|
1046
|
+
media: {
|
1047
|
+
sid: string;
|
1048
|
+
size: string;
|
1049
|
+
content_type: string;
|
1050
|
+
filename: string;
|
1051
|
+
}[] | null;
|
1052
|
+
links: {
|
1053
|
+
conversation: string;
|
1054
|
+
messages_receipts: string;
|
1055
|
+
};
|
1056
|
+
}
|
1057
|
+
type MessagesEvents = {
|
1058
|
+
messageAdded: (message: Message) => void;
|
1059
|
+
messageRemoved: (message: Message) => void;
|
1060
|
+
messageUpdated: (data: {
|
1061
|
+
message: Message;
|
1062
|
+
updateReasons: MessageUpdateReason[];
|
1063
|
+
}) => void;
|
1064
|
+
};
|
1065
|
+
interface MessagesServices {
|
1066
|
+
mcsClient: McsClient;
|
1067
|
+
network: Network;
|
1068
|
+
syncClient: SyncClient;
|
1069
|
+
commandExecutor: CommandExecutor;
|
1070
|
+
}
|
1071
|
+
/**
|
1072
|
+
* Represents the collection of messages in a conversation
|
1073
|
+
*/
|
1074
|
+
declare class Messages extends ReplayEventEmitter<MessagesEvents> {
|
1075
|
+
readonly conversation: Conversation;
|
1076
|
+
private readonly configuration;
|
1077
|
+
private readonly services;
|
1078
|
+
private readonly messagesByIndex;
|
1079
|
+
private messagesListPromise;
|
1080
|
+
constructor(conversation: Conversation, configuration: Configuration, services: MessagesServices);
|
1081
|
+
/**
|
1082
|
+
* Subscribe to the Messages Event Stream
|
1083
|
+
* @param name - The name of Sync object for the Messages resource.
|
1084
|
+
*/
|
1085
|
+
subscribe(name: string): Promise<SyncList>;
|
1086
|
+
unsubscribe(): Promise<void>;
|
1087
|
+
/**
|
1088
|
+
* Send Message to the conversation, message could include both text and multiple media attachments.
|
1089
|
+
* @param message Message to post
|
1090
|
+
* @returns Returns a promise which can fail
|
1091
|
+
*/
|
1092
|
+
sendV2(message: UnsentMessage): Promise<MessageResponse>;
|
1093
|
+
/**
|
1094
|
+
* Send Message to the conversation
|
1095
|
+
* @param message Message to post
|
1096
|
+
* @param attributes Message attributes
|
1097
|
+
* @param emailOptions Options that modify E-mail integration behaviors.
|
1098
|
+
* @returns Returns promise which can fail
|
1099
|
+
*/
|
1100
|
+
send(message: null | string | FormData | SendMediaOptions, attributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<MessageResponse>;
|
1101
|
+
/**
|
1102
|
+
* Send Media Message to the conversation
|
1103
|
+
* @param mediaContent Media content to post
|
1104
|
+
* @param attributes Message attributes
|
1105
|
+
* @param emailOptions Email options
|
1106
|
+
* @returns Returns promise which can fail
|
1107
|
+
*/
|
1108
|
+
sendMedia(mediaContent: FormData | SendMediaOptions, attributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<MessageResponse>;
|
1109
|
+
/**
|
1110
|
+
* Returns messages from conversation using paginator interface
|
1111
|
+
* @param pageSize Number of messages to return in single chunk. By default it's 30.
|
1112
|
+
* @param anchor Most early message id which is already known, or 'end' by default
|
1113
|
+
* @param direction Pagination order 'backwards' or 'forward', 'forward' by default
|
1114
|
+
* @returns Last page of messages by default
|
1115
|
+
*/
|
1116
|
+
getMessages(pageSize: number | undefined, anchor: number | "end" | undefined, direction?: "forward" | "backwards"): Promise<SyncPaginator<Message>>;
|
1117
|
+
private _wrapPaginator;
|
1118
|
+
private _upsertMessage;
|
1119
|
+
/**
|
1120
|
+
* Returns last messages from conversation
|
1121
|
+
* @param {Number} [pageSize] Number of messages to return in single chunk. By default it's 30.
|
1122
|
+
* @param {String} [anchor] Most early message id which is already known, or 'end' by default
|
1123
|
+
* @param {String} [direction] Pagination order 'backwards' or 'forward', or 'forward' by default
|
1124
|
+
* @returns {Promise<SyncPaginator<Message>>} last page of messages by default
|
1125
|
+
* @private
|
1126
|
+
*/
|
1127
|
+
private _getMessages;
|
882
1128
|
}
|
883
1129
|
/**
|
884
1130
|
* Message builder. Allows the message to be built and sent via method chaining.
|
@@ -898,10 +1144,12 @@ declare class UnsentMessage {
|
|
898
1144
|
declare class MessageBuilder {
|
899
1145
|
private readonly limits;
|
900
1146
|
private readonly message;
|
1147
|
+
private emailBodies;
|
1148
|
+
private emailHistories;
|
901
1149
|
/**
|
902
1150
|
* @internal
|
903
1151
|
*/
|
904
|
-
constructor(limits:
|
1152
|
+
constructor(limits: ConversationLimits, messagesEntity: Messages);
|
905
1153
|
/**
|
906
1154
|
* Sets the message body.
|
907
1155
|
* @param text Contents of the body.
|
@@ -916,7 +1164,19 @@ declare class MessageBuilder {
|
|
916
1164
|
* Sets the message attributes.
|
917
1165
|
* @param attributes Message attributes.
|
918
1166
|
*/
|
919
|
-
setAttributes(attributes:
|
1167
|
+
setAttributes(attributes: JSONValue): MessageBuilder;
|
1168
|
+
/**
|
1169
|
+
* Set email body with given MIME-type.
|
1170
|
+
* @param mimeType Format of the body to set (text/plain or text/html).
|
1171
|
+
* @param body Body payload in selected format.
|
1172
|
+
*/
|
1173
|
+
setEmailBody(mimeType: string, body: FormData | SendMediaOptions): MessageBuilder;
|
1174
|
+
/**
|
1175
|
+
* Set email history with given MIME-type.
|
1176
|
+
* @param mimeType Format of the history to set (text/plain or text/html).
|
1177
|
+
* @param history History payload in selected format.
|
1178
|
+
*/
|
1179
|
+
setEmailHistory(mimeType: string, history: FormData | SendMediaOptions): MessageBuilder;
|
920
1180
|
/**
|
921
1181
|
* Adds media to the message.
|
922
1182
|
* @param payload Media to add.
|
@@ -961,13 +1221,14 @@ interface ConversationDescriptor {
|
|
961
1221
|
channel: string;
|
962
1222
|
entityName: string;
|
963
1223
|
uniqueName: string;
|
964
|
-
attributes:
|
1224
|
+
attributes: JSONValue;
|
965
1225
|
createdBy?: string;
|
966
1226
|
friendlyName?: string;
|
967
1227
|
lastConsumedMessageIndex: number;
|
968
|
-
dateCreated:
|
969
|
-
dateUpdated:
|
1228
|
+
dateCreated: Date | null;
|
1229
|
+
dateUpdated: Date | null;
|
970
1230
|
notificationLevel?: NotificationLevel;
|
1231
|
+
bindings?: ConversationBindings;
|
971
1232
|
}
|
972
1233
|
interface ConversationLinks {
|
973
1234
|
self: string;
|
@@ -977,7 +1238,7 @@ interface ConversationLinks {
|
|
977
1238
|
/**
|
978
1239
|
* The reason for the `updated` event being emitted by a conversation.
|
979
1240
|
*/
|
980
|
-
type ConversationUpdateReason = "attributes" | "createdBy" | "dateCreated" | "dateUpdated" | "friendlyName" | "lastReadMessageIndex" | "state" | "status" | "uniqueName" | "lastMessage" | "notificationLevel";
|
1241
|
+
type ConversationUpdateReason = "attributes" | "createdBy" | "dateCreated" | "dateUpdated" | "friendlyName" | "lastReadMessageIndex" | "state" | "status" | "uniqueName" | "lastMessage" | "notificationLevel" | "bindings";
|
981
1242
|
/**
|
982
1243
|
* The status of the conversation, relative to the client: whether
|
983
1244
|
* the conversation has been `joined` or the client is
|
@@ -1008,6 +1269,23 @@ interface ConversationUpdatedEventArgs {
|
|
1008
1269
|
conversation: Conversation;
|
1009
1270
|
updateReasons: ConversationUpdateReason[];
|
1010
1271
|
}
|
1272
|
+
/**
|
1273
|
+
* Binding for email conversation.
|
1274
|
+
*/
|
1275
|
+
interface ConversationBindings {
|
1276
|
+
email?: ConversationEmailBinding;
|
1277
|
+
sms?: ConversationSmsBinding;
|
1278
|
+
}
|
1279
|
+
/**
|
1280
|
+
* Binding for email conversation.
|
1281
|
+
*/
|
1282
|
+
interface ConversationEmailBinding {
|
1283
|
+
name?: string;
|
1284
|
+
projected_address: string;
|
1285
|
+
}
|
1286
|
+
interface ConversationSmsBinding {
|
1287
|
+
address?: string;
|
1288
|
+
}
|
1011
1289
|
/**
|
1012
1290
|
* Configuration for attaching a media file to a message.
|
1013
1291
|
* These options can be passed to {@link Conversation.sendMessage} and
|
@@ -1017,7 +1295,7 @@ interface SendMediaOptions {
|
|
1017
1295
|
/**
|
1018
1296
|
* Content type of media.
|
1019
1297
|
*/
|
1020
|
-
contentType: string;
|
1298
|
+
contentType: null | string;
|
1021
1299
|
/**
|
1022
1300
|
* Optional filename.
|
1023
1301
|
*/
|
@@ -1025,7 +1303,7 @@ interface SendMediaOptions {
|
|
1025
1303
|
/**
|
1026
1304
|
* Content to post.
|
1027
1305
|
*/
|
1028
|
-
media: string | Buffer | Blob;
|
1306
|
+
media: null | string | Buffer | Blob;
|
1029
1307
|
}
|
1030
1308
|
/**
|
1031
1309
|
* These options can be passed to {@link Conversation.sendMessage}.
|
@@ -1161,7 +1439,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1161
1439
|
/**
|
1162
1440
|
* Unique name of the conversation.
|
1163
1441
|
*/
|
1164
|
-
get uniqueName(): string;
|
1442
|
+
get uniqueName(): string | null;
|
1165
1443
|
/**
|
1166
1444
|
* Status of the conversation.
|
1167
1445
|
*/
|
@@ -1169,15 +1447,15 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1169
1447
|
/**
|
1170
1448
|
* Name of the conversation.
|
1171
1449
|
*/
|
1172
|
-
get friendlyName(): string;
|
1450
|
+
get friendlyName(): string | null;
|
1173
1451
|
/**
|
1174
1452
|
* Date this conversation was last updated on.
|
1175
1453
|
*/
|
1176
|
-
get dateUpdated():
|
1454
|
+
get dateUpdated(): Date | null;
|
1177
1455
|
/**
|
1178
1456
|
* Date this conversation was created on.
|
1179
1457
|
*/
|
1180
|
-
get dateCreated():
|
1458
|
+
get dateCreated(): Date | null;
|
1181
1459
|
/**
|
1182
1460
|
* Identity of the user that created this conversation.
|
1183
1461
|
*/
|
@@ -1185,7 +1463,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1185
1463
|
/**
|
1186
1464
|
* Custom attributes of the conversation.
|
1187
1465
|
*/
|
1188
|
-
get attributes():
|
1466
|
+
get attributes(): JSONValue;
|
1189
1467
|
/**
|
1190
1468
|
* Index of the last message the user has read in this conversation.
|
1191
1469
|
*/
|
@@ -1193,12 +1471,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1193
1471
|
/**
|
1194
1472
|
* Last message sent to this conversation.
|
1195
1473
|
*/
|
1196
|
-
get lastMessage(): LastMessage;
|
1474
|
+
get lastMessage(): LastMessage | undefined;
|
1197
1475
|
/**
|
1198
1476
|
* User notification level for this conversation.
|
1199
1477
|
*/
|
1200
1478
|
get notificationLevel(): NotificationLevel;
|
1201
|
-
get
|
1479
|
+
get bindings(): ConversationBindings;
|
1480
|
+
get limits(): ConversationLimits;
|
1202
1481
|
/**
|
1203
1482
|
* State of the conversation.
|
1204
1483
|
*/
|
@@ -1208,7 +1487,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1208
1487
|
* This or _subscribeStreams will need to be called before any events on conversation will fire.
|
1209
1488
|
* @internal
|
1210
1489
|
*/
|
1211
|
-
_subscribe(): Promise<
|
1490
|
+
_subscribe(): Promise<void | SyncDocument>;
|
1212
1491
|
/**
|
1213
1492
|
* Load the attributes of this conversation and instantiate its participants and messages.
|
1214
1493
|
* This or _subscribe will need to be called before any events on the conversation will fire.
|
@@ -1222,7 +1501,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1222
1501
|
*/
|
1223
1502
|
_unsubscribe(): Promise<[
|
1224
1503
|
void,
|
1225
|
-
|
1504
|
+
void
|
1226
1505
|
]>;
|
1227
1506
|
/**
|
1228
1507
|
* Set conversation status.
|
@@ -1250,14 +1529,15 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1250
1529
|
* @param identity Identity of the Client to add.
|
1251
1530
|
* @param attributes Attributes to be attached to the participant.
|
1252
1531
|
*/
|
1253
|
-
add(identity: string, attributes?:
|
1532
|
+
add(identity: string, attributes?: JSONValue): Promise<ParticipantResponse>;
|
1254
1533
|
/**
|
1255
1534
|
* Add a non-chat participant to the conversation.
|
1256
1535
|
* @param proxyAddress Proxy (Twilio) address of the participant.
|
1257
1536
|
* @param address User address of the participant.
|
1258
1537
|
* @param attributes Attributes to be attached to the participant.
|
1538
|
+
* @param bindingOptions Options for adding email participants - name and CC/To level.
|
1259
1539
|
*/
|
1260
|
-
addNonChatParticipant(proxyAddress: string, address: string, attributes?:
|
1540
|
+
addNonChatParticipant(proxyAddress: string, address: string, attributes?: JSONValue, bindingOptions?: ParticipantBindingOptions): Promise<ParticipantResponse>;
|
1261
1541
|
/**
|
1262
1542
|
* Advance the conversation's last read message index to the current read horizon.
|
1263
1543
|
* Rejects if the user is not a participant of the conversation.
|
@@ -1273,7 +1553,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1273
1553
|
/**
|
1274
1554
|
* Get the custom attributes of this Conversation.
|
1275
1555
|
*/
|
1276
|
-
getAttributes(): Promise<
|
1556
|
+
getAttributes(): Promise<JSONValue>;
|
1277
1557
|
/**
|
1278
1558
|
* Returns messages from the conversation using the paginator interface.
|
1279
1559
|
* @param pageSize Number of messages to return in a single chunk. Default is 30.
|
@@ -1302,12 +1582,12 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1302
1582
|
* Get a participant by its SID.
|
1303
1583
|
* @param participantSid Participant SID.
|
1304
1584
|
*/
|
1305
|
-
getParticipantBySid(participantSid: string): Promise<Participant>;
|
1585
|
+
getParticipantBySid(participantSid: string): Promise<Participant | null>;
|
1306
1586
|
/**
|
1307
1587
|
* Get a participant by its identity.
|
1308
1588
|
* @param identity Participant identity.
|
1309
1589
|
*/
|
1310
|
-
getParticipantByIdentity(identity
|
1590
|
+
getParticipantByIdentity(identity?: string | null): Promise<Participant | null>;
|
1311
1591
|
/**
|
1312
1592
|
* Get the total message count in the conversation.
|
1313
1593
|
*
|
@@ -1348,6 +1628,8 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1348
1628
|
* argument, it will assume that the string is an identity or SID.
|
1349
1629
|
* @param participant Identity, SID or the participant object to remove.
|
1350
1630
|
*/
|
1631
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
1632
|
+
// @ts-ignore TODO: fix validateTypesAsync typing
|
1351
1633
|
removeParticipant(participant: string | Participant): Promise<void>;
|
1352
1634
|
/**
|
1353
1635
|
* Send a message to the conversation.
|
@@ -1357,10 +1639,11 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1357
1639
|
* @param emailOptions Email options for the message.
|
1358
1640
|
* @return Index of the new message.
|
1359
1641
|
*/
|
1360
|
-
sendMessage(message: string | FormData | SendMediaOptions
|
1642
|
+
sendMessage(message: null | string | FormData | SendMediaOptions, messageAttributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<number>;
|
1361
1643
|
/**
|
1362
1644
|
* New interface to prepare for sending a message.
|
1363
1645
|
* Use instead of `sendMessage`.
|
1646
|
+
* @return A MessageBuilder to help set all message sending options.
|
1364
1647
|
*/
|
1365
1648
|
prepareMessage(): MessageBuilder;
|
1366
1649
|
/**
|
@@ -1387,7 +1670,7 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1387
1670
|
* Update the attributes of the conversation.
|
1388
1671
|
* @param attributes New attributes.
|
1389
1672
|
*/
|
1390
|
-
updateAttributes(attributes:
|
1673
|
+
updateAttributes(attributes: JSONValue): Promise<Conversation>;
|
1391
1674
|
/**
|
1392
1675
|
* Update the friendly name of the conversation.
|
1393
1676
|
* @param friendlyName New friendly name.
|
@@ -1412,13 +1695,13 @@ type ConversationsDataSource = "sync" | "chat" | "rest";
|
|
1412
1695
|
*/
|
1413
1696
|
type PushNotificationType = "twilio.conversations.new_message" | "twilio.conversations.added_to_conversation" | "twilio.conversations.removed_from_conversation";
|
1414
1697
|
interface PushNotificationDescriptor {
|
1415
|
-
title: string;
|
1416
|
-
body: string;
|
1417
|
-
sound: string;
|
1418
|
-
badge: number;
|
1419
|
-
action: string;
|
1698
|
+
title: string | null;
|
1699
|
+
body: string | null;
|
1700
|
+
sound: string | null;
|
1701
|
+
badge: number | null;
|
1702
|
+
action: string | null;
|
1420
1703
|
type: PushNotificationType;
|
1421
|
-
data:
|
1704
|
+
data: Record<string, unknown>;
|
1422
1705
|
}
|
1423
1706
|
/**
|
1424
1707
|
* Additional data for a given push notification.
|
@@ -1444,23 +1727,23 @@ declare class PushNotification {
|
|
1444
1727
|
/**
|
1445
1728
|
* Title of the notification.
|
1446
1729
|
*/
|
1447
|
-
readonly title: string;
|
1730
|
+
readonly title: string | null;
|
1448
1731
|
/**
|
1449
1732
|
* Text of the notification.
|
1450
1733
|
*/
|
1451
|
-
readonly body: string;
|
1734
|
+
readonly body: string | null;
|
1452
1735
|
/**
|
1453
1736
|
* Sound of the notification.
|
1454
1737
|
*/
|
1455
|
-
readonly sound: string;
|
1738
|
+
readonly sound: string | null;
|
1456
1739
|
/**
|
1457
1740
|
* Number of the badge.
|
1458
1741
|
*/
|
1459
|
-
readonly badge: number;
|
1742
|
+
readonly badge: number | null;
|
1460
1743
|
/**
|
1461
1744
|
* Notification action (`click_action` in FCM terms and `category` in APN terms).
|
1462
1745
|
*/
|
1463
|
-
readonly action: string;
|
1746
|
+
readonly action: string | null;
|
1464
1747
|
/**
|
1465
1748
|
* Type of the notification.
|
1466
1749
|
*/
|
@@ -1536,7 +1819,7 @@ type State = "failed" | "initialized";
|
|
1536
1819
|
* * `'apn'`
|
1537
1820
|
*/
|
1538
1821
|
type NotificationsChannelType = ChannelType;
|
1539
|
-
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent"
|
1822
|
+
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
|
1540
1823
|
/**
|
1541
1824
|
* Conversations client options.
|
1542
1825
|
*/
|
@@ -1556,15 +1839,17 @@ interface ClientOptions {
|
|
1556
1839
|
httpCacheIntervalOverride?: string;
|
1557
1840
|
userInfosToSubscribeOverride?: number;
|
1558
1841
|
retryWhenThrottledOverride?: boolean;
|
1559
|
-
backoffConfigOverride?:
|
1560
|
-
Chat?:
|
1561
|
-
IPMessaging?:
|
1562
|
-
Sync?:
|
1563
|
-
Notification?:
|
1564
|
-
Twilsock?:
|
1565
|
-
clientMetadata?:
|
1842
|
+
backoffConfigOverride?: Record<string, unknown>;
|
1843
|
+
Chat?: ClientOptions;
|
1844
|
+
IPMessaging?: ClientOptions;
|
1845
|
+
Sync?: Record<string, unknown>;
|
1846
|
+
Notification?: Record<string, unknown>;
|
1847
|
+
Twilsock?: Record<string, unknown>;
|
1848
|
+
clientMetadata?: Record<string, unknown>;
|
1566
1849
|
initRegistrations?: InitRegistration[];
|
1567
1850
|
disableDeepClone?: boolean;
|
1851
|
+
typingUri?: string;
|
1852
|
+
apiUri?: string;
|
1568
1853
|
}
|
1569
1854
|
/**
|
1570
1855
|
* Options for {@link Client.createConversation}.
|
@@ -1573,7 +1858,7 @@ interface CreateConversationOptions {
|
|
1573
1858
|
/**
|
1574
1859
|
* Any custom attributes to attach to the conversation.
|
1575
1860
|
*/
|
1576
|
-
attributes?:
|
1861
|
+
attributes?: JSONValue;
|
1577
1862
|
/**
|
1578
1863
|
* A non-unique display name of the conversation.
|
1579
1864
|
*/
|
@@ -1620,7 +1905,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1620
1905
|
* @param options Options to customize the Client
|
1621
1906
|
* @returns A not yet fully-initialized client.
|
1622
1907
|
*/
|
1623
|
-
constructor(fpaToken: string, options?: ClientOptions);
|
1908
|
+
constructor(fpaToken: string, options?: ClientOptions | null);
|
1624
1909
|
static populateInitRegistrations(reg: InitRegistration): void;
|
1625
1910
|
/**
|
1626
1911
|
* Fired when a conversation becomes visible to the client. The event is also triggered when the client creates a new conversation.
|
@@ -1828,7 +2113,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1828
2113
|
* @param options Options to customize the client.
|
1829
2114
|
* @returns Returns a fully initialized client.
|
1830
2115
|
*/
|
1831
|
-
static create(token: string, options?: ClientOptions): Promise<Client>;
|
2116
|
+
static create(token: string, options?: ClientOptions | null): Promise<Client>;
|
1832
2117
|
/**
|
1833
2118
|
* Information of the logged-in user. Before client initialization, returns an
|
1834
2119
|
* uninitialized user. Will trigger a {@link Client.userUpdated} event after
|
@@ -1866,7 +2151,7 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1866
2151
|
/**
|
1867
2152
|
* Get the current list of all the subscribed conversations.
|
1868
2153
|
*/
|
1869
|
-
getSubscribedConversations(
|
2154
|
+
getSubscribedConversations(): Promise<Paginator<Conversation>>;
|
1870
2155
|
/**
|
1871
2156
|
* Create a conversation on the server and subscribe to its events.
|
1872
2157
|
* The default is a conversation with an empty friendly name.
|
@@ -1920,36 +2205,6 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1920
2205
|
*/
|
1921
2206
|
getSubscribedUsers(): Promise<Array<User>>;
|
1922
2207
|
}
|
1923
|
-
/**
|
1924
|
-
* Pagination helper class.
|
1925
|
-
*/
|
1926
|
-
declare class RestPaginator<T> implements Paginator<T> {
|
1927
|
-
private state;
|
1928
|
-
/**
|
1929
|
-
* Indicates the existence of the next page.
|
1930
|
-
*/
|
1931
|
-
get hasNextPage(): boolean;
|
1932
|
-
/**
|
1933
|
-
* Indicates the existence of the previous page
|
1934
|
-
*/
|
1935
|
-
get hasPrevPage(): boolean;
|
1936
|
-
/**
|
1937
|
-
* Array of elements on the current page.
|
1938
|
-
*/
|
1939
|
-
get items(): Array<T>;
|
1940
|
-
/**
|
1941
|
-
* @internal
|
1942
|
-
*/
|
1943
|
-
constructor(items: any, source: any, prevToken: any, nextToken: any);
|
1944
|
-
/**
|
1945
|
-
* Request the next page. Does not modify the existing object.
|
1946
|
-
*/
|
1947
|
-
nextPage(): Promise<RestPaginator<T>>;
|
1948
|
-
/**
|
1949
|
-
* Request the previous page. Does not modify the existing object.
|
1950
|
-
*/
|
1951
|
-
prevPage(): Promise<RestPaginator<T>>;
|
1952
|
-
}
|
1953
2208
|
declare class NotificationTypes {
|
1954
2209
|
static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";
|
1955
2210
|
static readonly NEW_MESSAGE = "twilio.conversations.new_message";
|
@@ -1958,4 +2213,4 @@ declare class NotificationTypes {
|
|
1958
2213
|
static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
|
1959
2214
|
static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
|
1960
2215
|
}
|
1961
|
-
export { Conversation, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions };
|
2216
|
+
export { Conversation, ConversationBindings, ConversationEmailBinding, ConversationUpdateReason, ConversationStatus, NotificationLevel, ConversationState, ConversationUpdatedEventArgs, SendMediaOptions, SendEmailOptions, LastMessage, Participant, ParticipantUpdateReason, ParticipantType, ParticipantUpdatedEventArgs, ParticipantBindings, ParticipantEmailBinding, ParticipantEmailLevel, Message, MessageUpdateReason, MessageType, MessageUpdatedEventArgs, Media, MediaCategory$0 as MediaCategory, AggregatedDeliveryReceipt, DeliveryAmount, DetailedDeliveryReceipt, DeliveryStatus, RestPaginator, MessageBuilder, UnsentMessage, Paginator, ParticipantBindingOptions, User, UserUpdateReason, UserUpdatedEventArgs, PushNotification, PushNotificationType, PushNotificationDescriptor, PushNotificationData, NotificationTypes, Client, State, ConnectionState, NotificationsChannelType, ClientOptions, CreateConversationOptions, ConversationLimits, JSONValue, JSONObject, JSONArray };
|