forked from NativeScript/firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
373 lines (298 loc) · 11 KB
/
index.d.ts
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
import { ActionCodeInfoOperation } from './common';
import { Firebase, FirebaseApp } from '@nativescript/firebase-core';
export { ActionCodeInfoOperation };
export interface IUserMetadata {
creationDate: Date;
lastSignInDate: Date;
}
export interface IUserInfo {
uid: string;
displayName: string;
email: string;
phoneNumber: string;
photoURL: string;
providerId: string;
}
export interface IAuthTokenResult {
authDate: Date;
claims: Record<string, any>;
expirationDate: Date;
issuedAtDate: Date;
signInProvider: string;
token: string;
}
export interface IUser {
uid: string;
displayName: string;
anonymous: boolean;
emailVerified: boolean;
email: string;
phoneNumber: string;
providerId: string;
photoURL: string;
metadata: IUserMetadata;
providerData: IUserInfo[];
delete(): Promise<void>;
getIdToken(forceRefresh?: undefined | false | true): Promise<string>;
getIdTokenResult(forceRefresh?: undefined | false | true): Promise<IAuthTokenResult>;
linkWithCredential(credential: IAuthCredential): Promise<IUserCredential>;
reauthenticateWithProvider(credential: IOAuthProvider): Promise<IUserCredential>;
reauthenticateWithCredential(credential: IAuthCredential): Promise<IUserCredential>;
reload(): Promise<void>;
sendEmailVerification(actionCodeSettings?: IActionCodeSettings): Promise<void>;
unlink(providerId: string): Promise<IUser>;
updateEmail(email: string): Promise<void>;
updatePassword(password: string): Promise<void>;
updatePhoneNumber(credential: IAuthCredential): Promise<void>;
updateProfile(updates: UserProfileChangeRequest): Promise<void>;
verifyBeforeUpdateEmail(email: string, actionCodeSettings?: IActionCodeSettings): Promise<void>;
}
export interface IAuthSettings {
appVerificationDisabledForTesting: boolean;
}
export interface ActionCodeInfoData {
email: string;
previousEmail: string;
}
export interface ActionCodeInfo {
data: ActionCodeInfoData;
operation: ActionCodeInfoOperation;
}
export interface AdditionalUserInfo {
newUser: boolean;
profile: Record<string, any>;
providerId: string;
username: string;
}
export interface IUserCredential {
additionalUserInfo: AdditionalUserInfo;
user: IUser;
credential: IAuthCredential;
}
export interface IAuthCredential {
readonly provider: string;
readonly signInMethod: string;
}
export interface IActionCodeSettings {
readonly url: string;
readonly androidInstallIfNotAvailable: boolean;
readonly androidMinimumVersion: string;
readonly androidPackageName: string;
readonly dynamicLinkDomain: string;
readonly handleCodeInApp: boolean;
readonly iOSBundleId: string;
}
export interface OAuthCredentialOptions {
accessToken?: string;
idToken?: string;
rawNonce?: string;
}
export interface IOAuthCredential extends IAuthCredential {
readonly idToken: string;
readonly accessToken: string;
readonly secret: string;
}
export interface IPhoneAuthCredential extends IAuthCredential {}
export interface UserProfileChangeRequest {
displayName?: string;
photoUri?: string;
}
export interface IOAuthProvider {
addCustomParameter(key: string, value: string);
setScopes(scopes: string[]);
credential(optionsOrIdToken: OAuthCredentialOptions | string | null, accessToken?: string);
}
export interface IAuth {
readonly app: FirebaseApp;
readonly currentUser: IUser;
languageCode: string;
readonly settings: IAuthSettings;
readonly tenantId: string;
useEmulator(host: string, port: number);
applyActionCode(code: string): Promise<void>;
checkActionCode(code: string): Promise<ActionCodeInfo>;
confirmPasswordReset(code: string, newPassword: string): Promise<void>;
createUserWithEmailAndPassword(email: string, password: string): Promise<IUserCredential>;
fetchSignInMethodsForEmail(email: string): Promise<string[]>;
isSignInWithEmailLink(emailLink: string): boolean;
addAuthStateChangeListener(listener: (user: IUser) => void);
removeAuthStateChangeListener(listener: (user: IUser) => void);
addIdTokenChangeListener(listener: (user: IUser) => void);
removeIdTokenChangListener(listener: (user: IUser) => void);
sendPasswordResetEmail(email: string, actionCodeSettings?: IActionCodeSettings): Promise<void>;
sendSignInLinkToEmail(email: string, actionCodeSettings?: IActionCodeSettings): Promise<void>;
signInAnonymously(): Promise<IUserCredential>;
signInWithProvider(provider: IOAuthProvider): Promise<IUserCredential>;
signInWithCredential(credential: IAuthCredential): Promise<IUserCredential>;
signInWithCustomToken(customToken: string): Promise<IUserCredential>;
signInWithEmailAndPassword(email: string, password: string): Promise<IUserCredential>;
signInWithEmailLink(email: string, emailLink: string): Promise<IUserCredential>;
signOut();
useUserAccessGroup(userAccessGroup: string): Promise<void>;
verifyPasswordResetCode(code: string): Promise<string>;
}
export interface UserCredential extends IUserCredential {
additionalUserInfo: AdditionalUserInfo;
user: User;
credential: AuthCredential;
}
export declare class UserMetadata implements IUserMetadata {
readonly native;
readonly ios;
readonly android;
readonly creationDate: Date;
readonly lastSignInDate: Date;
}
export declare class UserInfo implements IUserInfo {
readonly native;
readonly ios;
readonly android;
readonly uid: string;
readonly displayName: string;
readonly email: string;
readonly phoneNumber: string;
readonly photoURL: string;
readonly providerId: string;
}
export declare class User implements IUser {
readonly uid: string;
readonly displayName: string;
readonly anonymous: boolean;
readonly emailVerified: boolean;
readonly email: string;
readonly phoneNumber: string;
readonly providerId: string;
readonly photoURL: string;
readonly metadata: UserMetadata;
readonly providerData: UserInfo[];
delete(): Promise<void>;
getIdToken(forceRefresh?: undefined | false | true): Promise<string>;
getIdTokenResult(forceRefresh?: undefined | false | true): Promise<AuthTokenResult>;
linkWithCredential(credential: AuthCredential): Promise<UserCredential>;
reauthenticateWithProvider(provider: OAuthProvider): Promise<UserCredential>;
reauthenticateWithCredential(credential: AuthCredential): Promise<UserCredential>;
reload(): Promise<void>;
sendEmailVerification(actionCodeSettings?: ActionCodeSettings): Promise<void>;
unlink(providerId: string): Promise<User>;
updateEmail(email: string): Promise<void>;
updatePassword(password: string): Promise<void>;
updatePhoneNumber(credential: AuthCredential): Promise<void>;
updateProfile(updates: UserProfileChangeRequest): Promise<void>;
verifyBeforeUpdateEmail(email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
}
export declare class AuthSettings implements IAuthSettings {
readonly native;
readonly ios;
readonly android;
appVerificationDisabledForTesting: boolean;
}
export declare class ActionCodeSettings implements IActionCodeSettings {
readonly native;
readonly ios;
readonly android;
url: string;
androidInstallIfNotAvailable: boolean;
androidMinimumVersion: string;
androidPackageName: string;
dynamicLinkDomain: string;
handleCodeInApp: boolean;
iOSBundleId: string;
}
export declare class AuthCredential implements IAuthCredential {
readonly native;
readonly ios;
readonly android;
signInMethod: string;
readonly provider: string;
}
export declare class EmailAuthProvider {
static credential(email: string, password: string): AuthCredential;
static credentialWithLink(email: string, link: string): AuthCredential;
}
export declare class PhoneAuthProvider {
readonly native;
readonly ios;
readonly android;
static provider(auth?: Auth): PhoneAuthProvider;
credential(verificationId: string, verificationCode: string): AuthCredential;
verifyPhoneNumber(phoneNumber: string): Promise<string>;
}
export declare class AppleAuthProvider {
static credential(idToken: string, nonce: string): AuthCredential;
}
export declare class FacebookAuthProvider {
static credential(accessToken: string): AuthCredential;
}
export declare class GithubAuthProvider {
static credential(token: string): AuthCredential;
}
export declare class GoogleAuthProvider {
static credential(idToken: string, accessToken: string): AuthCredential;
}
export declare class OAuthCredential extends AuthCredential implements IOAuthCredential {
readonly native;
readonly ios;
readonly android;
signInMethod: string;
readonly idToken: string;
readonly accessToken: string;
readonly secret: string;
}
export declare class OAuthProvider implements IOAuthProvider {
constructor(providerId: string);
addCustomParameter(key: string, value: string);
setScopes(scopes: string[]);
credential(optionsOrIdToken: OAuthCredentialOptions | string | null, accessToken?: string): OAuthCredential;
}
export declare class TwitterAuthProvider {
static credential(token: string, secret: string): AuthCredential;
}
export declare class PhoneAuthCredential extends AuthCredential implements IPhoneAuthCredential {
readonly native;
readonly ios;
readonly android;
}
export declare class AuthTokenResult implements IAuthTokenResult {
readonly authDate: Date;
readonly claims: Record<string, any>;
readonly expirationDate: Date;
readonly issuedAtDate: Date;
readonly signInProvider: string;
readonly token: string;
}
export declare class Auth implements IAuth {
readonly app: FirebaseApp;
readonly currentUser: User | null;
languageCode: string;
readonly settings: AuthSettings;
readonly tenantId: string;
useEmulator(host: string, port: number);
applyActionCode(code: string): Promise<void>;
checkActionCode(code: string): Promise<ActionCodeInfo>;
confirmPasswordReset(code: string, newPassword: string): Promise<void>;
createUserWithEmailAndPassword(email: string, password: string): Promise<UserCredential>;
fetchSignInMethodsForEmail(email: string): Promise<string[]>;
isSignInWithEmailLink(emailLink: string): boolean;
addAuthStateChangeListener(listener: (user: User) => void);
removeAuthStateChangeListener(listener: (user: User) => void);
addIdTokenChangeListener(listener: (user: User) => void);
removeIdTokenChangListener(listener: (user: User) => void);
sendPasswordResetEmail(email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
sendSignInLinkToEmail(email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
signInAnonymously(): Promise<UserCredential>;
signInWithProvider(provider: OAuthProvider): Promise<UserCredential>;
getProviderCredential(provider: OAuthProvider): Promise<OAuthCredential>;
signInWithCredential(credential: AuthCredential): Promise<UserCredential>;
signInWithCustomToken(customToken: string): Promise<UserCredential>;
signInWithEmailAndPassword(email: string, password: string): Promise<UserCredential>;
signInWithEmailLink(email: string, emailLink: string): Promise<UserCredential>;
signOut(): Promise<boolean>;
useUserAccessGroup(userAccessGroup: string): Promise<void>;
verifyPasswordResetCode(code: string): Promise<string>;
}
declare module '@nativescript/firebase-core' {
export interface Firebase extends FirebaseAuth {}
}
export interface FirebaseAuth {
static auth(app?: FirebaseApp): Auth;
}