Skip to content

Commit ba4c4fc

Browse files
committed
Merge pull request DefinitelyTyped#8358 from r-ising/patch-1
update node-gcm.d.ts
2 parents 24635d7 + 54d5b57 commit ba4c4fc

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

node-gcm/node-gcm.d.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
1-
// Type definitions for node-gcm 0.9.15
1+
// Type definitions for node-gcm 0.14.0
22
// Project: https://www.npmjs.org/package/node-gcm
33
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
55

66
declare module "node-gcm" {
77

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+
819
export interface IMessageOptions {
920
collapseKey?: string;
21+
priority?: string;
22+
contentAvailable?: boolean;
1023
delayWhileIdle?: boolean;
1124
timeToLive?: number;
25+
restrictedPackageName?: string;
1226
dryRun?: boolean;
13-
data: {
27+
data?: {
1428
[key: string]: string;
1529
};
30+
notification?: INotificationOptions;
1631
}
17-
32+
1833
export class Message {
1934
constructor(options?: IMessageOptions);
2035
collapseKey: string;
@@ -24,6 +39,8 @@ declare module "node-gcm" {
2439

2540
addData(key: string, value: string): void;
2641
addData(data: { [key: string]: string }): void;
42+
addNotification(value: INotificationOptions): void;
43+
addNotification(key: string, value:INotificationOptions): void;
2744
}
2845

2946

@@ -37,15 +54,23 @@ declare module "node-gcm" {
3754
backoff?: number;
3855
}
3956

57+
export interface IRecipient {
58+
to?: string,
59+
topic?: string,
60+
notificationKey?: string,
61+
registrationIds?: string[],
62+
registrationTokens?: string[]
63+
}
64+
4065
export class Sender {
4166
constructor(key: string, options?: ISenderOptions);
4267
key: string;
4368
options: ISenderOptions;
4469

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;
4974
}
5075

5176

0 commit comments

Comments
 (0)