@vonage/client-sdk 1.2.1-alpha.0 → 1.2.1-snapshot.17.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
@@ -121,141 +121,37 @@ Below are several typical scenarios where the SDK is commonly utilized.
121
121
  ### Make an Outbound Call
122
122
 
123
123
  ```ts
124
- const call = await client.serverCall({
125
- customData: {
126
- callee: 'bob',
127
- type: 'app'
128
- }
129
- });
130
- console.log(call);
124
+
131
125
  ```
132
126
 
133
127
  ### Answer/Reject an Inbound Call
134
128
 
135
129
  ```ts
136
- // Answer Call
137
- client.on(
138
- 'callInvite',
139
- async (callId: string, from: string, channelType: string) => {
140
- client.answer(callId);
141
- console.log(callId, from, channelType);
142
- }
143
- );
144
-
145
- // ----
146
130
 
147
- // Reject Call
148
- client.on(
149
- 'callInvite',
150
- async (callId: string, from: string, channelType: string) => {
151
- client.reject(callId);
152
- console.log(callId, from, channelType);
153
- }
154
- );
155
131
  ```
156
132
 
157
133
  ### Hang-up and Collect Stats
158
134
 
159
135
  ```ts
160
- // await client.hangup(call);
161
- await client.hangup(call, 'reason-text', 'reason-code');
162
136
 
163
- client.on('callHangup', (callId, callQuality, reason) => {
164
- if (callId == call) {
165
- console.log('The call has finished');
166
- }
167
- console.log(`This was your call MOS score: `, callQuality.mos_score);
168
- const reason_name = reason.name;
169
- if (reason_name === 'LOCAL_HANGUP') {
170
- console.log('You hung up the call');
171
- return;
172
- } else if (reason_name === 'REMOTE_HANGUP') {
173
- console.log('Call was hung up remotely');
174
- return;
175
- } else if (reason_name === 'REMOTE_REJECT') {
176
- console.log('Call was rejected');
177
- return;
178
- } else if (reason_name === 'MEDIA_TIMEOUT') {
179
- console.log('Timeout due to media failure');
180
- return;
181
- } else if (reason_name === 'REMOTE_NO_ANSWER_TIMEOUT') {
182
- console.log('Timeout due to missing remote answer');
183
- return;
184
- } else {
185
- return exhaustiveCheck(reason_name);
186
- }
187
- });
188
137
  ```
189
138
 
190
139
  ### Get Conversations
191
140
 
192
141
  ```ts
193
- try {
194
- let cursor: string | undefined | null = undefined;
195
- const pageSize = 10;
196
- const conversations: Conversation[] = [];
197
- const includeCustomData = false;
198
- const orderBy = OrderBy.CREATED;
199
- do {
200
- const response: ConversationsPage = await client.getConversations(
201
- PresentingOrder.ASC,
202
- pageSize,
203
- cursor,
204
- includeCustomData,
205
- orderBy
206
- );
207
- conversations.push(...response.conversations);
208
- cursor = response.nextCursor;
209
- } while (cursor !== null);
210
- console.log(`Conversations successfully fetched: ${conversations}`);
211
- } catch (e) {
212
- console.log(`Error in fetching Conversations: ${e}`);
213
- }
142
+
214
143
  ```
215
144
 
216
145
  ### Send Text Messages
217
146
 
218
147
  ```ts
219
- try {
220
- const timestamp = await client.sendMessageTextEvent(
221
- 'conversationId',
222
- 'Hello there'
223
- );
224
- console.log(`Message successfully sent with timestamp ${timestamp}`);
225
- } catch (e) {
226
- console.log(`Error in sending Message: ${e}`);
227
- }
148
+
228
149
  ```
229
150
 
230
151
  ### Listen for Conversation Events
231
152
 
232
153
  ```ts
233
- client.on('conversationEvent', (event) => {
234
- switch (event.kind) {
235
- case 'member:invited':
236
- case 'member:joined':
237
- case 'member:left':
238
- case 'message:text':
239
- case 'message:custom':
240
- case 'message:audio':
241
- case 'message:video':
242
- case 'message:image':
243
- case 'message:file':
244
- case 'message:vcard':
245
- case 'message:location':
246
- case 'message:template':
247
- case 'custom':
248
- case 'ephemeral':
249
- break;
250
- default:
251
- exhaustiveCheck(event);
252
- }
253
- const sender =
254
- event.from.kind == 'embeddedInfo' ? event.from.user.name : 'System';
255
- console.log(
256
- `${sender} sent ${event.kind} event to Conversation ${event.conversationId}`
257
- );
258
- });
154
+
259
155
  ```
