diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index cac54f31a..b2aadff15 100644 --- a/node-gcm/node-gcm.d.ts +++ b/node-gcm/node-gcm.d.ts @@ -1,20 +1,35 @@ -// Type definitions for node-gcm 0.9.15 +// Type definitions for node-gcm 0.14.0 // Project: https://www.npmjs.org/package/node-gcm // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "node-gcm" { + export interface INotificationOptions { + title: string; + body?: string; + icon: string; + sound?: string; + badge?: string; + tag?: string; + color?: string; + click_action?: string; + } + export interface IMessageOptions { collapseKey?: string; + priority?: string; + contentAvailable?: boolean; delayWhileIdle?: boolean; timeToLive?: number; + restrictedPackageName?: string; dryRun?: boolean; - data: { + data?: { [key: string]: string; }; + notification?: INotificationOptions; } - + export class Message { constructor(options?: IMessageOptions); collapseKey: string; @@ -24,6 +39,8 @@ declare module "node-gcm" { addData(key: string, value: string): void; addData(data: { [key: string]: string }): void; + addNotification(value: INotificationOptions): void; + addNotification(key: string, value:INotificationOptions): void; } @@ -37,15 +54,23 @@ declare module "node-gcm" { backoff?: number; } + export interface IRecipient { + to?: string, + topic?: string, + notificationKey?: string, + registrationIds?: string[], + registrationTokens?: string[] + } + 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; + send(message: Message, registrationIds: string|string[]|IRecipient, callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[]|IRecipient, retries: number, callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[]|IRecipient, options: ISenderSendOptions, callback: (err: any, resJson: IResponseBody) => void): void; + sendNoRetry(message: Message, registrationIds: string|string[]|IRecipient, callback: (err: any, resJson: IResponseBody) => void): void; }