forked from github-tools/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIssue.js.html
More file actions
187 lines (155 loc) · 14.3 KB
/
Issue.js.html
File metadata and controls
187 lines (155 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Gist.html">Gist</a><ul class='methods'><li data-type='method'><a href="Gist.html#create">create</a></li><li data-type='method'><a href="Gist.html#createComment">createComment</a></li><li data-type='method'><a href="Gist.html#delete">delete</a></li><li data-type='method'><a href="Gist.html#deleteComment">deleteComment</a></li><li data-type='method'><a href="Gist.html#editComment">editComment</a></li><li data-type='method'><a href="Gist.html#fork">fork</a></li><li data-type='method'><a href="Gist.html#getComment">getComment</a></li><li data-type='method'><a href="Gist.html#isStarred">isStarred</a></li><li data-type='method'><a href="Gist.html#listComments">listComments</a></li><li data-type='method'><a href="Gist.html#read">read</a></li><li data-type='method'><a href="Gist.html#star">star</a></li><li data-type='method'><a href="Gist.html#unstar">unstar</a></li><li data-type='method'><a href="Gist.html#update">update</a></li></ul></li><li><a href="GitHub.html">GitHub</a><ul class='methods'><li data-type='method'><a href="GitHub.html#getGist">getGist</a></li><li data-type='method'><a href="GitHub.html#getIssues">getIssues</a></li><li data-type='method'><a href="GitHub.html#getOrganization">getOrganization</a></li><li data-type='method'><a href="GitHub.html#getRateLimit">getRateLimit</a></li><li data-type='method'><a href="GitHub.html#getRepo">getRepo</a></li><li data-type='method'><a href="GitHub.html#getUser">getUser</a></li><li data-type='method'><a href="GitHub.html#search">search</a></li></ul></li><li><a href="Issue.html">Issue</a><ul class='methods'><li data-type='method'><a href="Issue.html#createIssue">createIssue</a></li><li data-type='method'><a href="Issue.html#createIssueComment">createIssueComment</a></li><li data-type='method'><a href="Issue.html#deleteIssueComment">deleteIssueComment</a></li><li data-type='method'><a href="Issue.html#editIssue">editIssue</a></li><li data-type='method'><a href="Issue.html#editIssueComment">editIssueComment</a></li><li data-type='method'><a href="Issue.html#getIssue">getIssue</a></li><li data-type='method'><a href="Issue.html#getIssueComment">getIssueComment</a></li><li data-type='method'><a href="Issue.html#listIssueComments">listIssueComments</a></li><li data-type='method'><a href="Issue.html#listIssues">listIssues</a></li></ul></li><li><a href="Organization.html">Organization</a><ul class='methods'><li data-type='method'><a href="Organization.html#createRepo">createRepo</a></li><li data-type='method'><a href="Organization.html#getRepos">getRepos</a></li><li data-type='method'><a href="Organization.html#isMember">isMember</a></li><li data-type='method'><a href="Organization.html#listMembers">listMembers</a></li></ul></li><li><a href="RateLimit.html">RateLimit</a><ul class='methods'><li data-type='method'><a href="RateLimit.html#getRateLimit">getRateLimit</a></li></ul></li><li><a href="Repository.html">Repository</a><ul class='methods'><li data-type='method'><a href="Repository.html#commit">commit</a></li><li data-type='method'><a href="Repository.html#compareBranches">compareBranches</a></li><li data-type='method'><a href="Repository.html#createBlob">createBlob</a></li><li data-type='method'><a href="Repository.html#createBranch">createBranch</a></li><li data-type='method'><a href="Repository.html#createHook">createHook</a></li><li data-type='method'><a href="Repository.html#createPullRequest">createPullRequest</a></li><li data-type='method'><a href="Repository.html#createRef">createRef</a></li><li data-type='method'><a href="Repository.html#createRelease">createRelease</a></li><li data-type='method'><a href="Repository.html#createTree">createTree</a></li><li data-type='method'><a href="Repository.html#deleteFile">deleteFile</a></li><li data-type='method'><a href="Repository.html#deleteHook">deleteHook</a></li><li data-type='method'><a href="Repository.html#deleteRef">deleteRef</a></li><li data-type='method'><a href="Repository.html#deleteRelease">deleteRelease</a></li><li data-type='method'><a href="Repository.html#deleteRepo">deleteRepo</a></li><li data-type='method'><a href="Repository.html#fork">fork</a></li><li data-type='method'><a href="Repository.html#getBlob">getBlob</a></li><li data-type='method'><a href="Repository.html#getCollaborators">getCollaborators</a></li><li data-type='method'><a href="Repository.html#getCommit">getCommit</a></li><li data-type='method'><a href="Repository.html#getContents">getContents</a></li><li data-type='method'><a href="Repository.html#getContributors">getContributors</a></li><li data-type='method'><a href="Repository.html#getDetails">getDetails</a></li><li data-type='method'><a href="Repository.html#getHook">getHook</a></li><li data-type='method'><a href="Repository.html#getPullRequest">getPullRequest</a></li><li data-type='method'><a href="Repository.html#getRef">getRef</a></li><li data-type='method'><a href="Repository.html#getRelease">getRelease</a></li><li data-type='method'><a href="Repository.html#getSha">getSha</a></li><li data-type='method'><a href="Repository.html#getTree">getTree</a></li><li data-type='method'><a href="Repository.html#isCollaborator">isCollaborator</a></li><li data-type='method'><a href="Repository.html#isStarred">isStarred</a></li><li data-type='method'><a href="Repository.html#listBranches">listBranches</a></li><li data-type='method'><a href="Repository.html#listCommits">listCommits</a></li><li data-type='method'><a href="Repository.html#listForks">listForks</a></li><li data-type='method'><a href="Repository.html#listHooks">listHooks</a></li><li data-type='method'><a href="Repository.html#listPullRequests">listPullRequests</a></li><li data-type='method'><a href="Repository.html#listReleases">listReleases</a></li><li data-type='method'><a href="Repository.html#listStatuses">listStatuses</a></li><li data-type='method'><a href="Repository.html#listTags">listTags</a></li><li data-type='method'><a href="Repository.html#star">star</a></li><li data-type='method'><a href="Repository.html#unstar">unstar</a></li><li data-type='method'><a href="Repository.html#updateHead">updateHead</a></li><li data-type='method'><a href="Repository.html#updateHook">updateHook</a></li><li data-type='method'><a href="Repository.html#updateRelease">updateRelease</a></li><li data-type='method'><a href="Repository.html#updateTree">updateTree</a></li><li data-type='method'><a href="Repository.html#writeFile">writeFile</a></li></ul></li><li><a href="Requestable.html">Requestable</a><ul class='methods'><li data-type='method'><a href="Requestable.html#_dateToISO">_dateToISO</a></li><li data-type='method'><a href="Requestable.html#_getOptionsWithDefaults">_getOptionsWithDefaults</a></li><li data-type='method'><a href="Requestable.html#_request">_request</a></li><li data-type='method'><a href="Requestable.html#_request204or404">_request204or404</a></li><li data-type='method'><a href="Requestable.html#_requestAllPages">_requestAllPages</a></li></ul></li><li><a href="Search.html">Search</a><ul class='methods'><li data-type='method'><a href="Search.html#forCode">forCode</a></li><li data-type='method'><a href="Search.html#forIssues">forIssues</a></li><li data-type='method'><a href="Search.html#forRepositories">forRepositories</a></li><li data-type='method'><a href="Search.html#forUsers">forUsers</a></li></ul></li><li><a href="User.html">User</a><ul class='methods'><li data-type='method'><a href="User.html#createRepo">createRepo</a></li><li data-type='method'><a href="User.html#follow">follow</a></li><li data-type='method'><a href="User.html#getGists">getGists</a></li><li data-type='method'><a href="User.html#getNotifications">getNotifications</a></li><li data-type='method'><a href="User.html#getOrgs">getOrgs</a></li><li data-type='method'><a href="User.html#getProfile">getProfile</a></li><li data-type='method'><a href="User.html#getRepos">getRepos</a></li><li data-type='method'><a href="User.html#getStarredRepos">getStarredRepos</a></li><li data-type='method'><a href="User.html#unfollow">unfollow</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Issue.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @file
* @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.
* @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.
* Github.js is freely distributable.
*/
import Requestable from './Requestable';
/**
* Issue wraps the functionality to get issues for repositories
*/
class Issue extends Requestable {
/**
* Create a new Issue
* @param {string} repository - the full name of the repository (`:user/:repo`) to get issues for
* @param {Requestable.auth} [auth] - information required to authenticate to Github
* @param {string} [apiBase=https://api.github.com] - the base Github API URL
*/
constructor(repository, auth, apiBase) {
super(auth, apiBase);
this.__repository = repository;
}
/**
* Create a new issue
* @see https://developer.github.com/v3/issues/#create-an-issue
* @param {Object} issueData - the issue to create
* @param {Requestable.callback} [cb] - will receive the created issue
* @return {Promise} - the promise for the http request
*/
createIssue(issueData, cb) {
return this._request('POST', `/repos/${this.__repository}/issues`, issueData, cb);
}
/**
* List the issues for the repository
* @see https://developer.github.com/v3/issues/#list-issues-for-a-repository
* @param {Object} options - filtering options
* @param {Requestable.callback} [cb] - will receive the array of issues
* @return {Promise} - the promise for the http request
*/
listIssues(options, cb) {
return this._requestAllPages(`/repos/${this.__repository}/issues`, options, cb);
}
/**
* List comments on an issue
* @see https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
* @param {number} issue - the id of the issue to get comments from
* @param {Requestable.callback} [cb] - will receive the comments
* @return {Promise} - the promise for the http request
*/
listIssueComments(issue, cb) {
return this._request('GET', `/repos/${this.__repository}/issues/${issue}/comments`, null, cb); // jscs:ignore
}
/**
* Get a single comment on an issue
* @see https://developer.github.com/v3/issues/comments/#get-a-single-comment
* @param {number} id - the comment id to get
* @param {Requestable.callback} [cb] - will receive the comment
* @return {Promise} - the promise for the http request
*/
getIssueComment(id, cb) {
return this._request('GET', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
}
/**
* Comment on an issue
* @see https://developer.github.com/v3/issues/comments/#create-a-comment
* @param {number} issue - the id of the issue to comment on
* @param {string} comment - the comment to add
* @param {Requestable.callback} [cb] - will receive the created comment
* @return {Promise} - the promise for the http request
*/
createIssueComment(issue, comment, cb) {
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/comments`, {body: comment}, cb); // jscs:ignore
}
/**
* Edit a comment on an issue
* @see https://developer.github.com/v3/issues/comments/#edit-a-comment
* @param {number} id - the comment id to edit
* @param {string} comment - the comment to edit
* @param {Requestable.callback} [cb] - will receive the edited comment
* @return {Promise} - the promise for the http request
*/
editIssueComment(id, comment, cb) {
return this._request('PATCH', `/repos/${this.__repository}/issues/comments/${id}`, {body: comment}, cb); // jscs:ignore
}
/**
* Delete a comment on an issue
* @see https://developer.github.com/v3/issues/comments/#delete-a-comment
* @param {number} id - the comment id to delete
* @param {Requestable.callback} [cb] - will receive true if the request is successful
* @return {Promise} - the promise for the http request
*/
deleteIssueComment(id, cb) {
return this._request('DELETE', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
}
/**
* Edit an issue
* @see https://developer.github.com/v3/issues/#edit-an-issue
* @param {number} issue - the issue number to edit
* @param {Object} issueData - the new issue data
* @param {Requestable.callback} [cb] - will receive the modified issue
* @return {Promise} - the promise for the http request
*/
editIssue(issue, issueData, cb) {
return this._request('PATCH', `/repos/${this.__repository}/issues/${issue}`, issueData, cb);
}
/**
* Get a particular issue
* @see https://developer.github.com/v3/issues/#get-a-single-issue
* @param {number} issue - the issue number to fetch
* @param {Requestable.callback} [cb] - will receive the issue
* @return {Promise} - the promise for the http request
*/
getIssue(issue, cb) {
return this._request('GET', `/repos/${this.__repository}/issues/${issue}`, null, cb);
}
}
module.exports = Issue;
</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu May 12 2016 07:30:07 GMT-0500 (CDT) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>