import { BADGE_TYPE, CALL_STATE, CALL_TYPE } from "../constants/sidebar"; import { StringNull } from './api.interfaces'; /** * @public */ export interface IParticipant { /** * Name of the participant (local / remote) * @readonly */ name: StringNull; /** * Phone number (or) E-mail address of the participant (local / remote) * @readonly */ callerID: StringNull; /** * Mute state of the participant (local / remote) * @readonly */ isMuted?: boolean; } /** * This will hold information about each call object obtained using {@link IWebexAppsSidebar.getCalls | sidebar.getCalls()} method * @public */ export interface ICall { /** * ID of the call * @readonly */ id: string; /** * State of the call. * * It can be one of the following, * * - "Started" * * - "Connecting" * * - "Connected" * * - "Disconnecting" * * - "Disconnected" * * - "Rejected" * * - "Hold" * * - "Ended" * * @readonly */ state: CALL_STATE; /** * Type of call. * * It can be one of the following, * * - "Placed" * * - "Received" * @readonly */ callType: CALL_TYPE; /** * Represents the list of remote participants in the call * @readonly */ remoteParticipants: IParticipant[]; /** * Holds information of the local participant * @readonly */ localParticipant: IParticipant; } /** * This will hold list of all calls obtained using {@link IWebexAppsSidebar.getCalls | sidebar.getCalls()} method * @public */ export interface ICalls { /** * Array of call objects * * See {@link ICall} to know what each call object would hold */ calls: ICall[]; } /** * @public */ export interface IBadge { /** * This is the type of badge that one can show on the native client * * The badge type can be one of "count" or "error" * @readonly */ badgeType: BADGE_TYPE; /** * This is the notification count that one can set to appear on the native client * * This needs to be provided when the badgeType is "count" * @readonly */ count?: number; } /** * Webex Embedded Apps Sidebar * @example * This can be accessed as follows, * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.context.getSidebar(); * ``` * The `sidebar` object's properties are documented on this page below * @public */ export interface IWebexAppsSidebar { /** * Information about the current state of the badge in the native client sidebar * * @public */ badge: IBadge; /** * This method returns a list of all calls from the native client. * * This API can also reject with one of the following error codes. * * 0 = SUCCESS, 1 = GENERIC_ERROR, 5 = BAD_CONTEXT, 6 = NOT_SUPPORTED * @example * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.getSidebar(); * const calls = await sidebar.getCalls(); * ``` * The `calls` object will have a list of call objects where each call object would have properties as mentioned in {@link ICall} * @public */ getCalls(): Promise; /** * This method is used to update the badge that'll be shown in the native client applications * * @param badge - Badge object of type {@link IBadge} * @example * Example for badgeType - Count * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.getSidebar(); * const isBadgeSet = await sidebar.showBadge({ * badgeType: 'count', * count: 100 * }); * ``` * @example * Example for badgeType - Error * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.getSidebar(); * const isBadgeSet = await sidebar.showBadge({ * badgeType: 'error', * }); * ``` * The variable `isBadgeSet` is a boolean */ showBadge(badge: IBadge): Promise; /** * This API can be used when one wants to clear the current badge shown in the native client applications * @example * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.getSidebar(); * const isBadgeSet = await sidebar.clearBadge(); * ``` * @public */ clearBadge(): Promise; /** * This method is used to display a notification in the native client sidebar * * @param message - The notification message to display * @param redirectURL - URL to navigate to when notification is clicked * @example * ```javascript * const app = new webex.Application(); * await app.onReady(); * const sidebar = await app.getSidebar(); * const isNotificationShown = await sidebar.showNotification( * "You have a new message", * "https://example.com/messages/123" * ); * ``` * The variable `isNotificationShown` is a boolean * @public */ showNotification(message: string, redirectURL: string): Promise; /** * This event is fired when a call information changes. * * This can be anything from a new incoming call to a call that got ended * * @event * @public * @example * ```javascript * const app = new webex.Application(); * app.onReady().then(() => { * app.listen() * .then(() => { * app.on("sidebar:callStateChanged", (call) => { * console.log("Call state changed. New call object:", call); * }) * }) * .catch((reason) => { * console.error("listen: fail reason=" + webex.Application.ErrorCodes[reason]); * }); * }); * ``` */ readonly 'sidebar:callStateChanged': ICall; } //# sourceMappingURL=sidebar.interfaces.d.ts.map