New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yode

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yode - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

6

demos/tests.js
var yode = require('../index');
yo = new yode();
// authenticate, and send a yo to everyone subscribed to the account "yodenodedev"
yo.authenticate('083eeb23-3d19-1adb-e618-b8c4382804fd', function (data){
yo.yoAll();
});
// authenticate
yo.authenticate('083eeb23-3d19-1adb-e618-b8c4382804fd');

@@ -7,12 +7,15 @@ var request = require('request');

e.prototype.authenticate = function(api_key, cb) {
e.prototype.authenticate = function(api_token, cb) {
var self = this;
request.get('http://api.justyo.co/subscribers_count/?api_token=' + api_key, function (err, response, body) {
request.get('http://api.justyo.co/subscribers_count/?api_token=' + api_token, function (err, response, body) {
if (err) throw err;
var data = JSON.parse(body);
if (data.result == 1) {
self.api_key = api_key;
self.api_token = api_token;
return cb ? cb({
"status": 1,
"api_key":api_key
"response": {
"api_token": api_token
},
"errors": null
}) : true;

@@ -23,3 +26,4 @@ }

"status": 0,
"error":"API key is invalid."
"response": null,
"errors": ["API key is invalid."]
}) : false;

@@ -32,20 +36,52 @@ }

var self = this;
if (usernames instanceof Array) {
for (var i in usernames) {
if (self.api_token != undefined) {
if (usernames instanceof Array) {
for (var i in usernames) {
request.post('http://api.justyo.co/yo/', {form: {
'api_token': self.api_token,
'username': usernames[i]
}}, function (err, response, body) {
if (err) throw err;
var data = JSON.parse(body);
if (data.result == "OK") {
return cb ? cb({
"status": 0,
"response": null,
"errors": [data.error]
}) : false;
}
if (i == usernames.length - 1) {
return cb ? cb({
"status": 1,
"response": {
"success": true
},
"errors": null
}) : true;
}
});
}
}
else {
request.post('http://api.justyo.co/yo/', {form: {
'api_token': self.api_key,
'username': usernames[i]
'api_token': self.api_token,
'username': usernames
}}, function (err, response, body) {
if (err) throw err;
var data = JSON.parse(body);
if (data.result != "OK") {
if (data.result == "OK") {
return cb ? cb({
"status": 0,
"error": data.error
}) : false;
"status": 1,
"response": {
"success": true
},
"errors": null
}) : true;
}
if (i == usernames.length - 1) {
else {
return cb ? cb({
"status": 1
}) : true;
"status": 0,
"response": null,
"errors": [data.error]
}) : false;
}

@@ -56,5 +92,15 @@ });

else {
request.post('http://api.justyo.co/yo/', {form: {
'api_token': self.api_key,
'username': usernames
return cb ? cb({
"status": 0,
"response": null,
"errors": ["No API key has been set."]
}) : false;
}
};
e.prototype.yoAll = function(cb) {
var self = this;
if (self.api_token != undefined) {
request.post('http://api.justyo.co/yoall/', {form: {
'api_token': self.api_token
}}, function (err, response, body) {

@@ -65,3 +111,7 @@ if (err) throw err;

return cb ? cb({
"status": 1
"status": 1,
"response": {
"success": true
},
"errors": null
}) : true;

@@ -71,4 +121,5 @@ }

return cb ? cb({
"status": 0,
"error": data.error
"status": 0,
"response": null,
"errors": [data.error]
}) : false;

@@ -78,14 +129,29 @@ }

}
else {
return cb ? cb({
"status": 0,
"response": null,
"errors": ["No API key has been set."]
}) : false;
}
};
e.prototype.yoAll = function(cb) {
e.prototype.getSubscriberCount = function(cb) {
var self = this;
if (self.api_key != undefined) {
request.post('http://api.justyo.co/yoall/', {form: {
'api_token': self.api_key
}}, function (err, response, body) {
if (self.api_token != undefined) {
request.get('http://api.justyo.co/subscribers_count/?api_token=' + self.api_token, function (err, response, body) {
if (err) throw err;
return cb ? cb({
"status": 1
}) : true;
var data = JSON.parse(body);
if (data.result == 1) {
return cb ? cb({
"status": 1,
"data": data.data
}) : true;
}
else {
return cb ? cb({
"status": 0,
"error": "API key is invalid."
}) : false;
}
});

@@ -96,25 +162,6 @@ }

"status": 0,
"error":"No API key has been set."
"response": null,
"errors": ["No API key has been set."]
}) : false;
}
};
e.prototype.getSubscriberCount = function(cb) {
var self = this;
request.get('http://api.justyo.co/subscribers_count/?api_token=' + self.api_key, function (err, response, body) {
if (err) throw err;
var data = JSON.parse(body);
if (data.result == 1) {
return cb ? cb({
"status": 1,
"data": data.data
}) : true;
}
else {
return cb ? cb({
"status": 0,
"error":"API key is invalid."
}) : false;
}
});
}
{
"name": "yode",
"version": "0.0.2",
"version": "0.0.3",
"description": "A yo api wrapper for node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

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