Socket
Socket
Sign inDemoInstall

octonode

Package Overview
Dependencies
41
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.1 to 0.7.2

lib/octonode/notification.js

8

lib/octonode/client.js
// Generated by CoffeeScript 1.9.3
(function() {
var Client, Gist, HttpError, Issue, Label, Me, Milestone, Org, Pr, Repo, Search, Team, User, extend, request, url,
var Client, Gist, HttpError, Issue, Label, Me, Milestone, Notification, Org, Pr, Repo, Search, Team, User, extend, request, url,
extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },

@@ -33,2 +33,4 @@ hasProp = {}.hasOwnProperty,

Notification = require('./notification');
extend = require('deep-extend');

@@ -110,2 +112,6 @@

Client.prototype.notification = function(id) {
return new Notification(id, this);
};
Client.prototype.requestOptions = function(params1, params2) {

@@ -112,0 +118,0 @@ return extend(this.requestDefaults, params1, params2);

@@ -165,2 +165,15 @@ // Generated by CoffeeScript 1.9.3

Org.prototype.addMember = function(user, options, cb) {
return this.client.put("/orgs/" + this.name + "/memberships/" + user, options, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 204) {
return cb(new Error("Org addMember error"));
} else {
return cb(null, b, h);
}
});
};
Org.prototype.removeMember = function(user, cb) {

@@ -197,3 +210,3 @@ return this.client.del("/orgs/" + this.name + "/members/" + user, null, function(err, s, b, h) {

}
if (s !== 201) {
if (s !== 204) {
return cb(new Error('Org addTeamRepo error'));

@@ -200,0 +213,0 @@ } else {

@@ -25,2 +25,15 @@ // Generated by CoffeeScript 1.9.3

Repo.prototype.update = function(info, cb) {
return this.client.patch("/repos/" + this.name, info, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Repo update error"));
} else {
return cb(null, b, h);
}
});
};
Repo.prototype.collaborators = function(cbOrUser, cb) {

@@ -219,2 +232,18 @@ if ((cb != null) && typeof cbOrUser !== 'function') {

Repo.prototype.createReference = function(ref, sha, cb) {
return this.client.post("/repos/" + this.name + "/git/refs", {
ref: "refs/heads/" + ref,
sha: sha
}, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 201) {
return cb(new Error("Repo createReference error"));
} else {
return cb(null, b, h);
}
});
};
Repo.prototype.issue = function(numberOrIssue, cb) {

@@ -671,3 +700,3 @@ if (typeof cb === 'function' && typeof numberOrIssue === 'object') {

Repo.prototype.deleteHook = function(id, cb) {
return this.client.del("/repos/" + this.name + "/hooks/" + id, function(err, s, b, h) {
return this.client.del("/repos/" + this.name + "/hooks/" + id, {}, function(err, s, b, h) {
if (err) {

@@ -674,0 +703,0 @@ return cb(err);

@@ -41,3 +41,7 @@ // Generated by CoffeeScript 1.9.3

params = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), cb = arguments[i++];
return (ref = this.client).get.apply(ref, ["/teams/" + this.id + "/members"].concat(slice.call(params), [function(err, s, b, h) {
return (ref = this.client).getOptions.apply(ref, ["/teams/" + this.id + "/members", {
headers: {
Accept: 'application/vnd.github.ironman-preview+json'
}
}].concat(slice.call(params), [function(err, s, b, h) {
if (err) {

@@ -94,8 +98,8 @@ return cb(err);

}
return cb(null, s === 204, h);
return cb(null, s === 204 || s === 200, h);
});
};
Team.prototype.addMembership = function(user, cb) {
return this.client.put("/teams/" + this.id + "/memberships/" + user, null, function(err, s, b, h) {
Team.prototype.getMembership = function(user, cb) {
return this.client.get("/teams/" + this.id + "/memberships/" + user, function(err, s, b, h) {
if (err) {

@@ -105,2 +109,22 @@ return cb(err);

if (s !== 200) {
return cb(new Error("Team getMembership error"));
} else {
return cb(null, b, h);
}
});
};
Team.prototype.addMembership = function(user, cbOrOptions, cb) {
var param;
if ((cb == null) && cbOrOptions) {
cb = cbOrOptions;
param = {};
} else if (typeof cbOrOptions === 'object') {
param = cbOrOptions;
}
return this.client.put("/teams/" + this.id + "/memberships/" + user, param, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 200) {
return cb(new Error("Team membership error"));

@@ -141,2 +165,28 @@ } else {

Team.prototype.removeRepo = function(repo, cb) {
return this.client.del("/teams/" + this.id + "/repos/" + repo, {}, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 204) {
return cb(new Error("Team removeRepo error"));
} else {
return cb(null, b, h);
}
});
};
Team.prototype.destroy = function(cb) {
return this.client.del("/teams/" + this.id, {}, function(err, s, b, h) {
if (err) {
return cb(err);
}
if (s !== 204) {
return cb(new Error("Team destroy error"));
} else {
return cb(null, b, h);
}
});
};
return Team;

@@ -143,0 +193,0 @@

2

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

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

@@ -17,12 +17,13 @@ # octonode [![Gitter chat](https://badges.gitter.im/pksunkara/octonode.svg)](https://gitter.im/pksunkara/octonode)

var ghme = client.me();
var ghuser = client.user('pksunkara');
var ghrepo = client.repo('pksunkara/hub');
var ghorg = client.org('flatiron');
var ghissue = client.issue('pksunkara/hub', 37);
var ghmilestone = client.milestone('pksunkara/hub', 37);
var ghlabel = client.label('pksunkara/hub', 'todo');
var ghpr = client.pr('pksunkara/hub', 37);
var ghgist = client.gist();
var ghteam = client.team(37);
var ghme = client.me();
var ghuser = client.user('pksunkara');
var ghrepo = client.repo('pksunkara/hub');
var ghorg = client.org('flatiron');
var ghissue = client.issue('pksunkara/hub', 37);
var ghmilestone = client.milestone('pksunkara/hub', 37);
var ghlabel = client.label('pksunkara/hub', 'todo');
var ghpr = client.pr('pksunkara/hub', 37);
var ghgist = client.gist();
var ghteam = client.team(37);
var ghnotification = client.notification(37);

@@ -405,2 +406,10 @@ var ghsearch = client.search();

#### List notifications
Options based on http://git.io/vYYOx
```js
ghme.notifications({}, callback); //array of notifications
```
## Github users api

@@ -464,2 +473,10 @@

#### Edit a repository (PATCH /repos/pksunkara/hub)
```js
ghrepo.update({
private: false
}, callback); // repo
```
#### Get the collaborators for a repository (GET /repos/pksunkara/hub/collaborators)

@@ -525,3 +542,8 @@

```
#### Create a Reference (POST /repos/pksunkara/hub/git/refs)
```js
ghrepo.createReference('master', '18293abcd72', callback);
```
#### Get the issues for a repository (GET /repos/pksunkara/hub/issues)

@@ -728,2 +750,28 @@

## GitHub notifications api
#### Mark a thread as read
```js
ghnotification.markAsRead(callback);
```
#### Subscribe to a thread
```js
ghnotification.subscribe(callback);
```
#### Unsubscribe from a thread
```js
ghnotification.unsubscribe(callback);
```
#### Mute a thread
```js
ghnotification.mute(callback);
```
## Github organizations api

@@ -1131,2 +1179,14 @@

#### Remove a repo from a team (DELETE /team/37/repos/flatiron/hub)
```js
ghteam.removeRepo("flatiron/hub", callback);
```
#### Delete a team (DELETE /team/37)
```js
ghteam.destroy(callback);
```
## Github search api

@@ -1294,3 +1354,2 @@

repo.get_all_references(callback);
repo.create_reference('ref', 'sha', callback);
repo.update_reference('ref', 'sha', force, callback);

@@ -1297,0 +1356,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