-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeclarations.d.ts
More file actions
197 lines (161 loc) · 5.07 KB
/
declarations.d.ts
File metadata and controls
197 lines (161 loc) · 5.07 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
Declaration files are how the Typescript compiler knows about the type information(or shape) of an object.
They're what make intellisense work and make Typescript know all about your code.
A wildcard module is declared below to allow third party libraries to be used in an app even if they don't
provide their own type declarations.
To learn more about using third party libraries in an Ionic app, check out the docs here:
http://ionicframework.com/docs/v2/resources/third-party-libs/
For more info on type definition files, check out the Typescript docs here:
https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
*/
declare module '*';
declare namespace Handshake {
interface HandshakeFields {
ext: any
}
interface AbstractHandshakeOptions {
authType: string
sandboxId: string
deploymentId: string
}
interface CredentialsHandshakeOptions {
authType: string
deploymentId: string
login: string
password: string
}
interface TokenHandshakeOptions {
authType: string
deploymentId: string
token: string
}
interface AbstractHandshake {
constructor(options: AbstractHandshakeOptions)
authType: string
authVersion: string
sandboxId: string
deploymentId: string
getHandshakeFields(Client): HandshakeFields
}
interface CredentialsAuthData {
login: string
password: string
}
interface CredentialsHandshake extends AbstractHandshake {
constructor(options: AbstractHandshakeOptions)
login: string
password: string
authData: CredentialsAuthData
}
interface TokenAuthData {
token: string
}
interface TokenHandshake extends AbstractHandshake {
constructor(options: AbstractHandshakeOptions)
token: string
authData: TokenAuthData
}
type AuthenticationCallback = () => AbstractHandshake
}
declare module "zetapush-js" {
type AsyncMacroServicePublisher = (method: string, parameters: any, hardFail?: boolean, debug?: number) => Promise<any>
type MacroServicePublisher = (method: string, parameters: any, hardFail?: boolean, debug?: number) => void
type ServicePublisher = (method: string, parameters: any) => void
interface Options {
apiUrl: string
sandboxId: string
forceHttps?: boolean
resource?: string
transports?: Array<any>
}
interface ClientOptions extends Options{
authentication: () => any
}
interface WeakClientOptions {
deploymentId?: string
}
interface SmartClientOptions extends Options {
}
interface ConnectionStatusListener {
onConnectionBroken?: () => void
onConnectionClosed?: () => void
onConnectionEstablished?: () => void
onConnectionWillClose?: () => void
onFailedHandshake?: (failure: any) => void
onMessageLost?: () => void
onSuccessfulHandshake?: (authentication: any) => void
}
interface Services {
Macro: AsyncMacroService
Messaging: Service
}
interface Service {
DEFAULT_DEPLOYMENT_ID: string
$publish: ServicePublisher
new($publish: ServicePublisher): Service
}
interface AsyncMacroService {
DEFAULT_DEPLOYMENT_ID: string
$publish: AsyncMacroServicePublisher
new($publish: AsyncMacroServicePublisher): AsyncMacroService
}
interface MacroService {
DEFAULT_DEPLOYMENT_ID: string
$publish: MacroServicePublisher
new($publish: MacroServicePublisher): MacroService
}
interface ServiceDeclaration {
Type: Service
deploymentId?: string
}
interface Token {
token: string
}
interface Credentials {
login: string
password: string
}
interface ClientHelper {
authentication: Handshake.AuthenticationCallback
servers: Promise<Array<string>>
getUniqRequestId(): string
}
type ConnectionStatusHandler = number
export class Authentication {
static delegating({ token }): Handshake.TokenHandshake
static simple({ login, password }): Handshake.CredentialsHandshake
static weak({ token }): Handshake.TokenHandshake
}
export class Client {
helper: ClientHelper
constructor(options: ClientOptions)
addConnectionStatusListener(listener: ConnectionStatusListener): ConnectionStatusHandler
connect(): void
createService(ServiceDeclaration): Service
createAsyncMacroService(ServiceDeclaration): AsyncMacroService
disconnect(): void
isConnected(): boolean
getSandboxId(): string
getResource(): string
getUserId(): string
removeConnectionStatusListener(listener: ConnectionStatusHandler)
setAuthentication(authentication: Handshake.AuthenticationCallback)
setLogLevel(level: string)
setResource(resource: string)
unsubscribe(service: Service)
}
export class WeakClient extends Client {
constructor(options: WeakClientOptions)
getToken(): Token
}
export class SmartClient extends Client {
constructor(options: SmartClientOptions)
getCredentials(): any
getSession(): any
hasCredentials(): boolean
isStronglyAuthenticated(session?: any): boolean
isWeaklyAuthenticated(session?: any): boolean
setCredentials(credentials: any): void
}
const services: Services
}