Class IssuesApi

  • All Implemented Interfaces:
    Constants

    public class IssuesApi
    extends AbstractApi
    implements Constants
    This class provides an entry point to all the GitLab API Issue calls.
    • Constructor Detail

      • IssuesApi

        public IssuesApi​(GitLabApi gitLabApi)
    • Method Detail

      • getIssues

        public List<Issue> getIssues()
                              throws GitLabApiException
        Get all issues the authenticated user has access to. Only returns issues created by the current user.
        GitLab Endpoint: GET /issues
        Returns:
        a list of user's issues
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(int page,
                                     int perPage)
                              throws GitLabApiException
        Get all issues the authenticated user has access to using the specified page and per page setting. Only returns issues created by the current user.
        GitLab Endpoint: GET /issues
        Parameters:
        page - the page to get
        perPage - the number of issues per page
        Returns:
        the list of issues in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public Pager<Issue> getIssues​(int itemsPerPage)
                               throws GitLabApiException
        Get a Pager of all issues the authenticated user has access to. Only returns issues created by the current user.
        GitLab Endpoint: GET /issues
        r
        Parameters:
        itemsPerPage - the number of issues per page
        Returns:
        the list of issues in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getIssuesStream

        public Stream<Issue> getIssuesStream()
                                      throws GitLabApiException
        Get all issues the authenticated user has access to as a Stream. Only returns issues created by the current user.
        GitLab Endpoint: GET /issues
        Returns:
        a Stream of user's issues
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(Object projectIdOrPath)
                              throws GitLabApiException
        Get a list of project's issues. Only returns the first page
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        Returns:
        a list of project's issues
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(Object projectIdOrPath,
                                     int page,
                                     int perPage)
                              throws GitLabApiException
        Get a list of project's issues using the specified page and per page settings.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        page - the page to get
        perPage - the number of issues per page
        Returns:
        the list of issues in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public Pager<Issue> getIssues​(Object projectIdOrPath,
                                      int itemsPerPage)
                               throws GitLabApiException
        Get a Pager of project's issues.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        itemsPerPage - the number of issues per page
        Returns:
        the list of issues in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getIssuesStream

        public Stream<Issue> getIssuesStream​(Object projectIdOrPath)
                                      throws GitLabApiException
        Get a Stream of project's issues. Only returns the first page
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        Returns:
        a Stream of project's issues
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(Object projectIdOrPath,
                                     IssueFilter filter)
                              throws GitLabApiException
        Get a list of project's issues.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        filter - IssueFilter a IssueFilter instance with the filter settings
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(Object projectIdOrPath,
                                     IssueFilter filter,
                                     int page,
                                     int perPage)
                              throws GitLabApiException
        Get a list of project's issues.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        filter - IssueFilter a IssueFilter instance with the filter settings.
        page - the page to get.
        perPage - the number of projects per page.
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public Pager<Issue> getIssues​(Object projectIdOrPath,
                                      IssueFilter filter,
                                      int itemsPerPage)
                               throws GitLabApiException
        Get a list of project's issues.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        filter - IssueFilter a IssueFilter instance with the filter settings.
        itemsPerPage - the number of Project instances that will be fetched per page.
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssuesStream

        public Stream<Issue> getIssuesStream​(Object projectIdOrPath,
                                             IssueFilter filter)
                                      throws GitLabApiException
        Get a Stream of project's issues.
        GitLab Endpoint: GET /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        filter - IssueFilter a IssueFilter instance with the filter settings
        Returns:
        a Stream of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(IssueFilter filter)
                              throws GitLabApiException
        Get all issues the authenticated user has access to. By default it returns only issues created by the current user.
        GitLab Endpoint: GET /issues
        Parameters:
        filter - IssueFilter a IssueFilter instance with the filter settings
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public List<Issue> getIssues​(IssueFilter filter,
                                     int page,
                                     int perPage)
                              throws GitLabApiException
        Get all issues the authenticated user has access to. By default it returns only issues created by the current user.
        GitLab Endpoint: GET /issues
        Parameters:
        filter - IssueFilter a IssueFilter instance with the filter settings.
        page - the page to get.
        perPage - the number of projects per page.
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssues

        public Pager<Issue> getIssues​(IssueFilter filter,
                                      int itemsPerPage)
                               throws GitLabApiException
        Get all issues the authenticated user has access to. By default it returns only issues created by the current user.
        GitLab Endpoint: GET /issues
        Parameters:
        filter - IssueFilter a IssueFilter instance with the filter settings.
        itemsPerPage - the number of Project instances that will be fetched per page.
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssuesStream

        public Stream<Issue> getIssuesStream​(IssueFilter filter)
                                      throws GitLabApiException
        Get all issues the authenticated user has access to. By default it returns only issues created by the current user.
        GitLab Endpoint: GET /issues
        Parameters:
        filter - IssueFilter a IssueFilter instance with the filter settings
        Returns:
        the list of issues in the specified range.
        Throws:
        GitLabApiException - if any exception occurs
      • getIssue

        public Issue getIssue​(Object projectIdOrPath,
                              Integer issueIid)
                       throws GitLabApiException
        Get a single project issue.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        the specified Issue instance
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalIssue

        public Optional<Issue> getOptionalIssue​(Object projectIdOrPath,
                                                Integer issueIid)
        Get a single project issue as an Optional instance.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        the specified Issue as an Optional instance
      • createIssue

        public Issue createIssue​(Object projectIdOrPath,
                                 String title,
                                 String description)
                          throws GitLabApiException
        Create an issue for the project.
        GitLab Endpoint: POST /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        title - the title of an issue, required
        description - the description of an issue, optional
        Returns:
        an instance of Issue
        Throws:
        GitLabApiException - if any exception occurs
      • createIssue

        public Issue createIssue​(Object projectIdOrPath,
                                 String title,
                                 String description,
                                 Boolean confidential,
                                 List<Integer> assigneeIds,
                                 Integer milestoneId,
                                 String labels,
                                 Date createdAt,
                                 Date dueDate,
                                 Integer mergeRequestToResolveId,
                                 Integer discussionToResolveId)
                          throws GitLabApiException
        Create an issue for the project.
        GitLab Endpoint: POST /projects/:id/issues
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        title - the issue title of an issue, required
        description - the description of an issue, optional
        confidential - set the issue to be confidential, default is false, optional
        assigneeIds - the IDs of the users to assign issue, optional
        milestoneId - the ID of a milestone to assign issue, optional
        labels - comma-separated label names for an issue, optional
        createdAt - the date the issue was created at, optional
        dueDate - the due date, optional
        mergeRequestToResolveId - the IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values. Optional
        discussionToResolveId - the ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with merge_request_to_resolve_discussions_of. Optional
        Returns:
        an instance of Issue
        Throws:
        GitLabApiException - if any exception occurs
      • closeIssue

        public Issue closeIssue​(Object projectIdOrPath,
                                Integer issueIid)
                         throws GitLabApiException
        Closes an existing project issue.
        GitLab Endpoint: PUT /projects/:id/issues/:issue_iid
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance, required
        issueIid - the issue IID to update, required
        Returns:
        an instance of the updated Issue
        Throws:
        GitLabApiException - if any exception occurs
      • updateIssue

        public Issue updateIssue​(Object projectIdOrPath,
                                 Integer issueIid,
                                 String title,
                                 String description,
                                 Boolean confidential,
                                 List<Integer> assigneeIds,
                                 Integer milestoneId,
                                 String labels,
                                 Constants.StateEvent stateEvent,
                                 Date updatedAt,
                                 Date dueDate)
                          throws GitLabApiException
        Updates an existing project issue. This call can also be used to mark an issue as closed.
        GitLab Endpoint: PUT /projects/:id/issues/:issue_iid
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance, required
        issueIid - the issue IID to update, required
        title - the title of an issue, optional
        description - the description of an issue, optional
        confidential - set the issue to be confidential, default is false, optional
        assigneeIds - the IDs of the users to assign issue, optional
        milestoneId - the ID of a milestone to assign issue, optional
        labels - comma-separated label names for an issue, optional
        stateEvent - the state event of an issue. Set close to close the issue and reopen to reopen it, optional
        updatedAt - sets the updated date, requires admin or project owner rights, optional
        dueDate - the due date, optional
        Returns:
        an instance of the updated Issue
        Throws:
        GitLabApiException - if any exception occurs
      • deleteIssue

        public void deleteIssue​(Object projectIdOrPath,
                                Integer issueIid)
                         throws GitLabApiException
        Delete an issue.
        GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance, required
        issueIid - the internal ID of a project's issue
        Throws:
        GitLabApiException - if any exception occurs
      • estimateTime

        public TimeStats estimateTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      int duration)
                               throws GitLabApiException
        Sets an estimated time of work in this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance, required
        issueIid - the internal ID of a project's issue
        duration - estimated time in seconds
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • estimateTime

        public TimeStats estimateTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      String duration)
                               throws GitLabApiException
        Sets an estimated time of work in this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance, required
        issueIid - the internal ID of a project's issue
        duration - Human readable format, e.g. 3h30m
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • estimateTime

        public TimeStats estimateTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      Duration duration)
                               throws GitLabApiException
        Sets an estimated time of work in this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/time_estimate
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        duration - set the estimate of time to this duration
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • resetEstimatedTime

        public TimeStats resetEstimatedTime​(Object projectIdOrPath,
                                            Integer issueIid)
                                     throws GitLabApiException
        Resets the estimated time for this issue to 0 seconds.
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/reset_time_estimate
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • addSpentTime

        public TimeStats addSpentTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      int duration)
                               throws GitLabApiException
        Adds spent time for this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        duration - the duration in seconds
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • addSpentTime

        public TimeStats addSpentTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      String duration)
                               throws GitLabApiException
        Adds spent time for this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        duration - Human readable format, e.g. 3h30m
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • addSpentTime

        public TimeStats addSpentTime​(Object projectIdOrPath,
                                      Integer issueIid,
                                      Duration duration)
                               throws GitLabApiException
        Adds spent time for this issue
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/add_spent_time
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        duration - the duration of time spent
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • resetSpentTime

        public TimeStats resetSpentTime​(Object projectIdOrPath,
                                        Integer issueIid)
                                 throws GitLabApiException
        Resets the total spent time for this issue to 0 seconds.
        GitLab Endpoint: POST /projects/:id/issues/:issue_iid/reset_spent_time
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        a TimeSTats instance
        Throws:
        GitLabApiException - if any exception occurs
      • getTimeTrackingStats

        public TimeStats getTimeTrackingStats​(Object projectIdOrPath,
                                              Integer issueIid)
                                       throws GitLabApiException
        Get time tracking stats.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/time_stats
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        a TimeStats instance
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalTimeTrackingStats

        public Optional<TimeStats> getOptionalTimeTrackingStats​(Object projectIdOrPath,
                                                                Integer issueIid)
        Get time tracking stats as an Optional instance
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/time_stats
        Parameters:
        projectIdOrPath - the project in the form of an Integer(ID), String(path), or Project instance
        issueIid - the internal ID of a project's issue
        Returns:
        a TimeStats as an Optional instance
      • getClosedByMergeRequests

        public List<MergeRequest> getClosedByMergeRequests​(Object projectIdOrPath,
                                                           Integer issueIid)
                                                    throws GitLabApiException
        Get list containing all the merge requests that will close issue when merged.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/closed_by
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        issueIid - the internal ID of a project's issue
        Returns:
        a List containing all the merge requests what will close the issue when merged.
        Throws:
        GitLabApiException - if any exception occurs
      • getClosedByMergeRequests

        public List<MergeRequest> getClosedByMergeRequests​(Object projectIdOrPath,
                                                           Integer issueIid,
                                                           int page,
                                                           int perPage)
                                                    throws GitLabApiException
        Get list containing all the merge requests that will close issue when merged.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/closed_by
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        issueIid - the internal ID of a project's issue
        page - the page to get
        perPage - the number of issues per page
        Returns:
        a List containing all the merge requests what will close the issue when merged.
        Throws:
        GitLabApiException - if any exception occurs
      • getClosedByMergeRequests

        public Pager<MergeRequest> getClosedByMergeRequests​(Object projectIdOrPath,
                                                            Integer issueIid,
                                                            int itemsPerPage)
                                                     throws GitLabApiException
        Get a Pager containing all the merge requests that will close issue when merged.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/closed_by
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        issueIid - the internal ID of a project's issue
        itemsPerPage - the number of Issue instances that will be fetched per page
        Returns:
        a Pager containing all the issues that would be closed by merging the provided merge request
        Throws:
        GitLabApiException - if any exception occurs
      • getClosedByMergeRequestsStream

        public Stream<MergeRequest> getClosedByMergeRequestsStream​(Object projectIdOrPath,
                                                                   Integer issueIid)
                                                            throws GitLabApiException
        Get list containing all the merge requests that will close issue when merged.
        GitLab Endpoint: GET /projects/:id/issues/:issue_iid/closed_by
        Parameters:
        projectIdOrPath - id, path of the project, or a Project instance holding the project ID or path
        issueIid - the internal ID of a project's issue
        Returns:
        a List containing all the merge requests what will close the issue when merged.
        Throws:
        GitLabApiException - if any exception occurs