@vonage/client-sdk
Version:
The Client SDK is intended to provide a ready solution for developers to build Programmable Conversation applications across multiple Channels including: Messages, Voice, SIP, websockets, and App.
97 lines (96 loc) • 4.76 kB
TypeScript
import { Nullable } from '../kotlin/clientsdk-clientcore_js';
import vonage from '../utils/vonage';
import { LoggingLevel, VonageLogger, VonageLoggerJS } from './logging';
/**
* The datacenter region for the Client.
*
* It can be set either via {@link ClientInitConfigObject} or {@link ClientConfigObject}.
*/
export type ConfigRegion = vonage.CoreClientConfigRegionJS | typeof vonage.CoreClientConfigRegionJS.prototype.name;
export declare const ConfigRegion: typeof vonage.CoreClientConfigRegionJS;
/**
* An convenience union for {@link ConfigObjectJS} allowing to pass strings for enum properties.
*/
/**
* Represents the configuration object for the client.
*
* The `ClientConfig` class provides a convenient way to configure the client by specifying various properties.
* These properties control different aspects of the client's behavior, such as API URLs, media reoffer, and WebSocket settings.
*
* @property region The Vonage datacenter to use
* @property apiUrl The API URL of your chosen datacenter, if set overrides default from region
* @property websocketUrl The WebSocket URL of your chosen datacenter, if set overrides default from region
* @property websocketPath The Path component appended to the Websocket URL
* @property rtcStatsTelemetry Allow users to enable RTCStats
* @property autoReconnectMedia Allow the sdk to automatically reconnect media when network interface changes
*
* @example
* [[include:snippet_SetClientConfig.txt]]
*/
export type ClientConfigObject = ConfigObjectJS | ({
region?: ConfigRegion;
} & Omit<ConfigObjectJS, 'region'>);
/**
* Represents the configuration object used to initialize the client.
*
* The `ClientInitConfig` class provides a convenient way to configure the client by specifying various properties.
* These properties include all the ones in {@link ClientConfigObject} plus {@link loggingLevel}, {@link customLoggers} and {@link disableInternalLogger}.
*
* @property loggingLevel The Logging Level to use
* @property customLoggers A List of custom loggers
* @property disableInternalLogger Whether to enable the SDK internal logger
* @property region The Vonage datacenter to use
* @property apiUrl The API URL of your chosen datacenter, if set overrides default from region
* @property websocketUrl The WebSocket URL of your chosen datacenter, if set overrides default from region
* @property websocketPath The Path component appended to the Websocket URL
* @property rtcStatsTelemetry Allow users to enable RTCStats
* @property autoReconnectMedia Allow the sdk to automatically reconnect media when network interface changes
*
* @example
* [[include:snippet_Logging.txt]]
*/
export type ClientInitConfigObject = InitConfigObjectJS | ({
region?: ConfigRegion;
loggingLevel?: LoggingLevel;
customLoggers?: VonageLogger[];
} & Omit<InitConfigObjectJS, 'region' | 'loggingLevel' | 'customLoggers'>);
export interface ConfigObjectJS {
region?: Nullable<vonage.CoreClientConfigRegionJS>;
apiUrl?: Nullable<string>;
websocketUrl?: Nullable<string>;
websocketPath?: Nullable<string>;
rtcStatsTelemetry?: Nullable<boolean>;
autoReconnectMedia?: Nullable<boolean>;
}
export interface InitConfigObjectJS extends ConfigObjectJS {
loggingLevel?: Nullable<vonage.LoggingLevelJS>;
customLoggers?: Nullable<VonageLoggerJS[]>;
disableInternalLogger?: Nullable<boolean>;
}
export declare class ClientConfig extends vonage.CoreClientConfigJS {
/**
* Constructs a new instance of the class.
*
* @param region The region where the API and WebSocket URLs should be configured.
* Valid values are "EU" (Europe), "US" (United States), or "AP" (Asia Pacific).
* The URLs will be automatically set based on the selected region.
* Defaults to "US" if no region is specified.
*/
constructor(region?: ConfigRegion);
}
export declare class ClientInitConfig implements InitConfigObjectJS {
loggingLevel: vonage.LoggingLevelJS;
region: vonage.CoreClientConfigRegionJS;
customLoggers: VonageLoggerJS[];
disableInternalLogger: boolean;
apiUrl?: Nullable<string>;
websocketUrl?: Nullable<string>;
websocketPath?: Nullable<string>;
rtcStatsTelemetry?: Nullable<boolean>;
autoReconnectMedia?: Nullable<boolean>;
/**
* Constructs a new instance of the class.
*/
constructor(loggingLevel?: LoggingLevel, region?: ConfigRegion, customLoggers?: Array<VonageLogger | VonageLoggerJS>);
}
export declare const convertInitConfig: (config: ClientInitConfigObject) => InitConfigObjectJS;