@twilio/conversations 3.0.1-rc.102 → 3.0.1-rc.103

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/builds/lib.d.ts CHANGED
@@ -111,6 +111,7 @@ declare class Configuration {
111
111
  readonly userInfo: string;
112
112
  readonly myConversations: string;
113
113
  readonly channelMetadataCacheCapacity: number;
114
+ readonly messageRecipientsCacheCapacity: number;
114
115
  constructor(options: ClientOptions, configurationResponse: ConfigurationResponse, logger: Logger);
115
116
  }
116
117
  interface CommandExecutorServices {
@@ -1209,6 +1210,115 @@ declare class ChannelMetadataClient {
1209
1210
  constructor(services: ChannelMetadataClientServices, configuration: Configuration);
1210
1211
  getChannelMetadata(conversationSid: string, messageSid: string): Promise<ChannelMetadata | null>;
1211
1212
  }
1213
+ type MessageRecipient = {
1214
+ message_sid: string;
1215
+ type: "email"; // discriminant for future expansion
1216
+ level: "to" | "from" | "cc";
1217
+ name: string;
1218
+ address: string;
1219
+ };
1220
+ /**
1221
+ * Pagination helper interface.
1222
+ * @typeParam T The item type.
1223
+ */
1224
+ interface Paginator<T> {
1225
+ /**
1226
+ * Indicates the existence of the next page.
1227
+ */
1228
+ hasNextPage: boolean;
1229
+ /**
1230
+ * Indicates the existence of the previous page.
1231
+ */
1232
+ hasPrevPage: boolean;
1233
+ /**
1234
+ * Array of elements of type T on the current page.
1235
+ */
1236
+ items: T[];
1237
+ /**
1238
+ * Request next page.
1239
+ * Does not modify the existing object.
1240
+ */
1241
+ nextPage(): Promise<Paginator<T>>;
1242
+ /**
1243
+ * Request previous page.
1244
+ * Does not modify the existing object.
1245
+ */
1246
+ prevPage(): Promise<Paginator<T>>;
1247
+ }
1248
+ type MessageRecipientsClientServices = {
1249
+ commandExecutor: CommandExecutor;
1250
+ };
1251
+ /**
1252
+ * Message recipient descriptor.
1253
+ */
1254
+ type RecipientDescriptor = EmailRecipientDescriptor | UnknownRecipientDescriptor;
1255
+ /**
1256
+ * Email recipient level.
1257
+ */
1258
+ type EmailRecipientLevel = "to" | "from" | "cc";
1259
+ /**
1260
+ * Email recipient descriptor.
1261
+ */
1262
+ declare class EmailRecipientDescriptor {
1263
+ /**
1264
+ * Type of recipient.
1265
+ */
1266
+ readonly type = "email";
1267
+ /**
1268
+ * Sid of the message that this recipient belongs to.
1269
+ */
1270
+ readonly messageSid: string;
1271
+ /**
1272
+ * Email recipient level.
1273
+ */
1274
+ readonly level: EmailRecipientLevel;
1275
+ /**
1276
+ * Name of the recipient.
1277
+ */
1278
+ readonly name: string;
1279
+ /**
1280
+ * Address of the recipient.
1281
+ */
1282
+ readonly address: string;
1283
+ /**
1284
+ * @internal
1285
+ */
1286
+ constructor(recipient: MessageRecipient);
1287
+ }
1288
+ /**
1289
+ * Unknown recipient descriptor. Used to be able to handle recipient types that
1290
+ * are not supported by the current version of the SDK.
1291
+ */
1292
+ declare class UnknownRecipientDescriptor {
1293
+ /**
1294
+ * Type of recipient.
1295
+ */
1296
+ readonly type: string;
1297
+ /**
1298
+ * Sid of the message that this recipient belongs to.
1299
+ */
1300
+ readonly messageSid: string;
1301
+ /**
1302
+ * Recipient data as a JSON string.
1303
+ */
1304
+ readonly rawData: string;
1305
+ /**
1306
+ * @internal
1307
+ */
1308
+ constructor(recipient: MessageRecipient);
1309
+ }
1310
+ declare class MessageRecipientsClient {
1311
+ private readonly _services;
1312
+ private readonly _configuration;
1313
+ private readonly _cache;
1314
+ constructor(services: MessageRecipientsClientServices, configuration: Configuration);
1315
+ getRecipientsFromMessage(conversationSid: string, messageSid: string): Promise<RecipientDescriptor[]>;
1316
+ getRecipientsFromConversation(conversationSid: string, paginatorOptions?: {
1317
+ pageToken?: string;
1318
+ pageSize?: string;
1319
+ }): Promise<Paginator<RecipientDescriptor>>;
1320
+ private _wrapResponse;
1321
+ }
1212
1322
  type MessageEvents = {
1213
1323
  updated: (data: {
1214
1324
  message: Message;
@@ -1220,6 +1330,7 @@ interface MessageServices {
1220
1330
  network: Network;
1221
1331
  commandExecutor: CommandExecutor;
1222
1332
  channelMetadataClient: ChannelMetadataClient;
1333
+ messageRecipientsClient: MessageRecipientsClient;
1223
1334
  }
1224
1335
  interface MessageLinks {
1225
1336
  self: string;
@@ -1431,34 +1542,10 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1431
1542
  * the message doesn't have any channel metadata.
1432
1543
  */
1433
1544
  getChannelMetadata(): Promise<ChannelMetadata | null>;
1434
- }
1435
- /**
1436
- * Pagination helper interface.
1437
- * @typeParam T The item type.
1438
- */
1439
- interface Paginator<T> {
1440
1545
  /**
1441
- * Indicates the existence of the next page.
1546
+ * Get recipients of the message.
1442
1547
  */
1443
- hasNextPage: boolean;
1444
- /**
1445
- * Indicates the existence of the previous page.
1446
- */
1447
- hasPrevPage: boolean;
1448
- /**
1449
- * Array of elements of type T on the current page.
1450
- */
1451
- items: T[];
1452
- /**
1453
- * Request next page.
1454
- * Does not modify the existing object.
1455
- */
1456
- nextPage(): Promise<Paginator<T>>;
1457
- /**
1458
- * Request previous page.
1459
- * Does not modify the existing object.
1460
- */
1461
- prevPage(): Promise<Paginator<T>>;
1548
+ getMessageRecipients(): Promise<RecipientDescriptor[]>;
1462
1549
  }
1463
1550
  interface TypingIndicatorServices {
1464
1551
  twilsockClient: TwilsockClient;
@@ -1594,6 +1681,7 @@ interface MessagesServices {
1594
1681
  syncClient: SyncClient;
1595
1682
  commandExecutor: CommandExecutor;
1596
1683
  channelMetadataClient: ChannelMetadataClient;
1684
+ messageRecipientsClient: MessageRecipientsClient;
1597
1685
  }
1598
1686
  /**
1599
1687
  * Represents the collection of messages in a conversation
@@ -1889,6 +1977,7 @@ interface ConversationServices {
1889
1977
  syncClient: SyncClient;
1890
1978
  commandExecutor: CommandExecutor;
1891
1979
  channelMetadataClient: ChannelMetadataClient;
1980
+ messageRecipientsClient: MessageRecipientsClient;
1892
1981
  }
1893
1982
  /**
1894
1983
  * Conversation descriptor.
@@ -2337,6 +2426,10 @@ declare class Conversation extends ReplayEventEmitter<ConversationEvents> {
2337
2426
  * to null removes it.
2338
2427
  */
2339
2428
  updateUniqueName(uniqueName: string | null): Promise<Conversation>;
2429
+ /**
2430
+ * Get recipients of all messages in the conversation.
2431
+ */
2432
+ getMessageRecipients(): Promise<Paginator<RecipientDescriptor>>;
2340
2433
  /**
2341
2434
  * Load and subscribe to this conversation and do not subscribe to its
2342
2435
  * participants and messages. This or _subscribeStreams will need to be called
@@ -2549,6 +2642,10 @@ interface ClientOptions {
2549
2642
  * The cache capacity for channel metadata.
2550
2643
  */
2551
2644
  channelMetadataCacheCapacity?: number;
2645
+ /**
2646
+ * The cache capacity for message recipients.
2647
+ */
2648
+ messageRecipientsCacheCapacity?: number;
2552
2649
  region?: string;
2553
2650
  productId?: string;
2554
2651
  twilsockClient?: TwilsockClient;
@@ -3065,4 +3162,4 @@ declare class NotificationTypes {
3065
3162
  static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
3066
3163
  static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
3067
3164
  }
3068
- 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, ContentDataActionUrl, ContentDataActionPhone, ContentDataActionReply, ContentDataActionOther, ContentDataAction, ContentDataText, ContentDataMedia, ContentDataLocation, ContentDataReply, ContentDataQuickReply, ContentDataCallToAction, ContentDataListPicker, ContentDataListItem, ContentDataCard, ContentDataOther, ContentData, ContentTemplate, ContentTemplateVariable, ChannelMetadata };
3165
+ 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, ContentDataActionUrl, ContentDataActionPhone, ContentDataActionReply, ContentDataActionOther, ContentDataAction, ContentDataText, ContentDataMedia, ContentDataLocation, ContentDataReply, ContentDataQuickReply, ContentDataCallToAction, ContentDataListPicker, ContentDataListItem, ContentDataCard, ContentDataOther, ContentData, ContentTemplate, ContentTemplateVariable, ChannelMetadata, RecipientDescriptor, EmailRecipientDescriptor, UnknownRecipientDescriptor, EmailRecipientLevel };