Repository navigation
Expand file tree
/
Copy pathsession.d.ts
More file actions
50 lines (47 loc) · 1.82 KB
/
Copy pathsession.d.ts
File metadata and controls
50 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type {
CustomResponseIncomingCallMap as KBCustomResponseIncomingCallMap,
IncomingCallMapType as KBIncomingCallMap,
} from '@/constants/types/rpc-gen'
import type {
CustomResponseIncomingCallMap as ChatCustomResponseIncomingCallMap,
IncomingCallMapType as ChatIncomingCallMap,
} from '@/constants/types/rpc-chat-gen'
import type {
CustomResponseIncomingCallMap as GregorCustomResponseIncomingCallMap,
IncomingCallMapType as GregorIncomingCallMap,
} from '@/constants/types/rpc-gregor-gen'
import type {
CustomResponseIncomingCallMap as SellarCustomResponseIncomingCallMap,
IncomingCallMapType as SellarIncomingCallMap,
} from '@/constants/types/rpc-stellar-gen'
type IncomingCallMap = {} & KBIncomingCallMap &
ChatIncomingCallMap &
GregorIncomingCallMap &
SellarIncomingCallMap
type CustomResponseIncomingCallMap = {} & KBCustomResponseIncomingCallMap &
ChatCustomResponseIncomingCallMap &
GregorCustomResponseIncomingCallMap &
SellarCustomResponseIncomingCallMap
declare class Session {
id: number
getId: () => number
end: () => void
getDangling: () => boolean
hasSeqID: (seqID: number) => boolean
_startMethod: string | undefined
cancel: () => void
incomingCall: (method: string, param: Object, response?: Object) => boolean
start: (method: string, param?: Object, callback?: () => void) => void
constructor(p: {
sessionID: number
incomingCallMap?: IncomingCallMap
customResponseIncomingCallMap?: CustomResponseIncomingCallMap
waitingKey?: string | ReadonlyArray<string>
invoke: (method: string, param: [Object] | undefined, cb: (err?: unknown, data?: unknown) => void) => void
endHandler: (session: Session) => void
cancelHandler?: (session: Session) => void
dangling?: boolean
})
}
export default Session
export type CancelHandlerType = (session: Session) => void