/**
 *  mixin misc
 *
 *  Copyright 2012 Cloud9 IDE, Inc.
 *
 *  This product includes software developed by
 *  Cloud9 IDE, Inc (http://c9.io).
 *
 *  Author: Mike de Boer <info@mikedeboer.nl>
 **/

"use strict";

var error = require("./../../error");
var Util = require("./../../util");

var misc = module.exports = {
    misc: {}
};

(function() {
    /** section: github
     *  misc#meta(msg, callback) -> null
     *      - msg (Object): Object that contains the parameters and their values to be sent to the server.
     *      - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
     *
     *  ##### Params on the `msg` object:
     *
     *  - 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'.
     *  No other params, simply pass an empty Object literal `{}`
     **/
    this.meta = function(msg, block, callback) {
        var self = this;
        this.client.httpSend(msg, block, function(err, res) {
            if (err)
                return self.sendError(err, null, msg, callback);

            var ret;
            try {
                ret = res.data && JSON.parse(res.data);
            }
            catch (ex) {
                if (callback)
                    callback(new error.InternalServerError(ex.message), res);
                return;
            }

            if (!ret)
                ret = {};
            if (!ret.meta)
                ret.meta = {};
            ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
                if (res.headers[header])
                    ret.meta[header] = res.headers[header];
            });

            if (callback)
                callback(null, ret);
        });
    };

    /** section: github
     *  misc#rateLimit(msg, callback) -> null
     *      - msg (Object): Object that contains the parameters and their values to be sent to the server.
     *      - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.
     *
     *  ##### Params on the `msg` object:
     *
     *  - 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'.
     *  No other params, simply pass an empty Object literal `{}`
     **/
    this.rateLimit = function(msg, block, callback) {
        var self = this;
        this.client.httpSend(msg, block, function(err, res) {
            if (err)
                return self.sendError(err, null, msg, callback);

            var ret;
            try {
                ret = res.data && JSON.parse(res.data);
            }
            catch (ex) {
                if (callback)
                    callback(new error.InternalServerError(ex.message), res);
                return;
            }

            if (!ret)
                ret = {};
            if (!ret.meta)
                ret.meta = {};
            ["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
                if (res.headers[header])
                    ret.meta[header] = res.headers[header];
            });

            if (callback)
                callback(null, ret);
        });
    };

}).call(misc.misc);

@@ -340,24 +340,1688 @@
 unction() %7B%0A
+    /** section: github%0A     *  misc#emojis(msg, callback) -%3E null%0A     *      - msg (Object): Object that contains the parameters and their values to be sent to the server.%0A     *      - callback (Function): function to call when the request is finished with an error as first argument and result data as second argument.%0A     *%0A     *  ##### Params on the %60msg%60 object:%0A     *%0A     *  - 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'.%0A     *  No other params, simply pass an empty Object literal %60%7B%7D%60%0A     **/%0A    this.emojis = function(msg, block, callback) %7B%0A        var self = this;%0A        this.client.httpSend(msg, block, function(err, res) %7B%0A            if (err)%0A                return self.sendError(err, null, msg, callback);%0A%0A            var ret;%0A            try %7B%0A                ret = res.data && JSON.parse(res.data);%0A            %7D%0A            catch (ex) %7B%0A                if (callback)%0A                    callback(new error.InternalServerError(ex.message), res);%0A                return;%0A            %7D%0A%0A            if (!ret)%0A                ret = %7B%7D;%0A            if (!ret.meta)%0A                ret.meta = %7B%7D;%0A            %5B%22x-ratelimit-limit%22, %22x-ratelimit-remaining%22, %22x-ratelimit-reset%22, %22x-oauth-scopes%22, %22link%22, %22location%22, %22last-modified%22, %22etag%22, %22status%22%5D.forEach(function(header) %7B%0A                if (res.headers%5Bheader%5D)%0A                    ret.meta%5Bheader%5D = res.headers%5Bheader%5D;%0A            %7D);%0A%0A            if (callback)%0A                callback(null, ret);%0A        %7D);%0A    %7D;%0A%0A
     /** sect

Generate code for misc.emojis