forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node-gcm.d.ts
62 lines (50 loc) · 1.87 KB
/
node-gcm.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
// Type definitions for node-gcm 0.9.15
// Project: https://www.npmjs.org/package/node-gcm
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "node-gcm" {
export interface IMessageOptions {
collapseKey?: string;
delayWhileIdle?: boolean;
timeToLive?: number;
dryRun?: boolean;
}
export class Message {
constructor(options?: IMessageOptions);
collapseKey: string;
delayWhileIdle: boolean;
timeToLive: number;
dryRun: boolean;
addData(key: string, value: string): void;
addData(data: any): void;
}
export interface ISenderOptions {
proxy?: any;
maxSockets?: number;
timeout?: number;
}
export interface ISenderSendOptions {
retries?: number;
backoff?: number;
}
export class Sender {
constructor(key: string, options?: ISenderOptions);
key: string;
options: ISenderOptions;
send(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void;
send(message: Message, registrationIds: string|string[], retries: number, callback: (err: any, resJson: IResponseBody) => void): void;
send(message: Message, registrationIds: string|string[], options: ISenderSendOptions, callback: (err: any, resJson: IResponseBody) => void): void;
sendNoRetry(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void;
}
export interface IResponseBody {
success: number;
failure: number;
canonical_ids: number;
multicast_id?: number;
results?: {
message_id?: string;
registration_id?: string;
error?: string;
}[];
}
}