@vonage/client-sdk 1.3.0-snapshot.42.0 → 1.3.0-snapshot.58.0

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/README.md CHANGED
@@ -196,12 +196,13 @@ client.on('callHangup', (callId, callQuality, reason) => {
196
196
 
197
197
  ```ts
198
198
  const { conversations, nextCursor, previousCursor } =
199
- await client.getConversations(
200
- PresentingOrder.ASC,
201
- 10, // page size
202
- undefined, // cursor
203
- true // include custom data
204
- );
199
+ await client.getConversations({
200
+ order: PresentingOrder.DESC,
201
+ pageSize: 10,
202
+ cursor: undefined,
203
+ includeCustomData: true,
204
+ orderBy: OrderBy.CUSTOM_SORT_KEY
205
+ });
205
206
  ```
206
207
 
207
208
  ### Send Text Messages
@@ -245,6 +246,8 @@ const eventHandler = (event: ConversationEvent) => {
245
246
  console.log(`Location message: ${event.body.location}`);
246
247
  } else if (event.kind == 'message:template') {
247
248
  console.log(`Template message: ${event.body.template}`);
249
+ } else if (event.kind == 'event:delete') {
250
+ console.log(`Template message: ${event.body}`);
248
251
  } else {
249
252
  exhaustiveCheck(event);
250
253
  }
@@ -1,5 +1,6 @@
1
1
  import vonage from '../utils/vonage';
2
- import { Conversation, ConversationsPage, Member, MembersPage, PresentingOrder, OrderBy, ClientInitConfigObject, ClientConfigObject } from '../utils';
2
+ import { Conversation, ConversationsPage, Member, MembersPage, PresentingOrder, ClientInitConfigObject, ClientConfigObject, Json, CustomData, Location, Template, Whatsapp, CreateConversationParameters, GetConversationsParameters, OrderBy, GetConversationEventsParameters, GetConversationMembersParameters } from '../utils';
3
+ import { Nullable } from '../kotlin/clientsdk-clientcore_js';
3
4
  import { ConversationEvent, PersistentConversationEvent } from '../kotlin/JsUnions';
4
5
  /**
5
6
  * The Vonage Client SDK for JS/TS provides a simple interface
@@ -19,9 +20,6 @@ export interface EventsPage extends vonage.EventsPageJS {
19
20
  interface VonageEvent extends vonage.CombinedEvents {
20
21
  conversationEvent: (event: ConversationEvent) => void;
21
22
  }
22
- type EventPage = vonage.EventsPageJS & {
23
- events: PersistentConversationEvent[];
24
- };
25
23
  export type RTCQuality = vonage.RTCQualityJS;
26
24
  export type CancelReason = vonage.CancelReasonJS;
27
25
  export declare const CancelReason: typeof vonage.CancelReasonJS;
@@ -38,14 +36,6 @@ export type CallSayParams = Partial<vonage.CallSayParams> & {
38
36
  export type CallDisconnectReason = vonage.CallDisconnectReasonJS;
39
37
  export declare const CallDisconnectReason: typeof vonage.CallDisconnectReasonJS;
40
38
  export type RtcStats = vonage.RTCStatsJS;
41
- type JSONValue = string | number | boolean | {
42
- [x: string]: JSONValue;
43
- } | JSONValue[];
44
- /**
45
- * @deprecated Use {@link ClientInitConfig.loggingLevel} instead.
46
- * @param level - The logging level to set.
47
- */
48
- export declare const setVonageClientLoggingLevel: typeof vonage.setDefaultLoggingLevel;
49
39
  /**
50
40
  * VonageClient is the main entry point for the Vonage Client SDK.
51
41
  *
@@ -193,9 +183,21 @@ export declare class VonageClient extends vonage.CombinedClientJS {
193
183
  *
194
184
  * @group Chat
195
185
  * @beta
186
+ * @param parameters - A {@link GetConversationsParameters} object containing the parameters for the request.
187
+ * @returns a `ConversationsPage` containing the conversations
188
+ */
189
+ getConversations(parameters?: Nullable<GetConversationsParameters>): Promise<ConversationsPage>;
190
+ /**
191
+ * Get a list of Conversations for the user.
192
+ *
193
+ * @deprecated Use {@link getConversations(parameters)} instead.
194
+ * @group Chat
195
+ * @beta
196
196
  * @param order - the order to return the conversations in (default: 'asc')
197
197
  * @param pageSize - the number of conversations to return per page (default: 100)
198
198
  * @param cursor - the cursor to use for pagination (default: null)
199
+ * @param includeCustomData - include custom data (default: false)
200
+ * @param orderBy - order by strategy (default: null)
199
201
  * @returns a `ConversationsPage` containing the conversations
200
202
  */
201
203
  getConversations(order?: PresentingOrder, pageSize?: number, cursor?: string | null, includeCustomData?: boolean, orderBy?: OrderBy | null): Promise<ConversationsPage>;
@@ -208,18 +210,30 @@ export declare class VonageClient extends vonage.CombinedClientJS {
208
210
  * @group Chat
209
211
  * @beta
210
212
  * @param id - the Conversation's id
213
+ * @param parameters - A {@link GetConversationEventsParameters} object containing the parameters for the request.
214
+ * @returns a {@link EventsPage} containing the events
215
+ */
216
+ getConversationEvents(id: string, parameters?: Nullable<GetConversationEventsParameters>): Promise<EventsPage>;
217
+ /**
218
+ * Get a Conversation's Events
219
+ *
220
+ * @deprecated Use {@link getConversationEvents(id, parameters)} instead.
221
+ * @group Chat
222
+ * @beta
223
+ * @param id - the Conversation's id
211
224
  * @param order - the order to return the events in (default: 'asc')
212
225
  * @param pageSize - the number of events to return per page (default: 100)
213
226
  * @param cursor - the cursor to use for pagination (default: null)
214
227
  * @param eventFilter - the event types to filter by (default: null)
215
228
  * @param includeDeletedEvents - A boolean, which when sent as true, will include `deletedEvents` in the list, default is false
216
- * @returns a `EventsPage` containing the events
229
+ * @param startId - A number, the starting id of the events to be returned (default: null)
230
+ * @returns a {@link EventsPage} containing the events
217
231
  *
218
232
  * @privateRemarks
219
233
  * * This is a workaround for the to ensure exhaustiveness of the `ConversationEvent` type
220
234
  * * the kotlin core does not support union types
221
235
  */
222
- getConversationEvents(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null, eventFilter?: string[] | null, includeDeletedEvents?: boolean): Promise<EventPage>;
236
+ getConversationEvents(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null, eventFilter?: string[] | null, includeDeletedEvents?: boolean, startId?: number): Promise<EventsPage>;
223
237
  /**
224
238
  * Get a Conversation's Members
225
239
  *
@@ -229,6 +243,17 @@ export declare class VonageClient extends vonage.CombinedClientJS {
229
243
  * @group Chat
230
244
  * @beta
231
245
  * @param id - the Conversation's id
246
+ * @param parameters - A {@link GetConversationMembersParameters} object containing the parameters for the request.
247
+ * @returns a `MembersPage` containing the members
248
+ */
249
+ getConversationMembers(id: string, parameters?: Nullable<GetConversationMembersParameters>): Promise<MembersPage>;
250
+ /**
251
+ * Get a Conversation's Members
252
+ *
253
+ * @deprecated Use {@link getConversationMembers(id, parameters)} instead.
254
+ * @group Chat
255
+ * @beta
256
+ * @param id - the Conversation's id
232
257
  * @param order - the order to return the members in (default: 'asc')
233
258
  * @param pageSize - the number of members to return per page (default: 100)
234
259
  * @param cursor - the cursor to use for pagination (default: null)
@@ -243,6 +268,17 @@ export declare class VonageClient extends vonage.CombinedClientJS {
243
268
  *
244
269
  * @group Chat
245
270
  * @beta
271
+ * @param parameters - A {@link CreateConversationParameters} object containing the parameters for the creation request.
272
+ *
273
+ * @returns the `cid` of the conversation
274
+ */
275
+ createConversation(parameters?: Nullable<CreateConversationParameters>): Promise<string>;
276
+ /**
277
+ * Create a conversation
278
+ *
279
+ * @deprecated Use {@link createConversation(parameters)} instead.
280
+ * @group Chat
281
+ * @beta
246
282
  * @param name - the name of the conversation
247
283
  * @param displayName - the display name of the conversation
248
284
  * @returns the `cid` of the conversation
@@ -254,10 +290,10 @@ export declare class VonageClient extends vonage.CombinedClientJS {
254
290
  * @example
255
291
  * [[include: snippet_GetConversation.txt]]
256
292
  *
257
- * @param id - the Conversation's id
293
+ * @param conversationIdOrName - the Conversation's id or conversation name
258
294
  * @returns the `Conversation`
259
295
  */
260
- getConversation(cid: string): Promise<Conversation>;
296
+ getConversation(conversationIdOrName: string): Promise<Conversation>;
261
297
  /**
262
298
  * Leave a Conversation
263
299
  *
@@ -332,7 +368,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
332
368
  * @param customData - the body of the message
333
369
  * @returns the `timestamp` of the message
334
370
  */
335
- sendMessageCustomEvent(id: string, customData: JSONValue): Promise<string>;
371
+ sendMessageCustomEvent(id: string, customData: CustomData): Promise<string>;
336
372
  /**
337
373
  * Send a Image message to a Conversation.
338
374
  *
@@ -346,6 +382,85 @@ export declare class VonageClient extends vonage.CombinedClientJS {
346
382
  * @returns the `timestamp` of the message
347
383
  */
348
384
  sendMessageImageEvent(id: string, imageUrl: URL): Promise<string>;
385
+ /**
386
+ * Send a Vidoe message to a Conversation.
387
+ *
388
+ * @example
389
+ * [[include: snippet_SendVideoMessage.txt]]
390
+ *
391
+ * @group Chat
392
+ * @beta
393
+ * @param id - the Conversation's id
394
+ * @param videoUrl - the url of the video resource.
395
+ * @returns the `timestamp` of the message
396
+ */
397
+ sendMessageVideoEvent(id: string, videoUrl: URL): Promise<string>;
398
+ /**
399
+ * Send a file message to a Conversation.
400
+ *
401
+ * @example
402
+ * [[include: snippet_SendFileMessage.txt]]
403
+ *
404
+ * @group Chat
405
+ * @beta
406
+ * @param id - the Conversation's id
407
+ * @param fileUrl - the url of the file resource.
408
+ * @returns the `timestamp` of the message
409
+ */
410
+ sendMessageFileEvent(id: string, fileUrl: URL): Promise<string>;
411
+ /**
412
+ * Send a audio message to a Conversation.
413
+ *
414
+ * @example
415
+ * [[include: snippet_SendAudioMessage.txt]]
416
+ *
417
+ * @group Chat
418
+ * @beta
419
+ * @param id - the Conversation's id
420
+ * @param audioUrl - the url of the audio resource.
421
+ * @returns the `timestamp` of the message
422
+ */
423
+ sendMessageAudioEvent(id: string, audioUrl: URL): Promise<string>;
424
+ /**
425
+ * Send a vcard message to a Conversation.
426
+ *
427
+ * @example
428
+ * [[include: snippet_SendVCardMessage.txt]]
429
+ *
430
+ * @group Chat
431
+ * @beta
432
+ * @param id - the Conversation's id
433
+ * @param vCardUrl - the url of the vCardUrl resource.
434
+ * @returns the `timestamp` of the message
435
+ */
436
+ sendMessageVCardEvent(id: string, vCardUrl: URL): Promise<string>;
437
+ /**
438
+ * Send a Location message to a Conversation.
439
+ *
440
+ * @example
441
+ * [[include: snippet_SendLocationMessage.txt]]
442
+ *
443
+ * @group Chat
444
+ * @beta
445
+ * @param id - the Conversation's id
446
+ * @param location - the description of the location.
447
+ * @returns the `timestamp` of the message
448
+ */
449
+ sendMessageLocationEvent(id: string, location: Location): Promise<string>;
450
+ /**
451
+ * Send a template message to a Conversation.
452
+ *
453
+ * @example
454
+ * [[include: snippet_SendMessageTemplateEvent.txt]]
455
+ *
456
+ * @group Chat
457
+ * @beta
458
+ * @param id - the Conversation's id
459
+ * @param whatsappObject - the description(locale and policies of business account) of the location.
460
+ * @param templateObject - the description(name and paramters) of the template.
461
+ * @returns the `timestamp` of the message
462
+ */
463
+ sendMessageTemplateEvent(id: string, templateObject: Template, whatsappObject: Whatsapp): Promise<string>;
349
464
  /**
350
465
  * Send an ephemeral event to a Conversation
351
466
  *
@@ -355,10 +470,24 @@ export declare class VonageClient extends vonage.CombinedClientJS {
355
470
  * @group Chat
356
471
  * @beta
357
472
  * @param id - the Conversation's id
358
- * @param customBody - the body of the event
473
+ * @param customData - the body of the event
474
+ * @returns the `timestamp` of the message
475
+ */
476
+ sendEphemeralEvent(id: string, customData: CustomData): Promise<string>;
477
+ /**
478
+ * Send a Custom event to a Conversation
479
+ *
480
+ * @example
481
+ * [[include: snippet_SendCustomEvent.txt]]
482
+ *
483
+ * @group Chat
484
+ * @beta
485
+ * @param id - the Conversation's id
486
+ * @param type - the type of the custom event. Type must start with `custom:<...>`
487
+ * @param customData - the body of the event
359
488
  * @returns the `timestamp` of the message
360
489
  */
361
- sendEphemeralEvent(id: string, customBody: JSONValue): Promise<string>;
490
+ sendCustomEvent(id: string, eventType: string, customData: CustomData): Promise<string>;
362
491
  /**
363
492
  * Delete an Event in a Conversation
364
493
  *