1+ /** 0.6.10 */
2+
3+ export as namespace SendBirdCall ;
4+
5+ export function init ( appId ) : void ;
6+ export function authenticate ( authOption : AuthOption , handler ?: AuthHandler ) : Promise < User > ;
7+ export function deauthenticate ( ) : void ;
8+ export function connectWebSocket ( ) : Promise < void > ;
9+ export function addListener ( id : string , listener : SendBirdCallListener ) : void ;
10+ export function removeListener ( id : string ) : void ;
11+ export function removeAllListeners ( ) : void ;
12+ export function dial ( userId : string , isVideoCall : false , callOption : DirectCallOption , callback ?: DialHandler ) : DirectCall ;
13+ export function createDirectCallLogListQuery ( params ?: DirectCallLogListQueryParams ) : DirectCallLogListQuery ;
14+ export function setLoggerLevel ( level : LoggerLevel ) ;
15+ export function getCall ( callId : string ) : DirectCall ;
16+ export const sdkVersion : string ;
17+ export const appId : string ;
18+ export const currentUser : User ;
19+
20+ export enum LoggerLevel {
21+ NONE = 'NONE' ,
22+ ERROR = 'ERROR'
23+ }
24+
25+ export enum DirectCallUserRole {
26+ CALLER = 'dc_caller' ,
27+ CALLEE = 'dc_callee'
28+ }
29+
30+ export enum DirectCallEndResult {
31+ NO_ANSWER = 'no_answer' ,
32+ CANCELED = 'canceled' ,
33+ DECLINED = 'declined' ,
34+ OTHER_DEVICE_ACCEPTED = 'other_device_accepted' ,
35+ COMPLETED = 'completed' ,
36+ CONNECTION_LOST = 'connection_lost' ,
37+ TIMED_OUT = 'timed_out' ,
38+ FAILED_TO_DIAL = 'failed_to_dial' ,
39+ FAILED_TO_ACCEPT = 'failed_to_accept' ,
40+ UNKNOWN = 'unknown'
41+ }
42+
43+ export interface SendBirdCallListener {
44+ onRinging : ( ( directCall : DirectCall ) => void ) | null ;
45+ }
46+
47+ export interface DirectCall {
48+ onEstablished : ( ( call : DirectCall ) => void ) | null ;
49+ onConnected : ( ( call : DirectCall ) => void ) | null ;
50+
51+ //deprecated
52+ onRemoteAudioEnabled : ( ( call : DirectCall ) => void ) | null ;
53+ onRemoteAudioSettingsChanged : ( ( call : DirectCall ) => void ) | null ;
54+ onEnded : ( ( call : DirectCall ) => void ) | null ;
55+
56+ readonly caller : DirectCallUser ;
57+ readonly callee : DirectCallUser ;
58+ readonly isVideoCall : boolean ;
59+ readonly localUser : DirectCallUser ;
60+ readonly remoteUser : DirectCallUser ;
61+ readonly isLocalAudioEnabled : boolean ;
62+ readonly isRemoteAudioEnabled : boolean ;
63+ readonly myRole : DirectCallUserRole ;
64+ readonly endedBy : DirectCallUser ;
65+ readonly endResult : DirectCallEndResult ;
66+
67+ getDuration ( ) : number ;
68+ accept ( callOptions : DirectCallOption ) : void ;
69+ end ( ) : void ;
70+
71+ //deprecated
72+ mute ( ) : void ;
73+
74+ //deprecated
75+ unmute ( ) : void ;
76+
77+ muteMicrophone ( ) : void ;
78+ unmuteMicrophone ( ) : void ;
79+ }
80+
81+ export interface DirectCallOption {
82+ localMediaView ?: HTMLAudioElement | HTMLVideoElement ;
83+ remoteMediaView ?: HTMLAudioElement | HTMLVideoElement ;
84+ localVideoView ?: HTMLAudioElement | HTMLVideoElement ;
85+ remoteVideoView ?: HTMLAudioElement | HTMLVideoElement ;
86+ audioEnabled ?: boolean ;
87+ }
88+
89+ declare const DirectCallOption : {
90+ new ( option : DirectCallOption ) : DirectCallOption ;
91+ } ;
92+
93+ export interface DirectCallLogListQuery {
94+ next ( callback ?: DirectCallLogListQueryResultHandler ) : Promise < DirectCallLog [ ] > ;
95+ readonly isLoading : boolean ;
96+ readonly hasNext : boolean ;
97+ }
98+
99+ export type DirectCallLogListQueryResultHandler = ( callLogs ?: DirectCallLog [ ] , error ?: Error ) => void ;
100+
101+ export interface DirectCallLog {
102+ readonly callId : string ;
103+ readonly userRole : DirectCallUserRole ;
104+ readonly startedAt : Date ;
105+ readonly endedAt : Date ;
106+ readonly endedBy : DirectCallUser ;
107+ readonly duration : number ;
108+ readonly endResult : DirectCallEndResult ;
109+ readonly isVideoCall : boolean ;
110+ }
111+
112+ export interface DirectCallUser {
113+ readonly userId : string ;
114+ readonly nickname : string ;
115+ readonly profileUrl : string ;
116+ readonly metaData : object ;
117+ readonly isActive : boolean ;
118+ readonly role : DirectCallUserRole ;
119+ }
120+
121+ export interface AuthOption {
122+ userId : string ;
123+ accessToken ?: string ;
124+ }
125+
126+ export type AuthHandler = ( user ?: User , error ?: Error ) => void ;
127+ export type DialHandler = ( call ?: DirectCall , error ?: Error ) => void ;
128+ export type CompletionHandler = ( error ?: Error ) => void ;
129+
130+ export interface User {
131+ readonly userId : string ;
132+ readonly nickname : string ;
133+ readonly profileUrl : string ;
134+ readonly metaData : string ;
135+ readonly isActive : string ;
136+ }
137+
138+ export interface DirectCallLogListQueryParams {
139+ myRole ?: DirectCallUserRole ;
140+ endResults ?: DirectCallEndResult [ ] ;
141+ limit ?: number ;
142+ }
0 commit comments