sinch-rtc
Version:
RTC JavaScript/Web SDK
83 lines (82 loc) • 3.12 kB
TypeScript
import { CallClient } from "./calling";
import { NotificationResult } from "./push";
import { SinchClientListener } from "./SinchClientListener";
/**
* SinchClient is an entry point for whole SDK
*/
export interface SinchClient {
/**
* Starts the Sinch client. This must be done prior to making any calls.
*
* @throws InvalidOperationError if {@link SinchClient} is already started
*/
start(): Promise<void>;
/**
* @returns true if the {@link SinchClient} is started.
*/
isStarted(): boolean;
/**
* Method used to forward the Sinch specific payload extracted from an
* incoming push notification. This will implicitly start the
* {@link SinchClient} if it wasn't already started.
*
* @param payload - Sinch specific payload which was transferred with the message
* @returns A result indicating initial inspection of the payload.
*/
relayRemotePushNotification(payload: Record<string, string>): NotificationResult;
/**
* Specify a display name to be used when the Sinch client initiates a call a on
* behalf of the local user (e.g. for an outgoing video call).
*
* Display name is included in a push notification on a best-effort basis. For example, if the
* target device has very limited push payload size constraints (e.g iOS 7 can only handle
* 255 byte push notification payload), then the display name may not be included. display name is also
* included in an incoming call, {@link Call.remoteUserDisplayName}
*
* @returns display name
*/
pushNotificationDisplayName?: string;
/**
* The {@link SinchClientListener} object handles events from the
* {@link SinchClient} such as incoming calls.
*
* @param sinchClientListener - a {@link SinchClientListener}
*/
addListener(sinchClientListener: SinchClientListener): void;
/**
* Remove listener for client events.
*
* @param sinchClientListener - a {@link SinchClientListener}
*/
removeListener(sinchClientListener: SinchClientListener): void;
/**
* Enables the use of managed push, where Sinch is responsible for sending your app a push notification when
* necessary.
*
* @param serviceWorker - filename of push ServiceWorker definition, default is sw.js
*/
setSupportManagedPush(serviceWorker?: string): Promise<void>;
/**
* Disables the use of managed push.
*
* @see {@link SinchClient.setSupportManagedPush}
*/
disableManagedPushSupport(): Promise<void>;
/**
* Terminates the Sinch client, while still leaving it some time to finish up currently
* pending tasks, for example finishing pending HTTP requests.
*/
terminate(): void;
/**
* Returns the {@link CallClient} object for placing and receiving calls.
*
* @returns the {@link CallClient} object.
*/
callClient: CallClient;
/**
* Returns the id of the user associated with this {@link SinchClient}.
*
* @returns the local user id.
*/
localUserId: string;
}