Socket
Socket
Sign inDemoInstall

octonode

Package Overview
Dependencies
25
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.8 to 0.3.9

30

lib/octonode/client.js

@@ -99,6 +99,9 @@ // Generated by CoffeeScript 1.6.3

} else {
query = {
page: pageOrQuery != null ? pageOrQuery : void 0,
per_page: per_page != null ? per_page : void 0
};
query = {};
if (pageOrQuery != null) {
query.page = pageOrQuery;
}
if (per_page != null) {
query.per_page = per_page;
}
}

@@ -158,2 +161,21 @@ if (typeof this.token === 'string') {

Client.prototype.getNoFollow = function() {
var callback, params, path, _i,
_this = this;
path = arguments[0], params = 3 <= arguments.length ? __slice.call(arguments, 1, _i = arguments.length - 1) : (_i = 1, []), callback = arguments[_i++];
return request({
uri: this.buildUrl.apply(this, [path].concat(__slice.call(params))),
method: 'GET',
followRedirect: false,
headers: {
'User-Agent': 'octonode/0.3 (https://github.com/pksunkara/octonode) terminal/0.0'
}
}, function(err, res, body) {
if (err) {
return callback(err);
}
return _this.errorHandle(res, body, callback);
});
};
Client.prototype.post = function(path, content, callback) {

@@ -160,0 +182,0 @@ var _this = this;

@@ -12,2 +12,28 @@ // Generated by CoffeeScript 1.6.3

Issue.prototype.info = function(cb) {
return this.client.get("/repos/" + this.repo + "/issues/" + this.number, function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Issue info error"));
} else {
return cb(null, b);
}
});
};
Issue.prototype.update = function(obj, cb) {
return this.client.post("/repos/" + this.repo + "/issues/" + this.number, obj, function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Issue update error"));
} else {
return cb(null, b);
}
});
};
Issue.prototype.comments = function(cb) {

@@ -14,0 +40,0 @@ return this.client.get("/repos/" + this.repo + "/issues/" + this.number + "/comments", function(err, s, b) {

// Generated by CoffeeScript 1.6.3
(function() {
var Me;
var Me,
__slice = [].slice;

@@ -143,2 +144,60 @@ Me = (function() {

Me.prototype.starred = function(cbOrUser, cb) {
if ((cb != null) && typeof cbOrUser !== 'function') {
return this.checkStarred(cbOrUser, cb);
} else {
cb = cbOrUser;
return this.client.get('/user/starred', function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error('User starred error'));
} else {
return cb(null, b);
}
});
}
};
Me.prototype.checkStarred = function(repo, cb) {
return this.client.get("/user/starred/" + repo, function(err, s, b) {
if (err) {
return cb(err);
}
return cb(null, s === 204);
});
};
Me.prototype.star = function(repo) {
var _this = this;
return this.client.put("/user/starred/" + repo, {}, function(err, s, b) {
if ((err != null) || s !== 204) {
return _this.star(repo);
}
});
};
Me.prototype.unstar = function(repo) {
var _this = this;
return this.client.del("/user/starred/" + repo, {}, function(err, s, b) {
if ((err != null) || s !== 204) {
return _this.unstar(repo);
}
});
};
Me.prototype.watched = function(cb) {
return this.client.get('/user/subscriptions', function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error('User subscription error'));
} else {
return cb(null, b);
}
});
};
Me.prototype.keys = function(cbOrIdOrKey, cbOrKey, cb) {

@@ -233,24 +292,25 @@ if ((cb == null) && typeof cbOrIdOrKey === 'number' && typeof cbOrKey === 'function') {

Me.prototype.repo = function(name) {
return this.client.repo(name);
};
Me.prototype.repos = function(cbOrRepo, cb) {
if (typeof cb === 'function' && typeof cbOrRepo === 'object') {
return this.createRepo(cbOrRepo, cb);
Me.prototype.repo = function(name, cb) {
if (typeof cb === 'function' && typeof nameOrRepo === 'object') {
return this.createRepo(nameOrRepo, cb);
} else {
cb = cbOrRepo;
return this.client.get("/user/repos", function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error('User repos error'));
} else {
return cb(null, b);
}
});
return this.client.repo(name);
}
};
Me.prototype.repos = function() {
var cb, params, _i, _ref;
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++];
return (_ref = this.client).get.apply(_ref, ["/user/repos"].concat(__slice.call(params), [function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error('User repos error'));
} else {
return cb(null, b);
}
}]));
};
Me.prototype.createRepo = function(repo, cb) {

@@ -257,0 +317,0 @@ return this.client.post("/user/repos", repo, function(err, s, b) {

4

lib/octonode/org.js

@@ -95,7 +95,7 @@ // Generated by CoffeeScript 1.6.3

Org.prototype.member = function(user, cb) {
return this.client.get("/orgs/" + this.name + "/members/" + user, function(err, s, b) {
return this.client.getNoFollow("/orgs/" + this.name + "/members/" + user, function(err, s, b) {
if (err) {
return cb(err);
}
return cb(null, s === 204);
return cb(null, s === 204 || s === 302);
});

@@ -102,0 +102,0 @@ };

@@ -147,2 +147,10 @@ // Generated by CoffeeScript 1.6.3

Repo.prototype.issue = function(numberOrIssue, cb) {
if (typeof cb === 'function' && typeof numberOrIssue === 'object') {
return this.createIssue(numberOrIssue, cb);
} else {
return this.client.issue(this.name, numberOrIssue);
}
};
Repo.prototype.issues = function() {

@@ -163,2 +171,12 @@ var cb, params, _i, _ref;

Repo.prototype.createIssue = function(issue, cb) {
return this.client.post("/repos/" + this.name + "/issues", issue, function(err, s, b) {
if (s !== 201) {
return cb(new Error("Repo createIssue error"));
} else {
return cb(null, b);
}
});
};
Repo.prototype.readme = function(cbOrRef, cb) {

@@ -274,24 +292,25 @@ if ((cb == null) && cbOrRef) {

Repo.prototype.pr = function(number) {
return this.client.pr(this.name, number);
};
Repo.prototype.prs = function(cbOrPr, cb) {
if (typeof cb === 'function' && typeof cbOrPr === 'object') {
return this.createPr(cbOrPr, cb);
Repo.prototype.pr = function(numberOrPr, cb) {
if (typeof cb === 'function' && typeof numberOrPr === 'object') {
return this.createPr(numberOrPr, cb);
} else {
cb = cbOrPr;
return this.client.get("/repos/" + this.name + "/pulls", function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Repo prs error"));
} else {
return cb(null, b);
}
});
return this.client.pr(this.name, numberOrPr);
}
};
Repo.prototype.prs = function() {
var cb, params, _i, _ref;
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++];
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/pulls"].concat(__slice.call(params), [function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Repo prs error"));
} else {
return cb(null, b);
}
}]));
};
Repo.prototype.createPr = function(pr, cb) {

@@ -298,0 +317,0 @@ return this.client.post("/repos/" + this.name + "/pulls", pr, function(err, s, b) {

@@ -77,2 +77,15 @@ // Generated by CoffeeScript 1.6.3

User.prototype.orgs = function(cb) {
return this.client.get("/users/" + this.login + "/orgs", function(err, s, b) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error('User organizations error'));
} else {
return cb(null, b);
}
});
};
return User;

@@ -79,0 +92,0 @@

{
"name": "octonode",
"version": "0.3.8",
"version": "0.3.9",
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)",

@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api",

@@ -299,3 +299,3 @@ # octonode

#### Get information about an user (GET /users/pksunkara)
#### Get information about a user (GET /users/pksunkara)

@@ -306,3 +306,3 @@ ```js

#### Get an user followers (GET /users/pksunkara/followers)
#### Get user followers (GET /users/pksunkara/followers)

@@ -313,3 +313,3 @@ ```js

#### Get an user followings (GET /users/pksunkara/following)
#### Get user followings (GET /users/pksunkara/following)

@@ -320,2 +320,9 @@ ```js

#### Get user organizations (GET /users/pksunkara/orgs)
```js
ghuser.orgs(callback); //array of organizations
```
## Github repositories api

@@ -322,0 +329,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc