Comparing version 2.0.14 to 3.0.0
@@ -89,13 +89,10 @@ var request = require('request'); | ||
// Fetch push notification ID | ||
var pushId = body.id; | ||
// Callback? | ||
if (callback) { | ||
// Pass push ID to callback with a null error | ||
callback(null, pushId); | ||
// Pass response body to callback with a null error | ||
callback(null, body); | ||
} | ||
else { | ||
// Resolve the promise | ||
resolve(pushId); | ||
// Resolve the promise with response body | ||
resolve(body); | ||
} | ||
@@ -102,0 +99,0 @@ }); |
@@ -26,3 +26,3 @@ // Change to require('pushy') to use this code in your own project | ||
// Send push notification using the Send Notifications API | ||
pushy.sendPushNotification(data, to, options, function (err, id) { | ||
pushy.sendPushNotification(data, to, options, function (err, result) { | ||
// Log errors to console | ||
@@ -34,3 +34,3 @@ if (err) { | ||
// Log success | ||
console.log('Push sent successfully! (ID: ' + id + ')'); | ||
console.log('Push sent successfully! (ID: ' + result.id + ')'); | ||
}); | ||
@@ -37,0 +37,0 @@ |
{ | ||
"name": "pushy", | ||
"version": "2.0.14", | ||
"version": "3.0.0", | ||
"description": "The official Node.js package for sending push notifications with Pushy.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -45,3 +45,3 @@ # pushy-node | ||
// Send push notification using the Send Notifications API | ||
pushy.sendPushNotification(data, to, options, function (err, id) { | ||
pushy.sendPushNotification(data, to, options, function (err, result) { | ||
// Log errors to console | ||
@@ -53,3 +53,3 @@ if (err) { | ||
// Log success | ||
console.log('Push sent successfully! (ID: ' + id + ')'); | ||
console.log('Push sent successfully! (ID: ' + result.id + ')'); | ||
}); | ||
@@ -66,5 +66,5 @@ ``` | ||
pushy.sendPushNotification(data, tokens, options) | ||
.then(function (id) { | ||
.then(function (result) { | ||
// Log success | ||
console.log('Push sent successfully! (ID: ' + id + ')'); | ||
console.log('Push sent successfully! (ID: ' + result.id + ')'); | ||
}).catch(function (err) { | ||
@@ -85,3 +85,3 @@ // Log errors to console | ||
```js | ||
pushy.sendPushNotification(data, to, options, function (err, id) { | ||
pushy.sendPushNotification(data, to, options, function (err, result) { | ||
// Log errors to console | ||
@@ -93,3 +93,3 @@ if (err) { | ||
// Log success | ||
console.log('Push sent successfully! (ID: ' + id + ')'); | ||
console.log('Push sent successfully! (ID: ' + result.id + ')'); | ||
}); | ||
@@ -96,0 +96,0 @@ ``` |
71469
966