1247 lines
53 KiB
JavaScript
1247 lines
53 KiB
JavaScript
|
/**
|
||
|
* mixin issues
|
||
|
*
|
||
|
* 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 issues = module.exports = {
|
||
|
issues: {}
|
||
|
};
|
||
|
|
||
|
(function() {
|
||
|
/** section: github
|
||
|
* issues#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'.
|
||
|
* - filter (String): Optional. Validation rule: ` ^(all|assigned|created|mentioned|subscribed)$ `.
|
||
|
* - state (String): Optional. open, closed, or all Validation rule: ` ^(open|closed|all)$ `.
|
||
|
* - labels (String): Optional. String list of comma separated Label names. Example: bug,ui,@high
|
||
|
* - sort (String): Optional. Validation rule: ` ^(created|updated|comments)$ `.
|
||
|
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
|
||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||
|
* - 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
|
||
|
* issues#repoIssues(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.
|
||
|
* - milestone (String): Optional. Validation rule: ` ^([0-9]+|none|\*)$ `.
|
||
|
* - state (String): Optional. open, closed, or all Validation rule: ` ^(open|closed|all)$ `.
|
||
|
* - assignee (String): Optional. String User login, `none` for Issues with no assigned User. `*` for Issues with any assigned User.
|
||
|
* - creator (String): Optional. The user that created the issue.
|
||
|
* - mentioned (String): Optional. String User login.
|
||
|
* - labels (String): Optional. String list of comma separated Label names. Example: bug,ui,@high
|
||
|
* - sort (String): Optional. Validation rule: ` ^(created|updated|comments)$ `.
|
||
|
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
|
||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||
|
* - 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.repoIssues = 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
|
||
|
* issues#getRepoIssue(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
**/
|
||
|
this.getRepoIssue = 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
|
||
|
* issues#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'.
|
||
|
* - user (String): Required.
|
||
|
* - repo (String): Required.
|
||
|
* - title (String): Required.
|
||
|
* - body (String): Optional.
|
||
|
* - assignee (String): Optional. Login for the user that this issue should be assigned to.
|
||
|
* - milestone (Number): Optional. Milestone to associate this issue with. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - labels (Json): Optional. Array of strings - Labels to associate with this issue.
|
||
|
**/
|
||
|
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
|
||
|
* issues#edit(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - title (String): Optional.
|
||
|
* - body (String): Optional.
|
||
|
* - assignee (String): Optional. Login for the user that this issue should be assigned to.
|
||
|
* - milestone (Number): Optional. Milestone to associate this issue with. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - labels (Json): Optional. Array of strings - Labels to associate with this issue.
|
||
|
* - state (String): Optional. open or closed Validation rule: ` ^(open|closed)$ `.
|
||
|
**/
|
||
|
this.edit = 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
|
||
|
* issues#repoComments(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.
|
||
|
* - sort (String): Optional. Validation rule: ` ^(created|updated)$ `.
|
||
|
* - direction (String): Optional. Validation rule: ` ^(asc|desc)$ `.
|
||
|
* - since (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||
|
* - 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.repoComments = 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
|
||
|
* issues#getComments(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - 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.getComments = 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
|
||
|
* issues#getComment(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.
|
||
|
* - id (String): Required.
|
||
|
**/
|
||
|
this.getComment = 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
|
||
|
* issues#createComment(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - body (String): Required.
|
||
|
**/
|
||
|
this.createComment = 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
|
||
|
* issues#editComment(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.
|
||
|
* - id (String): Required.
|
||
|
* - body (String): Required.
|
||
|
**/
|
||
|
this.editComment = 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
|
||
|
* issues#deleteComment(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.
|
||
|
* - id (String): Required.
|
||
|
**/
|
||
|
this.deleteComment = 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
|
||
|
* issues#getEvents(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - 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.getEvents = 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
|
||
|
* issues#getRepoEvents(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.getRepoEvents = 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
|
||
|
* issues#getEvent(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.
|
||
|
* - id (String): Required.
|
||
|
**/
|
||
|
this.getEvent = 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
|
||
|
* issues#getLabels(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.getLabels = 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
|
||
|
* issues#getLabel(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.
|
||
|
**/
|
||
|
this.getLabel = 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
|
||
|
* issues#createLabel(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.
|
||
|
* - color (String): Required. 6 character hex code, without a leading #.
|
||
|
**/
|
||
|
this.createLabel = 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
|
||
|
* issues#updateLabel(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.
|
||
|
* - color (String): Required. 6 character hex code, without a leading #.
|
||
|
**/
|
||
|
this.updateLabel = 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
|
||
|
* issues#deleteLabel(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.
|
||
|
**/
|
||
|
this.deleteLabel = 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
|
||
|
* issues#getIssueLabels(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
**/
|
||
|
this.getIssueLabels = 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
|
||
|
* issues#getAllMilestones(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.
|
||
|
* - state (String): Optional. Validation rule: ` ^(open|closed)$ `.
|
||
|
* - sort (String): Optional. due_date, completeness, default: due_date Validation rule: ` ^(due_date|completeness)$ `.
|
||
|
* - 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.getAllMilestones = 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
|
||
|
* issues#getMilestone(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
**/
|
||
|
this.getMilestone = 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
|
||
|
* issues#createMilestone(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.
|
||
|
* - title (String): Required.
|
||
|
* - state (String): Optional. Validation rule: ` ^(open|closed)$ `.
|
||
|
* - description (String): Optional.
|
||
|
* - due_on (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||
|
**/
|
||
|
this.createMilestone = 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
|
||
|
* issues#updateMilestone(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
* - title (String): Required.
|
||
|
* - state (String): Optional. Validation rule: ` ^(open|closed)$ `.
|
||
|
* - description (String): Optional.
|
||
|
* - due_on (Date): Optional. Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
||
|
**/
|
||
|
this.updateMilestone = 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
|
||
|
* issues#deleteMilestone(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.
|
||
|
* - number (Number): Required. Validation rule: ` ^[0-9]+$ `.
|
||
|
**/
|
||
|
this.deleteMilestone = 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);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
}).call(issues.issues);
|