Class LabelsApi

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants

        org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
    • Field Summary

      • Fields inherited from interface org.gitlab4j.models.Constants

        NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
    • Constructor Summary

      Constructors 
      Constructor Description
      LabelsApi​(GitLabApi gitLabApi)  
    • Constructor Detail

      • LabelsApi

        public LabelsApi​(GitLabApi gitLabApi)
    • Method Detail

      • getProjectLabels

        public java.util.List<org.gitlab4j.api.models.Label> getProjectLabels​(java.lang.Object projectIdOrPath)
                                                                       throws GitLabApiException
        Get all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of project's labels
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectLabels

        public Pager<org.gitlab4j.api.models.Label> getProjectLabels​(java.lang.Object projectIdOrPath,
                                                                     int itemsPerPage)
                                                              throws GitLabApiException
        Get a Pager of all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        itemsPerPage - the number of items per page
        Returns:
        a list of project's labels in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectLabelsStream

        public java.util.stream.Stream<org.gitlab4j.api.models.Label> getProjectLabelsStream​(java.lang.Object projectIdOrPath)
                                                                                      throws GitLabApiException
        Get a Stream of all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a Stream of project's labels
        Throws:
        GitLabApiException - if any exception occurs
      • getProjectLabel

        public org.gitlab4j.api.models.Label getProjectLabel​(java.lang.Object projectIdOrPath,
                                                             java.lang.Object labelIdOrName)
                                                      throws GitLabApiException
        Get a single project label.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        a Label instance holding the information for the group label
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalProjectLabel

        public java.util.Optional<org.gitlab4j.api.models.Label> getOptionalProjectLabel​(java.lang.Object projectIdOrPath,
                                                                                         java.lang.Object labelIdOrName)
                                                                                  throws GitLabApiException
        Get a single project label as the value of an Optional.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        a Optional instance with a Label instance as its value
        Throws:
        GitLabApiException - if any exception occurs
      • createProjectLabel

        public org.gitlab4j.api.models.Label createProjectLabel​(java.lang.Object projectIdOrPath,
                                                                org.gitlab4j.api.models.Label labelProperties)
                                                         throws GitLabApiException
        Create a project label. A Label instance is used to set the label properties. withXXX() methods are provided to set the properties of the label to create:
        
           // name and color properties are required
           Label labelProperties = new Label()
                  .withName("a-pink-project-label")
                  .withColor("pink")
                  .withDescription("A new pink project label")
               .withPriority(10);
           gitLabApi.getLabelsApi().createProjectLabel(projectId, labelProperties);
         
        GitLab Endpoint: POST /groups/:id/labels
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelProperties - a Label instance holding the properties for the new group label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateProjectLabel

        public org.gitlab4j.api.models.Label updateProjectLabel​(java.lang.Object projectIdOrPath,
                                                                java.lang.Object labelIdOrName,
                                                                org.gitlab4j.api.models.Label labelConfig)
                                                         throws GitLabApiException
        Update the specified project label. The name, color, and description can be updated. A Label instance is used to set the properties of the label to update, withXXX() methods are provided to set the properties to update:
        
           Label labelUpdates = new Label()
                .withName("a-new-name")
                .withColor("red")
                .withDescription("A red group label");
           gitLabApi.getLabelsApi().updateGroupLabel(projectId, labelId, labelUpdates);
         
        GitLab Endpoint: PUT /projects/:id/labels/:label_id
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        labelConfig - a Label instance holding the label properties to update
        Returns:
        the updated Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteProjectLabel

        public void deleteProjectLabel​(java.lang.Object projectIdOrPath,
                                       java.lang.Object labelIdOrName)
                                throws GitLabApiException
        Delete the specified project label.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • subscribeProjectLabel

        public org.gitlab4j.api.models.Label subscribeProjectLabel​(java.lang.Object projectIdOrPath,
                                                                   java.lang.Object labelIdOrName)
                                                            throws GitLabApiException
        Subscribe a specified project label.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs
      • unsubscribeProjectLabel

        public org.gitlab4j.api.models.Label unsubscribeProjectLabel​(java.lang.Object projectIdOrPath,
                                                                     java.lang.Object labelIdOrName)
                                                              throws GitLabApiException
        Unsubscribe a specified project label.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupLabels

        public java.util.List<org.gitlab4j.api.models.Label> getGroupLabels​(java.lang.Object groupIdOrPath)
                                                                     throws GitLabApiException
        Get all labels of the specified group.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        Returns:
        a list of group's labels
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupLabels

        public Pager<org.gitlab4j.api.models.Label> getGroupLabels​(java.lang.Object groupIdOrPath,
                                                                   int itemsPerPage)
                                                            throws GitLabApiException
        Get a Pager of all labels of the specified group.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        itemsPerPage - the number of items per page
        Returns:
        a list of group's labels in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupLabelsStream

        public java.util.stream.Stream<org.gitlab4j.api.models.Label> getGroupLabelsStream​(java.lang.Object groupIdOrPath)
                                                                                    throws GitLabApiException
        Get a Stream of all labels of the specified group.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        Returns:
        a Stream of group's labels
        Throws:
        GitLabApiException - if any exception occurs
      • getGroupLabel

        public org.gitlab4j.api.models.Label getGroupLabel​(java.lang.Object groupIdOrPath,
                                                           java.lang.Object labelIdOrName)
                                                    throws GitLabApiException
        Get a single group label.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        a Label instance holding the information for the group label
        Throws:
        GitLabApiException - if any exception occurs
      • getOptionalGroupLabel

        public java.util.Optional<org.gitlab4j.api.models.Label> getOptionalGroupLabel​(java.lang.Object groupIdOrPath,
                                                                                       java.lang.Object labelIdOrName)
                                                                                throws GitLabApiException
        Get a single group label as the value of an Optional.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        a Optional instance with a Label instance as its value
        Throws:
        GitLabApiException - if any exception occurs
      • createGroupLabel

        public org.gitlab4j.api.models.Label createGroupLabel​(java.lang.Object groupIdOrPath,
                                                              org.gitlab4j.api.models.Label labelProperties)
                                                       throws GitLabApiException
        Create a group label. A Label instance is used to set the label properties. withXXX() methods are provided to set the properties of the label to create:
        
           Label labelProperties = new Label()
               .withName("a-name")
               .withColor("green")
               .withDescription("A new green group label");
           gitLabApi.getLabelsApi().createGroupLabel(projectId, labelProperties);
         
        GitLab Endpoint: POST /groups/:id/labels
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelProperties - a Label instance holding the properties for the new group label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateGroupLabel

        public org.gitlab4j.api.models.Label updateGroupLabel​(java.lang.Object groupIdOrPath,
                                                              java.lang.Object labelIdOrName,
                                                              org.gitlab4j.api.models.Label labelConfig)
                                                       throws GitLabApiException
        Update the specified label. The name, color, and description can be updated. A Label instance is used to set the properties of the label to update, withXXX() methods are provided to set the properties to update:
        
           Label labelUpdates = new Label()
               .withName("a-new-name")
               .withColor("red")
               .withDescription("A red group label");
           gitLabApi.getLabelsApi().updateGroupLabel(projectId, labelId, labelUpdates);
         
        GitLab Endpoint: PUT /groups/:id/labels/:label_id
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        labelConfig - a Label instance holding the label properties to update
        Returns:
        the updated Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteGroupLabel

        public void deleteGroupLabel​(java.lang.Object groupIdOrPath,
                                     java.lang.Object labelIdOrName)
                              throws GitLabApiException
        Delete the specified label
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • subscribeGroupLabel

        public org.gitlab4j.api.models.Label subscribeGroupLabel​(java.lang.Object groupIdOrPath,
                                                                 java.lang.Object labelIdOrName)
                                                          throws GitLabApiException
        Subscribe a specified group label.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs
      • unsubscribeGroupLabel

        public org.gitlab4j.api.models.Label unsubscribeGroupLabel​(java.lang.Object groupIdOrPath,
                                                                   java.lang.Object labelIdOrName)
                                                            throws GitLabApiException
        Unsubscribe a specified group label.
        Parameters:
        groupIdOrPath - the group in the form of an Long(ID), String(path), or Group instance
        labelIdOrName - the label in the form of an Long(ID), String(name), or Label instance
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs
      • getLabels

        @Deprecated
        public java.util.List<org.gitlab4j.api.models.Label> getLabels​(java.lang.Object projectIdOrPath)
                                                                throws GitLabApiException
        Deprecated.
        Replaced by the getProjectLabels(Object) method.
        Get all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a list of project's labels
        Throws:
        GitLabApiException - if any exception occurs
      • getLabels

        @Deprecated
        public java.util.List<org.gitlab4j.api.models.Label> getLabels​(java.lang.Object projectIdOrPath,
                                                                       int page,
                                                                       int perPage)
                                                                throws GitLabApiException
        Deprecated.
        Will be removed in the next major release (6.0.0)
        Get all labels of the specified project to using the specified page and per page setting
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        page - the page to get
        perPage - the number of items per page
        Returns:
        a list of project's labels in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getLabels

        @Deprecated
        public Pager<org.gitlab4j.api.models.Label> getLabels​(java.lang.Object projectIdOrPath,
                                                              int itemsPerPage)
                                                       throws GitLabApiException
        Deprecated.
        Replaced by the getProjectLabels(Object, int) method.
        Get a Pager of all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        itemsPerPage - the number of items per page
        Returns:
        a list of project's labels in the specified range
        Throws:
        GitLabApiException - if any exception occurs
      • getLabelsStream

        @Deprecated
        public java.util.stream.Stream<org.gitlab4j.api.models.Label> getLabelsStream​(java.lang.Object projectIdOrPath)
                                                                               throws GitLabApiException
        Deprecated.
        Replaced by the getProjectLabelsStream(Object) method.
        Get a Stream of all labels of the specified project.
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        Returns:
        a Stream of project's labels
        Throws:
        GitLabApiException - if any exception occurs
      • createLabel

        @Deprecated
        public org.gitlab4j.api.models.Label createLabel​(java.lang.Object projectIdOrPath,
                                                         java.lang.String name,
                                                         java.lang.String color,
                                                         java.lang.String description)
                                                  throws GitLabApiException
        Deprecated.
        Replaced by the createProjectLabel(Object, Label) method.
        Create a label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        color - the color for the label
        description - the description for the label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • createLabel

        @Deprecated
        public org.gitlab4j.api.models.Label createLabel​(java.lang.Object projectIdOrPath,
                                                         java.lang.String name,
                                                         java.lang.String color)
                                                  throws GitLabApiException
        Deprecated.
        Replaced by the createProjectLabel(Object, Label) method.
        Create a label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        color - the color for the label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • createLabel

        @Deprecated
        public org.gitlab4j.api.models.Label createLabel​(java.lang.Object projectIdOrPath,
                                                         java.lang.String name,
                                                         java.lang.String color,
                                                         java.lang.Integer priority)
                                                  throws GitLabApiException
        Deprecated.
        Replaced by the createProjectLabel(Object, Label) method.
        Create a label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        color - the color for the label
        priority - the priority for the label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • createLabel

        @Deprecated
        public org.gitlab4j.api.models.Label createLabel​(java.lang.Object projectIdOrPath,
                                                         java.lang.String name,
                                                         java.lang.String color,
                                                         java.lang.String description,
                                                         java.lang.Integer priority)
                                                  throws GitLabApiException
        Deprecated.
        Replaced by the createProjectLabel(Object, Label) method.
        Create a label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        color - the color for the label
        description - the description for the label
        priority - the priority for the label
        Returns:
        the created Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateLabelName

        @Deprecated
        public org.gitlab4j.api.models.Label updateLabelName​(java.lang.Object projectIdOrPath,
                                                             java.lang.String name,
                                                             java.lang.String newName,
                                                             java.lang.String description,
                                                             java.lang.Integer priority)
                                                      throws GitLabApiException
        Deprecated.
        Update the specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        newName - the new name for the label
        description - the description for the label
        priority - the priority for the label
        Returns:
        the modified Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateLabelColor

        @Deprecated
        public org.gitlab4j.api.models.Label updateLabelColor​(java.lang.Object projectIdOrPath,
                                                              java.lang.String name,
                                                              java.lang.String color,
                                                              java.lang.String description,
                                                              java.lang.Integer priority)
                                                       throws GitLabApiException
        Deprecated.
        Update the specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        color - the color for the label
        description - the description for the label
        priority - the priority for the label
        Returns:
        the modified Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • updateLabel

        @Deprecated
        public org.gitlab4j.api.models.Label updateLabel​(java.lang.Object projectIdOrPath,
                                                         java.lang.String name,
                                                         java.lang.String newName,
                                                         java.lang.String color,
                                                         java.lang.String description,
                                                         java.lang.Integer priority)
                                                  throws GitLabApiException
        Deprecated.
        Update the specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        newName - the new name for the label
        color - the color for the label
        description - the description for the label
        priority - the priority for the label
        Returns:
        the modified Label instance
        Throws:
        GitLabApiException - if any exception occurs
      • deleteLabel

        @Deprecated
        public void deleteLabel​(java.lang.Object projectIdOrPath,
                                java.lang.String name)
                         throws GitLabApiException
        Deprecated.
        Replaced by the deleteProjectLabel(Object, Object) method.
        Delete the specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        name - the name for the label
        Throws:
        GitLabApiException - if any exception occurs
      • subscribeLabel

        @Deprecated
        public org.gitlab4j.api.models.Label subscribeLabel​(java.lang.Object projectIdOrPath,
                                                            java.lang.Long labelId)
                                                     throws GitLabApiException
        Deprecated.
        Subscribe a specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelId - the label ID
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs
      • unsubscribeLabel

        @Deprecated
        public org.gitlab4j.api.models.Label unsubscribeLabel​(java.lang.Object projectIdOrPath,
                                                              java.lang.Long labelId)
                                                       throws GitLabApiException
        Deprecated.
        Unsubscribe a specified label
        Parameters:
        projectIdOrPath - the project in the form of an Long(ID), String(path), or Project instance
        labelId - the label ID
        Returns:
        HttpStatusCode 503
        Throws:
        GitLabApiException - if any exception occurs