1- declare namespace firebase {
1+ declare module "nativescript- firebase" {
22
33 /**
44 * The allowed values for LoginOptions.type.
55 */
66 export enum LoginType {
7- /**
8- * No further data is required.
9- */
10- ANONYMOUS ,
11- /**
12- * This requires you to pass in email and password properties as well.
13- */
14- PASSWORD ,
15- /**
16- * This requires you to pass either an authentication token generated by your backend server
17- * or the tokenProviderFn function that returns a promise to provide the token.
18- * See: https://firebase.google.com/docs/auth/server
19- */
20- CUSTOM ,
21- /**
22- * This requires you to setup Facebook Auth in the Firebase console,
23- * as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
24- */
25- FACEBOOK ,
26- /**
27- * This requires you to setup Google Sign In in the Firebase console,
28- * as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
29- */
30- GOOGLE
7+ /**
8+ * No further data is required.
9+ */
10+ ANONYMOUS ,
11+ /**
12+ * This requires you to pass in email and password properties as well.
13+ */
14+ PASSWORD ,
15+ /**
16+ * This requires you to pass either an authentication token generated by your backend server
17+ * or the tokenProviderFn function that returns a promise to provide the token.
18+ * See: https://firebase.google.com/docs/auth/server
19+ */
20+ CUSTOM ,
21+ /**
22+ * This requires you to setup Facebook Auth in the Firebase console,
23+ * as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
24+ */
25+ FACEBOOK ,
26+ /**
27+ * This requires you to setup Google Sign In in the Firebase console,
28+ * as well as uncommenting the SDK includes in include.gradle (Android) and Podfile (iOS).
29+ */
30+ GOOGLE
3131 }
3232
3333 /**
3434 * The allowed values for QueryOptions.orderBy.type.
3535 */
3636 export enum QueryOrderByType {
37- KEY ,
38- VALUE ,
39- CHILD ,
40- PRIORITY
37+ KEY ,
38+ VALUE ,
39+ CHILD ,
40+ PRIORITY
4141 }
4242
4343 /**
4444 * The allowed values for QueryOptions.range.type.
4545 */
4646 export enum QueryRangeType {
47- START_AT ,
48- END_AT ,
49- EQUAL_TO
47+ START_AT ,
48+ END_AT ,
49+ EQUAL_TO
5050 }
5151
5252 /**
5353 * The allowed values for QueryOptions.limit.type.
5454 */
5555 export enum QueryLimitType {
56- FIRST ,
57- LAST
56+ FIRST ,
57+ LAST
5858 }
5959
6060 export interface ServerValue {
@@ -370,6 +370,7 @@ declare namespace firebase {
370370 }
371371
372372 export interface UploadFileResult {
373+
373374 }
374375
375376 export interface DownloadFileOptions {
@@ -429,8 +430,24 @@ declare namespace firebase {
429430 log : string ;
430431 }
431432
433+ export function init ( options : InitOptions ) : Promise < any > ;
434+
435+ // Database
436+ export function push ( path : string , value : any ) : Promise < PushResult > ;
437+ export function setValue ( path : string , value : any ) : Promise < any > ;
438+ export function update ( path : string , value : any ) : Promise < any > ;
439+ export function remove ( path : string ) : Promise < any > ;
440+ export function query ( onValueEvent : ( data : FBData ) => void , path : string , options : QueryOptions ) : Promise < any > ;
441+ export function addChildEventListener ( onChildEvent : ( data : FBData ) => void , path : string ) : Promise < AddEventListenerResult > ;
442+ export function addValueEventListener ( onValueEvent : ( data : FBData ) => void , path : string ) : Promise < AddEventListenerResult > ;
443+ export function removeEventListeners ( listeners : Array < any > , path : string ) : Promise < any > ;
444+ /**
445+ * Tells the client to keep its local cache in sync with the server automatically.
446+ */
447+ export function keepInSync ( path : string , switchOn : boolean ) : Promise < any > ;
448+
432449 // Analytics, nicely grouped in its own module
433- namespace analytics {
450+ export module analytics {
434451 export interface LogEventParameter {
435452 key : string ;
436453 value : string ;
@@ -464,52 +481,32 @@ declare namespace firebase {
464481 function setUserProperty ( options : SetUserPropertyOptions ) : Promise < any > ;
465482 }
466483
467- interface Firebase {
468- init ( options : InitOptions ) : Promise < any > ;
469-
470- // Database
471- push ( path : string , value : any ) : Promise < PushResult > ;
472- setValue ( path : string , value : any ) : Promise < any > ;
473- update ( path : string , value : any ) : Promise < any > ;
474- remove ( path : string ) : Promise < any > ;
475- query ( onValueEvent : ( data : FBData ) => void , path : string , options : QueryOptions ) : Promise < any > ;
476- addChildEventListener ( onChildEvent : ( data : FBData ) => void , path : string ) : Promise < AddEventListenerResult > ;
477- addValueEventListener ( onValueEvent : ( data : FBData ) => void , path : string ) : Promise < AddEventListenerResult > ;
478- removeEventListeners ( listeners : Array < any > , path : string ) : Promise < any > ;
479- /**
480- * Tells the client to keep its local cache in sync with the server automatically.
481- */
482- keepInSync ( path : string , switchOn : boolean ) : Promise < any > ;
483-
484- // Auth
485- login ( options : LoginOptions ) : Promise < User > ;
486- getAuthToken ( option : GetAuthTokenOptions ) : Promise < string > ;
487- logout ( ) : Promise < any > ;
488- createUser ( options : CreateUserOptions ) : Promise < CreateUserResult > ;
489- deleteUser ( ) : Promise < any > ;
490- resetPassword ( options : ResetPasswordOptions ) : Promise < any > ;
491- changePassword ( options : ChangePasswordOptions ) : Promise < any > ;
492- addAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
493- removeAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
494- hasAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
495- getCurrentUser ( ) : Promise < User > ;
496-
497- // FCM
498- addOnMessageReceivedCallback ( onMessageReceived : ( data : Message ) => void ) : Promise < any > ;
499- addOnPushTokenReceivedCallback ( onPushTokenReceived : ( data : string ) => void ) : Promise < any > ;
500-
501- // remote config
502- getRemoteConfig ( options : GetRemoteConfigOptions ) : Promise < GetRemoteConfigResult > ;
503-
504- // storage
505- uploadFile ( options : UploadFileOptions ) : Promise < UploadFileResult > ;
506- downloadFile ( options : DownloadFileOptions ) : Promise < any > ;
507- getDownloadUrl ( options : GetDownloadUrlOptions ) : Promise < string > ;
508- deleteFile ( options : DeleteFileOptions ) : Promise < any > ;
509-
510- // crash logging
511- // sendCrashLog(options: SendCrashLogOptions): Promise<any>;
512- }
513- }
514-
515- export = firebase ;
484+ // Auth
485+ export function login ( options : LoginOptions ) : Promise < User > ;
486+ export function getAuthToken ( option : GetAuthTokenOptions ) : Promise < string > ;
487+ export function logout ( ) : Promise < any > ;
488+ export function createUser ( options : CreateUserOptions ) : Promise < CreateUserResult > ;
489+ export function deleteUser ( ) : Promise < any > ;
490+ export function resetPassword ( options : ResetPasswordOptions ) : Promise < any > ;
491+ export function changePassword ( options : ChangePasswordOptions ) : Promise < any > ;
492+ export function addAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
493+ export function removeAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
494+ export function hasAuthStateListener ( listener : AuthStateChangeListener ) : boolean ;
495+ export function getCurrentUser ( ) : Promise < User > ;
496+
497+ // FCM
498+ export function addOnMessageReceivedCallback ( onMessageReceived : ( data : Message ) => void ) : Promise < any > ;
499+ export function addOnPushTokenReceivedCallback ( onPushTokenReceived : ( data : string ) => void ) : Promise < any > ;
500+
501+ // remote config
502+ export function getRemoteConfig ( options : GetRemoteConfigOptions ) : Promise < GetRemoteConfigResult > ;
503+
504+ // storage
505+ export function uploadFile ( options : UploadFileOptions ) : Promise < UploadFileResult > ;
506+ export function downloadFile ( options : DownloadFileOptions ) : Promise < any > ;
507+ export function getDownloadUrl ( options : GetDownloadUrlOptions ) : Promise < string > ;
508+ export function deleteFile ( options : DeleteFileOptions ) : Promise < any > ;
509+
510+ // crash logging
511+ // export function sendCrashLog(options: SendCrashLogOptions): Promise<any>;
512+ }
0 commit comments