Package com.codebarrel.jira.issues
Interface IssueClient
- All Known Implementing Classes:
NativeIssueClient
public interface IssueClient
Contains all the functions for accessing issues in Jira
-
Method Summary
Modifier and TypeMethodDescriptionio.atlassian.fugue.Either<ErrorCollection, CommentBean> addComment(String issueKey, CommentRequest commentRequest, IssueRequestOptions options) Adds a comment to the issue with the given issue key.addWorklog(String issueKey, AddWorklogRequest request, AdjustEstimate adjustEstimate, String remainingEstimateValue) Logs work against an issuearchiveIssue(String issueKey, IssueRequestOptions options) Archives an issueassignIssue(String issueKey, String userId, IssueRequestOptions options) Assigns the provided issue to the user provided in the userId.copyAttachments(String fromIssueKey, String toIssueKey, List<AttachmentBean> attachments, boolean sendNotification) io.atlassian.fugue.Either<ErrorCollection, CreateIssueResponse> createIssue(IssueRequest request, IssueRequestOptions options) Create an issueio.atlassian.fugue.Either<ErrorCollection, CreateIssuesResponse> createIssues(List<IssueRequest> requests, IssueRequestOptions options) Bulk creates the issues specifieddeleteAttachment(Long id, IssueRequestOptions options) Deletes an attachmentdeleteComment(String issueKey, long commentId, IssueRequestOptions options) Deletes a commentdeleteIssue(String issueKey, IssueRequestOptions options) Deletes an issuedeleteIssueLink(Long issueLinkId) Deletes and issue link by it's ID.editIssue(String issueKey, IssueRequest request, IssueRequestOptions options) Edits an issuegetAttachments(String issueKey) Returns list of attachments in the issue.getComments(String issueKey) getCreateIssueMetaData(String projectKeyOrId, String issueTypeNameOrId, Set<String> fieldsToInclude) Retreive given a project and issue type and all the field configgetCreateIssueMetaData(List<String> projectKeysOrIds, List<String> issueTypeNamesOrIds, Set<String> fieldsToInclude) Retrieve given projects and issue types.getCreateIssueMetaData(Set<String> fieldsToInclude) Retrieve all the project ans issue types for creation.getEditIssueMetaData(String issueKey, IssueRequestOptions options, Set<String> fieldsToInclude) Retrieve edit meta data for a given issuegetFieldOptions(String fieldId, String accountId) Gets the list of options for a custom field.Gets the issue fields for the system.Get an issueReturns a list of available issue events (both system and custom);getIssueHistory(String key) getIssueLinks(String issueKey) Get issue links for an issueReturns all globally configured issue link types.getParentIssue(IssueBean subTask) This shouldn't really be called or necessary, but due to issues with server and it not always having the issue parent link populated, we need cloud vs server dependant implementations.getRenderedCommentBody(String issueKey, Long commentId) Get the rendered body of a commentgetRenderedFields(String issueKeyOrId, List<String> fieldIds) Get a rendered fields for issuegetRenderedWorklogBody(String issueKey, Long worklogId) Get the rendered body of a workloggetTransitions(String issueKey, boolean includeFields, IssueRequestOptions options) Retrieves all valid transitions available on the provided issue.getTransitions(String issueKey, IssueRequestOptions options) Retrieves all valid transitions available on the provided issue.getWatchers(String issueKey) getWorklogs(String issueKey) linkIssueTo(LinkIssueRequest request) Links an issue to another issue.voidpublishEvent(Long eventId, Long issueId, boolean publishBundle) Publishes the provided issue event with the issue payload.io.atlassian.fugue.Either<SearchErrors, SearchResult> search(String jql, SearchParams params) Executes the JQL search provided with the search parameters passed in.transitionIssue(String issueKey, TransitionRequest request, IssueRequestOptions options) Transitions the provided issue using the given transition id.unwatchIssue(String issueKey, String watcherAccountId) Remove a user as a watcher to the specified issue.validateSearch(String jql, SearchParams params) Validates that the passed in query and parameters are valid.watchIssue(String issueKey, String watcherAccountId) Add a user as a watcher to the specified issue.
-
Method Details
-
getCreateIssueMetaData
Retrieve all the project ans issue types for creation. Does not contain field information.- Returns:
- Projects and issue types
-
getCreateIssueMetaData
Optional<CreateIssueMetaData> getCreateIssueMetaData(List<String> projectKeysOrIds, List<String> issueTypeNamesOrIds, Set<String> fieldsToInclude) Retrieve given projects and issue types. Optionally return field data.- Parameters:
projectKeysOrIds- projects to retrieve meta for. If strings contains only numeric values, it is interpreted as Ids, otherwise keys.issueTypeNamesOrIds- issue types to retrieve meta for. If strings contains only numeric values, it is interpreted as Ids, otherwise keys.fieldsToInclude- the set of fields we're trying to include in the create request.- Returns:
- Meta data for crete issue
-
getCreateIssueMetaData
Optional<CreateIssueMetaData> getCreateIssueMetaData(String projectKeyOrId, String issueTypeNameOrId, Set<String> fieldsToInclude) Retreive given a project and issue type and all the field config- Parameters:
projectKeyOrId- project to retrieve meta for. If string contains only numeric values, it is interpreted as Id, otherwise key.issueTypeNameOrId- issue type to retrieve meta for. If string contains only numeric values, it is interpreted as Id, otherwise key.fieldsToInclude- the set of fields we're trying to include in the create request.- Returns:
- Meta data for crete issue
-
getEditIssueMetaData
Optional<EditIssueMetaData> getEditIssueMetaData(String issueKey, IssueRequestOptions options, Set<String> fieldsToInclude) Retrieve edit meta data for a given issue- Parameters:
issueKey- issue key of the issue to get meta data foroptions- options for the request. e.g. overrideScreenSecurityfieldsToInclude- the set of fields we're trying to edit in the request.- Returns:
- Meta data for edit issue
-
getIssue
Get an issue- Parameters:
issueKeyOrId- issue key or id- Returns:
- a reference to the issue
-
getRenderedFields
Get a rendered fields for issue- Parameters:
issueKeyOrId- issue key or idfieldIds- ids of fields to retrieve- Returns:
- a map containing the rendered version of the specified fields
-
getIssueHistory
-
createIssue
io.atlassian.fugue.Either<ErrorCollection,CreateIssueResponse> createIssue(IssueRequest request, IssueRequestOptions options) Create an issue- Parameters:
request- contains all the field informationoptions- options for the request. e.g. send notifications- Returns:
- a reference to the issue created
-
createIssues
io.atlassian.fugue.Either<ErrorCollection,CreateIssuesResponse> createIssues(List<IssueRequest> requests, IssueRequestOptions options) Bulk creates the issues specified- Parameters:
requests- contains all issues to createoptions- options for the request. e.g. send notifications- Returns:
- references to the issues created
-
deleteIssue
Deletes an issue- Parameters:
issueKey- the issue to delete.options- options for the request. e.g. send notifications
-
archiveIssue
Archives an issue- Parameters:
issueKey- the issue to archive.options- options for the request. e.g. send notifications- Returns:
- empty
ErrorCollectionon success, collection of errors inErrorCollectionotherwise
-
deleteComment
Deletes a comment- Parameters:
issueKey- the issue the comment belongs to.commentId- the comment to delete.options- options for the request. e.g. send notifications
-
deleteAttachment
Deletes an attachment- Parameters:
id- the id of the attachment to delete.
-
getAttachments
Returns list of attachments in the issue.- Parameters:
issueKey- key of the issue to get attachments from- Returns:
- list of attachment beans, when no result empty list is returned
-
editIssue
Edits an issue- Parameters:
issueKey- the issue to edit.request- contains all the field informationoptions- options for the request. e.g. send notifications- Returns:
- An error collection if any errors occurred during the operation.
-
addComment
io.atlassian.fugue.Either<ErrorCollection,CommentBean> addComment(String issueKey, CommentRequest commentRequest, IssueRequestOptions options) Adds a comment to the issue with the given issue key.- Parameters:
issueKey- The issue to add a comment tocommentRequest- The comment parameters.options- options for the request. e.g. send notifications- Returns:
- The newly added comment.
-
assignIssue
Assigns the provided issue to the user provided in the userId. This method may return an error collection containing errors if the assign failed.- Parameters:
issueKey- the issue to change the assignee foruserId- the new assignee for the issue. Can be -1 for automatic, null for unassignoptions- options for the request. e.g. send notifications- Returns:
- Any errors
-
getTransitions
Retrieves all valid transitions available on the provided issue.- Parameters:
issueKey- the issue to retrieve transitions foroptions- options for the request. e.g. ignore conditions- Returns:
- all valid transitions available on the provided issue.
-
getTransitions
Optional<TransitionsBean> getTransitions(String issueKey, boolean includeFields, IssueRequestOptions options) Retrieves all valid transitions available on the provided issue.- Parameters:
issueKey- the issue to retrieve transitions forincludeFields- whther to return the fields on the transition screenoptions- options for the request. e.g. ignore conditions- Returns:
- all valid transitions available on the provided issue.
-
transitionIssue
ErrorCollection transitionIssue(String issueKey, TransitionRequest request, IssueRequestOptions options) Transitions the provided issue using the given transition id.- Parameters:
issueKey- the issue to transitionrequest- the transition to useoptions- options for the request. e.g. ignore conditions- Returns:
- Any errors
-
search
Executes the JQL search provided with the search parameters passed in.- Parameters:
jql- the jql string to search forparams- Additional parameters to page results or return certain fields- Returns:
- The results of running the search.
-
validateSearch
Validates that the passed in query and parameters are valid.- Parameters:
jql- the jql string to search forparams- Additional parameters to page results or return certain fields- Returns:
- An error collection containing any JQL validation errors returned by Jira
-
getFields
Gets the issue fields for the system.- Parameters:
userKey- Fields will be looked up as the passed in user (this may end up returning field names translated in a different locale)- Returns:
- The a list of fields.
-
getFieldOptions
Gets the list of options for a custom field. If the custom field type does not suport options, an Optional.empty() is returned- Parameters:
fieldId- id of the custom fieldaccountId- Fields will be looked up as the passed in user (this may end up returning field names translated in a different locale)- Returns:
- The list of options
-
watchIssue
Add a user as a watcher to the specified issue.- Parameters:
issueKey- the issue to watchwatcherAccountId- the key of the user to add as a watcher- Returns:
- and ErrorCollection if there's any errors
-
unwatchIssue
Remove a user as a watcher to the specified issue.- Parameters:
issueKey- the issue to unwatchwatcherAccountId- the key of the user to remove as a watcher- Returns:
- and ErrorCollection if there's any errors
-
getIssueEvents
List<IssueEvent> getIssueEvents()Returns a list of available issue events (both system and custom);- Returns:
- A list of all issue events in the system.
-
publishEvent
Publishes the provided issue event with the issue payload. -
getLinkTypes
List<IssueLinkTypeBean> getLinkTypes()Returns all globally configured issue link types. -
linkIssueTo
Links an issue to another issue.- Parameters:
request- contains the details of the link to establish (type and destination issue)- Returns:
- an errorcollection containing any errors.
-
deleteIssueLink
Deletes and issue link by it's ID.- Parameters:
issueLinkId- The issue link ID to delete.- Returns:
- an errorcollection containing any errors.
-
getComments
-
getRenderedCommentBody
Get the rendered body of a comment -
getRenderedWorklogBody
Get the rendered body of a worklog -
getWorklogs
-
addWorklog
ErrorCollection addWorklog(String issueKey, AddWorklogRequest request, AdjustEstimate adjustEstimate, @Nullable String remainingEstimateValue) Logs work against an issue- Parameters:
issueKey- key of the issue to log the work againstrequest- details of the worklogadjustEstimate- how to adjust the remaining estimateremainingEstimateValue- value for adjusting the remaining estimate, if required- Returns:
- an
ErrorCollectioncontaining any errors
-
getWatchers
-
getVoters
-
copyAttachments
ErrorCollection copyAttachments(String fromIssueKey, String toIssueKey, List<AttachmentBean> attachments, boolean sendNotification) -
getParentIssue
This shouldn't really be called or necessary, but due to issues with server and it not always having the issue parent link populated, we need cloud vs server dependant implementations. -
getIssueLinks
Get issue links for an issue- Parameters:
issueKey- the issue key- Returns:
- list of issue links, empty list if none found
-