pushy 2.0.14 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,14 +42,14 @@ var options = {
42
42
  };
43
43
 
44
44
  // Send push notification using the Send Notifications API
45
- pushy.sendPushNotification(data, to, options, function (err, id) {
45
+ pushy.sendPushNotification(data, to, options, function (err, result) {
46
46
  // Log errors to console
47
47
  if (err) {
48
48
  return console.error(err);
49
49
  }
50
50
 
51
51
  // Log success
52
- console.log('Push sent successfully! (ID: ' + id + ')');
52
+ console.log('Push sent successfully! (ID: ' + result.id + ')');
53
53
  });
54
54
  ```
55
55
 
@@ -61,9 +61,9 @@ The library also supports using promise syntax instead of callbacks for all API
61
61
 
62
62
  ```js
63
63
  pushy.sendPushNotification(data, tokens, options)
64
- .then(function (id) {
64
+ .then(function (result) {
65
65
  // Log success
66
- console.log('Push sent successfully! (ID: ' + id + ')');
66
+ console.log('Push sent successfully! (ID: ' + result.id + ')');
67
67
  }).catch(function (err) {
68
68
  // Log errors to console
69
69
  return console.error(err);
@@ -79,14 +79,14 @@ pushy.sendPushNotification(data, tokens, options)
79
79
  Instantly send push notifications to your users using the [Send Notifications API](https://pushy.me/docs/api/send-notifications) (see example above):
80
80
 
81
81
  ```js
82
- pushy.sendPushNotification(data, to, options, function (err, id) {
82
+ pushy.sendPushNotification(data, to, options, function (err, result) {
83
83
  // Log errors to console
84
84
  if (err) {
85
85
  return console.error(err);
86
86
  }
87
87
 
88
88
  // Log success
89
- console.log('Push sent successfully! (ID: ' + id + ')');
89
+ console.log('Push sent successfully! (ID: ' + result.id + ')');
90
90
  });
91
91
  ```
92
92
 
package/api/push/send.js CHANGED
@@ -86,17 +86,14 @@ module.exports = function (data, recipient, options, callback) {
86
86
  return reject(new Error('An invalid response code was received from the Pushy API.'));
87
87
  }
88
88
 
89
- // Fetch push notification ID
90
- var pushId = body.id;
91
-
92
89
  // Callback?
93
90
  if (callback) {
94
- // Pass push ID to callback with a null error
95
- callback(null, pushId);
91
+ // Pass response body to callback with a null error
92
+ callback(null, body);
96
93
  }
97
94
  else {
98
- // Resolve the promise
99
- resolve(pushId);
95
+ // Resolve the promise with response body
96
+ resolve(body);
100
97
  }
101
98
  });
102
99
  });
package/examples/push.js CHANGED
@@ -23,14 +23,14 @@ var options = {
23
23
  };
24
24
 
25
25
  // Send push notification using the Send Notifications API
26
- pushy.sendPushNotification(data, to, options, function (err, id) {
26
+ pushy.sendPushNotification(data, to, options, function (err, result) {
27
27
  // Log errors to console
28
28
  if (err) {
29
29
  return console.error(err);
30
30
  }
31
31
 
32
32
  // Log success
33
- console.log('Push sent successfully! (ID: ' + id + ')');
33
+ console.log('Push sent successfully! (ID: ' + result.id + ')');
34
34
  });
35
35
 
36
36
  // Check the delivery status of your push notifications using the Notification Status API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushy",
3
- "version": "2.0.14",
3
+ "version": "3.0.0",
4
4
  "description": "The official Node.js package for sending push notifications with Pushy.",
5
5
  "main": "index.js",
6
6
  "scripts": {