Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pushy

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pushy - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

26

api/device/info.js

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -23,13 +22,10 @@ // Device Info API

// Make a request to the Device Info API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/devices/' + deviceToken + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/devices/' + deviceToken + '?api_key=' + that.apiKey,
method: 'GET',
json: true
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -47,3 +43,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -64,4 +60,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -43,13 +42,10 @@ // Device Presence API

// Make a request to the Device Presence API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/devices/presence' + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/devices/presence' + '?api_key=' + that.apiKey,
method: 'POST',
json: postData
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
data: postData
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -67,3 +63,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -84,4 +80,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -37,13 +36,10 @@ // Pub/Sub Subscribe API

// Make a request to the Pub/Sub Subscribe API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/topics/subscribe/' + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/topics/subscribe/' + '?api_key=' + that.apiKey,
method: 'POST',
json: postData
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
data: postData
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -61,3 +57,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -75,4 +71,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -23,13 +22,10 @@ // Pub/Sub Subscribers API

// Make a request to the Pub/Sub Subscribers API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/topics/' + topic + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/topics/' + topic + '?api_key=' + that.apiKey,
method: 'GET',
json: true
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -47,3 +43,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -64,4 +60,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -18,13 +17,10 @@ // Pub/Sub Topics API

// Make a request to the Pub/Sub Topics API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/topics/' + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/topics/' + '?api_key=' + that.apiKey,
method: 'GET',
json: true
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -42,3 +38,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -59,4 +55,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -37,13 +36,10 @@ // Pub/Sub Unsubscribe API

// Make a request to the Pub/Sub Unsubscribe API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/topics/unsubscribe/' + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/topics/unsubscribe/' + '?api_key=' + that.apiKey,
method: 'POST',
json: postData
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
data: postData
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -61,3 +57,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -75,4 +71,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird')
var axios = require('axios');

@@ -33,13 +32,10 @@ // Notification Deletion API

// Make a request to the Notification Deletion API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
method: 'DELETE',
json: true
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -57,3 +53,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -71,4 +67,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
};

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -62,13 +61,10 @@ // Send Notifications API

// Make a request to the Send Notifications API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/push?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/push?api_key=' + that.apiKey,
method: 'POST',
json: postData
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
data: postData
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -86,3 +82,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -100,4 +96,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
};

@@ -1,3 +0,2 @@

var request = require('request');
var Promise = require('bluebird');
var axios = require('axios');

@@ -23,13 +22,10 @@ // Notification Status API

// Make a request to the Notification Status API
request(
axios(
Object.assign({
uri: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
url: that.getApiEndpoint() + '/pushes/' + pushId + '?api_key=' + that.apiKey,
method: 'GET',
json: true
}, that.extraRequestOptions || {}), function (err, res, body) {
// Request error?
if (err) {
// Send to callback
return reject(err);
}
}, that.extraRequestOptions || {})).then(function (res) {
// API response
var body = res.data;

@@ -47,3 +43,3 @@ // Missing body?

// Check for 200 OK
if (res.statusCode != 200) {
if (res.status != 200) {
return reject(new Error('An invalid response code was received from the Pushy API.'));

@@ -64,4 +60,12 @@ }

}
}).catch(function (err) {
// Invoke callback/reject promise with Pushy error
if (err.response && err.response.data) {
reject(err.response.data);
}
else {
reject(err);
}
});
});
}

@@ -113,2 +113,29 @@ declare module 'pushy' {

interface SendPushNotificationResult {
/** Returned if the API request was successful. */
success: boolean;
/**
* The push notification unique ID.
*
* Use it to check delivery status using the Notification Status API.
*/
id: string;
/**
* Contains additional information about the notification, for debugging purposes.
*/
info: {
/**
* The number of devices that will potentially receive the notification.
*/
devices: number;
/**
* An array of invalid device tokens passed in which could not be found in our
* database registered under the app with the Secret API Key used to authenticate this request.
*/
failed: Array<string>;
};
}
interface NotificationStatus {

@@ -247,4 +274,4 @@ /** The creation date of the push notification (unix timestamp). */

options?: SendPushNotificationOptions,
callback?: (error: Error | null, pushId: string) => void
): Promise<string>;
callback?: (error: Error | null, result: SendPushNotificationResult) => void
): Promise<SendPushNotificationResult>;

@@ -257,3 +284,6 @@ /**

*/
getNotificationStatus(pushId: string): Promise<NotificationStatus>;
getNotificationStatus(
pushId: string,
callback?: (error: Error | null, status: NotificationStatus) => void
): Promise<NotificationStatus>;

@@ -266,3 +296,3 @@ /**

*/
deletePushNotification(pushId: string): Promise<void>;
deletePushNotification(pushId: string, callback?: (error: Error | null) => void): Promise<void>;

@@ -275,3 +305,6 @@ /**

*/
getDevicePresence(deviceTokens: string | Array<string>): Promise<Array<DevicePresenceInfo>>;
getDevicePresence(
deviceTokens: string | Array<string>,
callback?: (error: Error | null, presence: Array<DevicePresenceInfo>) => void
): Promise<Array<DevicePresenceInfo>>;

@@ -285,3 +318,6 @@ /**

*/
getDeviceInfo(deviceToken: string): Promise<DeviceInfo>;
getDeviceInfo(
deviceToken: string,
callback?: (error: Error | null, device: DeviceInfo) => void
): Promise<DeviceInfo>;

@@ -295,3 +331,7 @@ /**

*/
subscribe(topics: string | Array<string>, deviceToken: string): Promise<void>;
subscribe(
topics: string | Array<string>,
deviceToken: string,
callback?: (error: Error | null) => void
): Promise<void>;

@@ -305,3 +345,7 @@ /**

*/
unsubscribe(topics: string | Array<string>, deviceToken: string): Promise<void>;
unsubscribe(
topics: string | Array<string>,
deviceToken: string,
callback?: (error: Error | null) => void
): Promise<void>;

@@ -320,4 +364,7 @@ /**

*/
getSubscribers(topic: string): Promise<TopicSuscribers>;
getSubscribers(
topic: string,
callback?: (error: Error | null, subscribers: TopicSuscribers) => void
): Promise<TopicSuscribers>;
}
}
{
"name": "pushy",
"version": "3.0.0",
"version": "3.0.1",
"description": "The official Node.js package for sending push notifications with Pushy.",

@@ -20,5 +20,4 @@ "main": "index.js",

"dependencies": {
"bluebird": "^3.4.1",
"request": "^2.72.0"
"axios": "^0.27.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc