1
- // Type definitions for node-gcm 0.9.15
1
+ // Type definitions for node-gcm 0.14.0
2
2
// Project: https://www.npmjs.org/package/node-gcm
3
3
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
4
4
// Definitions: https://github.com/borisyankov/DefinitelyTyped
5
5
6
6
declare module "node-gcm" {
7
7
8
+ export interface INotificationOptions {
9
+ title : string ;
10
+ body ?: string ;
11
+ icon : string ;
12
+ sound ?: string ;
13
+ badge ?: string ;
14
+ tag ?: string ;
15
+ color ?: string ;
16
+ click_action ?: string ;
17
+ }
18
+
8
19
export interface IMessageOptions {
9
20
collapseKey ?: string ;
21
+ priority ?: string ;
22
+ contentAvailable ?: boolean ;
10
23
delayWhileIdle ?: boolean ;
11
24
timeToLive ?: number ;
25
+ restrictedPackageName ?: string ;
12
26
dryRun ?: boolean ;
13
- data : {
27
+ data ? : {
14
28
[ key : string ] : string ;
15
29
} ;
30
+ notification ?: INotificationOptions ;
16
31
}
17
-
32
+
18
33
export class Message {
19
34
constructor ( options ?: IMessageOptions ) ;
20
35
collapseKey : string ;
@@ -24,6 +39,8 @@ declare module "node-gcm" {
24
39
25
40
addData ( key : string , value : string ) : void ;
26
41
addData ( data : { [ key : string ] : string } ) : void ;
42
+ addNotification ( value : INotificationOptions ) : void ;
43
+ addNotification ( key : string , value :INotificationOptions ) : void ;
27
44
}
28
45
29
46
@@ -37,15 +54,23 @@ declare module "node-gcm" {
37
54
backoff ?: number ;
38
55
}
39
56
57
+ export interface IRecipient {
58
+ to ?: string ,
59
+ topic ?: string ,
60
+ notificationKey ?: string ,
61
+ registrationIds ?: string [ ] ,
62
+ registrationTokens ?: string [ ]
63
+ }
64
+
40
65
export class Sender {
41
66
constructor ( key : string , options ?: ISenderOptions ) ;
42
67
key : string ;
43
68
options : ISenderOptions ;
44
69
45
- send ( message : Message , registrationIds : string | string [ ] , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
46
- send ( message : Message , registrationIds : string | string [ ] , retries : number , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
47
- send ( message : Message , registrationIds : string | string [ ] , options : ISenderSendOptions , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
48
- sendNoRetry ( message : Message , registrationIds : string | string [ ] , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
70
+ send ( message : Message , registrationIds : string | string [ ] | IRecipient , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
71
+ send ( message : Message , registrationIds : string | string [ ] | IRecipient , retries : number , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
72
+ send ( message : Message , registrationIds : string | string [ ] | IRecipient , options : ISenderSendOptions , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
73
+ sendNoRetry ( message : Message , registrationIds : string | string [ ] | IRecipient , callback : ( err : any , resJson : IResponseBody ) => void ) : void ;
49
74
}
50
75
51
76
0 commit comments