@vonage/client-sdk 1.1.0-alpha.3 → 1.1.0-alpha.7
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/dist/client/VonageClient.d.ts +200 -5
- package/dist/client/index.cjs +19714 -18628
- package/dist/client/index.mjs +19714 -18628
- package/dist/coreExtend.d.ts +30 -3
- package/dist/kotlin/clientsdk-clientcore_js.d.ts +2 -1
- package/dist/vonageClientSDK.js +18782 -17744
- package/dist/vonageClientSDK.min.js +2 -2
- package/dist/vonageClientSDK.min.mjs +2 -2
- package/dist/vonageClientSDK.mjs +18782 -17744
- package/package.json +1 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import vonage from '../utils/vonage';
|
|
2
|
-
export * from '../utils';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The Vonage Client SDK for JS/TS provides a simple interface
|
|
4
|
+
* For the Vonage Voice and Messaging APIs.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Built on top of the Kotlin Multiplatform SDK, it provides a
|
|
8
|
+
* more JS-like API, and platform specific implementations for
|
|
9
|
+
* the underlying network and media layers.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
6
12
|
*/
|
|
13
|
+
export * from '../utils';
|
|
7
14
|
export type VonageEvent = vonage.CombinedEvents;
|
|
8
15
|
export type RTCQuality = vonage.RTCQualityJS;
|
|
9
16
|
export type CancelReason = vonage.CancelReasonJS;
|
|
@@ -14,11 +21,199 @@ export type SessionErrorReason = vonage.SessionErrorReasonJS;
|
|
|
14
21
|
export declare const SessionErrorReason: typeof vonage.SessionErrorReasonJS;
|
|
15
22
|
export type LegStatus = vonage.LegStatusJS;
|
|
16
23
|
export declare const LegStatus: typeof vonage.LegStatusJS;
|
|
24
|
+
export type CallSayParams = Partial<vonage.CallSayParams> & {
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
type JSONValue = string | number | boolean | {
|
|
28
|
+
[x: string]: JSONValue;
|
|
29
|
+
} | JSONValue[];
|
|
30
|
+
import { Conversation, ConversationsPage, EventsPage, Member, MembersPage, PresentingOrder } from '../utils';
|
|
17
31
|
export declare const setVonageClientLoggingLevel: typeof vonage.setDefaultLoggingLevel;
|
|
32
|
+
/**
|
|
33
|
+
* VonageClient is the main entry point for the Vonage Client SDK.
|
|
34
|
+
*
|
|
35
|
+
* @privateRemarks
|
|
36
|
+
* This class is a wrapper around the KMP `CombinedClientJS` class.
|
|
37
|
+
* It provides a more JS-like API, and also provides a proxy object
|
|
38
|
+
* to allow for registering callbacks via `on()`.
|
|
39
|
+
*
|
|
40
|
+
* Minimal Interface built on top of KMP export
|
|
41
|
+
* DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
|
|
42
|
+
*/
|
|
18
43
|
export declare class VonageClient extends vonage.CombinedClientJS {
|
|
44
|
+
/**
|
|
45
|
+
* Proxy object to allow for registering callbacks via `on()`
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
19
48
|
private callbacks;
|
|
20
49
|
constructor();
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Register a callback for an event.
|
|
52
|
+
*
|
|
53
|
+
* @param event - the event to register for (e.g. 'legStatusUpdate')
|
|
54
|
+
* @param callback - the callback to register for the event
|
|
55
|
+
* @returns a symbol that can be used to unregister the callback
|
|
56
|
+
* @remarks
|
|
57
|
+
* Besure to store the symbol returned by this method so you can unregister the callback later.
|
|
58
|
+
* We recommend deregistering callbacks when you no longer need them. See {@link off}.
|
|
59
|
+
*/
|
|
60
|
+
on<T extends keyof VonageEvent, Fn extends VonageEvent[T]>(event: T, callback: Fn): symbol;
|
|
61
|
+
/**
|
|
62
|
+
* Unregister a callback for an event.
|
|
63
|
+
*
|
|
64
|
+
* @param event - the event to register for (e.g. 'legStatusUpdate')
|
|
65
|
+
* @param callbackSymbol - the callback symbol to unregister
|
|
66
|
+
* @returns true if the callback was unregistered, false otherwise
|
|
67
|
+
* @remarks
|
|
68
|
+
* We recommend deregistering callbacks when you no longer need them.
|
|
69
|
+
*/
|
|
70
|
+
off<T extends keyof VonageEvent>(event: T, callbackSymbol: symbol): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Clear all callbacks for an event.
|
|
73
|
+
*
|
|
74
|
+
* @param event - the event to register for (e.g. 'legStatusUpdate')
|
|
75
|
+
* @returns void
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* This is useful for cleaning up callbacks when you no longer need them.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* client.clearCallbacks('legStatusUpdate');
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
clearCallbacks<T extends keyof VonageEvent>(event: T): void;
|
|
86
|
+
/**
|
|
87
|
+
* Create a session with a token and optional sessionId
|
|
88
|
+
* If no sessionId is provided, a new one will be generated
|
|
89
|
+
* and returned. If a sessionId is provided, it will be used
|
|
90
|
+
* to resume an existing session.
|
|
91
|
+
*
|
|
92
|
+
* @param token
|
|
93
|
+
* @param sessionId - optional sessionId to use
|
|
94
|
+
* @returns the `sessionId` of the session
|
|
95
|
+
*/
|
|
96
|
+
createSession(token: string, sessionId?: string | null): Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Make a server call to the Vonage API.
|
|
99
|
+
* This is used to initiate a call using the Voice API and NCCO.
|
|
100
|
+
*
|
|
101
|
+
* @param context - the context to send to the server passed as Custom data to the voice answer webhook
|
|
102
|
+
* @returns the `callId` of the call
|
|
103
|
+
*/
|
|
104
|
+
serverCall(context?: Json): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Hangup a call.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
* this is a convenience method that calls `hangupWithReason` with
|
|
110
|
+
*
|
|
111
|
+
* @param callId - the `callId` of the call to hangup
|
|
112
|
+
* @param reasonText - optional reason text to send to the other party
|
|
113
|
+
* @param reasonCode - optional reason code to send to the other party
|
|
114
|
+
* @returns void
|
|
115
|
+
*/
|
|
116
|
+
hangup(callId: string, reasonText?: string, reasonCode?: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Sends a TTS message to the Call
|
|
119
|
+
* @param callId - the `callId` of the call to send the message to
|
|
120
|
+
* @param text - the text to send
|
|
121
|
+
* @returns void
|
|
122
|
+
*/
|
|
123
|
+
say(callId: string, text: string): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Sends a TTS message to the Call
|
|
126
|
+
* @param callId - the `callId` of the call to send the message to
|
|
127
|
+
* @param params - the `CallSayParams` to send
|
|
128
|
+
* @returns void
|
|
129
|
+
*/
|
|
130
|
+
say(callId: string, params: CallSayParams): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Get a list of Conversations for the user.
|
|
133
|
+
*
|
|
134
|
+
* @param order - the order to return the conversations in (default: 'asc')
|
|
135
|
+
* @param pageSize - the number of conversations to return per page (default: 100)
|
|
136
|
+
* @param cursor - the cursor to use for pagination (default: null)
|
|
137
|
+
* @returns a `ConversationsPage` containing the conversations
|
|
138
|
+
*/
|
|
139
|
+
getConversations(order?: PresentingOrder, pageSize?: number, cursor?: string | null): Promise<ConversationsPage>;
|
|
140
|
+
/**
|
|
141
|
+
* Get a Conversation's Events
|
|
142
|
+
*
|
|
143
|
+
* @param id - the Conversation's id
|
|
144
|
+
* @param order - the order to return the events in (default: 'asc')
|
|
145
|
+
* @param pageSize - the number of events to return per page (default: 100)
|
|
146
|
+
* @param cursor - the cursor to use for pagination (default: null)
|
|
147
|
+
* @returns a `EventsPage` containing the events
|
|
148
|
+
*/
|
|
149
|
+
getConversationEvents(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null): Promise<EventsPage>;
|
|
150
|
+
/**
|
|
151
|
+
* Get a Conversation's Members
|
|
152
|
+
* @param id - the Conversation's id
|
|
153
|
+
* @param order - the order to return the members in (default: 'asc')
|
|
154
|
+
* @param pageSize - the number of members to return per page (default: 100)
|
|
155
|
+
* @param cursor - the cursor to use for pagination (default: null)
|
|
156
|
+
* @returns a `MembersPage` containing the members
|
|
157
|
+
*/
|
|
158
|
+
getConversationMembers(id: string, order?: PresentingOrder, pageSize?: number, cursor?: string | null): Promise<MembersPage>;
|
|
159
|
+
/**
|
|
160
|
+
* Create a conversation
|
|
161
|
+
* @param name - the name of the conversation
|
|
162
|
+
* @param displayName - the display name of the conversation
|
|
163
|
+
* @returns the `cid` of the conversation
|
|
164
|
+
*/
|
|
165
|
+
createConversation(name?: string, displayName?: string): Promise<string>;
|
|
166
|
+
/**
|
|
167
|
+
* Get a Conversation
|
|
168
|
+
* @param id - the Conversation's id
|
|
169
|
+
* @returns the `Conversation`
|
|
170
|
+
*/
|
|
171
|
+
getConversation(cid: string): Promise<Conversation>;
|
|
172
|
+
/**
|
|
173
|
+
* Leave a Conversation
|
|
174
|
+
* @param id - the Conversation's id
|
|
175
|
+
* @returns void
|
|
176
|
+
*/
|
|
177
|
+
leaveConversation(id: string): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Join a Conversation
|
|
180
|
+
* @param id - the Conversation's id
|
|
181
|
+
* @returns the `memberId` of the member
|
|
182
|
+
*/
|
|
183
|
+
joinConversation(id: string): Promise<string>;
|
|
184
|
+
/**
|
|
185
|
+
* Delete a Conversation
|
|
186
|
+
* @param id - the Conversation's id
|
|
187
|
+
* @returns void
|
|
188
|
+
*/
|
|
189
|
+
deleteConversation(id: string): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Invite a user to a Conversation by user's `name`
|
|
192
|
+
* @param id - the Conversation's id
|
|
193
|
+
* @param name - the namne of the user to invite
|
|
194
|
+
* @returns the `memberId` of the member
|
|
195
|
+
*/
|
|
196
|
+
inviteToConversation(id: string, name: string): Promise<string>;
|
|
197
|
+
/**
|
|
198
|
+
* Send a text message to a Conversation
|
|
199
|
+
* @param id - the Conversation's id
|
|
200
|
+
* @param text - the Body of the message
|
|
201
|
+
* @returns the `timestamp` of the message
|
|
202
|
+
*/
|
|
203
|
+
sendTextMessage(id: string, text: string): Promise<string>;
|
|
204
|
+
/**
|
|
205
|
+
* Send a custom message to a Conversation
|
|
206
|
+
* @param id - the Conversation's id
|
|
207
|
+
* @param customData - the body of the message
|
|
208
|
+
* @returns the `timestamp` of the message
|
|
209
|
+
*/
|
|
210
|
+
sendCustomMessage(id: string, customData: JSONValue): Promise<string>;
|
|
211
|
+
/**
|
|
212
|
+
* Get a Member of a Conversation
|
|
213
|
+
* @param cid - the Conversation's id
|
|
214
|
+
* @param mid - the Member's id
|
|
215
|
+
* @returns the `Member`
|
|
216
|
+
*/
|
|
217
|
+
getConversationMember(cid: string, mid: string): Promise<Member>;
|
|
23
218
|
}
|
|
24
219
|
export default VonageClient;
|