@twilio/conversations 2.1.0-rc.8 → 2.2.0-rc.10
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 +214 -0
- package/README.md +8 -4
- package/builds/browser.js +2916 -1975
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +574 -284
- package/builds/lib.js +2916 -1975
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +27258 -11899
- package/builds/twilio-conversations.min.js +1 -16
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/client.js +466 -281
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +2 -2
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +428 -369
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +25 -13
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +56 -32
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +21 -12
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +2 -2
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/interfaces/attributes.js.map +1 -1
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/logger.js +2 -4
- package/dist/logger.js.map +1 -1
- package/dist/media.js +36 -25
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +24 -18
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +89 -17
- package/dist/message.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +2 -2
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +1 -1
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +13 -3
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +2 -2
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/CancellablePromise.html +3213 -0
- package/docs/classes/Client.html +243 -58
- package/docs/classes/Conversation.html +99 -47
- package/docs/classes/Media.html +2 -28
- package/docs/classes/Message.html +94 -39
- package/docs/classes/MessageBuilder.html +31 -8
- package/docs/classes/PushNotification.html +1 -1
- package/docs/classes/UnsentMessage.html +2 -2
- package/docs/index.html +25 -28
- package/docs/interfaces/ConversationLimits.html +12 -12
- package/docs/interfaces/ConversationState.html +2 -2
- package/docs/interfaces/ConversationUpdatedEventArgs.html +3001 -0
- package/docs/interfaces/PushNotificationData.html +48 -0
- package/docs/modules.html +24 -27
- package/package.json +24 -20
package/builds/lib.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { SyncClient, SyncDocument, SyncList } from "twilio-sync";
|
2
3
|
import { LogLevelDesc } from "loglevel";
|
3
4
|
import { Transport, TwilsockClient, InitRegistration, TransportResult } from "twilsock";
|
@@ -5,7 +6,7 @@ import { ConnectionState as TwilsockConnectionState } from "twilsock";
|
|
5
6
|
import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
|
6
7
|
import { ChannelType, Notifications } from "@twilio/notifications";
|
7
8
|
import { Notifications as NotificationClient } from "@twilio/notifications";
|
8
|
-
import { McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
|
9
|
+
import { CancellablePromise, McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
|
9
10
|
import { MediaCategory as McsMediaCategory } from "@twilio/mcs-client";
|
10
11
|
interface ConfigurationResponse {
|
11
12
|
options: {
|
@@ -72,13 +73,13 @@ interface ConversationLimits {
|
|
72
73
|
*/
|
73
74
|
mediaAttachmentsTotalSizeLimitInMb: number;
|
74
75
|
/**
|
75
|
-
* Allowed
|
76
|
+
* Allowed content types for E-Mail histories.
|
76
77
|
*/
|
77
|
-
|
78
|
+
emailHistoriesAllowedContentTypes: string[];
|
78
79
|
/**
|
79
|
-
* Allowed
|
80
|
+
* Allowed content types for E-Mail bodies.
|
80
81
|
*/
|
81
|
-
|
82
|
+
emailBodiesAllowedContentTypes: string[];
|
82
83
|
}
|
83
84
|
interface BackoffConfiguration {
|
84
85
|
min: number;
|
@@ -301,7 +302,7 @@ declare class Users extends ReplayEventEmitter<UsersEvents> {
|
|
301
302
|
* if not - then subscribes and adds user to the FIFO stack
|
302
303
|
* @returns {Promise<User>} Fully initialized user
|
303
304
|
*/
|
304
|
-
getUser(identity
|
305
|
+
getUser(identity: string, entityName?: string): Promise<User>;
|
305
306
|
/**
|
306
307
|
* @returns {Promise<Array<User>>} returns list of subscribed User objects {@see User}
|
307
308
|
*/
|
@@ -326,9 +327,9 @@ interface ParticipantDescriptor {
|
|
326
327
|
identity: string;
|
327
328
|
roleSid?: string;
|
328
329
|
lastConsumedMessageIndex: number | null;
|
329
|
-
lastConsumptionTimestamp: number;
|
330
|
+
lastConsumptionTimestamp: number | null;
|
330
331
|
type: ParticipantType;
|
331
|
-
userInfo
|
332
|
+
userInfo?: string;
|
332
333
|
bindings?: ParticipantBindings;
|
333
334
|
}
|
334
335
|
interface ParticipantServices {
|
@@ -499,9 +500,9 @@ interface ParticipantResponse {
|
|
499
500
|
attributes: string;
|
500
501
|
date_created: string;
|
501
502
|
date_updated: string;
|
502
|
-
identity: string
|
503
|
+
identity: string;
|
503
504
|
messaging_binding: {
|
504
|
-
type:
|
505
|
+
type: "chat" | "sms" | "whatsapp" | "email";
|
505
506
|
address: string;
|
506
507
|
proxy_address: string;
|
507
508
|
} | null;
|
@@ -568,17 +569,7 @@ declare class Media {
|
|
568
569
|
* If the URL becomes expired, you need to request a new one.
|
569
570
|
* Each call to this function produces a new temporary URL.
|
570
571
|
*/
|
571
|
-
getContentTemporaryUrl():
|
572
|
-
/**
|
573
|
-
* Returns cached direct content URL for the media.
|
574
|
-
*
|
575
|
-
* This URL will expire in several minutes. This function does not refresh the URL and can be used to query it several times
|
576
|
-
* without causing network traffic.
|
577
|
-
* If the URL becomes expired, you need to request a new one using getContentTemporaryUrl().
|
578
|
-
*
|
579
|
-
* @returns {Promise<String>}
|
580
|
-
*/
|
581
|
-
getCachedTemporaryUrl(): Promise<string | null>;
|
572
|
+
getContentTemporaryUrl(): CancellablePromise<string | null>;
|
582
573
|
private _fetchMcsMedia;
|
583
574
|
}
|
584
575
|
/**
|
@@ -857,21 +848,29 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
857
848
|
*/
|
858
849
|
get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null;
|
859
850
|
/**
|
851
|
+
* @deprecated
|
860
852
|
* Return a (possibly empty) array of media matching a specific set of categories.
|
861
853
|
* Allowed category is so far only 'media'.
|
862
854
|
* @param categories Array of categories to match.
|
863
855
|
* @returns Array of media descriptors matching given categories.
|
864
856
|
*/
|
865
857
|
getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null;
|
858
|
+
/**
|
859
|
+
* Return a (possibly empty) array of media matching a specific set of categories.
|
860
|
+
* Allowed category is so far only 'media'.
|
861
|
+
* @param categories Array of categories to match.
|
862
|
+
* @returns Array of media descriptors matching given categories.
|
863
|
+
*/
|
864
|
+
getMediaByCategories(categories: MediaCategory[]): Media[] | null;
|
866
865
|
/**
|
867
866
|
* Get a media descriptor for an email body attachment of a provided type.
|
868
|
-
* Allowed body types are returned in the Conversation.limits().
|
867
|
+
* Allowed body types are returned in the Conversation.limits().emailBodiesAllowedContentTypes array.
|
869
868
|
* @param type Type of email body to request, defaults to `text/plain`.
|
870
869
|
*/
|
871
870
|
getEmailBody(type?: string): Media | null;
|
872
871
|
/**
|
873
872
|
* Get a media descriptor for an email history attachment of a provided type.
|
874
|
-
* Allowed body types are returned in the Conversation.limits().
|
873
|
+
* Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedContentTypes array.
|
875
874
|
* @param type Type of email history to request, defaults to `text/plain`.
|
876
875
|
*/
|
877
876
|
getEmailHistory(type?: string): Media | null;
|
@@ -899,10 +898,25 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
|
|
899
898
|
*/
|
900
899
|
updateAttributes(attributes: JSONValue): Promise<Message>;
|
901
900
|
/**
|
902
|
-
*
|
903
|
-
*
|
901
|
+
* @deprecated
|
902
|
+
* Get content URLs for all media attachments in the given set using a single operation.
|
903
|
+
* @param contentSet Set of media attachments to query content URLs.
|
904
904
|
*/
|
905
905
|
attachTemporaryUrlsFor(contentSet: Media[] | null): Promise<Media[]>;
|
906
|
+
/**
|
907
|
+
* Get content URLs for all media attachments in the given set using a single operation.
|
908
|
+
* @param contentSet Set of media attachments to query content URLs.
|
909
|
+
*/
|
910
|
+
getTemporaryContentUrlsForMedia(contentSet: Media[]): CancellablePromise<Map<string, string>>;
|
911
|
+
/**
|
912
|
+
* Get content URLs for all media attachments in the given set of media sids using a single operation.
|
913
|
+
* @param mediaSids Set of media sids to query for the content URL.
|
914
|
+
*/
|
915
|
+
getTemporaryContentUrlsForMediaSids(mediaSids: string[]): CancellablePromise<Map<string, string>>;
|
916
|
+
/**
|
917
|
+
* Get content URLs for all media attached to the message.
|
918
|
+
*/
|
919
|
+
getTemporaryContentUrlsForAttachedMedia(): CancellablePromise<Map<string, string>>;
|
906
920
|
private _getDetailedDeliveryReceiptsPaginator;
|
907
921
|
}
|
908
922
|
/**
|
@@ -959,7 +973,7 @@ declare class TypingIndicator {
|
|
959
973
|
private sentUpdates;
|
960
974
|
private getConversation;
|
961
975
|
private serviceTypingTimeout;
|
962
|
-
constructor(getConversation:
|
976
|
+
constructor(getConversation: (conversationSid: string) => Promise<Conversation>, config: Configuration, services: TypingIndicatorServices);
|
963
977
|
get typingTimeout(): number;
|
964
978
|
/**
|
965
979
|
* Initialize TypingIndicator controller
|
@@ -978,25 +992,6 @@ declare class TypingIndicator {
|
|
978
992
|
send(conversationSid: string): Promise<void>;
|
979
993
|
private _send;
|
980
994
|
}
|
981
|
-
/**
|
982
|
-
* An unsent message. Returned from {@link MessageBuilder.build}.
|
983
|
-
*/
|
984
|
-
declare class UnsentMessage {
|
985
|
-
private messagesEntity;
|
986
|
-
text?: string;
|
987
|
-
attributes: JSONValue;
|
988
|
-
mediaContent: [MediaCategory, FormData | SendMediaOptions][];
|
989
|
-
emailOptions: SendEmailOptions;
|
990
|
-
/**
|
991
|
-
* @internal
|
992
|
-
*/
|
993
|
-
constructor(messagesEntity: any);
|
994
|
-
/**
|
995
|
-
* Send the prepared message to the conversation.
|
996
|
-
* @returns Index of the new message in the conversation.
|
997
|
-
*/
|
998
|
-
send(): Promise<number | null>;
|
999
|
-
}
|
1000
995
|
/**
|
1001
996
|
* Pagination helper class.
|
1002
997
|
*/
|
@@ -1098,16 +1093,16 @@ declare class Messages extends ReplayEventEmitter<MessagesEvents> {
|
|
1098
1093
|
constructor(conversation: Conversation, configuration: Configuration, services: MessagesServices);
|
1099
1094
|
/**
|
1100
1095
|
* Subscribe to the Messages Event Stream
|
1101
|
-
* @param
|
1096
|
+
* @param arg - Name of the Sync object, or the SyncList itself, that
|
1097
|
+
* represents the Messages resource.
|
1102
1098
|
*/
|
1103
|
-
subscribe(
|
1099
|
+
subscribe(arg: string | SyncList): Promise<SyncList>;
|
1104
1100
|
unsubscribe(): Promise<void>;
|
1105
1101
|
/**
|
1106
|
-
* Send
|
1102
|
+
* Send a message to the conversation. The message could include text and multiple media attachments.
|
1107
1103
|
* @param message Message to post
|
1108
|
-
* @returns Returns a promise which can fail
|
1109
1104
|
*/
|
1110
|
-
sendV2(message: UnsentMessage):
|
1105
|
+
sendV2(message: UnsentMessage): CancellablePromise<MessageResponse>;
|
1111
1106
|
/**
|
1112
1107
|
* Send Message to the conversation
|
1113
1108
|
* @param message Message to post
|
@@ -1144,6 +1139,28 @@ declare class Messages extends ReplayEventEmitter<MessagesEvents> {
|
|
1144
1139
|
*/
|
1145
1140
|
private _getMessages;
|
1146
1141
|
}
|
1142
|
+
/**
|
1143
|
+
* An unsent message. Returned from {@link MessageBuilder.build}.
|
1144
|
+
*/
|
1145
|
+
declare class UnsentMessage {
|
1146
|
+
private messagesEntity;
|
1147
|
+
text?: string;
|
1148
|
+
attributes: JSONValue;
|
1149
|
+
mediaContent: [
|
1150
|
+
MediaCategory,
|
1151
|
+
FormData | SendMediaOptions
|
1152
|
+
][];
|
1153
|
+
emailOptions: SendEmailOptions;
|
1154
|
+
/**
|
1155
|
+
* @internal
|
1156
|
+
*/
|
1157
|
+
constructor(messagesEntity: Messages);
|
1158
|
+
/**
|
1159
|
+
* Send the prepared message to the conversation.
|
1160
|
+
* @returns Index of the new message in the conversation.
|
1161
|
+
*/
|
1162
|
+
send(): CancellablePromise<number | null>;
|
1163
|
+
}
|
1147
1164
|
/**
|
1148
1165
|
* Message builder. Allows the message to be built and sent via method chaining.
|
1149
1166
|
*
|
@@ -1184,17 +1201,17 @@ declare class MessageBuilder {
|
|
1184
1201
|
*/
|
1185
1202
|
setAttributes(attributes: JSONValue): MessageBuilder;
|
1186
1203
|
/**
|
1187
|
-
* Set email body with given
|
1188
|
-
* @param
|
1189
|
-
* @param body Body payload in selected format.
|
1204
|
+
* Set the email body with a given content type.
|
1205
|
+
* @param contentType Format of the body to set (text/plain or text/html).
|
1206
|
+
* @param body Body payload in the selected format.
|
1190
1207
|
*/
|
1191
|
-
setEmailBody(
|
1208
|
+
setEmailBody(contentType: string, body: FormData | SendMediaOptions): MessageBuilder;
|
1192
1209
|
/**
|
1193
|
-
* Set email history with given
|
1194
|
-
* @param
|
1195
|
-
* @param history History payload in selected format.
|
1210
|
+
* Set the email history with a given content type.
|
1211
|
+
* @param contentType Format of the history to set (text/plain or text/html).
|
1212
|
+
* @param history History payload in the selected format.
|
1196
1213
|
*/
|
1197
|
-
setEmailHistory(
|
1214
|
+
setEmailHistory(contentType: string, history: FormData | SendMediaOptions): MessageBuilder;
|
1198
1215
|
/**
|
1199
1216
|
* Adds media to the message.
|
1200
1217
|
* @param payload Media to add.
|
@@ -1204,8 +1221,15 @@ declare class MessageBuilder {
|
|
1204
1221
|
* Builds the message, making it ready to be sent.
|
1205
1222
|
*/
|
1206
1223
|
build(): UnsentMessage;
|
1224
|
+
/**
|
1225
|
+
* Prepares a message and sends it to the conversation.
|
1226
|
+
*/
|
1227
|
+
buildAndSend(): CancellablePromise<number | null>;
|
1207
1228
|
private getPayloadContentType;
|
1208
1229
|
}
|
1230
|
+
/**
|
1231
|
+
* Conversation events.
|
1232
|
+
*/
|
1209
1233
|
type ConversationEvents = {
|
1210
1234
|
participantJoined: (participant: Participant) => void;
|
1211
1235
|
participantLeft: (participant: Participant) => void;
|
@@ -1227,55 +1251,28 @@ type ConversationEvents = {
|
|
1227
1251
|
}) => void;
|
1228
1252
|
removed: (conversation: Conversation) => void;
|
1229
1253
|
};
|
1230
|
-
interface ConversationServices {
|
1231
|
-
users: Users;
|
1232
|
-
typingIndicator: TypingIndicator;
|
1233
|
-
network: Network;
|
1234
|
-
mcsClient: McsClient;
|
1235
|
-
syncClient: SyncClient;
|
1236
|
-
commandExecutor: CommandExecutor;
|
1237
|
-
}
|
1238
|
-
interface ConversationDescriptor {
|
1239
|
-
channel: string;
|
1240
|
-
entityName: string;
|
1241
|
-
uniqueName: string;
|
1242
|
-
attributes: JSONValue;
|
1243
|
-
createdBy?: string;
|
1244
|
-
friendlyName?: string;
|
1245
|
-
lastConsumedMessageIndex: number;
|
1246
|
-
dateCreated: Date | null;
|
1247
|
-
dateUpdated: Date | null;
|
1248
|
-
notificationLevel?: NotificationLevel;
|
1249
|
-
bindings?: ConversationBindings;
|
1250
|
-
}
|
1251
|
-
interface ConversationLinks {
|
1252
|
-
self: string;
|
1253
|
-
messages: string;
|
1254
|
-
participants: string;
|
1255
|
-
}
|
1256
1254
|
/**
|
1257
|
-
*
|
1255
|
+
* Reason for the `updated` event emission by a conversation.
|
1258
1256
|
*/
|
1259
1257
|
type ConversationUpdateReason = "attributes" | "createdBy" | "dateCreated" | "dateUpdated" | "friendlyName" | "lastReadMessageIndex" | "state" | "status" | "uniqueName" | "lastMessage" | "notificationLevel" | "bindings";
|
1260
1258
|
/**
|
1261
|
-
*
|
1262
|
-
*
|
1263
|
-
* `notParticipating` in the conversation.
|
1259
|
+
* Status of the conversation, relative to the client: whether the conversation
|
1260
|
+
* has been `joined` or the client is `notParticipating` in the conversation.
|
1264
1261
|
*/
|
1265
1262
|
type ConversationStatus = "notParticipating" | "joined";
|
1266
1263
|
/**
|
1267
|
-
*
|
1264
|
+
* User's notification level for the conversation. Determines
|
1268
1265
|
* whether the currently logged-in user will receive pushes for events
|
1269
1266
|
* in this conversation. Can be either `muted` or `default`, where
|
1270
1267
|
* `default` defers to the global service push configuration.
|
1271
1268
|
*/
|
1272
1269
|
type NotificationLevel = "default" | "muted";
|
1273
1270
|
/**
|
1274
|
-
*
|
1271
|
+
* State of the conversation.
|
1275
1272
|
*/
|
1276
1273
|
interface ConversationState {
|
1277
1274
|
/**
|
1278
|
-
*
|
1275
|
+
* Current state.
|
1279
1276
|
*/
|
1280
1277
|
current: "active" | "inactive" | "closed";
|
1281
1278
|
/**
|
@@ -1283,6 +1280,9 @@ interface ConversationState {
|
|
1283
1280
|
*/
|
1284
1281
|
dateUpdated: Date;
|
1285
1282
|
}
|
1283
|
+
/**
|
1284
|
+
* Event arguments for the `updated` event.
|
1285
|
+
*/
|
1286
1286
|
interface ConversationUpdatedEventArgs {
|
1287
1287
|
conversation: Conversation;
|
1288
1288
|
updateReasons: ConversationUpdateReason[];
|
@@ -1301,6 +1301,9 @@ interface ConversationEmailBinding {
|
|
1301
1301
|
name?: string;
|
1302
1302
|
projected_address: string;
|
1303
1303
|
}
|
1304
|
+
/**
|
1305
|
+
* Binding for SMS conversation.
|
1306
|
+
*/
|
1304
1307
|
interface ConversationSmsBinding {
|
1305
1308
|
address?: string;
|
1306
1309
|
}
|
@@ -1346,33 +1349,51 @@ interface LastMessage {
|
|
1346
1349
|
dateCreated?: Date;
|
1347
1350
|
}
|
1348
1351
|
/**
|
1349
|
-
*
|
1352
|
+
* Conversation services.
|
1353
|
+
*/
|
1354
|
+
interface ConversationServices {
|
1355
|
+
users: Users;
|
1356
|
+
typingIndicator: TypingIndicator;
|
1357
|
+
network: Network;
|
1358
|
+
mcsClient: McsClient;
|
1359
|
+
syncClient: SyncClient;
|
1360
|
+
commandExecutor: CommandExecutor;
|
1361
|
+
}
|
1362
|
+
/**
|
1363
|
+
* Conversation descriptor.
|
1364
|
+
*/
|
1365
|
+
interface ConversationDescriptor {
|
1366
|
+
channel: string;
|
1367
|
+
entityName: string;
|
1368
|
+
uniqueName: string;
|
1369
|
+
attributes: JSONValue;
|
1370
|
+
createdBy?: string;
|
1371
|
+
friendlyName?: string;
|
1372
|
+
lastConsumedMessageIndex: number;
|
1373
|
+
dateCreated: Date | null;
|
1374
|
+
dateUpdated: Date | null;
|
1375
|
+
notificationLevel?: NotificationLevel;
|
1376
|
+
bindings?: ConversationBindings;
|
1377
|
+
}
|
1378
|
+
/**
|
1379
|
+
* Conversation links.
|
1380
|
+
*/
|
1381
|
+
interface ConversationLinks {
|
1382
|
+
self: string;
|
1383
|
+
messages: string;
|
1384
|
+
participants: string;
|
1385
|
+
}
|
1386
|
+
/**
|
1387
|
+
* A conversation represents communication between multiple Conversations
|
1388
|
+
* clients.
|
1350
1389
|
*/
|
1351
1390
|
declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
1352
|
-
/**
|
1353
|
-
* Unique system identifier of the conversation.
|
1354
|
-
*/
|
1355
|
-
readonly sid: string;
|
1356
|
-
readonly links: ConversationLinks;
|
1357
|
-
private readonly configuration;
|
1358
|
-
private readonly services;
|
1359
|
-
private channelState;
|
1360
|
-
private statusSource;
|
1361
|
-
private entityPromise;
|
1362
|
-
private entityName;
|
1363
|
-
private entity;
|
1364
|
-
private messagesEntity;
|
1365
|
-
private participantsEntity;
|
1366
|
-
private readonly participants;
|
1367
|
-
/**
|
1368
|
-
* @internal
|
1369
|
-
*/
|
1370
|
-
constructor(descriptor: ConversationDescriptor, sid: string, links: ConversationLinks, configuration: Configuration, services: ConversationServices);
|
1371
1391
|
/**
|
1372
1392
|
* Fired when a participant has joined the conversation.
|
1373
1393
|
*
|
1374
1394
|
* Parameters:
|
1375
|
-
* 1. {@link Participant} `participant` - participant that joined the
|
1395
|
+
* 1. {@link Participant} `participant` - participant that joined the
|
1396
|
+
* conversation
|
1376
1397
|
* @event
|
1377
1398
|
*/
|
1378
1399
|
static readonly participantJoined = "participantJoined";
|
@@ -1380,7 +1401,8 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1380
1401
|
* Fired when a participant has left the conversation.
|
1381
1402
|
*
|
1382
1403
|
* Parameters:
|
1383
|
-
* 1. {@link Participant} `participant` - participant that left the
|
1404
|
+
* 1. {@link Participant} `participant` - participant that left the
|
1405
|
+
* conversation
|
1384
1406
|
* @event
|
1385
1407
|
*/
|
1386
1408
|
static readonly participantLeft = "participantLeft";
|
@@ -1388,9 +1410,12 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1388
1410
|
* Fired when data of a participant has been updated.
|
1389
1411
|
*
|
1390
1412
|
* Parameters:
|
1391
|
-
* 1. object `data` - info object provided with the event. It has the
|
1392
|
-
*
|
1393
|
-
* * {@link
|
1413
|
+
* 1. object `data` - info object provided with the event. It has the
|
1414
|
+
* following properties:
|
1415
|
+
* * {@link Participant} `participant` - participant that has received the
|
1416
|
+
* update
|
1417
|
+
* * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons
|
1418
|
+
* for the update
|
1394
1419
|
* @event
|
1395
1420
|
*/
|
1396
1421
|
static readonly participantUpdated = "participantUpdated";
|
@@ -1414,9 +1439,11 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1414
1439
|
* Fired when data of a message has been updated.
|
1415
1440
|
*
|
1416
1441
|
* Parameters:
|
1417
|
-
* 1. object `data` - info object provided with the event. It has the
|
1442
|
+
* 1. object `data` - info object provided with the event. It has the
|
1443
|
+
* following properties:
|
1418
1444
|
* * {@link Message} `message` - message that has received the update
|
1419
|
-
* * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for
|
1445
|
+
* * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for
|
1446
|
+
* the update
|
1420
1447
|
* @event
|
1421
1448
|
*/
|
1422
1449
|
static readonly messageUpdated = "messageUpdated";
|
@@ -1424,7 +1451,8 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1424
1451
|
* Fired when a participant has stopped typing.
|
1425
1452
|
*
|
1426
1453
|
* Parameters:
|
1427
|
-
* 1. {@link Participant} `participant` - the participant that has stopped
|
1454
|
+
* 1. {@link Participant} `participant` - the participant that has stopped
|
1455
|
+
* typing
|
1428
1456
|
* @event
|
1429
1457
|
*/
|
1430
1458
|
static readonly typingEnded = "typingEnded";
|
@@ -1432,7 +1460,8 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1432
1460
|
* Fired when a participant has started typing.
|
1433
1461
|
*
|
1434
1462
|
* Parameters:
|
1435
|
-
* 1. {@link Participant} `participant` - the participant that has started
|
1463
|
+
* 1. {@link Participant} `participant` - the participant that has started
|
1464
|
+
* typing
|
1436
1465
|
* @event
|
1437
1466
|
*/
|
1438
1467
|
static readonly typingStarted = "typingStarted";
|
@@ -1440,20 +1469,95 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1440
1469
|
* Fired when the data of the conversation has been updated.
|
1441
1470
|
*
|
1442
1471
|
* Parameters:
|
1443
|
-
* 1. object `data` - info object provided with the event. It has the
|
1444
|
-
*
|
1445
|
-
* * {@link
|
1472
|
+
* 1. object `data` - info object provided with the event. It has the
|
1473
|
+
* following properties:
|
1474
|
+
* * {@link Conversation} `conversation` - conversation that has received
|
1475
|
+
* the update
|
1476
|
+
* * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons
|
1477
|
+
* for the update
|
1446
1478
|
* @event
|
1447
1479
|
*/
|
1448
1480
|
static readonly updated = "updated";
|
1449
1481
|
/**
|
1450
|
-
* Fired when the conversation was destroyed or the currently-logged-in user
|
1482
|
+
* Fired when the conversation was destroyed or the currently-logged-in user
|
1483
|
+
* has left private conversation.
|
1451
1484
|
*
|
1452
1485
|
* Parameters:
|
1453
1486
|
* 1. {@link Conversation} `conversation` - conversation that has been removed
|
1454
1487
|
* @event
|
1455
1488
|
*/
|
1456
1489
|
static readonly removed = "removed";
|
1490
|
+
/**
|
1491
|
+
* Logger instance.
|
1492
|
+
*/
|
1493
|
+
private static readonly _logger;
|
1494
|
+
/**
|
1495
|
+
* Unique system identifier of the conversation.
|
1496
|
+
*/
|
1497
|
+
readonly sid: string;
|
1498
|
+
/**
|
1499
|
+
* Conversation links for REST requests.
|
1500
|
+
* @internal
|
1501
|
+
*/
|
1502
|
+
readonly _links: ConversationLinks;
|
1503
|
+
/**
|
1504
|
+
* Map of participants.
|
1505
|
+
* @internal
|
1506
|
+
*/
|
1507
|
+
readonly _participants: Map<string, Participant>;
|
1508
|
+
/**
|
1509
|
+
* Configuration of the client that the conversation belongs to.
|
1510
|
+
*/
|
1511
|
+
private readonly _configuration;
|
1512
|
+
/**
|
1513
|
+
* Conversation service objects.
|
1514
|
+
*/
|
1515
|
+
private readonly _services;
|
1516
|
+
/**
|
1517
|
+
* Internal state of the conversation.
|
1518
|
+
*/
|
1519
|
+
private readonly _internalState;
|
1520
|
+
/**
|
1521
|
+
* Name of the conversation entity document.
|
1522
|
+
*/
|
1523
|
+
private readonly _entityName;
|
1524
|
+
/**
|
1525
|
+
* Messages entity.
|
1526
|
+
*/
|
1527
|
+
private readonly _messagesEntity;
|
1528
|
+
/**
|
1529
|
+
* Sync list containing messages.
|
1530
|
+
*/
|
1531
|
+
private _messagesList?;
|
1532
|
+
/**
|
1533
|
+
* Participants entity.
|
1534
|
+
*/
|
1535
|
+
private readonly _participantsEntity;
|
1536
|
+
/**
|
1537
|
+
* Sync map containing participants.
|
1538
|
+
*/
|
1539
|
+
private _participantsMap?;
|
1540
|
+
/**
|
1541
|
+
* Source of the most recent update.
|
1542
|
+
*/
|
1543
|
+
private _dataSource;
|
1544
|
+
/**
|
1545
|
+
* Promise for the conversation entity document.
|
1546
|
+
*/
|
1547
|
+
private _entityPromise;
|
1548
|
+
/**
|
1549
|
+
* Conversation entity document.
|
1550
|
+
*/
|
1551
|
+
private _entity;
|
1552
|
+
/**
|
1553
|
+
* @param descriptor Conversation descriptor.
|
1554
|
+
* @param sid Conversation SID.
|
1555
|
+
* @param links Conversation links for REST requests.
|
1556
|
+
* @param configuration Client configuration.
|
1557
|
+
* @param services Conversation services.
|
1558
|
+
* @internal
|
1559
|
+
*/
|
1560
|
+
constructor(descriptor: ConversationDescriptor, sid: string, links: ConversationLinks, configuration: Configuration, services: ConversationServices);
|
1457
1561
|
/**
|
1458
1562
|
* Unique name of the conversation.
|
1459
1563
|
*/
|
@@ -1494,58 +1598,35 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1494
1598
|
* User notification level for this conversation.
|
1495
1599
|
*/
|
1496
1600
|
get notificationLevel(): NotificationLevel;
|
1497
|
-
get bindings(): ConversationBindings;
|
1498
|
-
get limits(): ConversationLimits;
|
1499
1601
|
/**
|
1500
|
-
*
|
1501
|
-
*/
|
1502
|
-
get state(): ConversationState | undefined;
|
1503
|
-
/**
|
1504
|
-
* Load and subscribe to this conversation and do not subscribe to its participants and messages.
|
1505
|
-
* This or _subscribeStreams will need to be called before any events on conversation will fire.
|
1602
|
+
* Conversation bindings. Undocumented feature (for now).
|
1506
1603
|
* @internal
|
1507
1604
|
*/
|
1508
|
-
|
1605
|
+
get bindings(): ConversationBindings;
|
1509
1606
|
/**
|
1510
|
-
*
|
1511
|
-
* This or _subscribe will need to be called before any events on the conversation will fire.
|
1512
|
-
* This will need to be called before any events on participants or messages will fire
|
1513
|
-
* @internal
|
1607
|
+
* Current conversation limits.
|
1514
1608
|
*/
|
1515
|
-
|
1609
|
+
get limits(): ConversationLimits;
|
1516
1610
|
/**
|
1517
|
-
*
|
1518
|
-
* @internal
|
1611
|
+
* State of the conversation.
|
1519
1612
|
*/
|
1520
|
-
|
1521
|
-
void,
|
1522
|
-
void
|
1523
|
-
]>;
|
1613
|
+
get state(): ConversationState | undefined;
|
1524
1614
|
/**
|
1525
|
-
*
|
1615
|
+
* Source of the conversation update.
|
1526
1616
|
* @internal
|
1527
1617
|
*/
|
1528
|
-
|
1618
|
+
get _statusSource(): ConversationsDataSource;
|
1529
1619
|
/**
|
1530
|
-
*
|
1531
|
-
* @
|
1620
|
+
* Preprocess the update object.
|
1621
|
+
* @param update The update object received from Sync.
|
1622
|
+
* @param conversationSid The SID of the conversation in question.
|
1532
1623
|
*/
|
1533
|
-
_statusSource(): ConversationsDataSource;
|
1534
1624
|
private static preprocessUpdate;
|
1535
|
-
/**
|
1536
|
-
* Update the local conversation object with new values.
|
1537
|
-
* @internal
|
1538
|
-
*/
|
1539
|
-
_update(update: any): void;
|
1540
|
-
/**
|
1541
|
-
* @internal
|
1542
|
-
*/
|
1543
|
-
private _onMessageAdded;
|
1544
|
-
private _setLastReadMessageIndex;
|
1545
1625
|
/**
|
1546
1626
|
* Add a participant to the conversation by its identity.
|
1547
1627
|
* @param identity Identity of the Client to add.
|
1548
1628
|
* @param attributes Attributes to be attached to the participant.
|
1629
|
+
* @returns The added participant.
|
1549
1630
|
*/
|
1550
1631
|
add(identity: string, attributes?: JSONValue): Promise<ParticipantResponse>;
|
1551
1632
|
/**
|
@@ -1553,13 +1634,16 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1553
1634
|
* @param proxyAddress Proxy (Twilio) address of the participant.
|
1554
1635
|
* @param address User address of the participant.
|
1555
1636
|
* @param attributes Attributes to be attached to the participant.
|
1556
|
-
* @param bindingOptions Options for adding email participants - name and
|
1637
|
+
* @param bindingOptions Options for adding email participants - name and
|
1638
|
+
* CC/To level.
|
1639
|
+
* @returns The added participant.
|
1557
1640
|
*/
|
1558
1641
|
addNonChatParticipant(proxyAddress: string, address: string, attributes?: JSONValue, bindingOptions?: ParticipantBindingOptions): Promise<ParticipantResponse>;
|
1559
1642
|
/**
|
1560
|
-
* Advance the conversation's last read message index to the current read
|
1561
|
-
* Rejects if the user is not a participant of the conversation.
|
1562
|
-
*
|
1643
|
+
* Advance the conversation's last read message index to the current read
|
1644
|
+
* horizon. Rejects if the user is not a participant of the conversation. Last
|
1645
|
+
* read message index is updated only if the new index value is higher than
|
1646
|
+
* the previous.
|
1563
1647
|
* @param index Message index to advance to.
|
1564
1648
|
* @return Resulting unread messages count in the conversation.
|
1565
1649
|
*/
|
@@ -1574,10 +1658,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1574
1658
|
getAttributes(): Promise<JSONValue>;
|
1575
1659
|
/**
|
1576
1660
|
* Returns messages from the conversation using the paginator interface.
|
1577
|
-
* @param pageSize Number of messages to return in a single chunk. Default is
|
1578
|
-
*
|
1579
|
-
* @param
|
1580
|
-
*
|
1661
|
+
* @param pageSize Number of messages to return in a single chunk. Default is
|
1662
|
+
* 30.
|
1663
|
+
* @param anchor Index of the newest message to fetch. Default is from the
|
1664
|
+
* end.
|
1665
|
+
* @param direction Query direction. By default, it queries backwards
|
1666
|
+
* from newer to older. The `"forward"` value will query in the opposite
|
1667
|
+
* direction.
|
1581
1668
|
* @return A page of messages.
|
1582
1669
|
*/
|
1583
1670
|
getMessages(pageSize?: number, anchor?: number, direction?: "backwards" | "forward"): Promise<Paginator<Message>>;
|
@@ -1588,12 +1675,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1588
1675
|
/**
|
1589
1676
|
* Get conversation participants count.
|
1590
1677
|
*
|
1591
|
-
* This method is semi-realtime. This means that this data will be eventually
|
1592
|
-
* but will also be possibly incorrect for a few seconds. The
|
1593
|
-
* provide real time events for counter values
|
1678
|
+
* This method is semi-realtime. This means that this data will be eventually
|
1679
|
+
* correct, but will also be possibly incorrect for a few seconds. The
|
1680
|
+
* Conversations system does not provide real time events for counter values
|
1681
|
+
* changes.
|
1594
1682
|
*
|
1595
|
-
* This is useful for any UI badges, but it is not recommended to build any
|
1596
|
-
* logic based on these counters being accurate in real time.
|
1683
|
+
* This is useful for any UI badges, but it is not recommended to build any
|
1684
|
+
* core application logic based on these counters being accurate in real time.
|
1597
1685
|
*/
|
1598
1686
|
getParticipantsCount(): Promise<number>;
|
1599
1687
|
/**
|
@@ -1609,28 +1697,30 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1609
1697
|
/**
|
1610
1698
|
* Get the total message count in the conversation.
|
1611
1699
|
*
|
1612
|
-
* This method is semi-realtime. This means that this data will be eventually
|
1613
|
-
* but will also be possibly incorrect for a few seconds. The
|
1614
|
-
* provide real time events for counter values
|
1700
|
+
* This method is semi-realtime. This means that this data will be eventually
|
1701
|
+
* correct, but will also be possibly incorrect for a few seconds. The
|
1702
|
+
* Conversations system does not provide real time events for counter values
|
1703
|
+
* changes.
|
1615
1704
|
*
|
1616
|
-
* This is useful for any UI badges, but it is not recommended to build any
|
1617
|
-
* logic based on these counters being accurate in real time.
|
1705
|
+
* This is useful for any UI badges, but it is not recommended to build any
|
1706
|
+
* core application logic based on these counters being accurate in real time.
|
1618
1707
|
*/
|
1619
1708
|
getMessagesCount(): Promise<number>;
|
1620
1709
|
/**
|
1621
|
-
* Get unread messages count for the user if they are a participant of this
|
1622
|
-
* Rejects if the user is not a participant of the conversation.
|
1710
|
+
* Get unread messages count for the user if they are a participant of this
|
1711
|
+
* conversation. Rejects if the user is not a participant of the conversation.
|
1623
1712
|
*
|
1624
1713
|
* Use this method to obtain the number of unread messages together with
|
1625
1714
|
* {@link Conversation.updateLastReadMessageIndex} instead of relying on the
|
1626
1715
|
* message indices which may have gaps. See {@link Message.index} for details.
|
1627
1716
|
*
|
1628
|
-
* This method is semi-realtime. This means that this data will be eventually
|
1629
|
-
* but will also be possibly incorrect for a few seconds. The
|
1630
|
-
* provide real time events for counter values
|
1717
|
+
* This method is semi-realtime. This means that this data will be eventually
|
1718
|
+
* correct, but will also be possibly incorrect for a few seconds. The
|
1719
|
+
* Conversations system does not provide real time events for counter values
|
1720
|
+
* changes.
|
1631
1721
|
*
|
1632
|
-
* This is useful for any UI badges, but it is not recommended to build any
|
1633
|
-
* logic based on these counters being accurate in real time.
|
1722
|
+
* This is useful for any UI badges, but it is not recommended to build any
|
1723
|
+
* core application logic based on these counters being accurate in real time.
|
1634
1724
|
*/
|
1635
1725
|
getUnreadMessagesCount(): Promise<number | null>;
|
1636
1726
|
/**
|
@@ -1646,13 +1736,12 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1646
1736
|
* argument, it will assume that the string is an identity or SID.
|
1647
1737
|
* @param participant Identity, SID or the participant object to remove.
|
1648
1738
|
*/
|
1649
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
1650
|
-
// @ts-ignore TODO: fix validateTypesAsync typing
|
1651
1739
|
removeParticipant(participant: string | Participant): Promise<void>;
|
1652
1740
|
/**
|
1653
1741
|
* Send a message to the conversation.
|
1654
1742
|
* @param message Message body for the text message,
|
1655
|
-
* `FormData` or {@link SendMediaOptions} for media content. Sending FormData
|
1743
|
+
* `FormData` or {@link SendMediaOptions} for media content. Sending FormData
|
1744
|
+
* is supported only with the browser engine.
|
1656
1745
|
* @param messageAttributes Attributes for the message.
|
1657
1746
|
* @param emailOptions Email options for the message.
|
1658
1747
|
* @return Index of the new message.
|
@@ -1660,12 +1749,13 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1660
1749
|
sendMessage(message: null | string | FormData | SendMediaOptions, messageAttributes?: JSONValue, emailOptions?: SendEmailOptions): Promise<number>;
|
1661
1750
|
/**
|
1662
1751
|
* New interface to prepare for sending a message.
|
1663
|
-
* Use instead of
|
1752
|
+
* Use this instead of {@link Message.sendMessage}.
|
1664
1753
|
* @return A MessageBuilder to help set all message sending options.
|
1665
1754
|
*/
|
1666
1755
|
prepareMessage(): MessageBuilder;
|
1667
1756
|
/**
|
1668
|
-
* Set last read message index of the conversation to the index of the last
|
1757
|
+
* Set last read message index of the conversation to the index of the last
|
1758
|
+
* known message.
|
1669
1759
|
* @return Resulting unread messages count in the conversation.
|
1670
1760
|
*/
|
1671
1761
|
setAllMessagesRead(): Promise<number>;
|
@@ -1680,8 +1770,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1680
1770
|
*/
|
1681
1771
|
setUserNotificationLevel(notificationLevel: NotificationLevel): Promise<void>;
|
1682
1772
|
/**
|
1683
|
-
* Send a notification to the server indicating that this client is currently
|
1684
|
-
* Typing ended notification is sent after a
|
1773
|
+
* Send a notification to the server indicating that this client is currently
|
1774
|
+
* typing in this conversation. Typing ended notification is sent after a
|
1775
|
+
* while automatically, but by calling this method again you ensure that
|
1776
|
+
* typing ended is not received.
|
1685
1777
|
*/
|
1686
1778
|
typing(): Promise<void>;
|
1687
1779
|
/**
|
@@ -1696,21 +1788,71 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
|
|
1696
1788
|
updateFriendlyName(friendlyName: string): Promise<Conversation>;
|
1697
1789
|
/**
|
1698
1790
|
* Set the last read message index to the current read horizon.
|
1699
|
-
* @param index Message index to set as last read.
|
1700
|
-
*
|
1791
|
+
* @param index Message index to set as last read. If null is provided, then
|
1792
|
+
* the behavior is identical to {@link Conversation.setAllMessagesUnread}.
|
1701
1793
|
* @returns Resulting unread messages count in the conversation.
|
1702
1794
|
*/
|
1703
1795
|
updateLastReadMessageIndex(index: number | null): Promise<number>;
|
1704
1796
|
/**
|
1705
1797
|
* Update the unique name of the conversation.
|
1706
|
-
* @param uniqueName New unique name for the conversation. Setting unique name
|
1798
|
+
* @param uniqueName New unique name for the conversation. Setting unique name
|
1799
|
+
* to null removes it.
|
1707
1800
|
*/
|
1708
1801
|
updateUniqueName(uniqueName: string | null): Promise<Conversation>;
|
1802
|
+
/**
|
1803
|
+
* Load and subscribe to this conversation and do not subscribe to its
|
1804
|
+
* participants and messages. This or _subscribeStreams will need to be called
|
1805
|
+
* before any events on conversation will fire.
|
1806
|
+
* @internal
|
1807
|
+
*/
|
1808
|
+
_subscribe(): Promise<SyncDocument>;
|
1809
|
+
/**
|
1810
|
+
* Fetch participants and messages of the conversation. This method needs to
|
1811
|
+
* be called during conversation initialization to catch broken conversations
|
1812
|
+
* (broken conversations are conversations that have essential Sync entities
|
1813
|
+
* missing, i.e. the conversation document, the messages list or the
|
1814
|
+
* participant map). In case of this conversation being broken, the method
|
1815
|
+
* will throw an exception that will be caught and handled gracefully.
|
1816
|
+
* @internal
|
1817
|
+
*/
|
1818
|
+
_fetchStreams(): Promise<void>;
|
1819
|
+
/**
|
1820
|
+
* Load the attributes of this conversation and instantiate its participants
|
1821
|
+
* and messages. This or _subscribe will need to be called before any events
|
1822
|
+
* on the conversation will fire. This will need to be called before any
|
1823
|
+
* events on participants or messages will fire
|
1824
|
+
* @internal
|
1825
|
+
*/
|
1826
|
+
_subscribeStreams(): Promise<void>;
|
1827
|
+
/**
|
1828
|
+
* Stop listening for and firing events on this conversation.
|
1829
|
+
* @internal
|
1830
|
+
*/
|
1831
|
+
_unsubscribe(): Promise<[
|
1832
|
+
void,
|
1833
|
+
void
|
1834
|
+
]>;
|
1835
|
+
/**
|
1836
|
+
* Set conversation status.
|
1837
|
+
* @internal
|
1838
|
+
*/
|
1839
|
+
_setStatus(status: ConversationStatus, source: ConversationsDataSource): void;
|
1840
|
+
/**
|
1841
|
+
* Update the local conversation object with new values.
|
1842
|
+
* @internal
|
1843
|
+
*/
|
1844
|
+
_update(update: any): void;
|
1845
|
+
/**
|
1846
|
+
* Handle onMessageAdded event.
|
1847
|
+
*/
|
1848
|
+
private _onMessageAdded;
|
1849
|
+
/**
|
1850
|
+
* Set last read message index.
|
1851
|
+
* @param index New index to set.
|
1852
|
+
*/
|
1853
|
+
private _setLastReadMessageIndex;
|
1709
1854
|
}
|
1710
|
-
type ConversationsDataSource = "sync" | "
|
1711
|
-
/**
|
1712
|
-
* Push notification type.
|
1713
|
-
*/
|
1855
|
+
type ConversationsDataSource = "sync" | "rest";
|
1714
1856
|
type PushNotificationType = "twilio.conversations.new_message" | "twilio.conversations.added_to_conversation" | "twilio.conversations.removed_from_conversation";
|
1715
1857
|
interface PushNotificationDescriptor {
|
1716
1858
|
title: string | null;
|
@@ -1729,6 +1871,10 @@ interface PushNotificationData {
|
|
1729
1871
|
* SID of the conversation.
|
1730
1872
|
*/
|
1731
1873
|
conversationSid?: string;
|
1874
|
+
/**
|
1875
|
+
* Title of the conversation.
|
1876
|
+
*/
|
1877
|
+
conversationTitle?: string;
|
1732
1878
|
/**
|
1733
1879
|
* Index of the message in the conversation.
|
1734
1880
|
*/
|
@@ -1737,6 +1883,14 @@ interface PushNotificationData {
|
|
1737
1883
|
* SID of the message in the conversation.
|
1738
1884
|
*/
|
1739
1885
|
messageSid?: string;
|
1886
|
+
/**
|
1887
|
+
* Media of the notification
|
1888
|
+
*/
|
1889
|
+
media?: Media;
|
1890
|
+
/**
|
1891
|
+
* Count of the attached media of the message.
|
1892
|
+
*/
|
1893
|
+
mediaCount?: number;
|
1740
1894
|
}
|
1741
1895
|
/**
|
1742
1896
|
* Push notification for a Conversations client.
|
@@ -1775,6 +1929,9 @@ declare class PushNotification {
|
|
1775
1929
|
*/
|
1776
1930
|
constructor(data: PushNotificationDescriptor);
|
1777
1931
|
}
|
1932
|
+
/**
|
1933
|
+
* Client events.
|
1934
|
+
*/
|
1778
1935
|
type ClientEvents = {
|
1779
1936
|
conversationAdded: (conversation: Conversation) => void;
|
1780
1937
|
conversationJoined: (conversation: Conversation) => void;
|
@@ -1796,7 +1953,7 @@ type ClientEvents = {
|
|
1796
1953
|
message: Message;
|
1797
1954
|
updateReasons: MessageUpdateReason[];
|
1798
1955
|
}) => void;
|
1799
|
-
tokenAboutToExpire: (
|
1956
|
+
tokenAboutToExpire: () => void;
|
1800
1957
|
tokenExpired: () => void;
|
1801
1958
|
typingEnded: (participant: Participant) => void;
|
1802
1959
|
typingStarted: (participant: Participant) => void;
|
@@ -1808,21 +1965,22 @@ type ClientEvents = {
|
|
1808
1965
|
updateReasons: UserUpdateReason[];
|
1809
1966
|
}) => void;
|
1810
1967
|
stateChanged: (state: State) => void;
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
message: string;
|
1815
|
-
httpStatusCode?: number;
|
1816
|
-
errorCode?: number;
|
1968
|
+
initialized: (props: Record<string, unknown>) => void;
|
1969
|
+
initFailed: ({ error }: {
|
1970
|
+
error?: ConnectionError;
|
1817
1971
|
}) => void;
|
1972
|
+
connectionStateChanged: (state: TwilsockConnectionState) => void;
|
1973
|
+
connectionError: (data: ConnectionError) => void;
|
1818
1974
|
};
|
1819
1975
|
/**
|
1820
1976
|
* Connection state of the client. Possible values are as follows:
|
1821
1977
|
* * `'connecting'` - client is offline and connection attempt is in process
|
1822
1978
|
* * `'connected'` - client is online and ready
|
1823
1979
|
* * `'disconnecting'` - client is going offline as disconnection is in process
|
1824
|
-
* * `'disconnected'` - client is offline and no connection attempt is in
|
1825
|
-
*
|
1980
|
+
* * `'disconnected'` - client is offline and no connection attempt is in
|
1981
|
+
* process
|
1982
|
+
* * `'denied'` - client connection is denied because of invalid JWT access
|
1983
|
+
* token. User must refresh token in order to proceed
|
1826
1984
|
*/
|
1827
1985
|
type ConnectionState = TwilsockConnectionState;
|
1828
1986
|
/**
|
@@ -1837,6 +1995,9 @@ type State = "failed" | "initialized";
|
|
1837
1995
|
* * `'apn'`
|
1838
1996
|
*/
|
1839
1997
|
type NotificationsChannelType = ChannelType;
|
1998
|
+
/**
|
1999
|
+
* Level of logging.
|
2000
|
+
*/
|
1840
2001
|
type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
|
1841
2002
|
/**
|
1842
2003
|
* Conversations client options.
|
@@ -1869,6 +2030,10 @@ interface ClientOptions {
|
|
1869
2030
|
typingUri?: string;
|
1870
2031
|
apiUri?: string;
|
1871
2032
|
}
|
2033
|
+
type ConnectionError = {
|
2034
|
+
terminal: boolean;
|
2035
|
+
message: string;
|
2036
|
+
};
|
1872
2037
|
/**
|
1873
2038
|
* Options for {@link Client.createConversation}.
|
1874
2039
|
*/
|
@@ -1891,43 +2056,9 @@ interface CreateConversationOptions {
|
|
1891
2056
|
*/
|
1892
2057
|
declare class Client extends ReplayEventEmitter<ClientEvents> {
|
1893
2058
|
/**
|
1894
|
-
*
|
1895
|
-
|
1896
|
-
|
1897
|
-
private conversationsPromise;
|
1898
|
-
private _ensureReady;
|
1899
|
-
private _resolveEnsureReady;
|
1900
|
-
private _rejectEnsureReady;
|
1901
|
-
private fpaToken;
|
1902
|
-
private configuration;
|
1903
|
-
private conversations;
|
1904
|
-
private readonly options;
|
1905
|
-
private services;
|
1906
|
-
private readonly _myself;
|
1907
|
-
/**
|
1908
|
-
* Current version of the Conversations client.
|
1909
|
-
*/
|
1910
|
-
static readonly version: string;
|
1911
|
-
/**
|
1912
|
-
* Current version of the Conversations client.
|
1913
|
-
*/
|
1914
|
-
readonly version: string;
|
1915
|
-
private static readonly supportedPushChannels;
|
1916
|
-
private static readonly supportedPushDataFields;
|
1917
|
-
/**
|
1918
|
-
* Returned Conversations instance is not yet fully initialized. Calling any operations will block until it is.
|
1919
|
-
* Use connection events to monitor when client becomes fully available (connectionStateChanged with state
|
1920
|
-
* 'connected') or not available (connectionStateChange with state 'denied', event tokenExpired, event connectionError).
|
1921
|
-
*
|
1922
|
-
* @param fpaToken Access token
|
1923
|
-
* @param options Options to customize the Client
|
1924
|
-
* @returns A not yet fully-initialized client.
|
1925
|
-
*/
|
1926
|
-
constructor(fpaToken: string, options?: ClientOptions | null);
|
1927
|
-
static populateInitRegistrations(reg: InitRegistration): void;
|
1928
|
-
/**
|
1929
|
-
* Fired when a conversation becomes visible to the client. The event is also triggered when the client creates a new conversation.
|
1930
|
-
* Fired for all conversations client has joined.
|
2059
|
+
* Fired when a conversation becomes visible to the client. The event is also
|
2060
|
+
* triggered when the client creates a new conversation.
|
2061
|
+
* Fired for all conversations that the client has joined.
|
1931
2062
|
*
|
1932
2063
|
* Parameters:
|
1933
2064
|
* 1. {@link Conversation} `conversation` - the conversation in question
|
@@ -1959,14 +2090,17 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1959
2090
|
*/
|
1960
2091
|
static readonly conversationRemoved = "conversationRemoved";
|
1961
2092
|
/**
|
1962
|
-
* Fired when the attributes or the metadata of a conversation have been
|
1963
|
-
* During conversation's creation and initialization, this event
|
1964
|
-
* for same joined or created conversation as
|
2093
|
+
* Fired when the attributes or the metadata of a conversation have been
|
2094
|
+
* updated. During conversation's creation and initialization, this event
|
2095
|
+
* might be fired multiple times for same joined or created conversation as
|
2096
|
+
* new data is arriving from different sources.
|
1965
2097
|
*
|
1966
2098
|
* Parameters:
|
1967
|
-
* 1. object `data` - info object provided with the event. It has the
|
2099
|
+
* 1. object `data` - info object provided with the event. It has the
|
2100
|
+
* following properties:
|
1968
2101
|
* * {@link Conversation} `conversation` - the conversation in question
|
1969
|
-
* * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons
|
2102
|
+
* * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons
|
2103
|
+
* for the update
|
1970
2104
|
* @event
|
1971
2105
|
*/
|
1972
2106
|
static readonly conversationUpdated = "conversationUpdated";
|
@@ -1990,9 +2124,11 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
1990
2124
|
* Fired when a participant's fields have been updated.
|
1991
2125
|
*
|
1992
2126
|
* Parameters:
|
1993
|
-
* 1. object `data` - info object provided with the event. It has the
|
2127
|
+
* 1. object `data` - info object provided with the event. It has the
|
2128
|
+
* following properties:
|
1994
2129
|
* * {@link Participant} `participant` - the participant in question
|
1995
|
-
* * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons
|
2130
|
+
* * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons
|
2131
|
+
* for the update
|
1996
2132
|
* @event
|
1997
2133
|
*/
|
1998
2134
|
static readonly participantUpdated = "participantUpdated";
|
@@ -2016,16 +2152,16 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2016
2152
|
* Fired when the fields of an existing message are updated with new values.
|
2017
2153
|
*
|
2018
2154
|
* Parameters:
|
2019
|
-
* 1. object `data` - info object provided with the event. It has the
|
2155
|
+
* 1. object `data` - info object provided with the event. It has the
|
2156
|
+
* following properties:
|
2020
2157
|
* * {@link Message} `message` - the message in question
|
2021
|
-
* * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for
|
2158
|
+
* * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for
|
2159
|
+
* the update
|
2022
2160
|
* @event
|
2023
2161
|
*/
|
2024
2162
|
static readonly messageUpdated = "messageUpdated";
|
2025
2163
|
/**
|
2026
2164
|
* Fired when the token is about to expire and needs to be updated.
|
2027
|
-
* * Parameters:
|
2028
|
-
* 1. number `message` - token's time to live
|
2029
2165
|
* @event
|
2030
2166
|
*/
|
2031
2167
|
static readonly tokenAboutToExpire = "tokenAboutToExpire";
|
@@ -2051,10 +2187,12 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2051
2187
|
*/
|
2052
2188
|
static readonly typingStarted = "typingStarted";
|
2053
2189
|
/**
|
2054
|
-
* Fired when the client has received (and parsed) a push notification via one
|
2190
|
+
* Fired when the client has received (and parsed) a push notification via one
|
2191
|
+
* of the push channels (apn or fcm).
|
2055
2192
|
*
|
2056
2193
|
* Parameters:
|
2057
|
-
* 1. {@link PushNotification} `pushNotification` - the push notification in
|
2194
|
+
* 1. {@link PushNotification} `pushNotification` - the push notification in
|
2195
|
+
* question
|
2058
2196
|
* @event
|
2059
2197
|
*/
|
2060
2198
|
static readonly pushNotification = "pushNotification";
|
@@ -2075,16 +2213,20 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2075
2213
|
*/
|
2076
2214
|
static readonly userUnsubscribed = "userUnsubscribed";
|
2077
2215
|
/**
|
2078
|
-
* Fired when the properties or the reachability status of a user have been
|
2216
|
+
* Fired when the properties or the reachability status of a user have been
|
2217
|
+
* updated.
|
2079
2218
|
*
|
2080
2219
|
* Parameters:
|
2081
|
-
* 1. object `data` - info object provided with the event. It has the
|
2220
|
+
* 1. object `data` - info object provided with the event. It has the
|
2221
|
+
* following properties:
|
2082
2222
|
* * {@link User} `user` - the user in question
|
2083
|
-
* * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the
|
2223
|
+
* * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the
|
2224
|
+
* update
|
2084
2225
|
* @event
|
2085
2226
|
*/
|
2086
2227
|
static readonly userUpdated = "userUpdated";
|
2087
2228
|
/**
|
2229
|
+
* @deprecated Use initialized or initFailed events instead
|
2088
2230
|
* Fired when the state of the client has been changed.
|
2089
2231
|
*
|
2090
2232
|
* Parameters:
|
@@ -2092,10 +2234,28 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2092
2234
|
* @event
|
2093
2235
|
*/
|
2094
2236
|
static readonly stateChanged = "stateChanged";
|
2237
|
+
/**
|
2238
|
+
* Fired when the client has completed initialization successfully.
|
2239
|
+
*
|
2240
|
+
* Parameters:
|
2241
|
+
* 1. object `data` - Optional info object provided with the event
|
2242
|
+
* @event
|
2243
|
+
*/
|
2244
|
+
static readonly initialized = "initialized";
|
2245
|
+
/**
|
2246
|
+
* Fired when the client initialization failed.
|
2247
|
+
*
|
2248
|
+
* Parameters:
|
2249
|
+
* 1. object `data` - info object provided with the event. It has the
|
2250
|
+
* following property:
|
2251
|
+
* * Error? `error` - the initialization error if present
|
2252
|
+
* @event
|
2253
|
+
*/
|
2254
|
+
static readonly initFailed = "initFailed";
|
2095
2255
|
/**
|
2096
2256
|
* Fired when the connection state of the client has been changed.
|
2097
2257
|
*
|
2098
|
-
*
|
2258
|
+
* Parameters:
|
2099
2259
|
* 1. {@link ConnectionState} `state` - the new connection state
|
2100
2260
|
* @event
|
2101
2261
|
*/
|
@@ -2104,7 +2264,8 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2104
2264
|
* Fired when the connection is interrupted for an unexpected reason.
|
2105
2265
|
*
|
2106
2266
|
* Parameters:
|
2107
|
-
* 1. object `data` - info object provided with the event. It has the
|
2267
|
+
* 1. object `data` - info object provided with the event. It has the
|
2268
|
+
* following properties:
|
2108
2269
|
* * boolean `terminal` - Twilsock will stop connection attempts if true
|
2109
2270
|
* * string `message` - the error message of the root cause
|
2110
2271
|
* * number? `httpStatusCode` - http status code if available
|
@@ -2112,6 +2273,99 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2112
2273
|
* @event
|
2113
2274
|
*/
|
2114
2275
|
static readonly connectionError = "connectionError";
|
2276
|
+
/**
|
2277
|
+
* Current version of the Conversations client.
|
2278
|
+
*/
|
2279
|
+
static readonly version: string;
|
2280
|
+
/**
|
2281
|
+
* Logger instance.
|
2282
|
+
*/
|
2283
|
+
private static readonly _logger;
|
2284
|
+
/**
|
2285
|
+
* Supported push notification channels.
|
2286
|
+
*/
|
2287
|
+
private static readonly _supportedPushChannels;
|
2288
|
+
/**
|
2289
|
+
* Supported push data fields.
|
2290
|
+
*/
|
2291
|
+
private static readonly _supportedPushDataFields;
|
2292
|
+
/**
|
2293
|
+
* Current version of the Conversations client.
|
2294
|
+
*/
|
2295
|
+
readonly version: string;
|
2296
|
+
/**
|
2297
|
+
* Client connection state.
|
2298
|
+
*/
|
2299
|
+
connectionState: ConnectionState;
|
2300
|
+
/**
|
2301
|
+
* Promise that resolves on successful initialization.
|
2302
|
+
*/
|
2303
|
+
private readonly _ensureReady;
|
2304
|
+
/**
|
2305
|
+
* Options passed to the client.
|
2306
|
+
*/
|
2307
|
+
private readonly _options;
|
2308
|
+
/**
|
2309
|
+
* Client service objects.
|
2310
|
+
*/
|
2311
|
+
private readonly _services;
|
2312
|
+
/**
|
2313
|
+
* The user of the client.
|
2314
|
+
*/
|
2315
|
+
private readonly _myself;
|
2316
|
+
/**
|
2317
|
+
* Resolves the {@link Client._ensureReady} promise.
|
2318
|
+
*/
|
2319
|
+
private _resolveEnsureReady;
|
2320
|
+
/**
|
2321
|
+
* Rejects the {@link Client._ensureReady} promise.
|
2322
|
+
*/
|
2323
|
+
private _rejectEnsureReady;
|
2324
|
+
/**
|
2325
|
+
* The current token of the client.
|
2326
|
+
*/
|
2327
|
+
private _fpaToken;
|
2328
|
+
/**
|
2329
|
+
* The constructed configuration object.
|
2330
|
+
*/
|
2331
|
+
private _configuration;
|
2332
|
+
/**
|
2333
|
+
* The Conversations entity.
|
2334
|
+
*/
|
2335
|
+
private _conversationsEntity;
|
2336
|
+
/**
|
2337
|
+
* Promise that resolves when initial conversations are fetched.
|
2338
|
+
*/
|
2339
|
+
private _conversationsPromise;
|
2340
|
+
/**
|
2341
|
+
* Returned Conversations instance is not yet fully initialized. Calling any
|
2342
|
+
* operations will block until it is. Use connection events to monitor when
|
2343
|
+
* client becomes fully available (connectionStateChanged with state
|
2344
|
+
* 'connected') or not available (connectionStateChange with state 'denied',
|
2345
|
+
* event tokenExpired, event connectionError).
|
2346
|
+
*
|
2347
|
+
* @param fpaToken Access token
|
2348
|
+
* @param options Options to customize the Client
|
2349
|
+
* @returns A not yet fully-initialized client.
|
2350
|
+
*/
|
2351
|
+
constructor(fpaToken: string, options?: ClientOptions | null);
|
2352
|
+
/**
|
2353
|
+
* Information of the logged-in user. Before client initialization, returns an
|
2354
|
+
* uninitialized user. Will trigger a {@link Client.userUpdated} event after
|
2355
|
+
* initialization.
|
2356
|
+
*/
|
2357
|
+
get user(): User;
|
2358
|
+
/**
|
2359
|
+
* Client reachability state. Throws an error if accessed before the client
|
2360
|
+
* initialization was completed.
|
2361
|
+
*/
|
2362
|
+
get reachabilityEnabled(): boolean;
|
2363
|
+
/**
|
2364
|
+
* @deprecated
|
2365
|
+
* Current token.
|
2366
|
+
* @internal
|
2367
|
+
*/
|
2368
|
+
get token(): string;
|
2115
2369
|
/**
|
2116
2370
|
* @deprecated Call constructor directly.
|
2117
2371
|
*
|
@@ -2133,20 +2387,21 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2133
2387
|
*/
|
2134
2388
|
static create(token: string, options?: ClientOptions | null): Promise<Client>;
|
2135
2389
|
/**
|
2136
|
-
*
|
2137
|
-
*
|
2138
|
-
*
|
2390
|
+
* Static method for push notification payload parsing. Returns parsed push as
|
2391
|
+
* a {@link PushNotification} object.
|
2392
|
+
* @param notificationPayload Push notification payload.
|
2139
2393
|
*/
|
2140
|
-
|
2394
|
+
static parsePushNotification(notificationPayload: any): PushNotification;
|
2141
2395
|
/**
|
2142
|
-
*
|
2143
|
-
*
|
2396
|
+
* Static method for parsing push notification chat data.
|
2397
|
+
* @param data Data to parse
|
2144
2398
|
*/
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2399
|
+
private static _parsePushNotificationChatData;
|
2400
|
+
/**
|
2401
|
+
* Populate the client with init registrations.
|
2402
|
+
* @param reg The init registration to populate.
|
2403
|
+
*/
|
2404
|
+
static populateInitRegistrations(reg: InitRegistration): void;
|
2150
2405
|
/**
|
2151
2406
|
* Gracefully shut down the client.
|
2152
2407
|
*/
|
@@ -2161,6 +2416,12 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2161
2416
|
* @param conversationSid Conversation sid
|
2162
2417
|
*/
|
2163
2418
|
getConversationBySid(conversationSid: string): Promise<Conversation>;
|
2419
|
+
/**
|
2420
|
+
* Peek a conversation by its SID.
|
2421
|
+
* @param conversationSid Conversation sid
|
2422
|
+
* @internal
|
2423
|
+
*/
|
2424
|
+
peekConversationBySid(conversationSid: string): Promise<Conversation>;
|
2164
2425
|
/**
|
2165
2426
|
* Get a known conversation by its unique identifier name.
|
2166
2427
|
* @param uniqueName The unique identifier name of the conversation.
|
@@ -2179,7 +2440,8 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2179
2440
|
/**
|
2180
2441
|
* Register for push notifications.
|
2181
2442
|
* @param channelType Channel type.
|
2182
|
-
* @param registrationId Push notification ID provided by the FCM/APNS service
|
2443
|
+
* @param registrationId Push notification ID provided by the FCM/APNS service
|
2444
|
+
* on the platform.
|
2183
2445
|
*/
|
2184
2446
|
setPushRegistrationId(channelType: NotificationsChannelType, registrationId: string): Promise<void>;
|
2185
2447
|
/**
|
@@ -2192,27 +2454,29 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2192
2454
|
* Clear existing registrations directly using provided device token.
|
2193
2455
|
* This is useful to ensure stopped subscriptions without resubscribing.
|
2194
2456
|
*
|
2195
|
-
* This function goes completely beside the state machine and removes all
|
2196
|
-
*
|
2457
|
+
* This function goes completely beside the state machine and removes all
|
2458
|
+
* registrations.
|
2459
|
+
* Use with caution: if it races with current state machine operations,
|
2460
|
+
* madness will ensue.
|
2197
2461
|
*
|
2198
2462
|
* @param channelType Channel type.
|
2199
|
-
* @param registrationId Push notification ID provided by the FCM/APNS service
|
2463
|
+
* @param registrationId Push notification ID provided by the FCM/APNS service
|
2464
|
+
* on the platform.
|
2200
2465
|
*/
|
2201
2466
|
removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void>;
|
2202
|
-
private static parsePushNotificationChatData;
|
2203
2467
|
/**
|
2204
|
-
*
|
2205
|
-
* @param notificationPayload Push notification payload.
|
2468
|
+
* Current version of the Conversations client.
|
2206
2469
|
*/
|
2207
|
-
static parsePushNotification(notificationPayload: any): PushNotification;
|
2208
2470
|
parsePushNotification: typeof Client.parsePushNotification;
|
2209
2471
|
/**
|
2210
|
-
* Handle push notification payload parsing and emit the
|
2472
|
+
* Handle push notification payload parsing and emit the
|
2473
|
+
* {@link Client.pushNotification} event on this {@link Client} instance.
|
2211
2474
|
* @param notificationPayload Push notification payload
|
2212
2475
|
*/
|
2213
2476
|
handlePushNotification(notificationPayload: any): Promise<void>;
|
2214
2477
|
/**
|
2215
|
-
* Gets a user with the given identity. If it's in the subscribed list, then
|
2478
|
+
* Gets a user with the given identity. If it's in the subscribed list, then
|
2479
|
+
* return the user object from it;
|
2216
2480
|
* if not, then subscribe and add user to the subscribed list.
|
2217
2481
|
* @param identity Identity of the user.
|
2218
2482
|
* @returns A fully initialized user.
|
@@ -2222,6 +2486,32 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
|
|
2222
2486
|
* Get a list of subscribed user objects.
|
2223
2487
|
*/
|
2224
2488
|
getSubscribedUsers(): Promise<Array<User>>;
|
2489
|
+
/**
|
2490
|
+
* Get content URLs for all media attachments in the given set of media sids
|
2491
|
+
* using a single operation.
|
2492
|
+
* @param mediaSids Set of media sids to query for the content URL.
|
2493
|
+
*/
|
2494
|
+
getTemporaryContentUrlsForMediaSids(mediaSids: string[]): CancellablePromise<Map<string, string>>;
|
2495
|
+
/**
|
2496
|
+
* Get content URLs for all media attachments in the given set using a single
|
2497
|
+
* operation.
|
2498
|
+
* @param contentSet Set of media attachments to query content URLs.
|
2499
|
+
*/
|
2500
|
+
getTemporaryContentUrlsForMedia(contentSet: Media[]): CancellablePromise<Map<string, string>>;
|
2501
|
+
/**
|
2502
|
+
* Initialize the client.
|
2503
|
+
*/
|
2504
|
+
private _initialize;
|
2505
|
+
/**
|
2506
|
+
* Subscribe to push notifications.
|
2507
|
+
* @param channelType The channel type to subscribe to.
|
2508
|
+
*/
|
2509
|
+
private _subscribeToPushNotifications;
|
2510
|
+
/**
|
2511
|
+
* Unsubscribe from push notifications.
|
2512
|
+
* @param channelType The channel type to unsubscribe from.
|
2513
|
+
*/
|
2514
|
+
private _unsubscribeFromPushNotifications;
|
2225
2515
|
}
|
2226
2516
|
declare class NotificationTypes {
|
2227
2517
|
static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";
|
@@ -2231,4 +2521,4 @@ declare class NotificationTypes {
|
|
2231
2521
|
static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
|
2232
2522
|
static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
|
2233
2523
|
}
|
2234
|
-
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 };
|
2524
|
+
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, CancellablePromise };
|