pushy 2.0.14 → 3.0.2

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
 
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Device Info API
5
4
  module.exports = function (deviceToken, callback) {
@@ -20,17 +19,14 @@ module.exports = function (deviceToken, callback) {
20
19
  }
21
20
 
22
21
  // Make a request to the Device Info API
23
- request(
22
+ axios(
24
23
  Object.assign({
25
- uri: that.getApiEndpoint() + '/devices/' + deviceToken + '?api_key=' + that.apiKey,
24
+ url: that.getApiEndpoint() + '/devices/' + deviceToken + '?api_key=' + that.apiKey,
26
25
  method: 'GET',
27
26
  json: true
28
- }, that.extraRequestOptions || {}), function (err, res, body) {
29
- // Request error?
30
- if (err) {
31
- // Send to callback
32
- return reject(err);
33
- }
27
+ }, that.extraRequestOptions || {})).then(function (res) {
28
+ // API response
29
+ var body = res.data;
34
30
 
35
31
  // Missing body?
36
32
  if (!body) {
@@ -43,7 +39,7 @@ module.exports = function (deviceToken, callback) {
43
39
  }
44
40
 
45
41
  // Check for 200 OK
46
- if (res.statusCode != 200) {
42
+ if (res.status != 200) {
47
43
  return reject(new Error('An invalid response code was received from the Pushy API.'));
48
44
  }
49
45
 
@@ -59,6 +55,14 @@ module.exports = function (deviceToken, callback) {
59
55
  // Resolve the promise
60
56
  resolve(deviceInfo);
61
57
  }
58
+ }).catch(function (err) {
59
+ // Invoke callback/reject promise with Pushy error
60
+ if (err.response && err.response.data) {
61
+ reject(err.response.data);
62
+ }
63
+ else {
64
+ reject(err);
65
+ }
62
66
  });
63
67
  });
64
68
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Device Presence API
5
4
  module.exports = function (deviceTokens, callback) {
@@ -40,17 +39,14 @@ module.exports = function (deviceTokens, callback) {
40
39
  postData.tokens = deviceTokens;
41
40
 
42
41
  // Make a request to the Device Presence API
43
- request(
42
+ axios(
44
43
  Object.assign({
45
- uri: that.getApiEndpoint() + '/devices/presence' + '?api_key=' + that.apiKey,
44
+ url: that.getApiEndpoint() + '/devices/presence' + '?api_key=' + that.apiKey,
46
45
  method: 'POST',
47
- json: postData
48
- }, that.extraRequestOptions || {}), function (err, res, body) {
49
- // Request error?
50
- if (err) {
51
- // Send to callback
52
- return reject(err);
53
- }
46
+ data: postData
47
+ }, that.extraRequestOptions || {})).then(function (res) {
48
+ // API response
49
+ var body = res.data;
54
50
 
55
51
  // Missing body?
56
52
  if (!body) {
@@ -63,7 +59,7 @@ module.exports = function (deviceTokens, callback) {
63
59
  }
64
60
 
65
61
  // Check for 200 OK
66
- if (res.statusCode != 200) {
62
+ if (res.status != 200) {
67
63
  return reject(new Error('An invalid response code was received from the Pushy API.'));
68
64
  }
69
65
 
@@ -79,6 +75,14 @@ module.exports = function (deviceTokens, callback) {
79
75
  // Resolve the promise
80
76
  resolve(devicePresence);
81
77
  }
78
+ }).catch(function (err) {
79
+ // Invoke callback/reject promise with Pushy error
80
+ if (err.response && err.response.data) {
81
+ reject(err.response.data);
82
+ }
83
+ else {
84
+ reject(err);
85
+ }
82
86
  });
83
87
  });
84
88
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Pub/Sub Subscribe API
5
4
  module.exports = function (topics, deviceToken, callback) {
@@ -34,17 +33,14 @@ module.exports = function (topics, deviceToken, callback) {
34
33
  postData.topics = Array.isArray(topics) ? topics : [topics];
35
34
 
36
35
  // Make a request to the Pub/Sub Subscribe API
37
- request(
36
+ axios(
38
37
  Object.assign({
39
- uri: that.getApiEndpoint() + '/topics/subscribe/' + '?api_key=' + that.apiKey,
38
+ url: that.getApiEndpoint() + '/topics/subscribe/' + '?api_key=' + that.apiKey,
40
39
  method: 'POST',
41
- json: postData
42
- }, that.extraRequestOptions || {}), function (err, res, body) {
43
- // Request error?
44
- if (err) {
45
- // Send to callback
46
- return reject(err);
47
- }
40
+ data: postData
41
+ }, that.extraRequestOptions || {})).then(function (res) {
42
+ // API response
43
+ var body = res.data;
48
44
 
49
45
  // Missing body?
50
46
  if (!body) {
@@ -57,7 +53,7 @@ module.exports = function (topics, deviceToken, callback) {
57
53
  }
58
54
 
59
55
  // Check for 200 OK
60
- if (res.statusCode != 200) {
56
+ if (res.status != 200) {
61
57
  return reject(new Error('An invalid response code was received from the Pushy API.'));
62
58
  }
63
59
 
@@ -70,6 +66,14 @@ module.exports = function (topics, deviceToken, callback) {
70
66
  // Resolve the promise successfully
71
67
  resolve();
72
68
  }
69
+ }).catch(function (err) {
70
+ // Invoke callback/reject promise with Pushy error
71
+ if (err.response && err.response.data) {
72
+ reject(err.response.data);
73
+ }
74
+ else {
75
+ reject(err);
76
+ }
73
77
  });
74
78
  });
75
79
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Pub/Sub Subscribers API
5
4
  module.exports = function (topic, callback) {
@@ -20,17 +19,14 @@ module.exports = function (topic, callback) {
20
19
  }
21
20
 
22
21
  // Make a request to the Pub/Sub Subscribers API
23
- request(
22
+ axios(
24
23
  Object.assign({
25
- uri: that.getApiEndpoint() + '/topics/' + topic + '?api_key=' + that.apiKey,
24
+ url: that.getApiEndpoint() + '/topics/' + topic + '?api_key=' + that.apiKey,
26
25
  method: 'GET',
27
26
  json: true
28
- }, that.extraRequestOptions || {}), function (err, res, body) {
29
- // Request error?
30
- if (err) {
31
- // Send to callback
32
- return reject(err);
33
- }
27
+ }, that.extraRequestOptions || {})).then(function (res) {
28
+ // API response
29
+ var body = res.data;
34
30
 
35
31
  // Missing body?
36
32
  if (!body) {
@@ -43,7 +39,7 @@ module.exports = function (topic, callback) {
43
39
  }
44
40
 
45
41
  // Check for 200 OK
46
- if (res.statusCode != 200) {
42
+ if (res.status != 200) {
47
43
  return reject(new Error('An invalid response code was received from the Pushy API.'));
48
44
  }
49
45
 
@@ -59,6 +55,14 @@ module.exports = function (topic, callback) {
59
55
  // Resolve the promise
60
56
  resolve(body);
61
57
  }
58
+ }).catch(function (err) {
59
+ // Invoke callback/reject promise with Pushy error
60
+ if (err.response && err.response.data) {
61
+ reject(err.response.data);
62
+ }
63
+ else {
64
+ reject(err);
65
+ }
62
66
  });
63
67
  });
64
68
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Pub/Sub Topics API
5
4
  module.exports = function (callback) {
@@ -15,17 +14,14 @@ module.exports = function (callback) {
15
14
  }
16
15
 
17
16
  // Make a request to the Pub/Sub Topics API
18
- request(
17
+ axios(
19
18
  Object.assign({
20
- uri: that.getApiEndpoint() + '/topics/' + '?api_key=' + that.apiKey,
19
+ url: that.getApiEndpoint() + '/topics/' + '?api_key=' + that.apiKey,
21
20
  method: 'GET',
22
21
  json: true
23
- }, that.extraRequestOptions || {}), function (err, res, body) {
24
- // Request error?
25
- if (err) {
26
- // Send to callback
27
- return reject(err);
28
- }
22
+ }, that.extraRequestOptions || {})).then(function (res) {
23
+ // API response
24
+ var body = res.data;
29
25
 
30
26
  // Missing body?
31
27
  if (!body) {
@@ -38,7 +34,7 @@ module.exports = function (callback) {
38
34
  }
39
35
 
40
36
  // Check for 200 OK
41
- if (res.statusCode != 200) {
37
+ if (res.status != 200) {
42
38
  return reject(new Error('An invalid response code was received from the Pushy API.'));
43
39
  }
44
40
 
@@ -54,6 +50,14 @@ module.exports = function (callback) {
54
50
  // Resolve the promise
55
51
  resolve(body);
56
52
  }
53
+ }).catch(function (err) {
54
+ // Invoke callback/reject promise with Pushy error
55
+ if (err.response && err.response.data) {
56
+ reject(err.response.data);
57
+ }
58
+ else {
59
+ reject(err);
60
+ }
57
61
  });
58
62
  });
59
63
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Pub/Sub Unsubscribe API
5
4
  module.exports = function (topics, deviceToken, callback) {
@@ -34,17 +33,14 @@ module.exports = function (topics, deviceToken, callback) {
34
33
  postData.topics = Array.isArray(topics) ? topics : [topics];
35
34
 
36
35
  // Make a request to the Pub/Sub Unsubscribe API
37
- request(
36
+ axios(
38
37
  Object.assign({
39
- uri: that.getApiEndpoint() + '/topics/unsubscribe/' + '?api_key=' + that.apiKey,
38
+ url: that.getApiEndpoint() + '/topics/unsubscribe/' + '?api_key=' + that.apiKey,
40
39
  method: 'POST',
41
- json: postData
42
- }, that.extraRequestOptions || {}), function (err, res, body) {
43
- // Request error?
44
- if (err) {
45
- // Send to callback
46
- return reject(err);
47
- }
40
+ data: postData
41
+ }, that.extraRequestOptions || {})).then(function (res) {
42
+ // API response
43
+ var body = res.data;
48
44
 
49
45
  // Missing body?
50
46
  if (!body) {
@@ -57,7 +53,7 @@ module.exports = function (topics, deviceToken, callback) {
57
53
  }
58
54
 
59
55
  // Check for 200 OK
60
- if (res.statusCode != 200) {
56
+ if (res.status != 200) {
61
57
  return reject(new Error('An invalid response code was received from the Pushy API.'));
62
58
  }
63
59
 
@@ -70,6 +66,14 @@ module.exports = function (topics, deviceToken, callback) {
70
66
  // Resolve the promise successfully
71
67
  resolve();
72
68
  }
69
+ }).catch(function (err) {
70
+ // Invoke callback/reject promise with Pushy error
71
+ if (err.response && err.response.data) {
72
+ reject(err.response.data);
73
+ }
74
+ else {
75
+ reject(err);
76
+ }
73
77
  });
74
78
  });
75
79
  }
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird')
1
+ var axios = require('axios');
3
2
 
4
3
  // Notification Deletion API
5
4
  module.exports = function (pushId, callback) {
@@ -30,17 +29,14 @@ module.exports = function (pushId, callback) {
30
29
  }
31
30
 
32
31
  // Make a request to the Notification Deletion API
33
- request(
32
+ axios(
34
33
  Object.assign({
35
- uri: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
34
+ url: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
36
35
  method: 'DELETE',
37
36
  json: true
38
- }, that.extraRequestOptions || {}), function (err, res, body) {
39
- // Request error?
40
- if (err) {
41
- // Send to callback
42
- return reject(err);
43
- }
37
+ }, that.extraRequestOptions || {})).then(function (res) {
38
+ // API response
39
+ var body = res.data;
44
40
 
45
41
  // Missing body?
46
42
  if (!body) {
@@ -53,7 +49,7 @@ module.exports = function (pushId, callback) {
53
49
  }
54
50
 
55
51
  // Check for 200 OK
56
- if (res.statusCode != 200) {
52
+ if (res.status != 200) {
57
53
  return reject(new Error('An invalid response code was received from the Pushy API.'));
58
54
  }
59
55
 
@@ -66,6 +62,14 @@ module.exports = function (pushId, callback) {
66
62
  // Resolve the promise
67
63
  resolve();
68
64
  }
65
+ }).catch(function (err) {
66
+ // Invoke callback/reject promise with Pushy error
67
+ if (err.response && err.response.data) {
68
+ reject(err.response.data);
69
+ }
70
+ else {
71
+ reject(err);
72
+ }
69
73
  });
70
74
  });
71
75
  };
package/api/push/send.js CHANGED
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Send Notifications API
5
4
  module.exports = function (data, recipient, options, callback) {
@@ -59,17 +58,14 @@ module.exports = function (data, recipient, options, callback) {
59
58
  }
60
59
 
61
60
  // Make a request to the Send Notifications API
62
- request(
61
+ axios(
63
62
  Object.assign({
64
- uri: that.getApiEndpoint() + '/push?api_key=' + that.apiKey,
63
+ url: that.getApiEndpoint() + '/push?api_key=' + that.apiKey,
65
64
  method: 'POST',
66
- json: postData
67
- }, that.extraRequestOptions || {}), function (err, res, body) {
68
- // Request error?
69
- if (err) {
70
- // Send to callback
71
- return reject(err);
72
- }
65
+ data: postData
66
+ }, that.extraRequestOptions || {})).then(function (res) {
67
+ // API response
68
+ var body = res.data;
73
69
 
74
70
  // Missing body?
75
71
  if (!body) {
@@ -82,21 +78,26 @@ module.exports = function (data, recipient, options, callback) {
82
78
  }
83
79
 
84
80
  // Check for 200 OK
85
- if (res.statusCode != 200) {
81
+ if (res.status != 200) {
86
82
  return reject(new Error('An invalid response code was received from the Pushy API.'));
87
83
  }
88
84
 
89
- // Fetch push notification ID
90
- var pushId = body.id;
91
-
92
85
  // Callback?
93
86
  if (callback) {
94
- // Pass push ID to callback with a null error
95
- callback(null, pushId);
87
+ // Pass response body to callback with a null error
88
+ callback(null, body);
89
+ }
90
+ else {
91
+ // Resolve the promise with response body
92
+ resolve(body);
93
+ }
94
+ }).catch(function (err) {
95
+ // Invoke callback/reject promise with Pushy error
96
+ if (err.response && err.response.data) {
97
+ reject(err.response.data);
96
98
  }
97
99
  else {
98
- // Resolve the promise
99
- resolve(pushId);
100
+ reject(err);
100
101
  }
101
102
  });
102
103
  });
@@ -1,5 +1,4 @@
1
- var request = require('request');
2
- var Promise = require('bluebird');
1
+ var axios = require('axios');
3
2
 
4
3
  // Notification Status API
5
4
  module.exports = function (pushId, callback) {
@@ -20,17 +19,14 @@ module.exports = function (pushId, callback) {
20
19
  }
21
20
 
22
21
  // Make a request to the Notification Status API
23
- request(
22
+ axios(
24
23
  Object.assign({
25
- uri: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
24
+ url: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
26
25
  method: 'GET',
27
26
  json: true
28
- }, that.extraRequestOptions || {}), function (err, res, body) {
29
- // Request error?
30
- if (err) {
31
- // Send to callback
32
- return reject(err);
33
- }
27
+ }, that.extraRequestOptions || {})).then(function (res) {
28
+ // API response
29
+ var body = res.data;
34
30
 
35
31
  // Missing body?
36
32
  if (!body) {
@@ -43,7 +39,7 @@ module.exports = function (pushId, callback) {
43
39
  }
44
40
 
45
41
  // Check for 200 OK
46
- if (res.statusCode != 200) {
42
+ if (res.status != 200) {
47
43
  return reject(new Error('An invalid response code was received from the Pushy API.'));
48
44
  }
49
45
 
@@ -59,6 +55,14 @@ module.exports = function (pushId, callback) {
59
55
  // Resolve the promise
60
56
  resolve(status);
61
57
  }
58
+ }).catch(function (err) {
59
+ // Invoke callback/reject promise with Pushy error
60
+ if (err.response && err.response.data) {
61
+ reject(err.response.data);
62
+ }
63
+ else {
64
+ reject(err);
65
+ }
62
66
  });
63
67
  });
64
68
  }
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/index.d.ts CHANGED
@@ -110,6 +110,33 @@ declare module 'pushy' {
110
110
  };
111
111
  }
112
112
 
113
+ interface SendPushNotificationResult {
114
+ /** Returned if the API request was successful. */
115
+ success: boolean;
116
+
117
+ /**
118
+ * The push notification unique ID.
119
+ *
120
+ * Use it to check delivery status using the Notification Status API.
121
+ */
122
+ id: string;
123
+
124
+ /**
125
+ * Contains additional information about the notification, for debugging purposes.
126
+ */
127
+ info: {
128
+ /**
129
+ * The number of devices that will potentially receive the notification.
130
+ */
131
+ devices: number;
132
+
133
+ /**
134
+ * An array of invalid device tokens passed in which could not be found in our
135
+ * database registered under the app with the Secret API Key used to authenticate this request.
136
+ */
137
+ failed: Array<string>;
138
+ };
139
+ }
113
140
  interface NotificationStatus {
114
141
  /** The creation date of the push notification (unix timestamp). */
115
142
  date: number;
@@ -242,9 +269,9 @@ declare module 'pushy' {
242
269
  sendPushNotification(
243
270
  data: unknown,
244
271
  recipient: string | Array<string>,
245
- options?: SendPushNotificationOptions,
246
- callback?: (error: Error | null, pushId: string) => void
247
- ): Promise<string>;
272
+ options?: Partial<SendPushNotificationOptions>,
273
+ callback?: (error: Error | null, result: SendPushNotificationResult) => void
274
+ ): Promise<SendPushNotificationResult>;
248
275
 
249
276
  /**
250
277
  * Check the delivery status of your push notifications to Android / Electron recipients.
@@ -252,7 +279,10 @@ declare module 'pushy' {
252
279
  *
253
280
  * @param pushId
254
281
  */
255
- getNotificationStatus(pushId: string): Promise<NotificationStatus>;
282
+ getNotificationStatus(
283
+ pushId: string,
284
+ callback?: (error: Error | null, status: NotificationStatus) => void
285
+ ): Promise<NotificationStatus>;
256
286
 
257
287
  /**
258
288
  * Permanently delete a pending notification.
@@ -260,7 +290,7 @@ declare module 'pushy' {
260
290
  *
261
291
  * @param pushId
262
292
  */
263
- deletePushNotification(pushId: string): Promise<void>;
293
+ deletePushNotification(pushId: string, callback?: (error: Error | null) => void): Promise<void>;
264
294
 
265
295
  /**
266
296
  * Check the presence and connectivity status of multiple devices.
@@ -268,7 +298,10 @@ declare module 'pushy' {
268
298
  *
269
299
  * @param deviceTokens
270
300
  */
271
- getDevicePresence(deviceTokens: string | Array<string>): Promise<Array<DevicePresenceInfo>>;
301
+ getDevicePresence(
302
+ deviceTokens: string | Array<string>,
303
+ callback?: (error: Error | null, presence: Array<DevicePresenceInfo>) => void
304
+ ): Promise<Array<DevicePresenceInfo>>;
272
305
 
273
306
  /**
274
307
  * Fetch device info, presence, undelivered notifications, and more by device token.
@@ -277,7 +310,10 @@ declare module 'pushy' {
277
310
  *
278
311
  * @param deviceToken
279
312
  */
280
- getDeviceInfo(deviceToken: string): Promise<DeviceInfo>;
313
+ getDeviceInfo(
314
+ deviceToken: string,
315
+ callback?: (error: Error | null, device: DeviceInfo) => void
316
+ ): Promise<DeviceInfo>;
281
317
 
282
318
  /**
283
319
  * Subscribe a device to one or more topics.
@@ -286,7 +322,11 @@ declare module 'pushy' {
286
322
  * @param topics
287
323
  * @param deviceToken
288
324
  */
289
- subscribe(topics: string | Array<string>, deviceToken: string): Promise<void>;
325
+ subscribe(
326
+ topics: string | Array<string>,
327
+ deviceToken: string,
328
+ callback?: (error: Error | null) => void
329
+ ): Promise<void>;
290
330
 
291
331
  /**
292
332
  * Unsubscribe a device from one or more topics.
@@ -295,7 +335,11 @@ declare module 'pushy' {
295
335
  * @param topics
296
336
  * @param deviceToken
297
337
  */
298
- unsubscribe(topics: string | Array<string>, deviceToken: string): Promise<void>;
338
+ unsubscribe(
339
+ topics: string | Array<string>,
340
+ deviceToken: string,
341
+ callback?: (error: Error | null) => void
342
+ ): Promise<void>;
299
343
 
300
344
  /**
301
345
  * Retrieve a list of your app's topics and subscribers count.
@@ -309,6 +353,9 @@ declare module 'pushy' {
309
353
  *
310
354
  * @param topic The Pub/Sub topic to retrieve subscribers for. Topics are case-sensitive and must match the following regular expression: [a-zA-Z0-9-_.]+.
311
355
  */
312
- getSubscribers(topic: string): Promise<TopicSuscribers>;
356
+ getSubscribers(
357
+ topic: string,
358
+ callback?: (error: Error | null, subscribers: TopicSuscribers) => void
359
+ ): Promise<TopicSuscribers>;
313
360
  }
314
361
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushy",
3
- "version": "2.0.14",
3
+ "version": "3.0.2",
4
4
  "description": "The official Node.js package for sending push notifications with Pushy.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,7 +17,6 @@
17
17
  },
18
18
  "homepage": "https://github.com/pushy/pushy-node#readme",
19
19
  "dependencies": {
20
- "bluebird": "^3.4.1",
21
- "request": "^2.72.0"
20
+ "axios": "^0.27.2"
22
21
  }
23
22
  }