forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebase-client.d.ts
75 lines (62 loc) · 1.76 KB
/
firebase-client.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
// Type definitions for Firebase Client 0.1.0
// Project: https://www.github.com/jpstevens/firebase-client
// Definitions by: Andrew Breen <https://github.com/fpsscarecrow/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../q/Q.d.ts" />
interface PushResponse {
/**
* Name ref (key) of the child resource
*/
name : string;
}
interface FirebaseConfig {
/**
* path for the Firebase instance
*/
url : string;
/**
* Token for authorisation
*/
auth: string;
}
interface FirebaseClient {
/**
* Creates a new FirebaseClient given the provided configuration
*/
new (config : FirebaseConfig) : FirebaseClient;
/**
* Retrieves all objects at the base path
*/
get<T>() : Q.Promise<T>;
/**
* Retrieves an object
* @param path Relative path from the base for the resource
*/
get<T>(path : string) : Q.Promise<T>;
/**
* Returns a promise of the HTTP response from setting the value at the given path
* @param path Relative path from the base for the resource
* @param data Data to be set as the value for the given path
*/
set<T>(path : string, data : T) : Q.Promise<T>;
/**
* Update a node at a given path
* @param path Relative path from the base for the resource
* @param value Value of the response
*/
update<T>(path : string, value : T) : Q.Promise<T>;
/**
* Deletes the resource at a given path
* @param path Relative path from the base for the resource
*/
delete(path : string) : Q.Promise<void>;
/**
* @param path Relative path from the base for the resource
* @param value Object to push to the path
*/
push<T>(path : string, value : T) : Q.Promise<PushResponse>;
}
declare var FirebaseClient: FirebaseClient;
declare module 'firebase-client' {
export = FirebaseClient;
}