java.lang.Object
org.kohsuke.github.GHObject
org.kohsuke.github.GHIssue
- All Implemented Interfaces:
Reactable
- Direct Known Subclasses:
GHPullRequest
Represents an issue on GitHub.
- Author:
- Eric Maupin, Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected GHUser
The assignee.protected GHUser[]
The assignees.protected String
The body.protected String
The closed at.protected GHUser
The closed by.protected int
The comments.protected String
The html url.The labels.protected boolean
The locked.protected GHMilestone
The milestone.protected int
The number.protected GHIssue.PullRequest
The pull request.protected String
The state.protected String
The state reason.protected String
The html url.protected GHUser
The user.Fields inherited from class org.kohsuke.github.GHObject
responseHeaderFields
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAssignees
(Collection<GHUser> assignees) Add assignees.void
addAssignees
(GHUser... assignees) Add assignees.Adds labels to the issue.addLabels
(Collection<GHLabel> labels) Add labels.Add labels.void
Assign to.void
close()
Closes this issue.void
close
(GHIssueStateReason reason) Closes this issue.Updates the issue by adding a comment.createReaction
(ReactionContent content) Creates the reaction.void
deleteReaction
(GHReaction reaction) Delete reaction.protected String
Gets api route.Gets assignee.Gets assignees.getBody()
The description of this pull request.Gets closed at.Reports who has closed the issue.Obtains all the comments associated with this issue.int
Gets comments count.The HTML page of this issue, like https://github.com/jenkinsci/jenkins/issues/100protected String
Gets issues api route.Gets labels.getLogins
(Collection<GHUser> users) Gets the logins.Gets milestone.int
ID.Returns non-null if this issue is a shadow of a pull request.Repository to which the issue belongs.getState()
Gets state.Gets state reason.getTitle()
Gets title.getUser()
User who submitted the issue.boolean
isLocked()
Is locked boolean.boolean
Is pull request boolean.Obtains all the comments associated with this issue, without any filter.Lists events for this issue.List reactions.void
lock()
Lock.Search comments on this issue by specifying filters through a builder pattern.void
removeAssignees
(Collection<GHUser> assignees) Remove assignees.void
removeAssignees
(GHUser... assignees) Remove assignees.removeLabel
(String name) Remove a single label.removeLabels
(String... names) Remove a collection of labels.removeLabels
(Collection<GHLabel> labels) Remove a collection of labels.removeLabels
(GHLabel... labels) Remove a collection of labels.void
reopen()
Reopens this issue.void
setAssignees
(Collection<GHUser> assignees) Sets assignees.void
setAssignees
(GHUser... assignees) Sets assignees.void
Sets body.void
Sets labels on the target to a specific list.void
setMilestone
(GHMilestone milestone) Sets the milestone for this issue.void
Sets title.void
unlock()
Unlock.Methods inherited from class org.kohsuke.github.GHObject
getCreatedAt, getId, getNodeId, getResponseHeaderFields, getUpdatedAt, getUrl, setResponseHeaderFields, toString
-
Field Details
-
assignee
The assignee. -
assignees
The assignees. -
state
The state. -
state_reason
The state reason. -
number
protected int numberThe number. -
closed_at
The closed at. -
comments
protected int commentsThe comments. -
body
The body. -
labels
The labels. -
user
The user. -
title
The html url. -
html_url
The html url. -
pull_request
The pull request. -
milestone
The milestone. -
closed_by
The closed by. -
locked
protected boolean lockedThe locked.
-
-
Constructor Details
-
GHIssue
public GHIssue()Create default GHIssue instance
-
-
Method Details
-
getRepository
Repository to which the issue belongs.- Returns:
- the repository
-
getBody
The description of this pull request.- Returns:
- the body
-
getNumber
public int getNumber()ID.- Returns:
- the number
-
getHtmlUrl
The HTML page of this issue, like https://github.com/jenkinsci/jenkins/issues/100- Returns:
- the html url
-
getTitle
Gets title.- Returns:
- the title
-
isLocked
public boolean isLocked()Is locked boolean.- Returns:
- the boolean
-
getState
Gets state.- Returns:
- the state
-
getStateReason
Gets state reason.- Returns:
- the state reason
-
getLabels
Gets labels.- Returns:
- the labels
-
getClosedAt
Gets closed at.- Returns:
- the closed at
-
lock
Lock.- Throws:
IOException
- the io exception
-
unlock
Unlock.- Throws:
IOException
- the io exception
-
comment
Updates the issue by adding a comment.- Parameters:
message
- the message- Returns:
- Newly posted comment.
- Throws:
IOException
- the io exception
-
close
Closes this issue.- Throws:
IOException
- the io exception
-
close
Closes this issue.- Parameters:
reason
- the reason the issue was closed- Throws:
IOException
- the io exception
-
reopen
Reopens this issue.- Throws:
IOException
- the io exception
-
setTitle
Sets title.- Parameters:
title
- the title- Throws:
IOException
- the io exception
-
setBody
Sets body.- Parameters:
body
- the body- Throws:
IOException
- the io exception
-
setMilestone
Sets the milestone for this issue.- Parameters:
milestone
- The milestone to assign this issue to. Use null to remove the milestone for this issue.- Throws:
IOException
- The io exception
-
assignTo
Assign to.- Parameters:
user
- the user- Throws:
IOException
- the io exception
-
setLabels
Sets labels on the target to a specific list.- Parameters:
labels
- the labels- Throws:
IOException
- the io exception
-
addLabels
Adds labels to the issue. Labels that are already present on the target are ignored.- Parameters:
names
- Names of the label- Returns:
- the complete list of labels including the new additions
- Throws:
IOException
- the io exception
-
addLabels
Add labels. Labels that are already present on the target are ignored.- Parameters:
labels
- the labels- Returns:
- the complete list of labels including the new additions
- Throws:
IOException
- the io exception
-
addLabels
Add labels. Labels that are already present on the target are ignored.- Parameters:
labels
- the labels- Returns:
- the complete list of labels including the new additions
- Throws:
IOException
- the io exception
-
removeLabel
Remove a single label. Attempting to remove a label that is not present throwsGHFileNotFoundException
.- Parameters:
name
- the name- Returns:
- the remaining list of labels
- Throws:
IOException
- the io exception, throwsGHFileNotFoundException
if label was not present.
-
removeLabels
Remove a collection of labels. Attempting to remove labels that are not present on the target are ignored.- Parameters:
names
- the names- Returns:
- the remaining list of labels
- Throws:
IOException
- the io exception
-
removeLabels
Remove a collection of labels. Attempting to remove labels that are not present on the target are ignored.- Parameters:
labels
- the labels- Returns:
- the remaining list of labels
- Throws:
IOException
- the io exception- See Also:
-
removeLabels
Remove a collection of labels. Attempting to remove labels that are not present on the target are ignored.- Parameters:
labels
- the labels- Returns:
- the remaining list of labels
- Throws:
IOException
- the io exception
-
getComments
Obtains all the comments associated with this issue.- Returns:
- the comments
- Throws:
IOException
- the io exception- See Also:
-
listComments
Obtains all the comments associated with this issue, without any filter.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception- See Also:
-
queryComments
Search comments on this issue by specifying filters through a builder pattern.- Returns:
- the query builder
- See Also:
-
createReaction
Creates the reaction.- Specified by:
createReaction
in interfaceReactable
- Parameters:
content
- the content- Returns:
- the GH reaction
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
deleteReaction
Delete reaction.- Specified by:
deleteReaction
in interfaceReactable
- Parameters:
reaction
- the reaction- Throws:
IOException
- Signals that an I/O exception has occurred.
-
listReactions
List reactions.- Specified by:
listReactions
in interfaceReactable
- Returns:
- the paged iterable
-
addAssignees
Add assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
addAssignees
Add assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
setAssignees
Sets assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
setAssignees
Sets assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
removeAssignees
Remove assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
removeAssignees
Remove assignees.- Parameters:
assignees
- the assignees- Throws:
IOException
- the io exception
-
getApiRoute
Gets api route.- Returns:
- the api route
-
getIssuesApiRoute
Gets issues api route.- Returns:
- the issues api route
-
getAssignee
Gets assignee.- Returns:
- the assignee
- Throws:
IOException
- the io exception
-
getAssignees
Gets assignees.- Returns:
- the assignees
-
getUser
User who submitted the issue.- Returns:
- the user
- Throws:
IOException
- the io exception
-
getClosedBy
Reports who has closed the issue.Note that GitHub doesn't always seem to report this information even for an issue that's already closed. See https://github.com/kohsuke/github-api/issues/60.
- Returns:
- the closed by
- Throws:
IOException
- the io exception
-
getCommentsCount
public int getCommentsCount()Gets comments count.- Returns:
- the comments count
-
getPullRequest
Returns non-null if this issue is a shadow of a pull request.- Returns:
- the pull request
-
isPullRequest
public boolean isPullRequest()Is pull request boolean.- Returns:
- the boolean
-
getMilestone
Gets milestone.- Returns:
- the milestone
-
getLogins
Gets the logins.- Parameters:
users
- the users- Returns:
- the logins
-
listEvents
Lists events for this issue. See https://developer.github.com/v3/issues/events/- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-