From 0dc2ebd236c57c674fee031eeca5f161e9b690f0 Mon Sep 17 00:00:00 2001 From: r-ising Date: Thu, 3 Mar 2016 11:38:17 +0100 Subject: [PATCH 1/4] update node-gcm.d.ts updated version number (0.14.0) --- node-gcm/node-gcm.d.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index cac54f31a..21980416e 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: { [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); + addNotification(key: string, value:INotificationOptions); } From 8096d9e06581288ec467367f22b0d20f96eecbb7 Mon Sep 17 00:00:00 2001 From: r-ising Date: Thu, 3 Mar 2016 11:45:51 +0100 Subject: [PATCH 2/4] Update node-gcm.d.ts added missing return type --- node-gcm/node-gcm.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index 21980416e..82b3d1957 100644 --- a/node-gcm/node-gcm.d.ts +++ b/node-gcm/node-gcm.d.ts @@ -39,8 +39,8 @@ declare module "node-gcm" { addData(key: string, value: string): void; addData(data: { [key: string]: string }): void; - addNotification(value: INotificationOptions); - addNotification(key: string, value:INotificationOptions); + addNotification(value: INotificationOptions): void; + addNotification(key: string, value:INotificationOptions): void; } From ea1bdfa206e6f43e56f1ba2df9d0d93109f1e5d4 Mon Sep 17 00:00:00 2001 From: r-ising Date: Thu, 3 Mar 2016 11:49:58 +0100 Subject: [PATCH 3/4] Update node-gcm.d.ts data option in IMessageOptions is optional (see at google cloud messaging documentation) --- node-gcm/node-gcm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index 82b3d1957..8a467cfe8 100644 --- a/node-gcm/node-gcm.d.ts +++ b/node-gcm/node-gcm.d.ts @@ -24,7 +24,7 @@ declare module "node-gcm" { timeToLive?: number; restrictedPackageName?: string; dryRun?: boolean; - data: { + data?: { [key: string]: string; }; notification?: INotificationOptions; From 54d5b57d1ce6af82f30258f7100c0ab5eb85ed84 Mon Sep 17 00:00:00 2001 From: r-ising Date: Thu, 3 Mar 2016 12:07:48 +0100 Subject: [PATCH 4/4] Update node-gcm.d.ts added missing recipient type --- node-gcm/node-gcm.d.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index 8a467cfe8..b2aadff15 100644 --- a/node-gcm/node-gcm.d.ts +++ b/node-gcm/node-gcm.d.ts @@ -54,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; }