Client (interface)
Interface that provides API to connect and log in to the Voximplant Cloud.
Methods
- addEventListener
- connect
- disconnect
- login
- loginAccessToken
- loginOneTimeKey
- refreshTokens
- removeEventListener
- requestOneTimeKey
Properties
Methods
addEventListener
addEventListener(eventName: ClientEvent.Disconnected, listener: (event: ClientDisconnected) => void | Promise<void>, options: ListenerOptions): 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
Returns: void
connect
connect(options: ConnectionOptions): Promise<void>
Connects to the Voximplant Cloud.
Returns a promise that is resolved when the connection to the Voximplant Cloud is established.
Parameters
Returns: 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: Promise<void>
login
login(options: PasswordLoginOptions): Promise<LoginResult>
Logs in a user with a password to the Voximplant Cloud.
Returns a promise that is resolved to a LoginResult object.
Parameters
Returns: Promise<LoginResult>
Throws
One of LoginErrors
loginAccessToken
loginAccessToken(options: AccessTokenLoginOptions): 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
Returns: Promise<LoginResult>
Throws
One of LoginErrors
loginOneTimeKey
loginOneTimeKey(options: OneTimeKeyLoginOptions): 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
Returns: Promise<LoginResult>
Throws
One of LoginErrors
refreshTokens
refreshTokens(options: RefreshTokenOptions): Promise<LoginTokens>
Performs a refresh of login tokens required for Client.loginAccessToken.
Returns a promise that is resolved to a LoginTokens object.
Parameters
Returns: Promise<LoginTokens>
Throws
One of LoginErrors
removeEventListener
removeEventListener(eventName: ClientEvent.Disconnected, listener: (event: ClientDisconnected) => void | Promise<void>): void
Removes a previously registered handler for the specified event.
Parameters
Returns: void
requestOneTimeKey
requestOneTimeKey(options: RequestOneTimeKeyOptions): 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
Returns: Promise<string>
Throws
One of LoginErrors
Properties
state
state: ReadonlyWatchable<ClientState>
Watchable property that allows getting the current client state and observe its changes.