1+ /// <reference path="firebase-common.d.ts"/>
2+ declare module "nativescript-plugin-firebase" {
3+
4+ /**
5+ * The options object passed into the init function.
6+ */
7+ export interface InitOptions {
8+ /**
9+ * The endpoint of your firebase instance.
10+ */
11+ url : string ;
12+ }
13+
14+ /**
15+ * The options object passed into the query function.
16+ */
17+ export interface QueryOptions {
18+ /**
19+ * How you'd like to sort the query result.
20+ */
21+ orderBy : {
22+ type : QueryOrderByType ;
23+ /**
24+ * mandatory when type is QueryOrderByType.CHILD
25+ */
26+ value ?: string ;
27+ } ;
28+
29+ /**
30+ * You can further restrict the returned results by specifying restrictions.
31+ */
32+ range ?: {
33+ type : QueryRangeType ;
34+ value : string ;
35+ }
36+
37+ /**
38+ * You can limit the number of returned rows if you want to.
39+ */
40+ limit ?: {
41+ type : QueryLimitType ;
42+ value : number ;
43+ } ;
44+ }
45+
46+ /**
47+ * The options object passed into the login function.
48+ */
49+ export interface LoginOptions {
50+ type : LoginType ;
51+ email ?: string ;
52+ password ?: string ;
53+ }
54+
55+ /**
56+ * The returned object from the login function.
57+ */
58+ export interface LoginResult {
59+ uid : string ;
60+ provider : LoginType ;
61+ expiresAtUnixEpochSeconds : number ;
62+ profileImageURL ?: string ;
63+ token : string ;
64+ }
65+
66+ /**
67+ * The options object passed into the createUser function.
68+ */
69+ export interface CreateUserOptions {
70+ email : string ;
71+ password : string ;
72+ }
73+
74+ /**
75+ * The returned object in the callback handlers
76+ * of the addChildEventListener and addValueEventListener functions.
77+ */
78+ export interface FBData {
79+ type : string ;
80+ key : string ;
81+ value : any ;
82+ }
83+
84+ export function init ( options : InitOptions ) : Promise < any > ;
85+ export function login ( options : LoginOptions ) : Promise < LoginResult > ;
86+ export function createUser ( options : CreateUserOptions ) : string ;
87+ export function push ( path : string , value : any ) : void ;
88+ export function setValue ( path : string , value : any ) : void ;
89+ export function remove ( path : string ) : void ;
90+ export function query ( onValueEvent : ( data : FBData ) => void , path : string , options : QueryOptions ) : void ;
91+ export function addChildEventListener ( onChildEvent : ( data : FBData ) => void , path : string ) : void ;
92+ export function addValueEventListener ( onValueEvent : ( data : FBData ) => void , path : string ) : void ;
93+ }
0 commit comments