Skip to content

Commit 29480fe

Browse files
committed
add endpoint for editOrgMembership
1 parent 62cd415 commit 29480fe

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

api/v3.0.0/routes.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,6 +3007,21 @@
30073007
}
30083008
},
30093009

3010+
"edit-organization-membership": {
3011+
"url": "/user/memberships/orgs/:org",
3012+
"method": "PATCH",
3013+
"params": {
3014+
"$org": null,
3015+
"state": {
3016+
"type": "String",
3017+
"required": true,
3018+
"validation": "^(open|closed|active)$",
3019+
"invalidmsg": "",
3020+
"description": ""
3021+
}
3022+
}
3023+
},
3024+
30103025
"get-teams": {
30113026
"url": "/user/teams",
30123027
"method": "GET",

api/v3.0.0/user.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,48 @@ var user = module.exports = {
185185
callback(null, ret);
186186
});
187187
};
188+
189+
/** section: github
190+
* user#editOrgMembership(msg, callback) -> null
191+
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
192+
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
193+
*
194+
* ##### Params on the `msg` object:
195+
*
196+
* - 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'.
197+
* - org (String): Required.
198+
* - state (String): Required
199+
**/
200+
this.editOrganizationMembership = function(msg, block, callback) {
201+
var self = this;
202+
this.client.httpSend(msg, block, function(err, res) {
203+
if (err)
204+
return self.sendError(err, null, msg, callback);
188205

206+
var ret;
207+
try {
208+
ret = res.data && JSON.parse(res.data);
209+
}
210+
catch (ex) {
211+
if (callback)
212+
callback(new error.InternalServerError(ex.message), res);
213+
return;
214+
}
215+
216+
if (!ret)
217+
ret = {};
218+
if (!ret.meta)
219+
ret.meta = {};
220+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
221+
if (res.headers[header])
222+
ret.meta[header] = res.headers[header];
223+
});
224+
225+
if (callback)
226+
callback(null, ret);
227+
});
228+
};
229+
189230
/** section: github
190231
* user#getTeams(msg, callback) -> null
191232
* - msg (Object): Object that contains the parameters and their values to be sent to the server.

0 commit comments

Comments
 (0)