@twilio/conversations 2.3.1-rc.0 → 2.4.0-rc.1

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
@@ -110,6 +110,7 @@ declare class Configuration {
110
110
  readonly userIdentity: string;
111
111
  readonly userInfo: string;
112
112
  readonly myConversations: string;
113
+ readonly channelMetadataCacheCapacity: number;
113
114
  constructor(options: ClientOptions, configurationResponse: ConfigurationResponse, logger: Logger);
114
115
  }
115
116
  interface CommandExecutorServices {
@@ -344,9 +345,10 @@ interface ParticipantLinks {
344
345
  */
345
346
  type ParticipantUpdateReason = "attributes" | "dateCreated" | "dateUpdated" | "roleSid" | "lastReadMessageIndex" | "lastReadTimestamp" | "bindings";
346
347
  /**
347
- * Type of a participant.
348
+ * Participant type. The string variant can be used to denote new types of
349
+ * participant that aren't supported by this version of the SDK.
348
350
  */
349
- type ParticipantType = "chat" | "sms" | "whatsapp" | "email";
351
+ type ParticipantType = "chat" | "sms" | "whatsapp" | "email" | string;
350
352
  interface ParticipantUpdatedEventArgs {
351
353
  participant: Participant;
352
354
  updateReasons: ParticipantUpdateReason[];
@@ -1180,6 +1182,33 @@ declare class ContentTemplate {
1180
1182
  */
1181
1183
  constructor(contentTemplateResponse: ContentTemplateResponse);
1182
1184
  }
1185
+ type ChannelMetadataClientServices = {
1186
+ commandExecutor: CommandExecutor;
1187
+ };
1188
+ /**
1189
+ * Represents channel metadata.
1190
+ */
1191
+ declare class ChannelMetadata {
1192
+ /**
1193
+ * Communication channel type.
1194
+ */
1195
+ readonly type: string;
1196
+ /**
1197
+ * The actual metadata.
1198
+ */
1199
+ readonly data: unknown;
1200
+ /**
1201
+ * @internal
1202
+ */
1203
+ constructor(type: string, data: unknown);
1204
+ }
1205
+ declare class ChannelMetadataClient {
1206
+ private readonly _services;
1207
+ private readonly _configuration;
1208
+ private readonly _cache;
1209
+ constructor(services: ChannelMetadataClientServices, configuration: Configuration);
1210
+ getChannelMetadata(conversationSid: string, messageSid: string): Promise<ChannelMetadata | null>;
1211
+ }
1183
1212
  type MessageEvents = {
1184
1213
  updated: (data: {
1185
1214
  message: Message;
@@ -1190,6 +1219,7 @@ interface MessageServices {
1190
1219
  mcsClient: McsClient;
1191
1220
  network: Network;
1192
1221
  commandExecutor: CommandExecutor;
1222
+ channelMetadataClient: ChannelMetadataClient;
1193
1223
  }
1194
1224
  interface MessageLinks {
1195
1225
  self: string;
@@ -1223,6 +1253,7 @@ interface MessageData {
1223
1253
  media?: Media;
1224
1254
  memberSid?: string;
1225
1255
  delivery?: AggregatedDeliveryDescriptor;
1256
+ channelMetadata?: boolean;
1226
1257
  }
1227
1258
  /**
1228
1259
  * A message in a conversation.
@@ -1395,6 +1426,11 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
1395
1426
  * {@link Message.contentSid} is null.
1396
1427
  */
1397
1428
  getContentData(): CancellablePromise<ContentData | null>;
1429
+ /**
1430
+ * Get the {@link ChannelMetadata} for this message. Resolves to `null` if
1431
+ * the message doesn't have any channel metadata.
1432
+ */
1433
+ getChannelMetadata(): Promise<ChannelMetadata | null>;
1398
1434
  }
1399
1435
  /**
1400
1436
  * Pagination helper interface.
@@ -1557,6 +1593,7 @@ interface MessagesServices {
1557
1593
  network: Network;
1558
1594
  syncClient: SyncClient;
1559
1595
  commandExecutor: CommandExecutor;
1596
+ channelMetadataClient: ChannelMetadataClient;
1560
1597
  }
1561
1598
  /**
1562
1599
  * Represents the collection of messages in a conversation
@@ -1851,6 +1888,7 @@ interface ConversationServices {
1851
1888
  mcsClient: McsClient;
1852
1889
  syncClient: SyncClient;
1853
1890
  commandExecutor: CommandExecutor;
1891
+ channelMetadataClient: ChannelMetadataClient;
1854
1892
  }
1855
1893
  /**
1856
1894
  * Conversation descriptor.
@@ -2507,6 +2545,10 @@ interface ClientOptions {
2507
2545
  * The level of logging to enable.
2508
2546
  */
2509
2547
  logLevel?: LogLevel;
2548
+ /**
2549
+ * The cache capacity for channel metadata.
2550
+ */
2551
+ channelMetadataCacheCapacity?: number;
2510
2552
  region?: string;
2511
2553
  productId?: string;
2512
2554
  twilsockClient?: TwilsockClient;
@@ -3023,4 +3065,4 @@ declare class NotificationTypes {
3023
3065
  static readonly REMOVED_FROM_CONVERSATION = "twilio.conversations.removed_from_conversation";
3024
3066
  static readonly CONSUMPTION_UPDATE = "twilio.channel.consumption_update";
3025
3067
  }
3026
- 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 };
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 };