Interface IssueClient

All Known Implementing Classes:
NativeIssueClient

public interface IssueClient
Contains all the functions for accessing issues in Jira
  • Method Details

    • getCreateIssueMetaData

      Optional<CreateIssueMetaData> getCreateIssueMetaData(Set<String> fieldsToInclude)
      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 for
      options - options for the request. e.g. overrideScreenSecurity
      fieldsToInclude - the set of fields we're trying to edit in the request.
      Returns:
      Meta data for edit issue
    • getIssue

      Optional<IssueBean> getIssue(String issueKeyOrId)
      Get an issue
      Parameters:
      issueKeyOrId - issue key or id
      Returns:
      a reference to the issue
    • getRenderedFields

      Map<String,Object> getRenderedFields(String issueKeyOrId, List<String> fieldIds)
      Get a rendered fields for issue
      Parameters:
      issueKeyOrId - issue key or id
      fieldIds - ids of fields to retrieve
      Returns:
      a map containing the rendered version of the specified fields
    • getIssueHistory

      List<ChangeLogBean> getIssueHistory(String key)
    • createIssue

      io.atlassian.fugue.Either<ErrorCollection,CreateIssueResponse> createIssue(IssueRequest request, IssueRequestOptions options)
      Create an issue
      Parameters:
      request - contains all the field information
      options - 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 create
      options - options for the request. e.g. send notifications
      Returns:
      references to the issues created
    • deleteIssue

      ErrorCollection deleteIssue(String issueKey, IssueRequestOptions options)
      Deletes an issue
      Parameters:
      issueKey - the issue to delete.
      options - options for the request. e.g. send notifications
    • archiveIssue

      ErrorCollection archiveIssue(String issueKey, IssueRequestOptions options)
      Archives an issue
      Parameters:
      issueKey - the issue to archive.
      options - options for the request. e.g. send notifications
      Returns:
      empty ErrorCollection on success, collection of errors in ErrorCollection otherwise
    • deleteComment

      ErrorCollection deleteComment(String issueKey, long commentId, IssueRequestOptions options)
      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

      ErrorCollection deleteAttachment(Long id, IssueRequestOptions options)
      Deletes an attachment
      Parameters:
      id - the id of the attachment to delete.
    • getAttachments

      List<AttachmentBean> getAttachments(String issueKey)
      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

      ErrorCollection editIssue(String issueKey, IssueRequest request, IssueRequestOptions options)
      Edits an issue
      Parameters:
      issueKey - the issue to edit.
      request - contains all the field information
      options - 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 to
      commentRequest - The comment parameters.
      options - options for the request. e.g. send notifications
      Returns:
      The newly added comment.
    • assignIssue

      ErrorCollection assignIssue(String issueKey, String userId, IssueRequestOptions options)
      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 for
      userId - the new assignee for the issue. Can be -1 for automatic, null for unassign
      options - options for the request. e.g. send notifications
      Returns:
      Any errors
    • getTransitions

      Optional<TransitionsBean> getTransitions(String issueKey, IssueRequestOptions options)
      Retrieves all valid transitions available on the provided issue.
      Parameters:
      issueKey - the issue to retrieve transitions for
      options - 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 for
      includeFields - whther to return the fields on the transition screen
      options - 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 transition
      request - the transition to use
      options - options for the request. e.g. ignore conditions
      Returns:
      Any errors
    • search

      io.atlassian.fugue.Either<SearchErrors,SearchResult> search(String jql, SearchParams params)
      Executes the JQL search provided with the search parameters passed in.
      Parameters:
      jql - the jql string to search for
      params - Additional parameters to page results or return certain fields
      Returns:
      The results of running the search.
    • validateSearch

      ErrorCollection validateSearch(String jql, SearchParams params)
      Validates that the passed in query and parameters are valid.
      Parameters:
      jql - the jql string to search for
      params - Additional parameters to page results or return certain fields
      Returns:
      An error collection containing any JQL validation errors returned by Jira
    • getFields

      Optional<List<IssueFieldBean>> getFields(String userKey)
      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

      Optional<IssueFieldOptionsBean> getFieldOptions(String fieldId, String accountId)
      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 field
      accountId - 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

      ErrorCollection watchIssue(String issueKey, String watcherAccountId)
      Add a user as a watcher to the specified issue.
      Parameters:
      issueKey - the issue to watch
      watcherAccountId - the key of the user to add as a watcher
      Returns:
      and ErrorCollection if there's any errors
    • unwatchIssue

      ErrorCollection unwatchIssue(String issueKey, String watcherAccountId)
      Remove a user as a watcher to the specified issue.
      Parameters:
      issueKey - the issue to unwatch
      watcherAccountId - 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

      void publishEvent(Long eventId, Long issueId, boolean publishBundle)
      Publishes the provided issue event with the issue payload.
    • getLinkTypes

      List<IssueLinkTypeBean> getLinkTypes()
      Returns all globally configured issue link types.
    • linkIssueTo

      ErrorCollection linkIssueTo(LinkIssueRequest request)
      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

      ErrorCollection deleteIssueLink(Long issueLinkId)
      Deletes and issue link by it's ID.
      Parameters:
      issueLinkId - The issue link ID to delete.
      Returns:
      an errorcollection containing any errors.
    • getComments

      Optional<PageableComment> getComments(String issueKey)
    • getRenderedCommentBody

      Optional<String> getRenderedCommentBody(String issueKey, Long commentId)
      Get the rendered body of a comment
    • getRenderedWorklogBody

      Optional<String> getRenderedWorklogBody(String issueKey, Long worklogId)
      Get the rendered body of a worklog
    • getWorklogs

      Optional<PageableWorklog> getWorklogs(String issueKey)
    • 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 against
      request - details of the worklog
      adjustEstimate - how to adjust the remaining estimate
      remainingEstimateValue - value for adjusting the remaining estimate, if required
      Returns:
      an ErrorCollection containing any errors
    • getWatchers

      List<UserBean> getWatchers(String issueKey)
    • getVoters

      List<UserBean> getVoters(String issueKey)
    • copyAttachments

      ErrorCollection copyAttachments(String fromIssueKey, String toIssueKey, List<AttachmentBean> attachments, boolean sendNotification)
    • getParentIssue

      Optional<IssueBean> 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.
    • getIssueLinks

      List<IssueLinkBean> getIssueLinks(String issueKey)
      Get issue links for an issue
      Parameters:
      issueKey - the issue key
      Returns:
      list of issue links, empty list if none found