Client
Interface that provides API to connect and log in to the Voximplant Cloud.
Methods
addEventListener
addEventListener(eventName: , listener: (event: ClientDisconnected) => void | Promise<void>
, options: ): void
Registers a handler for the specified event.
One event can have more than one handler; handlers are executed in order of their registration.
Parameters
eventName:
Event name
listener:
(event: ClientDisconnected) => void | Promise<void>
Handler function that is triggered when an event of the specified type occurs
options:
Object that specifies characteristics about the event listener
Returns
type:
void
connect
connect(options: ): Promise<void>
Connects to the Voximplant Cloud.
Returns a promise that is resolved when the connection to the Voximplant Cloud is established.
Parameters
options:
Connect options
Returns
type:
Promise<void>
Throws
One of ConnectionErrors
disconnect
disconnect(): Promise<void>
Disconnects from the Voximplant Cloud.
Returns a promise that is resolved when the connection to the Voximplant Cloud is closed.
Returns
type:
Promise<void>
login
login(options: ): Promise<LoginResult>
Logs in a user with a password to the Voximplant Cloud.
Returns a promise that is resolved to a LoginResult object.
Parameters
options:
Options to log in with a password
Returns
type:
Promise<LoginResult>
Throws
One of LoginErrors
loginAccessToken
loginAccessToken(options: ): Promise<LoginResult>
Logs in a user with an access token to the Voximplant Cloud.
Returns a promise that is resolved to a LoginResult object.
Parameters
options:
Options to log in with an access token
Returns
type:
Promise<LoginResult>
Throws
One of LoginErrors
loginOneTimeKey
loginOneTimeKey(options: ): Promise<LoginResult>
Logs in a user with a one-time key to the Voximplant Cloud.
Returns a promise that is resolved to a LoginResult object.
Parameters
options:
Options to log in with a one-time key
Returns
type:
Promise<LoginResult>
Throws
One of LoginErrors
refreshTokens
refreshTokens(options: ): Promise<LoginTokens>
Performs a refresh of login tokens required for Client.loginAccessToken.
Returns a promise that is resolved to a LoginTokens object.
Parameters
options:
Options to refresh tokens
Returns
type:
Promise<LoginTokens>
Throws
One of LoginErrors
removeEventListener
removeEventListener(eventName: , listener: (event: ClientDisconnected) => void | Promise<void>
): void
Removes a previously registered handler for the specified event.
Parameters
eventName:
Event name
listener:
(event: ClientDisconnected) => void | Promise<void>
Handler function to remove from the event target
Returns
type:
void
requestOneTimeKey
requestOneTimeKey(options: ): Promise<string>
Generates a one-time login key to use in the automated login process.
For additional information please see the guide.
Returns a promise that is resolved to a string that represents the one-time key.
Parameters
options:
Options to request a one-time key
Returns
type:
Promise<string>
Throws
One of LoginErrors
Props
state
state:
Watchable property that allows getting the current client state and observe its changes.