@vonage/client-sdk 2.6.1 → 2.6.2-snapshot.20260820113314

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.
Files changed (111) hide show
  1. package/api_docs/ts/assets/hierarchy.js +1 -0
  2. package/api_docs/ts/assets/highlight.css +1 -1
  3. package/api_docs/ts/assets/icons.js +17 -14
  4. package/api_docs/ts/assets/icons.svg +1 -1
  5. package/api_docs/ts/assets/main.js +5 -4
  6. package/api_docs/ts/assets/navigation.js +1 -1
  7. package/api_docs/ts/assets/search.js +1 -1
  8. package/api_docs/ts/assets/style.css +1460 -1224
  9. package/api_docs/ts/classes/ClientConfig.html +207 -16
  10. package/api_docs/ts/classes/ClientInitConfig.html +130 -14
  11. package/api_docs/ts/classes/VonageClient.html +1697 -335
  12. package/api_docs/ts/enums/CallDisconnectReason.html +54 -3
  13. package/api_docs/ts/enums/CancelReason.html +66 -6
  14. package/api_docs/ts/enums/HangupReason.html +70 -7
  15. package/api_docs/ts/enums/LegStatus.html +62 -5
  16. package/api_docs/ts/enums/LoggingLevel.html +74 -8
  17. package/api_docs/ts/enums/MemberChannelType.html +94 -13
  18. package/api_docs/ts/enums/OrderBy.html +58 -2
  19. package/api_docs/ts/enums/PresentingOrder.html +62 -8
  20. package/api_docs/ts/enums/SessionErrorReason.html +62 -5
  21. package/api_docs/ts/enums/VoiceChannelType.html +66 -6
  22. package/api_docs/ts/enums/VonageErrorType.html +70 -7
  23. package/api_docs/ts/functions/none.html +42 -2
  24. package/api_docs/ts/functions/some.html +48 -3
  25. package/api_docs/ts/hierarchy.html +30 -0
  26. package/api_docs/ts/index.html +102 -26
  27. package/api_docs/ts/interfaces/CallSayParams.html +75 -8
  28. package/api_docs/ts/interfaces/Channel.html +67 -6
  29. package/api_docs/ts/interfaces/Conversation.html +127 -20
  30. package/api_docs/ts/interfaces/ConversationProperties.html +75 -8
  31. package/api_docs/ts/interfaces/ConversationTimestamp.html +75 -5
  32. package/api_docs/ts/interfaces/ConversationsPage.html +81 -8
  33. package/api_docs/ts/interfaces/CreateConversationParameters.html +88 -15
  34. package/api_docs/ts/interfaces/EmergencyCallData.html +67 -6
  35. package/api_docs/ts/interfaces/EmergencyCallOptions.html +57 -4
  36. package/api_docs/ts/interfaces/EphemeralConversationEvent.html +81 -12
  37. package/api_docs/ts/interfaces/EventsPage.html +81 -8
  38. package/api_docs/ts/interfaces/GetCallLegsParameters.html +69 -8
  39. package/api_docs/ts/interfaces/GetConversationEventsParameters.html +87 -14
  40. package/api_docs/ts/interfaces/GetConversationMembersParameters.html +69 -8
  41. package/api_docs/ts/interfaces/GetConversationsParameters.html +81 -12
  42. package/api_docs/ts/interfaces/Leg.html +131 -21
  43. package/api_docs/ts/interfaces/LegChannel.html +75 -8
  44. package/api_docs/ts/interfaces/LegsPage.html +81 -8
  45. package/api_docs/ts/interfaces/Location.html +67 -6
  46. package/api_docs/ts/interfaces/Member.html +81 -12
  47. package/api_docs/ts/interfaces/MemberChannel.html +69 -8
  48. package/api_docs/ts/interfaces/MemberEventBody.html +75 -7
  49. package/api_docs/ts/interfaces/MemberTimestamp.html +75 -5
  50. package/api_docs/ts/interfaces/MembersPage.html +81 -8
  51. package/api_docs/ts/interfaces/MessageAudioEventBody.html +67 -5
  52. package/api_docs/ts/interfaces/MessageCustomEventBody.html +67 -5
  53. package/api_docs/ts/interfaces/MessageFileEventBody.html +67 -6
  54. package/api_docs/ts/interfaces/MessageImageEventBody.html +67 -6
  55. package/api_docs/ts/interfaces/MessageLocationEventBody.html +67 -6
  56. package/api_docs/ts/interfaces/MessageTemplateEventBody.html +93 -9
  57. package/api_docs/ts/interfaces/MessageTextEventBody.html +67 -6
  58. package/api_docs/ts/interfaces/MessageVCardEventBody.html +67 -6
  59. package/api_docs/ts/interfaces/MessageVideoEventBody.html +67 -6
  60. package/api_docs/ts/interfaces/RTCQuality.html +123 -11
  61. package/api_docs/ts/interfaces/RtcStats.html +179 -18
  62. package/api_docs/ts/interfaces/Template.html +59 -4
  63. package/api_docs/ts/interfaces/UpdateConversationParameters.html +87 -14
  64. package/api_docs/ts/interfaces/User.html +107 -16
  65. package/api_docs/ts/interfaces/UserChannels.html +139 -13
  66. package/api_docs/ts/interfaces/UserTimestamp.html +75 -5
  67. package/api_docs/ts/interfaces/VonageError.html +89 -12
  68. package/api_docs/ts/interfaces/VonageEvent.html +131 -22
  69. package/api_docs/ts/interfaces/Whatsapp.html +59 -4
  70. package/api_docs/ts/modules.html +69 -74
  71. package/api_docs/ts/types/ClientConfigObject.html +52 -5
  72. package/api_docs/ts/types/ClientInitConfigObject.html +59 -4
  73. package/api_docs/ts/types/ConfigRegion.html +34 -2
  74. package/api_docs/ts/types/ConversationEvent.html +34 -2
  75. package/api_docs/ts/types/CustomData.html +34 -2
  76. package/api_docs/ts/types/Json.html +34 -2
  77. package/api_docs/ts/types/JsonValue.html +34 -2
  78. package/api_docs/ts/types/MemberStatus.html +34 -2
  79. package/api_docs/ts/types/Option.html +38 -2
  80. package/api_docs/ts/types/PersistentConversationEvent.html +34 -2
  81. package/api_docs/ts/types/Topics.html +34 -2
  82. package/api_docs/ts/types/VonageLogger.html +59 -4
  83. package/api_docs/ts/variables/Topics.html +34 -0
  84. package/api_docs/ts/variables/VonageError.html +38 -0
  85. package/dist/client/VonageClient.d.ts +704 -704
  86. package/dist/client/index.cjs +45072 -36319
  87. package/dist/client/index.d.ts +2 -2
  88. package/dist/client/index.mjs +44700 -35947
  89. package/dist/coreExtend.d.ts +107 -107
  90. package/dist/kotlin/JsUnions.d.ts +443 -443
  91. package/dist/kotlin/clientsdk-clientcore_js.d.ts +724 -145
  92. package/dist/utils/ClientConfig.d.ts +104 -104
  93. package/dist/utils/ConversationEventBodies.d.ts +125 -125
  94. package/dist/utils/ConversationModels.d.ts +170 -170
  95. package/dist/utils/Enums.d.ts +56 -56
  96. package/dist/utils/ErrorModels.d.ts +23 -23
  97. package/dist/utils/JsonUtils.d.ts +15 -15
  98. package/dist/utils/Option.d.ts +19 -19
  99. package/dist/utils/RequestParameterModels.d.ts +134 -134
  100. package/dist/utils/index.d.ts +10 -10
  101. package/dist/utils/jsEnumToVonageObject.d.ts +10 -10
  102. package/dist/utils/logging.d.ts +53 -53
  103. package/dist/utils/vonage.d.ts +2 -2
  104. package/dist/vonageClientSDK.js +44299 -35558
  105. package/dist/vonageClientSDK.min.js +25 -25
  106. package/dist/vonageClientSDK.min.mjs +26 -26
  107. package/dist/vonageClientSDK.mjs +44299 -35558
  108. package/package.json +6 -6
  109. package/typedoc.json +3 -0
  110. package/api_docs/ts/variables/Topics-1.html +0 -2
  111. package/api_docs/ts/variables/VonageError-1.html +0 -3
