Skip to content

Commit 62cd415

Browse files
committed
add endpoint for addTeamMembership
1 parent ca90bf2 commit 62cd415

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

api/v3.0.0/orgs.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,47 @@ var orgs = module.exports = {
808808
});
809809
};
810810

811+
/** section: github
812+
* orgs#addTeamMembership(msg, callback) -> null
813+
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
814+
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
815+
*
816+
* ##### Params on the `msg` object:
817+
*
818+
* - headers (Object): Optional. Key/ value pair of request headers to pass along with the HTTP request. Valid headers are: 'If-Modified-Since', 'If-None-Match', 'Cookie', 'User-Agent', 'Accept', 'X-GitHub-OTP'.
819+
* - id (String): Required.
820+
* - user (String): Required.
821+
**/
822+
this.addTeamMembership = function(msg, block, callback) {
823+
var self = this;
824+
this.client.httpSend(msg, block, function(err, res) {
825+
if (err)
826+
return self.sendError(err, null, msg, callback);
827+
828+
var ret;
829+
try {
830+
ret = res.data && JSON.parse(res.data);
831+
}
832+
catch (ex) {
833+
if (callback)
834+
callback(new error.InternalServerError(ex.message), res);
835+
return;
836+
}
837+
838+
if (!ret)
839+
ret = {};
840+
if (!ret.meta)
841+
ret.meta = {};
842+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
843+
if (res.headers[header])
844+
ret.meta[header] = res.headers[header];
845+
});
846+
847+
if (callback)
848+
callback(null, ret);
849+
});
850+
};
851+
811852
/** section: github
812853
* orgs#getTeamRepos(msg, callback) -> null
813854
* - msg (Object): Object that contains the parameters and their values to be sent to the server.

api/v3.0.0/routes.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,15 @@
15091509
}
15101510
},
15111511

1512+
"add-team-membership": {
1513+
"url": "/teams/:id/memberships/:user",
1514+
"method": "PUT",
1515+
"params": {
1516+
"$id": null,
1517+
"$user": null
1518+
}
1519+
},
1520+
15121521
"get-team-repos": {
15131522
"url": "/teams/:id/repos",
15141523
"method": "GET",

0 commit comments

Comments
 (0)