260
156
 
261
157
  ## Documentation and examples
@@ -1,5 +1,5 @@
1
1
  import vonage from '../utils/vonage';
2
- import { Conversation, ConversationsPage, Member, MembersPage, PresentingOrder, ConversationEvent, PersistentConversationEvent, OrderBy } from '../utils';
2
+ import { Conversation, ConversationsPage, Member, MembersPage, PresentingOrder, ConversationEvent, PersistentConversationEvent, OrderBy, ClientInitConfigObject } from '../utils';
3
3
  /**
4
4
  * The Vonage Client SDK for JS/TS provides a simple interface
5
5
  * For the Vonage Voice and Messaging APIs.
@@ -39,6 +39,10 @@ export declare const CallDisconnectReason: typeof vonage.CallDisconnectReasonJS;
39
39
  type JSONValue = string | number | boolean | {
40
40
  [x: string]: JSONValue;
41
41
  } | JSONValue[];
42
+ /**
43
+ * @deprecated Use {@link ClientInitConfig.loggingLevel} instead.
44
+ * @param level - The logging level to set.
45
+ */
42
46
  export declare const setVonageClientLoggingLevel: typeof vonage.setDefaultLoggingLevel;
43
47
  /**
44
48
  * VonageClient is the main entry point for the Vonage Client SDK.
@@ -52,12 +56,12 @@ export declare const setVonageClientLoggingLevel: typeof vonage.setDefaultLoggin
52
56
  * DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
53
57
  */
