@twilio/conversations 2.1.0 → 3.0.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
@@ -5,7 +5,7 @@ import { ConnectionState as TwilsockConnectionState } from "twilsock";
5
5
  import { ReplayEventEmitter } from "@twilio/replay-event-emitter";
6
6
  import { ChannelType, Notifications } from "@twilio/notifications";
7
7
  import { Notifications as NotificationClient } from "@twilio/notifications";
8
- import { McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
8
+ import { CancellablePromise, McsClient, MediaCategory, McsMedia } from "@twilio/mcs-client";
9
9
  import { MediaCategory as McsMediaCategory } from "@twilio/mcs-client";
10
10
  interface ConfigurationResponse {
11
11
  options: {
@@ -72,13 +72,13 @@ interface ConversationLimits {
72
72
  */
73
73
  mediaAttachmentsTotalSizeLimitInMb: number;
74
74
  /**
75
- * Allowed mime types for E-Mail histories.
75
+ * Allowed content types for E-Mail histories.
76
76
  */
77
- emailHistoriesAllowedMimeTypes: string[];
77
+ emailHistoriesAllowedContentTypes: string[];
78
78
  /**
79
- * Allowed mime types for E-Mail bodies.
79
+ * Allowed content types for E-Mail bodies.
80
80
  */
81
- emailBodiesAllowedMimeTypes: string[];
81
+ emailBodiesAllowedContentTypes: string[];
82
82
  }
83
83
  interface BackoffConfiguration {
84
84
  min: number;
@@ -568,17 +568,7 @@ declare class Media {
568
568
  * If the URL becomes expired, you need to request a new one.
569
569
  * Each call to this function produces a new temporary URL.
570
570
  */
571
- getContentTemporaryUrl(): Promise<string | null>;
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>;
571
+ getContentTemporaryUrl(): CancellablePromise<string | null>;
582
572
  private _fetchMcsMedia;
583
573
  }
584
574
  /**
@@ -862,16 +852,16 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
862
852
  * @param categories Array of categories to match.
863
853
  * @returns Array of media descriptors matching given categories.
864
854
  */
865
- getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null;
855
+ getMediaByCategories(categories: MediaCategory[]): Media[] | null;
866
856
  /**
867
857
  * Get a media descriptor for an email body attachment of a provided type.
868
- * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
858
+ * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedContentTypes array.
869
859
  * @param type Type of email body to request, defaults to `text/plain`.
870
860
  */
871
861
  getEmailBody(type?: string): Media | null;
872
862
  /**
873
863
  * Get a media descriptor for an email history attachment of a provided type.
874
- * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
864
+ * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedContentTypes array.
875
865
  * @param type Type of email history to request, defaults to `text/plain`.
876
866
  */
877
867
  getEmailHistory(type?: string): Media | null;
@@ -899,10 +889,19 @@ declare class Message extends ReplayEventEmitter<MessageEvents> {
899
889
  */
900
890
  updateAttributes(attributes: JSONValue): Promise<Message>;
901
891
  /**
902
- * Get content URLs for all media attachments in the given set using single operation.
903
- * @param contentSet Set of media attachments to query for content URL.
892
+ * Get content URLs for all media attachments in the given set using a single operation.
893
+ * @param contentSet Set of media attachments to query content URLs.
894
+ */
895
+ getTemporaryContentUrlsForMedia(contentSet: Media[] | null): CancellablePromise<Map<string, string>>;
896
+ /**
897
+ * Get content URLs for all media attachments in the given set of media sids using a single operation.
898
+ * @param mediaSids Set of media sids to query for the content URL.
904
899
  */
905
- attachTemporaryUrlsFor(contentSet: Media[] | null): Promise<Media[]>;
900
+ getTemporaryContentUrlsForMediaSids(mediaSids: string[]): CancellablePromise<Map<string, string>>;
901
+ /**
902
+ * Get content URLs for all media attached to the message.
903
+ */
904
+ getTemporaryContentUrlsForAttachedMedia(): CancellablePromise<Map<string, string>>;
906
905
  private _getDetailedDeliveryReceiptsPaginator;
907
906
  }
908
907
  /**
@@ -978,25 +977,6 @@ declare class TypingIndicator {
978
977
  send(conversationSid: string): Promise<void>;
979
978
  private _send;
980
979
  }
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
980
  /**
1001
981
  * Pagination helper class.
1002
982
  */
@@ -1103,11 +1083,10 @@ declare class Messages extends ReplayEventEmitter<MessagesEvents> {
1103
1083
  subscribe(name: string): Promise<SyncList>;
1104
1084
  unsubscribe(): Promise<void>;
1105
1085
  /**
1106
- * Send Message to the conversation, message could include both text and multiple media attachments.
1086
+ * Send a message to the conversation. The message could include text and multiple media attachments.
1107
1087
  * @param message Message to post
1108
- * @returns Returns a promise which can fail
1109
1088
  */
1110
- sendV2(message: UnsentMessage): Promise<MessageResponse>;
1089
+ sendV2(message: UnsentMessage): CancellablePromise<MessageResponse>;
1111
1090
  /**
1112
1091
  * Send Message to the conversation
1113
1092
  * @param message Message to post
@@ -1144,6 +1123,25 @@ declare class Messages extends ReplayEventEmitter<MessagesEvents> {
1144
1123
  */
1145
1124
  private _getMessages;
1146
1125
  }
1126
+ /**
1127
+ * An unsent message. Returned from {@link MessageBuilder.build}.
1128
+ */
1129
+ declare class UnsentMessage {
1130
+ private messagesEntity;
1131
+ text?: string;
1132
+ attributes: JSONValue;
1133
+ mediaContent: [MediaCategory, FormData | SendMediaOptions][];
1134
+ emailOptions: SendEmailOptions;
1135
+ /**
1136
+ * @internal
1137
+ */
1138
+ constructor(messagesEntity: Messages);
1139
+ /**
1140
+ * Send the prepared message to the conversation.
1141
+ * @returns Index of the new message in the conversation.
1142
+ */
1143
+ send(): CancellablePromise<number | null>;
1144
+ }
1147
1145
  /**
1148
1146
  * Message builder. Allows the message to be built and sent via method chaining.
1149
1147
  *
@@ -1184,17 +1182,17 @@ declare class MessageBuilder {
1184
1182
  */
1185
1183
  setAttributes(attributes: JSONValue): MessageBuilder;
1186
1184
  /**
1187
- * Set email body with given MIME-type.
1188
- * @param mimeType Format of the body to set (text/plain or text/html).
1189
- * @param body Body payload in selected format.
1185
+ * Set the email body with a given content type.
1186
+ * @param contentType Format of the body to set (text/plain or text/html).
1187
+ * @param body Body payload in the selected format.
1190
1188
  */
1191
- setEmailBody(mimeType: string, body: FormData | SendMediaOptions): MessageBuilder;
1189
+ setEmailBody(contentType: string, body: FormData | SendMediaOptions): MessageBuilder;
1192
1190
  /**
1193
- * Set email history with given MIME-type.
1194
- * @param mimeType Format of the history to set (text/plain or text/html).
1195
- * @param history History payload in selected format.
1191
+ * Set the email history with a given content type.
1192
+ * @param contentType Format of the history to set (text/plain or text/html).
1193
+ * @param history History payload in the selected format.
1196
1194
  */
1197
- setEmailHistory(mimeType: string, history: FormData | SendMediaOptions): MessageBuilder;
1195
+ setEmailHistory(contentType: string, history: FormData | SendMediaOptions): MessageBuilder;
1198
1196
  /**
1199
1197
  * Adds media to the message.
1200
1198
  * @param payload Media to add.
@@ -1204,6 +1202,10 @@ declare class MessageBuilder {
1204
1202
  * Builds the message, making it ready to be sent.
1205
1203
  */
1206
1204
  build(): UnsentMessage;
1205
+ /**
1206
+ * Prepares a message and sends it to the conversation.
1207
+ */
1208
+ buildAndSend(): CancellablePromise<number | null>;
1207
1209
  private getPayloadContentType;
1208
1210
  }
1209
1211
  type ConversationEvents = {
@@ -1778,6 +1780,9 @@ declare class PushNotification {
1778
1780
  */
1779
1781
  constructor(data: PushNotificationDescriptor);
1780
1782
  }
1783
+ /**
1784
+ * Client events.
1785
+ */
1781
1786
  type ClientEvents = {
1782
1787
  conversationAdded: (conversation: Conversation) => void;
1783
1788
  conversationJoined: (conversation: Conversation) => void;
@@ -1810,7 +1815,10 @@ type ClientEvents = {
1810
1815
  user: User;
1811
1816
  updateReasons: UserUpdateReason[];
1812
1817
  }) => void;
1813
- stateChanged: (state: State) => void;
1818
+ stateChanged: ({ state, error }: {
1819
+ state: State;
1820
+ error?: Error;
1821
+ }) => void;
1814
1822
  connectionStateChanged: (state: TwilsockConnectionState) => void;
1815
1823
  connectionError: (data: {
1816
1824
  terminal: boolean;
@@ -1824,8 +1832,10 @@ type ClientEvents = {
1824
1832
  * * `'connecting'` - client is offline and connection attempt is in process
1825
1833
  * * `'connected'` - client is online and ready
1826
1834
  * * `'disconnecting'` - client is going offline as disconnection is in process
1827
- * * `'disconnected'` - client is offline and no connection attempt is in process
1828
- * * `'denied'` - client connection is denied because of invalid JWT access token. User must refresh token in order to proceed
1835
+ * * `'disconnected'` - client is offline and no connection attempt is in
1836
+ * process
1837
+ * * `'denied'` - client connection is denied because of invalid JWT access
1838
+ * token. User must refresh token in order to proceed
1829
1839
  */
1830
1840
  type ConnectionState = TwilsockConnectionState;
1831
1841
  /**
@@ -1840,6 +1850,9 @@ type State = "failed" | "initialized";
1840
1850
  * * `'apn'`
1841
1851
  */
1842
1852
  type NotificationsChannelType = ChannelType;
1853
+ /**
1854
+ * Level of logging.
1855
+ */
1843
1856
  type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
1844
1857
  /**
1845
1858
  * Conversations client options.
@@ -1894,43 +1907,9 @@ interface CreateConversationOptions {
1894
1907
  */
1895
1908
  declare class Client extends ReplayEventEmitter<ClientEvents> {
1896
1909
  /**
1897
- * Client connection state.
1898
- */
1899
- connectionState: ConnectionState;
1900
- private conversationsPromise;
1901
- private _ensureReady;
1902
- private _resolveEnsureReady;
1903
- private _rejectEnsureReady;
1904
- private fpaToken;
1905
- private configuration;
1906
- private conversations;
1907
- private readonly options;
1908
- private services;
1909
- private readonly _myself;
1910
- /**
1911
- * Current version of the Conversations client.
1912
- */
1913
- static readonly version: string;
1914
- /**
1915
- * Current version of the Conversations client.
1916
- */
1917
- readonly version: string;
1918
- private static readonly supportedPushChannels;
1919
- private static readonly supportedPushDataFields;
1920
- /**
1921
- * Returned Conversations instance is not yet fully initialized. Calling any operations will block until it is.
1922
- * Use connection events to monitor when client becomes fully available (connectionStateChanged with state
1923
- * 'connected') or not available (connectionStateChange with state 'denied', event tokenExpired, event connectionError).
1924
- *
1925
- * @param fpaToken Access token
1926
- * @param options Options to customize the Client
1927
- * @returns A not yet fully-initialized client.
1928
- */
1929
- constructor(fpaToken: string, options?: ClientOptions | null);
1930
- static populateInitRegistrations(reg: InitRegistration): void;
1931
- /**
1932
- * Fired when a conversation becomes visible to the client. The event is also triggered when the client creates a new conversation.
1933
- * Fired for all conversations client has joined.
1910
+ * Fired when a conversation becomes visible to the client. The event is also
1911
+ * triggered when the client creates a new conversation.
1912
+ * Fired for all conversations that the client has joined.
1934
1913
  *
1935
1914
  * Parameters:
1936
1915
  * 1. {@link Conversation} `conversation` - the conversation in question
@@ -1962,14 +1941,17 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
1962
1941
  */
1963
1942
  static readonly conversationRemoved = "conversationRemoved";
1964
1943
  /**
1965
- * Fired when the attributes or the metadata of a conversation have been updated.
1966
- * During conversation's creation and initialization, this event might be fired multiple times
1967
- * for same joined or created conversation as new data is arriving from different sources.
1944
+ * Fired when the attributes or the metadata of a conversation have been
1945
+ * updated. During conversation's creation and initialization, this event
1946
+ * might be fired multiple times for same joined or created conversation as
1947
+ * new data is arriving from different sources.
1968
1948
  *
1969
1949
  * Parameters:
1970
- * 1. object `data` - info object provided with the event. It has the following properties:
1950
+ * 1. object `data` - info object provided with the event. It has the
1951
+ * following properties:
1971
1952
  * * {@link Conversation} `conversation` - the conversation in question
1972
- * * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons for the update
1953
+ * * {@link ConversationUpdateReason}[] `updateReasons` - array of reasons
1954
+ * for the update
1973
1955
  * @event
1974
1956
  */
1975
1957
  static readonly conversationUpdated = "conversationUpdated";
@@ -1993,9 +1975,11 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
1993
1975
  * Fired when a participant's fields have been updated.
1994
1976
  *
1995
1977
  * Parameters:
1996
- * 1. object `data` - info object provided with the event. It has the following properties:
1978
+ * 1. object `data` - info object provided with the event. It has the
1979
+ * following properties:
1997
1980
  * * {@link Participant} `participant` - the participant in question
1998
- * * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons for the update
1981
+ * * {@link ParticipantUpdateReason}[] `updateReasons` - array of reasons
1982
+ * for the update
1999
1983
  * @event
2000
1984
  */
2001
1985
  static readonly participantUpdated = "participantUpdated";
@@ -2019,9 +2003,11 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2019
2003
  * Fired when the fields of an existing message are updated with new values.
2020
2004
  *
2021
2005
  * Parameters:
2022
- * 1. object `data` - info object provided with the event. It has the following properties:
2006
+ * 1. object `data` - info object provided with the event. It has the
2007
+ * following properties:
2023
2008
  * * {@link Message} `message` - the message in question
2024
- * * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for the update
2009
+ * * {@link MessageUpdateReason}[] `updateReasons` - array of reasons for
2010
+ * the update
2025
2011
  * @event
2026
2012
  */
2027
2013
  static readonly messageUpdated = "messageUpdated";
@@ -2054,10 +2040,12 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2054
2040
  */
2055
2041
  static readonly typingStarted = "typingStarted";
2056
2042
  /**
2057
- * Fired when the client has received (and parsed) a push notification via one of the push channels (apn or fcm).
2043
+ * Fired when the client has received (and parsed) a push notification via one
2044
+ * of the push channels (apn or fcm).
2058
2045
  *
2059
2046
  * Parameters:
2060
- * 1. {@link PushNotification} `pushNotification` - the push notification in question
2047
+ * 1. {@link PushNotification} `pushNotification` - the push notification in
2048
+ * question
2061
2049
  * @event
2062
2050
  */
2063
2051
  static readonly pushNotification = "pushNotification";
@@ -2078,12 +2066,15 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2078
2066
  */
2079
2067
  static readonly userUnsubscribed = "userUnsubscribed";
2080
2068
  /**
2081
- * Fired when the properties or the reachability status of a user have been updated.
2069
+ * Fired when the properties or the reachability status of a user have been
2070
+ * updated.
2082
2071
  *
2083
2072
  * Parameters:
2084
- * 1. object `data` - info object provided with the event. It has the following properties:
2073
+ * 1. object `data` - info object provided with the event. It has the
2074
+ * following properties:
2085
2075
  * * {@link User} `user` - the user in question
2086
- * * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the update
2076
+ * * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the
2077
+ * update
2087
2078
  * @event
2088
2079
  */
2089
2080
  static readonly userUpdated = "userUpdated";
@@ -2091,14 +2082,17 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2091
2082
  * Fired when the state of the client has been changed.
2092
2083
  *
2093
2084
  * Parameters:
2094
- * 1. {@link State} `state` - the new client state
2085
+ * 1. object `data` - info object provided with the event. It has the
2086
+ * following properties:
2087
+ * * {@link State} `state` - the new client state
2088
+ * * Error? `error` - the initialization error if present
2095
2089
  * @event
2096
2090
  */
2097
2091
  static readonly stateChanged = "stateChanged";
2098
2092
  /**
2099
2093
  * Fired when the connection state of the client has been changed.
2100
2094
  *
2101
- * Paremeters:
2095
+ * Parameters:
2102
2096
  * 1. {@link ConnectionState} `state` - the new connection state
2103
2097
  * @event
2104
2098
  */
@@ -2107,7 +2101,8 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2107
2101
  * Fired when the connection is interrupted for an unexpected reason.
2108
2102
  *
2109
2103
  * Parameters:
2110
- * 1. object `data` - info object provided with the event. It has the following properties:
2104
+ * 1. object `data` - info object provided with the event. It has the
2105
+ * following properties:
2111
2106
  * * boolean `terminal` - Twilsock will stop connection attempts if true
2112
2107
  * * string `message` - the error message of the root cause
2113
2108
  * * number? `httpStatusCode` - http status code if available
@@ -2115,6 +2110,93 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2115
2110
  * @event
2116
2111
  */
2117
2112
  static readonly connectionError = "connectionError";
2113
+ /**
2114
+ * Current version of the Conversations client.
2115
+ */
2116
+ static readonly version: string;
2117
+ /**
2118
+ * Logger instance.
2119
+ */
2120
+ private static readonly _logger;
2121
+ /**
2122
+ * Supported push notification channels.
2123
+ */
2124
+ private static readonly _supportedPushChannels;
2125
+ /**
2126
+ * Supported push data fields.
2127
+ */
2128
+ private static readonly _supportedPushDataFields;
2129
+ /**
2130
+ * Current version of the Conversations client.
2131
+ */
2132
+ readonly version: string;
2133
+ /**
2134
+ * Client connection state.
2135
+ */
2136
+ connectionState: ConnectionState;
2137
+ /**
2138
+ * Promise that resolves on successful initialization.
2139
+ */
2140
+ private readonly _ensureReady;
2141
+ /**
2142
+ * Options passed to the client.
2143
+ */
2144
+ private readonly _options;
2145
+ /**
2146
+ * Client service objects.
2147
+ */
2148
+ private readonly _services;
2149
+ /**
2150
+ * The user of the client.
2151
+ */
2152
+ private readonly _myself;
2153
+ /**
2154
+ * Resolves the {@link Client._ensureReady} promise.
2155
+ */
2156
+ private _resolveEnsureReady;
2157
+ /**
2158
+ * Rejects the {@link Client._ensureReady} promise.
2159
+ */
2160
+ private _rejectEnsureReady;
2161
+ /**
2162
+ * The current token of the client.
2163
+ */
2164
+ private _fpaToken;
2165
+ /**
2166
+ * The constructed configuration object.
2167
+ */
2168
+ private _configuration;
2169
+ /**
2170
+ * The Conversations entity.
2171
+ */
2172
+ private _conversations;
2173
+ /**
2174
+ * Promise that resolves when initial conversations are fetched.
2175
+ */
2176
+ private _conversationsPromise;
2177
+ /**
2178
+ * Returned Conversations instance is not yet fully initialized. Calling any
2179
+ * operations will block until it is. Use connection events to monitor when
2180
+ * client becomes fully available (connectionStateChanged with state
2181
+ * 'connected') or not available (connectionStateChange with state 'denied',
2182
+ * event tokenExpired, event connectionError).
2183
+ *
2184
+ * @param fpaToken Access token
2185
+ * @param options Options to customize the Client
2186
+ * @returns A not yet fully-initialized client.
2187
+ */
2188
+ constructor(fpaToken: string, options?: ClientOptions | null);
2189
+ /**
2190
+ * Information of the logged-in user. Before client initialization, returns an
2191
+ * uninitialized user. Will trigger a {@link Client.userUpdated} event after
2192
+ * initialization.
2193
+ */
2194
+ get user(): User;
2195
+ /**
2196
+ * Client reachability state. Throws an error if accessed before the client
2197
+ * initialization was completed.
2198
+ */
2199
+ get reachabilityEnabled(): boolean;
2118
2200
  /**
2119
2201
  * @deprecated Call constructor directly.
2120
2202
  *
@@ -2136,20 +2218,21 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2136
2218
  */
2137
2219
  static create(token: string, options?: ClientOptions | null): Promise<Client>;
2138
2220
  /**
2139
- * Information of the logged-in user. Before client initialization, returns an
2140
- * uninitialized user. Will trigger a {@link Client.userUpdated} event after
2141
- * initialization.
2221
+ * Static method for push notification payload parsing. Returns parsed push as
2222
+ * a {@link PushNotification} object.
2223
+ * @param notificationPayload Push notification payload.
2142
2224
  */
2143
- get user(): User;
2225
+ static parsePushNotification(notificationPayload: any): PushNotification;
2144
2226
  /**
2145
- * Client reachability state. Throws if accessed before the client
2146
- * initialization was completed.
2227
+ * Static method for parsing push notification chat data.
2228
+ * @param data Data to parse
2147
2229
  */
2148
- get reachabilityEnabled(): boolean;
2149
- get token(): string;
2150
- private _subscribeToPushNotifications;
2151
- private _unsubscribeFromPushNotifications;
2152
- private _initialize;
2230
+ private static _parsePushNotificationChatData;
2231
+ /**
2232
+ * Populate the client with init registrations.
2233
+ * @param reg The init registration to populate.
2234
+ */
2235
+ static populateInitRegistrations(reg: InitRegistration): void;
2153
2236
  /**
2154
2237
  * Gracefully shut down the client.
2155
2238
  */
@@ -2164,6 +2247,12 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2164
2247
  * @param conversationSid Conversation sid
2165
2248
  */
2166
2249
  getConversationBySid(conversationSid: string): Promise<Conversation>;
2250
+ /**
2251
+ * Peek a conversation by its SID.
2252
+ * @param conversationSid Conversation sid
2253
+ * @internal
2254
+ */
2255
+ peekConversationBySid(conversationSid: string): Promise<Conversation>;
2167
2256
  /**
2168
2257
  * Get a known conversation by its unique identifier name.
2169
2258
  * @param uniqueName The unique identifier name of the conversation.
@@ -2182,7 +2271,8 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2182
2271
  /**
2183
2272
  * Register for push notifications.
2184
2273
  * @param channelType Channel type.
2185
- * @param registrationId Push notification ID provided by the FCM/APNS service on the platform.
2274
+ * @param registrationId Push notification ID provided by the FCM/APNS service
2275
+ * on the platform.
2186
2276
  */
2187
2277
  setPushRegistrationId(channelType: NotificationsChannelType, registrationId: string): Promise<void>;
2188
2278
  /**
@@ -2195,27 +2285,29 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2195
2285
  * Clear existing registrations directly using provided device token.
2196
2286
  * This is useful to ensure stopped subscriptions without resubscribing.
2197
2287
  *
2198
- * This function goes completely beside the state machine and removes all registrations.
2199
- * Use with caution: if it races with current state machine operations, madness will ensue.
2288
+ * This function goes completely beside the state machine and removes all
2289
+ * registrations.
2290
+ * Use with caution: if it races with current state machine operations,
2291
+ * madness will ensue.
2200
2292
  *
2201
2293
  * @param channelType Channel type.
2202
- * @param registrationId Push notification ID provided by the FCM/APNS service on the platform.
2294
+ * @param registrationId Push notification ID provided by the FCM/APNS service
2295
+ * on the platform.
2203
2296
  */
2204
2297
  removePushRegistrations(channelType: ChannelType, registrationId: string): Promise<void>;
2205
- private static parsePushNotificationChatData;
2206
2298
  /**
2207
- * Static method for push notification payload parsing. Returns parsed push as a {@link PushNotification} object.
2208
- * @param notificationPayload Push notification payload.
2299
+ * Current version of the Conversations client.
2209
2300
  */
2210
- static parsePushNotification(notificationPayload: any): PushNotification;
2211
2301
  parsePushNotification: typeof Client.parsePushNotification;
2212
2302
  /**
2213
- * Handle push notification payload parsing and emit the {@link Client.pushNotification} event on this {@link Client} instance.
2303
+ * Handle push notification payload parsing and emit the
2304
+ * {@link Client.pushNotification} event on this {@link Client} instance.
2214
2305
  * @param notificationPayload Push notification payload
2215
2306
  */
2216
2307
  handlePushNotification(notificationPayload: any): Promise<void>;
2217
2308
  /**
2218
- * Gets a user with the given identity. If it's in the subscribed list, then return the user object from it;
2309
+ * Gets a user with the given identity. If it's in the subscribed list, then
2310
+ * return the user object from it;
2219
2311
  * if not, then subscribe and add user to the subscribed list.
2220
2312
  * @param identity Identity of the user.
2221
2313
  * @returns A fully initialized user.
@@ -2225,6 +2317,32 @@ declare class Client extends ReplayEventEmitter<ClientEvents> {
2225
2317
  * Get a list of subscribed user objects.
2226
2318
  */
2227
2319
  getSubscribedUsers(): Promise<Array<User>>;
2320
+ /**
2321
+ * Get content URLs for all media attachments in the given set of media sids
2322
+ * using a single operation.
2323
+ * @param mediaSids Set of media sids to query for the content URL.
2324
+ */
2325
+ getTemporaryContentUrlsForMediaSids(mediaSids: string[]): CancellablePromise<Map<string, string>>;
2326
+ /**
2327
+ * Get content URLs for all media attachments in the given set using a single
2328
+ * operation.
2329
+ * @param contentSet Set of media attachments to query content URLs.
2330
+ */
2331
+ getTemporaryContentUrlsForMedia(contentSet: Media[]): CancellablePromise<Map<string, string>>;
2332
+ /**
2333
+ * Initialize the client.
2334
+ */
2335
+ private _initialize;
2336
+ /**
2337
+ * Subscribe to push notifications.
2338
+ * @param channelType The channel type to subscribe to.
2339
+ */
2340
+ private _subscribeToPushNotifications;
2341
+ /**
2342
+ * Unsubscribe from push notifications.
2343
+ * @param channelType The channel type to unsubscribe from.
2344
+ */
2345
+ private _unsubscribeFromPushNotifications;
2228
2346
  }
2229
2347
  declare class NotificationTypes {
2230
2348
  static readonly TYPING_INDICATOR = "twilio.ipmsg.typing_indicator";