bower
Version:
The browser package manager
1,098 lines (1,006 loc) • 158 kB
JavaScript
/**
* mixin repos
*
* 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 repos = module.exports = {
repos: {}
};
(function() {
/** section: github
* repos#getAll(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'.
* - type (String): Optional. Possible values: `all`, `owner`, `public`, `private`, `member`. Default: `all`. Validation rule: ` ^(all|owner|public|private|member)$ `.
* - sort (String): Optional. Possible values: `created`, `updated`, `pushed`, `full_name`. Default: `full_name`. Validation rule: ` ^(created|updated|pushed|full_name)$ `.
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getAll = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getFromUser(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'.
* - user (String): Required.
* - type (String): Optional. Possible values: `all`, `owner`, `member`. Default: `public`. Validation rule: ` ^(all|owner|member)$ `.
* - sort (String): Optional. Possible values: `created`, `updated`, `pushed`, `full_name`. Default: `full_name`. Validation rule: ` ^(created|updated|pushed|full_name)$ `.
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getFromUser = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getFromOrg(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'.
* - org (String): Required.
* - type (String): Optional. Possible values: `all`, `public`, `member`. Default: `all`. Validation rule: ` ^(all|public|member)$ `.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getFromOrg = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#create(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'.
* - name (String): Required.
* - description (String): Optional.
* - homepage (String): Optional.
* - private (Boolean): Optional. True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. Default is false.
* - has_issues (Boolean): Optional. True to enable issues for this repository, false to disable them. Default is true.
* - has_wiki (Boolean): Optional. True to enable the wiki for this repository, false to disable it. Default is true.
* - has_downloads (Boolean): Optional. True to enable downloads for this repository, false to disable them. Default is true.
* - auto_init (Boolean): Optional. True to create an initial commit with empty README. Default is false
* - gitignore_template (String): Optional. Desired language or platform .gitignore template to apply. Ignored if auto_init parameter is not provided.
**/
this.create = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#createFromOrg(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'.
* - org (String): Required.
* - name (String): Required.
* - description (String): Optional.
* - homepage (String): Optional.
* - private (Boolean): Optional. True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. Default is false.
* - has_issues (Boolean): Optional. True to enable issues for this repository, false to disable them. Default is true.
* - has_wiki (Boolean): Optional. True to enable the wiki for this repository, false to disable it. Default is true.
* - has_downloads (Boolean): Optional. True to enable downloads for this repository, false to disable them. Default is true.
* - auto_init (Boolean): Optional. True to create an initial commit with empty README. Default is false
* - gitignore_template (String): Optional. Desired language or platform .gitignore template to apply. Ignored if auto_init parameter is not provided.
* - team_id (Number): Optional. The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. Validation rule: ` ^[0-9]+$ `.
**/
this.createFromOrg = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#get(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'.
* - user (String): Required.
* - repo (String): Required.
**/
this.get = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#one(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'.
* - id (String): Required.
**/
this.one = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#update(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'.
* - user (String): Required.
* - repo (String): Required.
* - name (String): Required.
* - description (String): Optional.
* - homepage (String): Optional.
* - private (Boolean): Optional. True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. Default is false.
* - has_issues (Boolean): Optional. True to enable issues for this repository, false to disable them. Default is true.
* - has_wiki (Boolean): Optional. True to enable the wiki for this repository, false to disable it. Default is true.
* - has_downloads (Boolean): Optional. True to enable downloads for this repository, false to disable them. Default is true.
* - default_branch (String): Optional. Updates the default branch for this repository.
**/
this.update = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#delete(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'.
* - user (String): Required.
* - repo (String): Required.
**/
this.delete = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#merge(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'.
* - user (String): Required.
* - repo (String): Required.
* - base (String): Required. The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
* - head (String): Required. The branch (or git ref) where your changes are implemented.
* - commit_message (String): Optional. Commit message to use for the merge commit. If omitted, a default message will be used.
**/
this.merge = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getContributors(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'.
* - user (String): Required.
* - repo (String): Required.
* - anon (Boolean): Optional. Set to 1 or true to include anonymous contributors in results.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getContributors = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getLanguages(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'.
* - user (String): Required.
* - repo (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getLanguages = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getTeams(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'.
* - user (String): Required.
* - repo (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getTeams = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getTags(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'.
* - user (String): Required.
* - repo (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getTags = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getBranches(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'.
* - user (String): Required.
* - repo (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getBranches = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getBranch(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'.
* - user (String): Required.
* - repo (String): Required.
* - branch (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getBranch = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getCollaborators(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'.
* - user (String): Required.
* - repo (String): Required.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
**/
this.getCollaborators = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getCollaborator(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'.
* - user (String): Required.
* - repo (String): Required.
* - collabuser (String): Required.
**/
this.getCollaborator = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#addCollaborator(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'.
* - user (String): Required.
* - repo (String): Required.
* - collabuser (String): Required.
**/
this.addCollaborator = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#removeCollaborator(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'.
* - user (String): Required.
* - repo (String): Required.
* - collabuser (String): Required.
**/
this.removeCollaborator = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getCommits(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'.
* - user (String): Required.
* - repo (String): Required.
* - sha (String): Optional. Sha or branch to start listing commits from.
* - path (String): Optional. Only commits containing this file path will be returned.
* - author (String): Optional. GitHub login or email address by which to filter by commit author.
* - page (Number): Optional. Page number of the results to fetch. Validation rule: ` ^[0-9]+$ `.
* - per_page (Number): Optional. A custom page size up to 100. Default is 30. Validation rule: ` ^[0-9]+$ `.
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
* - until (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
**/
this.getCommits = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getCommit(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'.
* - user (String): Required.
* - repo (String): Required.
* - sha (String): Required.
**/
this.getCommit = 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;
var contentType = res.headers["content-type"];
if (contentType && contentType.indexOf("application/json") !== -1)
ret = JSON.parse(ret);
}
catch (ex) {
if (callback)
callback(new error.InternalServerError(ex.message), res);
return;
}
if (!ret)
ret = {};
if (typeof ret == "object") {
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
* repos#getAllCommitComments(msg, callback) -> null
* - msg (Object): Object that contains the parameters and their values to be se