Class EpicsApi

  • All Implemented Interfaces:
    Constants

    public class EpicsApi
    extends AbstractApi
    This class implements the client side API for the GitLab Epics and Epic Issues API calls. NOTE: - If a user is not a member of a group and the group is private, a GET request on that group will result to a 404 status code. - Epics are available only in Ultimate. If epics feature is not available a 403 status code will be returned.
    See Also:
    GitLab Epics API Documentaion, GitLab Epic Issues API Documentation
    • Constructor Detail

      • EpicsApi

        public EpicsApi​(GitLabApi gitLabApi)
    • Method Detail

      • getEpics

        public List<Epic> getEpics​(Object groupIdOrPath)
                            throws GitLabApiException
        Gets all epics of the requested group and its subgroups.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        Returns:
        a list of all epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpics

        public List<Epic> getEpics​(Object groupIdOrPath,
                                   int page,
                                   int perPage)
                            throws GitLabApiException
        Gets all epics of the requested group and its subgroups using the specified page and per page setting.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        page - the page to get
        perPage - the number of issues per page
        Returns:
        a list of all epics of the requested group and its subgroups in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getEpics

        public Pager<Epic> getEpics​(Object groupIdOrPath,
                                    int itemsPerPage)
                             throws GitLabApiException
        Get a Pager of all epics of the requested group and its subgroups.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        itemsPerPage - the number of issues per page
        Returns:
        the Pager of all epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicsStream

        public Stream<Epic> getEpicsStream​(Object groupIdOrPath)
                                    throws GitLabApiException
        Gets all epics of the requested group and its subgroups as a Stream.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        Returns:
        a Stream of all epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpics

        public List<Epic> getEpics​(Object groupIdOrPath,
                                   Integer authorId,
                                   String labels,
                                   Constants.EpicOrderBy orderBy,
                                   Constants.SortOrder sortOrder,
                                   String search)
                            throws GitLabApiException
        Gets all epics of the requested group and its subgroups.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        authorId - returns epics created by the given user id
        labels - return epics matching a comma separated list of labels names. Label names from the epic group or a parent group can be used
        orderBy - return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
        sortOrder - return epics sorted in ASC or DESC order. Default is DESC
        search - search epics against their title and description
        Returns:
        a list of matching epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpics

        public List<Epic> getEpics​(Object groupIdOrPath,
                                   Integer authorId,
                                   String labels,
                                   Constants.EpicOrderBy orderBy,
                                   Constants.SortOrder sortOrder,
                                   String search,
                                   int page,
                                   int perPage)
                            throws GitLabApiException
        Gets all epics of the requested group and its subgroups using the specified page and per page setting.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        authorId - returns epics created by the given user id
        labels - return epics matching a comma separated list of labels names Label names from the epic group or a parent group can be used
        orderBy - return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
        sortOrder - return epics sorted in ASC or DESC order. Default is DESC
        search - search epics against their title and description
        page - the page to get
        perPage - the number of issues per page
        Returns:
        a list of matching epics of the requested group and its subgroups in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getEpics

        public Pager<Epic> getEpics​(Object groupIdOrPath,
                                    Integer authorId,
                                    String labels,
                                    Constants.EpicOrderBy orderBy,
                                    Constants.SortOrder sortOrder,
                                    String search,
                                    int itemsPerPage)
                             throws GitLabApiException
        Get a Pager of all epics of the requested group and its subgroups.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        authorId - returns epics created by the given user id
        labels - return epics matching a comma separated list of labels names. Label names from the epic group or a parent group can be used
        itemsPerPage - the number of issues per page
        orderBy - return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
        sortOrder - return epics sorted in ASC or DESC order. Default is DESC
        search - search epics against their title and description
        Returns:
        the Pager of matching epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicsStream

        public Stream<Epic> getEpicsStream​(Object groupIdOrPath,
                                           Integer authorId,
                                           String labels,
                                           Constants.EpicOrderBy orderBy,
                                           Constants.SortOrder sortOrder,
                                           String search)
                                    throws GitLabApiException
        Gets all epics of the requested group and its subgroups as a Stream.
        GitLab Endpoint: GET /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        authorId - returns epics created by the given user id
        labels - return epics matching a comma separated list of labels names. Label names from the epic group or a parent group can be used
        orderBy - return epics ordered by CREATED_AT or UPDATED_AT. Default is CREATED_AT
        sortOrder - return epics sorted in ASC or DESC order. Default is DESC
        search - search epics against their title and description
        Returns:
        a Stream of matching epics of the requested group and its subgroups
        Throws:
        GitLabApiException - if any exception occurs
      • getEpic

        public Epic getEpic​(Object groupIdOrPath,
                            Integer epicIid)
                     throws GitLabApiException
        Get a single epic for the specified group.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get
        Returns:
        an Epic instance for the specified Epic
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalEpic

        public Optional<Epic> getOptionalEpic​(Object groupIdOrPath,
                                              Integer epicIid)
        Get an Optional instance with the value for the specific Epic.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get
        Returns:
        an Optional instance with the specified Epic as a value
      • createEpic

        public Epic createEpic​(Object groupIdOrPath,
                               String title,
                               String labels,
                               String description,
                               Date startDate,
                               Date endDate)
                        throws GitLabApiException
        Creates a new epic.
        GitLab Endpoint: POST /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        title - the title of the epic (required)
        labels - comma separated list of labels (optional)
        description - the description of the epic (optional)
        startDate - the start date of the epic (optional)
        endDate - the end date of the epic (optional)
        Returns:
        an Epic instance containing info on the newly created epic
        Throws:
        GitLabApiException - if any exception occurs
      • createEpic

        public Epic createEpic​(Object groupIdOrPath,
                               Epic epic)
                        throws GitLabApiException
        Creates a new epic using the information contained in the provided Epic instance. Only the following fields from the Epic instance are used:
        
              title - the title of the epic (required)
              labels - comma separated list of labels (optional)
              description - the description of the epic (optional)
              startDate - the start date of the epic (optional)
              endDate - the end date of the epic (optional) 
         
        GitLab Endpoint: POST /groups/:id/epics
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epic - the Epic instance with information for the new epic
        Returns:
        an Epic instance containing info on the newly created epic
        Throws:
        GitLabApiException - if any exception occurs
      • updateEpic

        public Epic updateEpic​(Object groupIdOrPath,
                               Integer epicIid,
                               String title,
                               String labels,
                               String description,
                               Date startDate,
                               Date endDate)
                        throws GitLabApiException
        Updates an existing epic.
        GitLab Endpoint: PUT /groups/:id/epics/:epic_iid
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to update
        title - the title of the epic (optional)
        labels - comma separated list of labels (optional)
        description - the description of the epic (optional)
        startDate - the start date of the epic (optional)
        endDate - the end date of the epic (optional)
        Returns:
        an Epic instance containing info on the newly created epic
        Throws:
        GitLabApiException - if any exception occurs
      • updateEpic

        public Epic updateEpic​(Object groupIdOrPath,
                               Integer epicIid,
                               Epic epic)
                        throws GitLabApiException
        Updates an epic using the information contained in the provided Epic instance. Only the following fields from the Epic instance are used:
        
              title - the title of the epic (optional)
              labels - comma separated list of labels (optional)
              description - the description of the epic (optional)
              startDate - the start date of the epic (optional)
              endDate - the end date of the epic (optional) 
         
        GitLab Endpoint: PUT /groups/:id/epics/:epic_iid
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to update
        epic - the Epic instance with update information
        Returns:
        an Epic instance containing info on the updated epic
        Throws:
        GitLabApiException - if any exception occurs
      • deleteEpic

        public void deleteEpic​(Object groupIdOrPath,
                               Integer epicIid)
                        throws GitLabApiException
        Deletes an epic.
        GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to delete
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicIssues

        public List<Epic> getEpicIssues​(Object groupIdOrPath,
                                        Integer epicIid)
                                 throws GitLabApiException
        Gets all issues that are assigned to an epic and the authenticated user has access to.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get issues for
        Returns:
        a list of all epic issues belonging to the specified epic
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicIssues

        public List<Epic> getEpicIssues​(Object groupIdOrPath,
                                        Integer epicIid,
                                        int page,
                                        int perPage)
                                 throws GitLabApiException
        Gets all issues that are assigned to an epic and the authenticated user has access to using the specified page and per page setting.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get issues for
        page - the page to get
        perPage - the number of issues per page
        Returns:
        a list of all epic issues belonging to the specified epic in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicIssues

        public Pager<Epic> getEpicIssues​(Object groupIdOrPath,
                                         Integer epicIid,
                                         int itemsPerPage)
                                  throws GitLabApiException
        Get a Pager of all issues that are assigned to an epic and the authenticated user has access to.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get issues for
        itemsPerPage - the number of issues per page
        Returns:
        the Pager of all epic issues belonging to the specified epic
        Throws:
        GitLabApiException - if any exception occurs
      • getEpicIssuesStream

        public Stream<Epic> getEpicIssuesStream​(Object groupIdOrPath,
                                                Integer epicIid)
                                         throws GitLabApiException
        Gets all issues that are assigned to an epic and the authenticated user has access to as a Stream.
        GitLab Endpoint: GET /groups/:id/epics/:epic_iid/issues
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the IID of the epic to get issues for
        Returns:
        a Stream of all epic issues belonging to the specified epic
        Throws:
        GitLabApiException - if any exception occurs
      • assignIssue

        public EpicIssue assignIssue​(Object groupIdOrPath,
                                     Integer epicIid,
                                     Integer issueIid)
                              throws GitLabApiException
        Creates an epic - issue association. If the issue in question belongs to another epic it is unassigned from that epic.
        GitLab Endpoint: POST /groups/:id/epics/:epic_iid/issues/:issue_id
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the Epic IID to assign the issue to
        issueIid - the issue IID of the issue to assign to the epic
        Returns:
        an EpicIssue instance containing info on the newly assigned epic issue
        Throws:
        GitLabApiException - if any exception occurs
      • removeIssue

        public EpicIssue removeIssue​(Object groupIdOrPath,
                                     Integer epicIid,
                                     Integer issueIid)
                              throws GitLabApiException
        Remove an epic - issue association.
        GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid/issues/:issue_id
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the Epic IID to remove the issue from
        issueIid - the issue IID of the issue to remove from the epic
        Returns:
        an EpicIssue instance containing info on the removed issue
        Throws:
        GitLabApiException - if any exception occurs
      • updateIssue

        public EpicIssue updateIssue​(Object groupIdOrPath,
                                     Integer epicIid,
                                     Integer issueIid,
                                     Integer moveBeforeId,
                                     Integer moveAfterId)
                              throws GitLabApiException
        Updates an epic - issue association.
        GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/issues/:issue_id
        Parameters:
        groupIdOrPath - the group ID, path of the group, or a Group instance holding the group ID or path
        epicIid - the Epic IID that the issue is assigned to
        issueIid - the issue IID to update
        moveBeforeId - the ID of the issue - epic association that should be placed before the link in the question (optional)
        moveAfterId - the ID of the issue - epic association that should be placed after the link in the question (optional)
        Returns:
        an EpicIssue instance containing info on the newly assigned epic issue
        Throws:
        GitLabApiException - if any exception occurs