octonode
Advanced tools
Comparing version 0.6.0 to 0.6.2
@@ -109,2 +109,15 @@ // Generated by CoffeeScript 1.7.1 | ||
Org.prototype.createTeam = function(options, cb) { | ||
return this.client.post("/orgs/" + this.name + "/teams", options, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error('Org createTeam error')); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
return Org; | ||
@@ -111,0 +124,0 @@ |
@@ -46,2 +46,33 @@ // Generated by CoffeeScript 1.7.1 | ||
Team.prototype.addUser = function(user, cb) { | ||
return this.client.put("/teams/" + this.id + "/members/" + user, null, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204, h); | ||
}); | ||
}; | ||
Team.prototype.removeUser = function(user, cb) { | ||
return this.client.del("/teams/" + this.id + "/members/" + user, null, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204, h); | ||
}); | ||
}; | ||
Team.prototype.repos = function(cb) { | ||
return this.client.get("/teams/" + this.id + "/repos/", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Team repos error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
return Team; | ||
@@ -48,0 +79,0 @@ |
{ | ||
"name": "octonode", | ||
"version": "0.6.0", | ||
"version": "0.6.2", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api", |
@@ -703,2 +703,14 @@ # octonode | ||
#### Create an organization team (POST /orgs/flatiron/teams) | ||
```js | ||
ghorg.createTeam({ | ||
"name": "new team name", | ||
"permission": "push", | ||
"repo_names": [ | ||
"flatiron/utile" | ||
] | ||
}, callback); | ||
``` | ||
## Github issues api | ||
@@ -928,5 +940,23 @@ | ||
```js | ||
ghteam.member('pksunkara'); //boolean | ||
ghteam.member('pksunkara', callback); //boolean | ||
``` | ||
#### Add a user to a team (PUT /team/37/members/pksunkara) | ||
```js | ||
ghteam.addUser("pksunkara", callback); //boolean | ||
``` | ||
#### Remove a user from a team (DELETE /team/37/members/pksunkara) | ||
```js | ||
ghteam.removeUser("pksunkara", callback); //boolean | ||
``` | ||
#### List all repos of a team (GET /team/37/repos) | ||
```js | ||
ghteam.repos(callback); //Array of JSON | ||
``` | ||
## Github search api | ||
@@ -933,0 +963,0 @@ |
95121
2092
1141