@@ -1,704 +1,704 @@
1
- import vonage from '../utils/vonage';
2
- import { Conversation, ConversationsPage, EventsPage, MembersPage, ClientInitConfigObject, ClientConfigObject, Json, CustomData, Location, Template, Whatsapp, CreateConversationParameters, GetConversationsParameters, GetConversationEventsParameters, GetConversationMembersParameters, GetCallLegsParameters, UpdateConversationParameters, LegsPage, HangupReason, CallDisconnectReason, CancelReason, LegStatus, VoiceChannelType, SessionErrorReason, VonageError } from '../utils';
3
- import { Nullable } from '../kotlin/clientsdk-clientcore_js';
4
- import { ConversationEvent } from '../kotlin/JsUnions';
5
- /**
6
- * The Vonage Client SDK for JS/TS provides a simple interface
7
- * For the Vonage Voice and Messaging APIs.
8
- *
9
- * @remarks
10
- * Built on top of the Kotlin Multiplatform SDK, it provides a
11
- * more JS-like API, and platform specific implementations for
12
- * the underlying network and media layers.
13
- *
14
- * @packageDocumentation
15
- */
16
- export * from '../utils';
17
- type VonageEventOverride = Omit<vonage.CombinedEvents, 'conversationEvent' | 'callHangup' | 'callMediaDisconnect' | 'legStatusUpdate' | 'rtcStatsUpdate' | 'callInvite' | 'callInviteCancel' | 'sessionError' | 'callMediaError' | 'emergencyCallDisconnected' | 'emergencyCallHangup'> & {
18
- conversationEvent: (event: ConversationEvent) => void;
19
- callHangup: (callId: string, callQuality: RTCQuality, reason: HangupReason) => void;
20
- callMediaDisconnect: (callId: string, reason: CallDisconnectReason) => void;
21
- legStatusUpdate: (callId: string, legId: string, legStatus: LegStatus) => void;
22
- rtcStatsUpdate: (stats: RtcStats, callId: string) => void;
23
- callInviteCancel: (callId: string, reason: CancelReason) => void;
24
- callInvite: (callId: string, from: string, channelType: VoiceChannelType) => void;
25
- sessionError: (reason: SessionErrorReason) => void;
26
- callMediaError: (callId: string, error: VonageError) => void;
27
- emergencyCallDisconnected: (callId: string) => void;
28
- emergencyCallHangup: (callId: string) => void;
29
- /**
30
- * Fired when a new RTCPeerConnection is instantiated by the SDK, before ICE
31
- * gathering begins. Subscribe to WebRTC lifecycle events (connection state,
32
- * ICE connection state, ICE gathering state, etc.) from this callback.
33
- *
34
- * @remarks
35
- * `callId` is available for inbound calls. For outbound calls the server has
36
- * not yet assigned an ID at this point in the flow, so `callId` will be
37
- * `null`.
38
- *
39
- * @experimental
40
- * @group Voice
41
- */
42
- peerConnectionCreated: (callId: string | null, pc: RTCPeerConnection) => void;
43
- };
44
- /**
45
- * Vonage Event Names
46
- * The events that can be listened to via the `on` method
47
- *
48
- * @remarks
49
- * Thsese names map to the VonageEventProps type to provide
50
- * type safety when registering callbacks.
51
- * @group VonageEvents
52
- */
53
- type VonageEventNames = keyof VonageEventOverride;
54
- /**
55
- * Vonage Event Props
56
- */
57
- type VonageEventProps<T> = T extends VonageEventNames ? VonageEventOverride[T] : never;
58
- /**
59
- * Vonage Events that can be listened to via the `on` method
60
- * @interface
61
- */
62
- export type VonageEvent = {
63
- [key in VonageEventNames]: VonageEventProps<key>;
64
- };
65
- /**
66
- * Information about the quality of a Voice Call
67
- *
68
- * @property mos_score
69
- * @property quality_percentage
70
- * @property jitter_min_var
71
- * @property jitter_max_var
72
- * @property jitter_loss_rate
73
- * @property jitter_burst_rate
74
- * @property flaw_total
75
- * @property packet_cnt
76
- * @property packet_loss_perc
77
- * @interface
78
- * @group Voice
79
- */
80
- export type RTCQuality = vonage.RTCQualityJS;
81
- /**
82
- * Represents the Leg of a Voice Call
83
- *
84
- * @property id The Leg id
85
- * @property type The type of Leg
86
- * @property direction The direction of the Leg (inbound or outbound)
87
- * @property conversationId The id of the Conversation the Leg belongs to
88
- * @property status The status of the Leg
89
- * @property startTime The timestamp when the Leg started
90
- * @property endTime The timestamp when the Leg ended
91
- * @property from The from {@link LegChannel}
92
- * @property to The to {@link LegChannel}
93
- * @interface
94
- * @group Voice
95
- */
96
- export type Leg = vonage.LegJS;
97
- /**
98
- * Represents a Leg Channel
99
- *
100
- * @property type The type of Channel
101
- * @property user The user id of the Channel
102
- * @property number The number id of the Channel
103
- * @interface
104
- * @group Voice
105
- */
106
- export type LegChannel = vonage.LegChannelJS;
107
- /**
108
- * Parameters for {@link VonageClient.say}
109
- *
110
- * @property text
111
- * @property level
112
- * @property loop
113
- * @property queue
114
- * @property voiceName
115
- * @property ssml
116
- * @interface
117
- * @group Voice
118
- */
119
- export type CallSayParams = Partial<vonage.CallSayParams> & {
120
- text: string;
121
- };
122
- /**
123
- * WebRTC Stats of a Voice Call
124
- *
125
- * @property audioRecvPackets
126
- * @property audioRecvPacketsLost
127
- * @property audioRecvBytes
128
- * @property audioRecvJitter
129
- * @property audioSentPackets
130
- * @property audioSentPacketsLost
131
- * @property audioSentBytes
132
- * @property audioSentJitter
133
- * @property audioRtt
134
- * @interface
135
- * @group Voice
136
- */
137
- export type RtcStats = vonage.RTCStatsJS;
138
- /**
139
- * Data for an emergency call
140
- *
141
- * @property callId The call ID
142
- * @property reconnectToken The reconnect token for the call
143
- * @interface
144
- * @group Emergency
145
- */
146
- export type EmergencyCallData = vonage.emergency.EmergencyCallDataJS;
147
- /**
148
- * Options for an emergency call
149
- *
150
- * @property ringbackTone Optional URL to a custom ringback tone audio file
151
- * @interface
152
- * @group Emergency
153
- */
154
- export type EmergencyCallOptions = vonage.emergency.EmergencyCallOptionsJS;
155
- /**
156
- * VonageClient is the main entry point for the Vonage Client SDK.
157
- *
158
- * @privateRemarks
159
- * This class is a wrapper around the KMP `CombinedClientJS` class.
160
- * It provides a more JS-like API, and also provides a proxy object
161
- * to allow for registering callbacks via `on()`.
162
- *
163
- * Minimal Interface built on top of KMP export
164
- * DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
165
- */
166
- export declare class VonageClient extends vonage.CombinedClientJS {
167
- constructor(config?: ClientInitConfigObject);
168
- /**
169
- * Set a configuration for the client SDK
170
- *
171
- * @example
172
- * [[include: snippet_Config.txt]]
173
- *
174
- * @param config - A configuration object
175
- * @returns void
176
- */
177
- setConfig(config: ClientConfigObject): void;
178
- /**
179
- * Register a callback for an event.
180
- *
181
- * @example
182
- * [[include: snippet_OnConversationEventListener.txt]]
183
- *
184
- * @param event - the event to register for (e.g. 'legStatusUpdate')
185
- * @param callback - the callback to register for the event
186
- * @returns a symbol that can be used to unregister the callback
187
- * @remarks
188
- * Be sure to store the symbol returned by this method so you can unregister the callback later.
189
- * We recommend unregistering callbacks when you no longer need them. See {@link off}.
190
- */
191
- on<T extends VonageEventNames, P extends VonageEvent[T]>(event: T, callback: P): symbol;
192
- /**
193
- * Unregister a callback for an event.
194
- *
195
- * @example
196
- * [[include: snippet_UnregisterListener.txt]]
197
- *
198
- * @param event - the event to register for (e.g. 'legStatusUpdate')
199
- * @param callbackSymbol - the callback symbol to unregister
200
- * @returns true if the callback was unregistered, false otherwise
201
- * @remarks
202
- * We recommend deregistering callbacks when you no longer need them.
203
- */
204
- off<T extends keyof VonageEvent>(event: T, callbackSymbol: symbol): boolean;
205
- /**
206
- * Clear all callbacks for an event.
207
- *
208
- * @example
209
- * [[include: snippet_ClearCallbacks.txt]]
210
- *
211
- * @param event - the event to unregister from (e.g. 'legStatusUpdate')
212
- * @returns void
213
- *
214
- * @remarks
215
- * This is useful for cleaning up callbacks when you no longer need them.
216
- *
217
- */
218
- clearCallbacks<T extends keyof VonageEvent>(event: T): void;
219
- /**
220
- * Create (or reconnect to) a session.
221
- *
222
- * When `sessionId` is omitted or `null`, a completely new session is created.
223
- *
224
- * When `sessionId` is set to the value returned by a **previous** `createSession` call, the
225
- * Conversation Service will replay any pending events into the new session. In particular, an
226
- * unanswered inbound call invite that arrived before a page refresh will be re-delivered so that
227
- * `onCallInvite` fires automatically — no extra API call is needed.
228
- *
229
- * **Important:** The Conversation Service retains pending events for approximately 30 seconds.
230
- * Persist the session ID (e.g. in `sessionStorage`) and pass it back within that window.
231
- *
232
- * @example
233
- * [[include: snippet_SessionCreate.txt]]
234
- *
235
- * @param token - JWT token of the user.
236
- * @param sessionId - Optional previous session ID. Omit or pass `null` for a fresh session.
237
- * @returns The `sessionId` of the newly established session.
238
- */
239
- createSession(token: string, sessionId?: string | null): Promise<string>;
240
- /**
241
- * Get the Peer Connection for a call
242
- *
243
- * @experimental
244
- * @group Voice
245
- * @param id - The Call Id
246
- */
247
- getPeerConnection(id: string): RTCPeerConnection | undefined;
248
- /**
249
- * Get the HTML Audio Element for the SDK.
250
- * It can be used to route output to other devices.
251
- *
252
- * @experimental
253
- * @group Voice
254
- */
255
- getAudioOutputElement(): HTMLAudioElement | undefined;
256
- /**
257
- * Enable noise suppression on a call's audio track.
258
- *
259
- * @experimental
260
- * @group Voice
261
- * @param id - The Call Id
262
- */
263
- enableNoiseSuppression(id: string): Promise<void>;
264
- /**
265
- * Disable noise suppression on a call's audio track.
266
- *
267
- * @experimental
268
- * @group Voice
269
- * @param id - The Call Id
270
- */
271
- disableNoiseSuppression(id: string): Promise<void>;
272
- /**
273
- * Enable auto gain control on a call's audio track.
274
- *
275
- * @experimental
276
- * @group Voice
277
- * @param id - The Call Id
278
- */
279
- enableAutoGainControl(id: string): Promise<void>;
280
- /**
281
- * Disable auto gain control on a call's audio track.
282
- *
283
- * @experimental
284
- * @group Voice
285
- * @param id - The Call Id
286
- */
287
- disableAutoGainControl(id: string): Promise<void>;
288
- /**
289
- * Enable echo cancellation on a call's audio track.
290
- *
291
- * @experimental
292
- * @group Voice
293
- * @param id - The Call Id
294
- */
295
- enableEchoCancellation(id: string): Promise<void>;
296
- /**
297
- * Disable echo cancellation on a call's audio track.
298
- *
299
- * @experimental
300
- * @group Voice
301
- * @param id - The Call Id
302
- */
303
- disableEchoCancellation(id: string): Promise<void>;
304
- /**
305
- * Get the Leg for a call
306
- *
307
- * @group Voice
308
- * @param legId - The Leg Id
309
- */
310
- getLeg(legId: string): Promise<Leg>;
311
- /**
312
- * Get a Call's Legs
313
- *
314
- * @example
315
- * [[include: snippet_GetCallLegs.txt]]
316
- *
317
- * @group Voice
318
- * @param id - the Call's id
319
- * @param parameters - A {@link GetCallLegsParameters} object containing the parameters for the request.
320
- * @returns a `LegsPage` containing the legs
321
- */
322
- getCallLegs(callId: string, parameters?: Nullable<GetCallLegsParameters>): Promise<LegsPage>;
323
- /**
324
- * Make a server call to the Vonage API.
325
- * This is used to initiate a call using the Voice API and NCCO.
326
- *
327
- * @example
328
- * [[include: snippet_OutboundCall.txt]]
329
- *
330
- * @group Voice
331
- * @param context - the context to send to the server passed as Custom data to the voice answer webhook
332
- * @returns the `callId` of the call
333
- */
334
- serverCall(context?: Json): Promise<string>;
335
- /**
336
- * Hangup a call.
337
- *
338
- * @example
339
- * [[include: snippet_CallHangup.txt]]
340
- *
341
- * @group Voice
342
- * @param callId - the `callId` of the call to hangup
343
- * @param reasonText - optional reason text to send to the other party
344
- * @param reasonCode - optional reason code to send to the other party
345
- * @returns void
346
- */
347
- hangup(callId: string, reasonText?: string, reasonCode?: string): Promise<void>;
348
- /**
349
- * Sends a TTS message to the Call
350
- *
351
- * @group Voice
352
- * @param callId - the `callId` of the call to send the message to
353
- * @param text - the text to send
354
- * @returns void
355
- */
356
- say(callId: string, text: string): Promise<void>;
357
- /**
358
- * Sends a TTS message to the Call
359
- *
360
- * @example
361
- * [[include: snippet_Say.txt]]
362
- *
363
- * @group Voice
364
- * @param callId - the `callId` of the call to send the message to
365
- * @param params - the `CallSayParams` to send
366
- * @returns void
367
- */
368
- say(callId: string, params: CallSayParams): Promise<void>;
369
- /**
370
- * Get a list of Conversations for the user.
371
- *
372
- * @example
373
- * [[include: snippet_GetConversations.txt]]
374
- *
375
- * @group Chat
376
- * @param parameters - A {@link GetConversationsParameters} object containing the parameters for the request.
377
- * @returns a `ConversationsPage` containing the conversations
378
- */
379
- getConversations(parameters?: Nullable<GetConversationsParameters>): Promise<ConversationsPage>;
380
- /**
381
- * Get a Conversation's Events
382
- *
383
- * @example
384
- * [[include: snippet_GetConversationEvents.txt]]
385
- *
386
- * @group Chat
387
- * @param id - the Conversation's id
388
- * @param parameters - A {@link GetConversationEventsParameters} object containing the parameters for the request.
389
- * @returns a {@link EventsPage} containing the events
390
- */
391
- getConversationEvents(id: string, parameters?: Nullable<GetConversationEventsParameters>): Promise<EventsPage>;
392
- /**
393
- * Get a Conversation's Members
394
- *
395
- * @example
396
- * [[include: snippet_GetConversationMembers.txt]]
397
- *
398
- * @group Chat
399
- * @param id - the Conversation's id
400
- * @param parameters - A {@link GetConversationMembersParameters} object containing the parameters for the request.
401
- * @returns a `MembersPage` containing the members
402
- */
403
- getConversationMembers(id: string, parameters?: Nullable<GetConversationMembersParameters>): Promise<MembersPage>;
404
- /**
405
- * Create a conversation
406
- *
407
- * @example
408
- * [[include: snippet_CreateConversation.txt]]
409
- *
410
- * @group Chat
411
- * @param parameters - A {@link CreateConversationParameters} object containing the parameters for the creation request.
412
- * @returns the `cid` of the conversation
413
- */
414
- createConversation(parameters?: Nullable<CreateConversationParameters>): Promise<string>;
415
- /**
416
- * Get a Conversation
417
- *
418
- * @example
419
- * [[include: snippet_GetConversation.txt]]
420
- *
421
- * @param conversationIdOrName - the Conversation's id or conversation name
422
- * @returns the `Conversation`
423
- */
424
- getConversation(conversationIdOrName: string): Promise<Conversation>;
425
- /**
426
- * Updates a conversation object identified by its unique conversation ID.
427
- *
428
- * This method overrides the conversation properties to the provided parameters and rest remains as it is.
429
- *
430
- * @example
431
- * [[include: snippet_UpdateConversation.txt]]
432
- *
433
- * @param conversationId - the Conversation's id.
434
- * @param parameters - The properties of the conversation. These will replace existing values to the provided ones, rest will remain as they are.
435
- * @returns `conversation`, this object will contain the updated conversation properties if the update is successful.
436
- */
437
- updateConversation(conversationId: string, parameters: UpdateConversationParameters): Promise<Conversation>;
438
- /**
439
- * Leave a Conversation
440
- *
441
- * @example
442
- * [[include: snippet_LeaveConversation.txt]]
443
- *
444
- * @group Chat
445
- * @param id - the Conversation's id
446
- * @returns void
447
- */
448
- leaveConversation(id: string): Promise<void>;
449
- /**
450
- * Join a Conversation
451
- *
452
- * @example
453
- * [[include: snippet_JoinConversation.txt]]
454
- *
455
- * @group Chat
456
- * @param id - the Conversation's id
457
- * @returns the `memberId` of the member
458
- */
459
- joinConversation(id: string): Promise<string>;
460
- /**
461
- * Delete a Conversation
462
- *
463
- * @example
464
- * [[include: snippet_DeleteConversation.txt]]
465
- *
466
- * @group Chat
467
- * @param id - the Conversation's id
468
- * @returns void
469
- */
470
- deleteConversation(id: string): Promise<void>;
471
- /**
472
- * Invite a user to a Conversation by user's `name`
473
- *
474
- * @example
475
- * [[include: snippet_InviteToConversation.txt]]
476
- *
477
- * @group Chat
478
- * @param id - the Conversation's id
479
- * @param name - the name of the user to invite
480
- * @returns the `memberId` of the member
481
- */
482
- inviteToConversation(id: string, name: string): Promise<string>;
483
- /**
484
- * Send a text message to a Conversation
485
- *
486
- * @example
487
- * [[include: snippet_SendTextMessage.txt]]
488
- *
489
- * @group Chat
490
- * @param id - the Conversation's id
491
- * @param text - the Body of the message
492
- * @param raw - whether to send the text as raw or not (default: false, not recommended)
493
- * @returns the `timestamp` of the message
494
- */
495
- sendMessageTextEvent(id: string, text: string, raw?: boolean): Promise<string>;
496
- /**
497
- * Send a custom message to a Conversation
498
- *
499
- * @example
500
- * [[include: snippet_SendCustomMessage.txt]]
501
- *
502
- * @group Chat
503
- * @param id - the Conversation's id
504
- * @param customData - the body of the message
505
- * @returns the `timestamp` of the message
506
- */
507
- sendMessageCustomEvent(id: string, customData: CustomData): Promise<string>;
508
- /**
509
- * Send a Image message to a Conversation.
510
- *
511
- * @example
512
- * [[include: snippet_SendImageMessage.txt]]
513
- *
514
- * @group Chat
515
- * @param id - the Conversation's id
516
- * @param imageUrl - the url of the image resource.
517
- * @returns the `timestamp` of the message
518
- */
519
- sendMessageImageEvent(id: string, imageUrl: URL): Promise<string>;
520
- /**
521
- * Send a Vidoe message to a Conversation.
522
- *
523
- * @example
524
- * [[include: snippet_SendVideoMessage.txt]]
525
- *
526
- * @group Chat
527
- * @param id - the Conversation's id
528
- * @param videoUrl - the url of the video resource.
529
- * @returns the `timestamp` of the message
530
- */
531
- sendMessageVideoEvent(id: string, videoUrl: URL): Promise<string>;
532
- /**
533
- * Send a file message to a Conversation.
534
- *
535
- * @example
536
- * [[include: snippet_SendFileMessage.txt]]
537
- *
538
- * @group Chat
539
- * @param id - the Conversation's id
540
- * @param fileUrl - the url of the file resource.
541
- * @returns the `timestamp` of the message
542
- */
543
- sendMessageFileEvent(id: string, fileUrl: URL): Promise<string>;
544
- /**
545
- * Send a audio message to a Conversation.
546
- *
547
- * @example
548
- * [[include: snippet_SendAudioMessage.txt]]
549
- *
550
- * @group Chat
551
- * @param id - the Conversation's id
552
- * @param audioUrl - the url of the audio resource.
553
- * @returns the `timestamp` of the message
554
- */
555
- sendMessageAudioEvent(id: string, audioUrl: URL): Promise<string>;
556
- /**
557
- * Send a vcard message to a Conversation.
558
- *
559
- * @example
560
- * [[include: snippet_SendVcardMessage.txt]]
561
- *
562
- * @group Chat
563
- * @param id - the Conversation's id
564
- * @param vCardUrl - the url of the vCardUrl resource.
565
- * @returns the `timestamp` of the message
566
- */
567
- sendMessageVCardEvent(id: string, vCardUrl: URL): Promise<string>;
568
- /**
569
- * Send a Location message to a Conversation.
570
- *
571
- * @example
572
- * [[include: snippet_SendLocationMessage.txt]]
573
- *
574
- * @group Chat
575
- * @param id - the Conversation's id
576
- * @param location - the description of the location.
577
- * @returns the `timestamp` of the message
578
- */
579
- sendMessageLocationEvent(id: string, location: Location): Promise<string>;
580
- /**
581
- * Send a template message to a Conversation.
582
- *
583
- * @example
584
- * [[include: snippet_SendTemplateMessage.txt]]
585
- *
586
- * @group Chat
587
- * @param id - the Conversation's id
588
- * @param whatsappObject - the description(locale and policies of business account) of the location.
589
- * @param templateObject - the description(name and paramters) of the template.
590
- * @returns the `timestamp` of the message
591
- */
592
- sendMessageTemplateEvent(id: string, templateObject: Template, whatsappObject: Whatsapp): Promise<string>;
593
- /**
594
- * Send an ephemeral event to a Conversation
595
- *
596
- * @example
597
- * [[include: snippet_SendEphemeralEvent.txt]]
598
- *
599
- * @group Chat
600
- * @param id - the Conversation's id
601
- * @param customData - the body of the event
602
- * @returns the `timestamp` of the message
603
- */
604
- sendEphemeralEvent(id: string, customData: CustomData): Promise<string>;
605
- /**
606
- * Send a Custom event to a Conversation
607
- *
608
- * @example
609
- * [[include: snippet_SendCustomEvent.txt]]
610
- *
611
- * @group Chat
612
- * @param id - the Conversation's id
613
- * @param evenType - the type of the custom event. Type must start with `custom:<...>`
614
- * @param customData - the body of the event
615
- * @returns the `timestamp` of the message
616
- */
617
- sendCustomEvent(id: string, eventType: string, customData: CustomData): Promise<string>;
618
- /**
619
- * Delete an Event in a Conversation
620
- *
621
- * @example
622
- * [[include:snippet_DeleteEvent.txt]]
623
- *
624
- * @group Chat
625
- * @param id - the id for the Event to be deleted
626
- * @param conversationId - the id for the conversation, the event belongs to.
627
- * @returns void
628
- */
629
- deleteEvent(id: number, conversationId: string): Promise<void>;
630
- /**
631
- * Send a message seen event to a Conversation
632
- *
633
- * @example
634
- * [[include: snippet_SendMessageSeenEvent.txt]]
635
- *
636
- * @group Chat
637
- * @param id - the event id
638
- * @param conversationId - the conversation id
639
- * @returns the `timestamp` of the message
640
- */
641
- sendMessageSeenEvent(id: number, conversationId: string): Promise<string>;
642
- /**
643
- * Starts an emergency call.
644
- *
645
- * @group Emergency
646
- * @param token
647
- * @param from
648
- * @param to
649
- * @param options - Optional {@link EmergencyCallOptions} containing call options
650
- * @returns the result containing `callId` and `reconnectToken`
651
- */
652
- emergencyCall(token: string, from: string, to: string, options?: Nullable<EmergencyCallOptions>): Promise<EmergencyCallData>;
653
- /**
654
- * Reconnects an existing emergency call.
655
- *
656
- * @group Emergency
657
- * @param token
658
- * @param callId
659
- * @param reconnectToken
660
- * @returns void
661
- */
662
- reconnectEmergencyCall(token: string, callId: string, reconnectToken: string): Promise<void>;
663
- /**
664
- * Hangup an emergency call.
665
- *
666
- * @group Emergency
667
- * @param callId - the `callId` of the call to hangup
668
- * @returns void
669
- */
670
- hangupEmergencyCall(callId: string): Promise<void>;
671
- /**
672
- * Mute an emergency call.
673
- *
674
- * @group Emergency
675
- * @param callId - the `callId` of the call to mute
676
- * @returns void
677
- */
678
- muteEmergencyCall(callId: string): Promise<void>;
679
- /**
680
- * Unmute an emergency call.
681
- *
682
- * @group Emergency
683
- * @param callId - the `callId` of the call to unmute
684
- * @returns void
685
- */
686
- unmuteEmergencyCall(callId: string): Promise<void>;
687
- /**
688
- * Enable earmuff for an emergency call.
689
- *
690
- * @group Emergency
691
- * @param callId - the `callId` of the call to enable earmuff for
692
- * @returns void
693
- */
694
- enableEarmuffEmergencyCall(callId: string): Promise<void>;
695
- /**
696
- * Disable earmuff for an emergency call.
697
- *
698
- * @group Emergency
699
- * @param callId - the `callId` of the call to disable earmuff for
700
- * @returns void
701
- */
702
- disableEarmuffEmergencyCall(callId: string): Promise<void>;
703
- }
704
- export default VonageClient;
1
+ import vonage from '../utils/vonage';
2
+ import { Conversation, ConversationsPage, EventsPage, MembersPage, ClientInitConfigObject, ClientConfigObject, Json, CustomData, Location, Template, Whatsapp, CreateConversationParameters, GetConversationsParameters, GetConversationEventsParameters, GetConversationMembersParameters, GetCallLegsParameters, UpdateConversationParameters, LegsPage, HangupReason, CallDisconnectReason, CancelReason, LegStatus, VoiceChannelType, SessionErrorReason, VonageError } from '../utils';
3
+ import { Nullable } from '../kotlin/clientsdk-clientcore_js';
4
+ import { ConversationEvent } from '../kotlin/JsUnions';
5
+ /**
6
+ * The Vonage Client SDK for JS/TS provides a simple interface
7
+ * For the Vonage Voice and Messaging APIs.
8
+ *
9
+ * @remarks
10
+ * Built on top of the Kotlin Multiplatform SDK, it provides a
11
+ * more JS-like API, and platform specific implementations for
12
+ * the underlying network and media layers.
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ export * from '../utils';
17
+ type VonageEventOverride = Omit<vonage.CombinedEvents, 'conversationEvent' | 'callHangup' | 'callMediaDisconnect' | 'legStatusUpdate' | 'rtcStatsUpdate' | 'callInvite' | 'callInviteCancel' | 'sessionError' | 'callMediaError' | 'emergencyCallDisconnected' | 'emergencyCallHangup'> & {
18
+ conversationEvent: (event: ConversationEvent) => void;
19
+ callHangup: (callId: string, callQuality: RTCQuality, reason: HangupReason) => void;
20
+ callMediaDisconnect: (callId: string, reason: CallDisconnectReason) => void;
21
+ legStatusUpdate: (callId: string, legId: string, legStatus: LegStatus) => void;
22
+ rtcStatsUpdate: (stats: RtcStats, callId: string) => void;
23
+ callInviteCancel: (callId: string, reason: CancelReason) => void;
24
+ callInvite: (callId: string, from: string, channelType: VoiceChannelType) => void;
25
+ sessionError: (reason: SessionErrorReason) => void;
26
+ callMediaError: (callId: string, error: VonageError) => void;
27
+ emergencyCallDisconnected: (callId: string) => void;
28
+ emergencyCallHangup: (callId: string) => void;
29
+ /**
30
+ * Fired when a new RTCPeerConnection is instantiated by the SDK, before ICE
31
+ * gathering begins. Subscribe to WebRTC lifecycle events (connection state,
32
+ * ICE connection state, ICE gathering state, etc.) from this callback.
33
+ *
34
+ * @remarks
35
+ * `callId` is available for inbound calls. For outbound calls the server has
36
+ * not yet assigned an ID at this point in the flow, so `callId` will be
37
+ * `null`.
38
+ *
39
+ * @experimental
40
+ * @group Voice
41
+ */
42
+ peerConnectionCreated: (callId: string | null, pc: RTCPeerConnection) => void;
43
+ };
44
+ /**
45
+ * Vonage Event Names
46
+ * The events that can be listened to via the `on` method
47
+ *
48
+ * @remarks
49
+ * Thsese names map to the VonageEventProps type to provide
50
+ * type safety when registering callbacks.
51
+ * @group VonageEvents
52
+ */
53
+ type VonageEventNames = keyof VonageEventOverride;
54
+ /**
55
+ * Vonage Event Props
56
+ */
57
+ type VonageEventProps<T> = T extends VonageEventNames ? VonageEventOverride[T] : never;
58
+ /**
59
+ * Vonage Events that can be listened to via the `on` method
60
+ * @interface
61
+ */
62
+ export type VonageEvent = {
63
+ [key in VonageEventNames]: VonageEventProps<key>;
64
+ };
65
+ /**
66
+ * Information about the quality of a Voice Call
67
+ *
68
+ * @property mos_score
69
+ * @property quality_percentage
70
+ * @property jitter_min_var
71
+ * @property jitter_max_var
72
+ * @property jitter_loss_rate
73
+ * @property jitter_burst_rate
74
+ * @property flaw_total
75
+ * @property packet_cnt
76
+ * @property packet_loss_perc
77
+ * @interface
78
+ * @group Voice
79
+ */
80
+ export type RTCQuality = vonage.RTCQualityJS;
81
+ /**
82
+ * Represents the Leg of a Voice Call
83
+ *
84
+ * @property id The Leg id
85
+ * @property type The type of Leg
86
+ * @property direction The direction of the Leg (inbound or outbound)
87
+ * @property conversationId The id of the Conversation the Leg belongs to
88
+ * @property status The status of the Leg
89
+ * @property startTime The timestamp when the Leg started
90
+ * @property endTime The timestamp when the Leg ended
91
+ * @property from The from {@link LegChannel}
92
+ * @property to The to {@link LegChannel}
93
+ * @interface
94
+ * @group Voice
95
+ */
96
+ export type Leg = vonage.LegJS;
97
+ /**
98
+ * Represents a Leg Channel
99
+ *
100
+ * @property type The type of Channel
101
+ * @property user The user id of the Channel
102
+ * @property number The number id of the Channel
103
+ * @interface
104
+ * @group Voice
105
+ */
106
+ export type LegChannel = vonage.LegChannelJS;
107
+ /**
108
+ * Parameters for {@link VonageClient.say}
109
+ *
110
+ * @property text
111
+ * @property level
112
+ * @property loop
113
+ * @property queue
114
+ * @property voiceName
115
+ * @property ssml
116
+ * @interface
117
+ * @group Voice
118
+ */
119
+ export type CallSayParams = Partial<vonage.CallSayParams> & {
120
+ text: string;
121
+ };
122
+ /**
123
+ * WebRTC Stats of a Voice Call
124
+ *
125
+ * @property audioRecvPackets
126
+ * @property audioRecvPacketsLost
127
+ * @property audioRecvBytes
128
+ * @property audioRecvJitter
129
+ * @property audioSentPackets
130
+ * @property audioSentPacketsLost
131
+ * @property audioSentBytes
132
+ * @property audioSentJitter
133
+ * @property audioRtt
134
+ * @interface
135
+ * @group Voice
136
+ */
137
+ export type RtcStats = vonage.RTCStatsJS;
138
+ /**
139
+ * Data for an emergency call
140
+ *
141
+ * @property callId The call ID
142
+ * @property reconnectToken The reconnect token for the call
143
+ * @interface
144
+ * @group Emergency
145
+ */
146
+ export type EmergencyCallData = vonage.emergency.EmergencyCallDataJS;
147
+ /**
148
+ * Options for an emergency call
149
+ *
150
+ * @property ringbackTone Optional URL to a custom ringback tone audio file
151
+ * @interface
152
+ * @group Emergency
153
+ */
154
+ export type EmergencyCallOptions = vonage.emergency.EmergencyCallOptionsJS;
155
+ /**
156
+ * VonageClient is the main entry point for the Vonage Client SDK.
157
+ *
158
+ * @privateRemarks
159
+ * This class is a wrapper around the KMP `CombinedClientJS` class.
160
+ * It provides a more JS-like API, and also provides a proxy object
161
+ * to allow for registering callbacks via `on()`.
162
+ *
163
+ * Minimal Interface built on top of KMP export
164
+ * DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
165
+ */
166
+ export declare class VonageClient extends vonage.CombinedClientJS {
167
+ constructor(config?: ClientInitConfigObject);
168
+ /**
169
+ * Set a configuration for the client SDK
170
+ *
171
+ * @example
172
+ * {@includeCode ../../examples/snippets/snippet_Config.txt}
173
+ *
174
+ * @param config - A configuration object
175
+ * @returns void
176
+ */
177
+ setConfig(config: ClientConfigObject): void;
178
+ /**
179
+ * Register a callback for an event.
180
+ *
181
+ * @example
182
+ * {@includeCode ../../examples/snippets/snippet_OnConversationEventListener.txt}
183
+ *
184
+ * @param event - the event to register for (e.g. 'legStatusUpdate')
185
+ * @param callback - the callback to register for the event
186
+ * @returns a symbol that can be used to unregister the callback
187
+ * @remarks
188
+ * Be sure to store the symbol returned by this method so you can unregister the callback later.
189
+ * We recommend unregistering callbacks when you no longer need them. See {@link off}.
190
+ */
191
+ on<T extends VonageEventNames, P extends VonageEvent[T]>(event: T, callback: P): symbol;
192
+ /**
193
+ * Unregister a callback for an event.
194
+ *
195
+ * @example
196
+ * {@includeCode ../../examples/snippets/snippet_UnregisterListener.txt}
197
+ *
198
+ * @param event - the event to register for (e.g. 'legStatusUpdate')
199
+ * @param callbackSymbol - the callback symbol to unregister
200
+ * @returns true if the callback was unregistered, false otherwise
201
+ * @remarks
202
+ * We recommend deregistering callbacks when you no longer need them.
203
+ */
204
+ off<T extends keyof VonageEvent>(event: T, callbackSymbol: symbol): boolean;
205
+ /**
206
+ * Clear all callbacks for an event.
207
+ *
208
+ * @example
209
+ * {@includeCode ../../examples/snippets/snippet_ClearCallbacks.txt}
210
+ *
211
+ * @param event - the event to unregister from (e.g. 'legStatusUpdate')
212
+ * @returns void
213
+ *
214
+ * @remarks
215
+ * This is useful for cleaning up callbacks when you no longer need them.
216
+ *
217
+ */
218
+ clearCallbacks<T extends keyof VonageEvent>(event: T): void;
219
+ /**
220
+ * Create (or reconnect to) a session.
221
+ *
222
+ * When `sessionId` is omitted or `null`, a completely new session is created.
223
+ *
224
+ * When `sessionId` is set to the value returned by a **previous** `createSession` call, the
225
+ * Conversation Service will replay any pending events into the new session. In particular, an
226
+ * unanswered inbound call invite that arrived before a page refresh will be re-delivered so that
227
+ * `onCallInvite` fires automatically — no extra API call is needed.
228
+ *
229
+ * **Important:** The Conversation Service retains pending events for approximately 30 seconds.
230
+ * Persist the session ID (e.g. in `sessionStorage`) and pass it back within that window.
231
+ *
232
+ * @example
233
+ * {@includeCode ../../examples/snippets/snippet_SessionCreate.txt}
234
+ *
235
+ * @param token - JWT token of the user.
236
+ * @param sessionId - Optional previous session ID. Omit or pass `null` for a fresh session.
237
+ * @returns The `sessionId` of the newly established session.
238
+ */
239
+ createSession(token: string, sessionId?: string | null): Promise<string>;
240
+ /**
241
+ * Get the Peer Connection for a call
242
+ *
243
+ * @experimental
244
+ * @group Voice
245
+ * @param id - The Call Id
246
+ */
247
+ getPeerConnection(id: string): RTCPeerConnection | undefined;
248
+ /**
249
+ * Get the HTML Audio Element for the SDK.
250
+ * It can be used to route output to other devices.
251
+ *
252
+ * @experimental
253
+ * @group Voice
254
+ */
255
+ getAudioOutputElement(): HTMLAudioElement | undefined;
256
+ /**
257
+ * Enable noise suppression on a call's audio track.
258
+ *
259
+ * @experimental
260
+ * @group Voice
261
+ * @param id - The Call Id
262
+ */
263
+ enableNoiseSuppression(id: string): Promise<void>;
264
+ /**
265
+ * Disable noise suppression on a call's audio track.
266
+ *
267
+ * @experimental
268
+ * @group Voice
269
+ * @param id - The Call Id
270
+ */
271
+ disableNoiseSuppression(id: string): Promise<void>;
272
+ /**
273
+ * Enable auto gain control on a call's audio track.
274
+ *
275
+ * @experimental
276
+ * @group Voice
277
+ * @param id - The Call Id
278
+ */
279
+ enableAutoGainControl(id: string): Promise<void>;
280
+ /**
281
+ * Disable auto gain control on a call's audio track.
282
+ *
283
+ * @experimental
284
+ * @group Voice
285
+ * @param id - The Call Id
286
+ */
287
+ disableAutoGainControl(id: string): Promise<void>;
288
+ /**
289
+ * Enable echo cancellation on a call's audio track.
290
+ *
291
+ * @experimental
292
+ * @group Voice
293
+ * @param id - The Call Id
294
+ */
295
+ enableEchoCancellation(id: string): Promise<void>;
296
+ /**
297
+ * Disable echo cancellation on a call's audio track.
298
+ *
299
+ * @experimental
300
+ * @group Voice
301
+ * @param id - The Call Id
302
+ */
303
+ disableEchoCancellation(id: string): Promise<void>;
304
+ /**
305
+ * Get the Leg for a call
306
+ *
307
+ * @group Voice
308
+ * @param legId - The Leg Id
309
+ */
310
+ getLeg(legId: string): Promise<Leg>;
311
+ /**
312
+ * Get a Call's Legs
313
+ *
314
+ * @example
315
+ * {@includeCode ../../examples/snippets/snippet_GetCallLegs.txt}
316
+ *
317
+ * @group Voice
318
+ * @param id - the Call's id
319
+ * @param parameters - A {@link GetCallLegsParameters} object containing the parameters for the request.
320
+ * @returns a `LegsPage` containing the legs
321
+ */
322
+ getCallLegs(callId: string, parameters?: Nullable<GetCallLegsParameters>): Promise<LegsPage>;
323
+ /**
324
+ * Make a server call to the Vonage API.
325
+ * This is used to initiate a call using the Voice API and NCCO.
326
+ *
327
+ * @example
328
+ * {@includeCode ../../examples/snippets/snippet_OutboundCall.txt}
329
+ *
330
+ * @group Voice
331
+ * @param context - the context to send to the server passed as Custom data to the voice answer webhook
332
+ * @returns the `callId` of the call
333
+ */
334
+ serverCall(context?: Json): Promise<string>;
335
+ /**
336
+ * Hangup a call.
337
+ *
338
+ * @example
339
+ * {@includeCode ../../examples/snippets/snippet_CallHangup.txt}
340
+ *
341
+ * @group Voice
342
+ * @param callId - the `callId` of the call to hangup
343
+ * @param reasonText - optional reason text to send to the other party
344
+ * @param reasonCode - optional reason code to send to the other party
345
+ * @returns void
346
+ */
347
+ hangup(callId: string, reasonText?: string, reasonCode?: string): Promise<void>;
348
+ /**
349
+ * Sends a TTS message to the Call
350
+ *
351
+ * @group Voice
352
+ * @param callId - the `callId` of the call to send the message to
353
+ * @param text - the text to send
354
+ * @returns void
355
+ */
356
+ say(callId: string, text: string): Promise<void>;
357
+ /**
358
+ * Sends a TTS message to the Call
359
+ *
360
+ * @example
361
+ * {@includeCode ../../examples/snippets/snippet_Say.txt}
362
+ *
363
+ * @group Voice
364
+ * @param callId - the `callId` of the call to send the message to
365
+ * @param params - the `CallSayParams` to send
366
+ * @returns void
367
+ */
368
+ say(callId: string, params: CallSayParams): Promise<void>;
369
+ /**
370
+ * Get a list of Conversations for the user.
371
+ *
372
+ * @example
373
+ * {@includeCode ../../examples/snippets/snippet_GetConversations.txt}
374
+ *
375
+ * @group Chat
376
+ * @param parameters - A {@link GetConversationsParameters} object containing the parameters for the request.
377
+ * @returns a `ConversationsPage` containing the conversations
378
+ */
379
+ getConversations(parameters?: Nullable<GetConversationsParameters>): Promise<ConversationsPage>;
380
+ /**
381
+ * Get a Conversation's Events
382
+ *
383
+ * @example
384
+ * {@includeCode ../../examples/snippets/snippet_GetConversationEvents.txt}
385
+ *
386
+ * @group Chat
387
+ * @param id - the Conversation's id
388
+ * @param parameters - A {@link GetConversationEventsParameters} object containing the parameters for the request.
389
+ * @returns a {@link EventsPage} containing the events
390
+ */
391
+ getConversationEvents(id: string, parameters?: Nullable<GetConversationEventsParameters>): Promise<EventsPage>;
392
+ /**
393
+ * Get a Conversation's Members
394
+ *
395
+ * @example
396
+ * {@includeCode ../../examples/snippets/snippet_GetConversationMembers.txt}
397
+ *
398
+ * @group Chat
399
+ * @param id - the Conversation's id
400
+ * @param parameters - A {@link GetConversationMembersParameters} object containing the parameters for the request.
401
+ * @returns a `MembersPage` containing the members
402
+ */
403
+ getConversationMembers(id: string, parameters?: Nullable<GetConversationMembersParameters>): Promise<MembersPage>;
404
+ /**
405
+ * Create a conversation
406
+ *
407
+ * @example
408
+ * {@includeCode ../../examples/snippets/snippet_CreateConversation.txt}
409
+ *
410
+ * @group Chat
411
+ * @param parameters - A {@link CreateConversationParameters} object containing the parameters for the creation request.
412
+ * @returns the `cid` of the conversation
413
+ */
414
+ createConversation(parameters?: Nullable<CreateConversationParameters>): Promise<string>;
415
+ /**
416
+ * Get a Conversation
417
+ *
418
+ * @example
419
+ * {@includeCode ../../examples/snippets/snippet_GetConversation.txt}
420
+ *
421
+ * @param conversationIdOrName - the Conversation's id or conversation name
422
+ * @returns the `Conversation`
423
+ */
424
+ getConversation(conversationIdOrName: string): Promise<Conversation>;
425
+ /**
426
+ * Updates a conversation object identified by its unique conversation ID.
427
+ *
428
+ * This method overrides the conversation properties to the provided parameters and rest remains as it is.
429
+ *
430
+ * @example
431
+ * {@includeCode ../../examples/snippets/snippet_UpdateConversation.txt}
432
+ *
433
+ * @param conversationId - the Conversation's id.
434
+ * @param parameters - The properties of the conversation. These will replace existing values to the provided ones, rest will remain as they are.
435
+ * @returns `conversation`, this object will contain the updated conversation properties if the update is successful.
436
+ */
437
+ updateConversation(conversationId: string, parameters: UpdateConversationParameters): Promise<Conversation>;
438
+ /**
439
+ * Leave a Conversation
440
+ *
441
+ * @example
442
+ * {@includeCode ../../examples/snippets/snippet_LeaveConversation.txt}
443
+ *
444
+ * @group Chat
445
+ * @param id - the Conversation's id
446
+ * @returns void
447
+ */
448
+ leaveConversation(id: string): Promise<void>;
449
+ /**
450
+ * Join a Conversation
451
+ *
452
+ * @example
453
+ * {@includeCode ../../examples/snippets/snippet_JoinConversation.txt}
454
+ *
455
+ * @group Chat
456
+ * @param id - the Conversation's id
457
+ * @returns the `memberId` of the member
458
+ */
459
+ joinConversation(id: string): Promise<string>;
460
+ /**
461
+ * Delete a Conversation
462
+ *
463
+ * @example
464
+ * {@includeCode ../../examples/snippets/snippet_DeleteConversation.txt}
465
+ *
466
+ * @group Chat
467
+ * @param id - the Conversation's id
468
+ * @returns void
469
+ */
470
+ deleteConversation(id: string): Promise<void>;
471
+ /**
472
+ * Invite a user to a Conversation by user's `name`
473
+ *
474
+ * @example
475
+ * {@includeCode ../../examples/snippets/snippet_InviteToConversation.txt}
476
+ *
477
+ * @group Chat
478
+ * @param id - the Conversation's id
479
+ * @param name - the name of the user to invite
480
+ * @returns the `memberId` of the member
481
+ */
482
+ inviteToConversation(id: string, name: string): Promise<string>;
483
+ /**
484
+ * Send a text message to a Conversation
485
+ *
486
+ * @example
487
+ * {@includeCode ../../examples/snippets/snippet_SendTextMessage.txt}
488
+ *
489
+ * @group Chat
490
+ * @param id - the Conversation's id
491
+ * @param text - the Body of the message
492
+ * @param raw - whether to send the text as raw or not (default: false, not recommended)
493
+ * @returns the `timestamp` of the message
494
+ */
495
+ sendMessageTextEvent(id: string, text: string, raw?: boolean): Promise<string>;
496
+ /**
497
+ * Send a custom message to a Conversation
498
+ *
499
+ * @example
500
+ * {@includeCode ../../examples/snippets/snippet_SendCustomMessage.txt}
501
+ *
502
+ * @group Chat
503
+ * @param id - the Conversation's id
504
+ * @param customData - the body of the message
505
+ * @returns the `timestamp` of the message
506
+ */
507
+ sendMessageCustomEvent(id: string, customData: CustomData): Promise<string>;
508
+ /**
509
+ * Send a Image message to a Conversation.
510
+ *
511
+ * @example
512
+ * {@includeCode ../../examples/snippets/snippet_SendImageMessage.txt}
513
+ *
514
+ * @group Chat
515
+ * @param id - the Conversation's id
516
+ * @param imageUrl - the url of the image resource.
517
+ * @returns the `timestamp` of the message
518
+ */
519
+ sendMessageImageEvent(id: string, imageUrl: URL): Promise<string>;
520
+ /**
521
+ * Send a Vidoe message to a Conversation.
522
+ *
523
+ * @example
524
+ * {@includeCode ../../examples/snippets/snippet_SendVideoMessage.txt}
525
+ *
526
+ * @group Chat
527
+ * @param id - the Conversation's id
528
+ * @param videoUrl - the url of the video resource.
529
+ * @returns the `timestamp` of the message
530
+ */
531
+ sendMessageVideoEvent(id: string, videoUrl: URL): Promise<string>;
532
+ /**
533
+ * Send a file message to a Conversation.
534
+ *
535
+ * @example
536
+ * {@includeCode ../../examples/snippets/snippet_SendFileMessage.txt}
537
+ *
538
+ * @group Chat
539
+ * @param id - the Conversation's id
540
+ * @param fileUrl - the url of the file resource.
541
+ * @returns the `timestamp` of the message
542
+ */
543
+ sendMessageFileEvent(id: string, fileUrl: URL): Promise<string>;
544
+ /**
545
+ * Send a audio message to a Conversation.
546
+ *
547
+ * @example
548
+ * {@includeCode ../../examples/snippets/snippet_SendAudioMessage.txt}
549
+ *
550
+ * @group Chat
551
+ * @param id - the Conversation's id
552
+ * @param audioUrl - the url of the audio resource.
553
+ * @returns the `timestamp` of the message
554
+ */
555
+ sendMessageAudioEvent(id: string, audioUrl: URL): Promise<string>;
556
+ /**
557
+ * Send a vcard message to a Conversation.
558
+ *
559
+ * @example
560
+ * {@includeCode ../../examples/snippets/snippet_SendVcardMessage.txt}
561
+ *
562
+ * @group Chat
563
+ * @param id - the Conversation's id
564
+ * @param vCardUrl - the url of the vCardUrl resource.
565
+ * @returns the `timestamp` of the message
566
+ */
567
+ sendMessageVCardEvent(id: string, vCardUrl: URL): Promise<string>;
568
+ /**
569
+ * Send a Location message to a Conversation.
570
+ *
571
+ * @example
572
+ * {@includeCode ../../examples/snippets/snippet_SendLocationMessage.txt}
573
+ *
574
+ * @group Chat
575
+ * @param id - the Conversation's id
576
+ * @param location - the description of the location.
577
+ * @returns the `timestamp` of the message
578
+ */
579
+ sendMessageLocationEvent(id: string, location: Location): Promise<string>;
580
+ /**
581
+ * Send a template message to a Conversation.
582
+ *
583
+ * @example
584
+ * {@includeCode ../../examples/snippets/snippet_SendTemplateMessage.txt}
585
+ *
586
+ * @group Chat
587
+ * @param id - the Conversation's id
588
+ * @param whatsappObject - the description(locale and policies of business account) of the location.
589
+ * @param templateObject - the description(name and paramters) of the template.
590
+ * @returns the `timestamp` of the message
591
+ */
592
+ sendMessageTemplateEvent(id: string, templateObject: Template, whatsappObject: Whatsapp): Promise<string>;
593
+ /**
594
+ * Send an ephemeral event to a Conversation
595
+ *
596
+ * @example
597
+ * {@includeCode ../../examples/snippets/snippet_SendEphemeralEvent.txt}
598
+ *
599
+ * @group Chat
600
+ * @param id - the Conversation's id
601
+ * @param customData - the body of the event
602
+ * @returns the `timestamp` of the message
603
+ */
604
+ sendEphemeralEvent(id: string, customData: CustomData): Promise<string>;
605
+ /**
606
+ * Send a Custom event to a Conversation
607
+ *
608
+ * @example
609
+ * {@includeCode ../../examples/snippets/snippet_SendCustomEvent.txt}
610
+ *
611
+ * @group Chat
612
+ * @param id - the Conversation's id
613
+ * @param evenType - the type of the custom event. Type must start with `custom:<...>`
614
+ * @param customData - the body of the event
615
+ * @returns the `timestamp` of the message
616
+ */
617
+ sendCustomEvent(id: string, eventType: string, customData: CustomData): Promise<string>;
618
+ /**
619
+ * Delete an Event in a Conversation
620
+ *
621
+ * @example
622
+ * {@includeCode ../../examples/snippets/snippet_DeleteEvent.txt}
623
+ *
624
+ * @group Chat
625
+ * @param id - the id for the Event to be deleted
626
+ * @param conversationId - the id for the conversation, the event belongs to.
627
+ * @returns void
628
+ */
629
+ deleteEvent(id: number, conversationId: string): Promise<void>;
630
+ /**
631
+ * Send a message seen event to a Conversation
632
+ *
633
+ * @example
634
+ * {@includeCode ../../examples/snippets/snippet_SendMessageSeenEvent.txt}
635
+ *
636
+ * @group Chat
637
+ * @param id - the event id
638
+ * @param conversationId - the conversation id
639
+ * @returns the `timestamp` of the message
640
+ */
641
+ sendMessageSeenEvent(id: number, conversationId: string): Promise<string>;
642
+ /**
643
+ * Starts an emergency call.
644
+ *
645
+ * @group Emergency
646
+ * @param token
647
+ * @param from
648
+ * @param to
649
+ * @param options - Optional {@link EmergencyCallOptions} containing call options
650
+ * @returns the result containing `callId` and `reconnectToken`
651
+ */
652
+ emergencyCall(token: string, from: string, to: string, options?: Nullable<EmergencyCallOptions>): Promise<EmergencyCallData>;
653
+ /**
654
+ * Reconnects an existing emergency call.
655
+ *
656
+ * @group Emergency
657
+ * @param token
658
+ * @param callId
659
+ * @param reconnectToken
660
+ * @returns void
661
+ */
662
+ reconnectEmergencyCall(token: string, callId: string, reconnectToken: string): Promise<void>;
663
+ /**
664
+ * Hangup an emergency call.
665
+ *
666
+ * @group Emergency
667
+ * @param callId - the `callId` of the call to hangup
668
+ * @returns void
669
+ */
670
+ hangupEmergencyCall(callId: string): Promise<void>;
671
+ /**
672
+ * Mute an emergency call.
673
+ *
674
+ * @group Emergency
675
+ * @param callId - the `callId` of the call to mute
676
+ * @returns void
677
+ */
678
+ muteEmergencyCall(callId: string): Promise<void>;
679
+ /**
680
+ * Unmute an emergency call.
681
+ *
682
+ * @group Emergency
683
+ * @param callId - the `callId` of the call to unmute
684
+ * @returns void
685
+ */
686
+ unmuteEmergencyCall(callId: string): Promise<void>;
687
+ /**
688
+ * Enable earmuff for an emergency call.
689
+ *
690
+ * @group Emergency
691
+ * @param callId - the `callId` of the call to enable earmuff for
692
+ * @returns void
693
+ */
694
+ enableEarmuffEmergencyCall(callId: string): Promise<void>;
695
+ /**
696
+ * Disable earmuff for an emergency call.
697
+ *
698
+ * @group Emergency
699
+ * @param callId - the `callId` of the call to disable earmuff for
700
+ * @returns void
701
+ */
702
+ disableEarmuffEmergencyCall(callId: string): Promise<void>;
703
+ }
704
+ export default VonageClient;