54
58
  export declare class VonageClient extends vonage.CombinedClientJS {
55
- constructor();
59
+ constructor(config?: ClientInitConfigObject);
56
60
  /**
57
61
  * Register a callback for an event.
58
62
  *
59
63
  * @example
60
- * [[include:register_listener.txt]]
64
+ * [[include: snippet_RegisterListener.txt]]
61
65
  *
62
66
  * @param event - the event to register for (e.g. 'legStatusUpdate')
63
67
  * @param callback - the callback to register for the event
@@ -71,7 +75,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
71
75
  * Unregister a callback for an event.
72
76
  *
73
77
  * @example
74
- * [[include:unregister_listener.txt]]
78
+ * [[include: snippet_UnregisterListener.txt]]
75
79
  *
76
80
  * @param event - the event to register for (e.g. 'legStatusUpdate')
77
81
  * @param callbackSymbol - the callback symbol to unregister
@@ -84,7 +88,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
84
88
  * Clear all callbacks for an event.
85
89
  *
86
90
  * @example
87
- * [[include: clear_callbacks.txt]]
91
+ * [[include: snippet_Clear_Callbacks.txt]]
88
92
  *
89
93
  * @param event - the event to unregister from (e.g. 'legStatusUpdate')
90
94
  * @returns void
@@ -101,7 +105,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
101
105
  * to resume an existing session.
102
106
  *
103
107
  * @example
104
- * [[include:create_session.txt]]
108
+ * [[include: snippet_SessionCreate.txt]]
105
109
  *
106
110
  * @param token
107
111
  * @param sessionId - optional sessionId to use
@@ -128,7 +132,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
128
132
  * This is used to initiate a call using the Voice API and NCCO.
129
133
  *
130
134
  * @example
131
- * [[include:outbound_call.txt]]
135
+ * [[include: snippet_OutboundCall.txt]]
132
136
  *
133
137
  * @group Voice
134
138
  * @param context - the context to send to the server passed as Custom data to the voice answer webhook
@@ -139,7 +143,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
139
143
  * Hangup a call.
140
144
  *
141
145
  * @example
142
- * [[include:call_hangup.txt]]
146
+ * [[include: snippet_CallHangup.txt]]
143
147
  *
144
148
  * @group Voice
145
149
  * @param callId - the `callId` of the call to hangup
@@ -161,7 +165,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
161
165
  * Sends a TTS message to the Call
162
166
  *
163
167
  * @example
164
- * [[include:call_say.txt]]
168
+ * [[include: snippet_CallSay.txt]]
165
169
  *
166
170
  * @group Voice
167
171
  * @param callId - the `callId` of the call to send the message to
@@ -173,7 +177,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
173
177
  * Get a list of Conversations for the user.
174
178
  *
175
179
  * @example
176
- * [[include:get_conversations.txt]]
180
+ * [[include: snippet_GetConversations.txt]]
177
181
  *
178
182
  * @group Chat
179
183
  * @beta
@@ -187,7 +191,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
187
191
  * Get a Conversation's Events
188
192
  *
189
193
  * @example
190
- * [[include:get_conversation_events.txt]]
194
+ * [[include: snippet_GetConversationEvents.txt]]
191
195
  *
192
196
  * @group Chat
193
197
  * @beta
@@ -196,18 +200,19 @@ export declare class VonageClient extends vonage.CombinedClientJS {
196
200
  * @param pageSize - the number of events to return per page (default: 100)
197
201
  * @param cursor - the cursor to use for pagination (default: null)
198
202
  * @param eventFilter - the event types to filter by (default: null)
203
+ * @param includeDeletedEvents - A boolean, which when sent as true, will include `deletedEvents` in the list, default is false
199
204
  * @returns a `EventsPage` containing the events
200
205
  *
201
206
  * @privateRemarks
202
207
  * * This is a workaround for the to ensure exhaustiveness of the `ConversationEvent` type
203
208
  * * the kotlin core does not support union types
204
209
  */
205
- getConversationEvents(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null, eventFilter?: string[] | null): Promise<EventPage>;
210
+ getConversationEvents(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null, eventFilter?: string[] | null, includeDeletedEvents?: boolean): Promise<EventPage>;
206
211
  /**
207
212
  * Get a Conversation's Members
208
213
  *
209
214
  * @example
210
- * [[include:get_conversation_members.txt]]
215
+ * [[include: snippet_GetConversationMembers.txt]]
211
216
  *
212
217
  * @group Chat
213
218
  * @beta
@@ -222,7 +227,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
222
227
  * Create a conversation
223
228
  *
224
229
  * @example
225
- * [[include:create_conversation.txt]]
230
+ * [[include: snippet_CreateConversation.txt]]
226
231
  *
227
232
  * @group Chat
228
233
  * @beta
@@ -235,7 +240,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
235
240
  * Get a Conversation
236
241
  *
237
242
  * @example
238
- * [[include:get_conversation.txt]]
243
+ * [[include: snippet_GetConversation.txt]]
239
244
  *
240
245
  * @param id - the Conversation's id
241
246
  * @returns the `Conversation`
@@ -245,7 +250,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
245
250
  * Leave a Conversation
246
251
  *
247
252
  * @example
248
- * [[include:leave_conversation.txt]]
253
+ * [[include: snippet_LeaveConversation.txt]]
249
254
  *
250
255
  * @group Chat
251
256
  * @beta
@@ -257,7 +262,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
257
262
  * Join a Conversation
258
263
  *
259
264
  * @example
260
- * [[include:join_conversation.txt]]
265
+ * [[include: snippet_JoinConversation.txt]]
261
266
  *
262
267
  * @group Chat
263
268
  * @beta
@@ -269,7 +274,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
269
274
  * Delete a Conversation
270
275
  *
271
276
  * @example
272
- * [[include:delete_conversation.txt]]
277
+ * [[include: snippet_DeleteConversation.txt]]
273
278
  *
274
279
  * @group Chat
275
280
  * @beta
@@ -281,7 +286,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
281
286
  * Invite a user to a Conversation by user's `name`
282
287
  *
283
288
  * @example
284
- * [[include:invite_to_conversation.txt]]
289
+ * [[include: snippet_InviteToConversation.txt]]
285
290
  *
286
291
  * @group Chat
287
292
  * @beta
@@ -294,7 +299,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
294
299
  * Send a text message to a Conversation
295
300
  *
296
301
  * @example
297
- * [[include:send_text_message.txt]]
302
+ * [[include: snippet_SendTextMessage.txt]]
298
303
  *
299
304
  * @group Chat
300
305
  * @beta
@@ -307,7 +312,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
307
312
  * Send a custom message to a Conversation
308
313
  *
309
314
  * @example
310
- * [[include:send_custom_message.txt]]
315
+ * [[include: snippet_SendCustomMessage.txt]]
311
316
  *
312
317
  * @group Chat
313
318
  * @beta
@@ -320,7 +325,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
320
325
  * Send an ephemeral event to a Conversation
321
326
  *
322
327
  * @example
323
- * [[include:send_ephemeral_event.txt]]
328
+ * [[include: snippet_SendEphemeralEvent.txt]]
324
329
  *
325
330
  * @group Chat
326
331
  * @beta
@@ -346,7 +351,7 @@ export declare class VonageClient extends vonage.CombinedClientJS {
346
351
  * Get a Member of a Conversation
347
352
  *
348
353
  * @example
349
- * [[include:get_conversation_member.txt]]
354
+ * [[include: snippet_GetConversationMember.txt]]
350
355
  *
351
356
  * @group Chat
352
357
  * @beta