Skip to content

Commit 066698b

Browse files
committed
Generate code for misc.emojis
1 parent a00fa0e commit 066698b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

api/v3.0.0/misc.js

+40
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,46 @@ var misc = module.exports = {
1919
};
2020

2121
(function() {
22+
/** section: github
23+
* misc#emojis(msg, callback) -> null
24+
* - msg (Object): Object that contains the parameters and their values to be sent to the server.
25+
* - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
26+
*
27+
* ##### Params on the `msg` object:
28+
*
29+
* - 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'.
30+
* No other params, simply pass an empty Object literal `{}`
31+
**/
32+
this.emojis = function(msg, block, callback) {
33+
var self = this;
34+
this.client.httpSend(msg, block, function(err, res) {
35+
if (err)
36+
return self.sendError(err, null, msg, callback);
37+
38+
var ret;
39+
try {
40+
ret = res.data && JSON.parse(res.data);
41+
}
42+
catch (ex) {
43+
if (callback)
44+
callback(new error.InternalServerError(ex.message), res);
45+
return;
46+
}
47+
48+
if (!ret)
49+
ret = {};
50+
if (!ret.meta)
51+
ret.meta = {};
52+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
53+
if (res.headers[header])
54+
ret.meta[header] = res.headers[header];
55+
});
56+
57+
if (callback)
58+
callback(null, ret);
59+
});
60+
};
61+
2262
/** section: github
2363
* misc#meta(msg, callback) -> null
2464
* - msg (Object): Object that contains the parameters and their values to be sent to the server.

0 commit comments

Comments
 (0)