Module bus.gitlab

Class LabelsApi

java.lang.Object
org.miaixz.bus.gitlab.AbstractApi
org.miaixz.bus.gitlab.LabelsApi
All Implemented Interfaces:
Constants

public class LabelsApi extends AbstractApi
This class provides an entry point to all the GitLab API project and group label calls.
See Also:
  • Constructor Details

    • LabelsApi

      public LabelsApi(GitLabApi gitLabApi)
  • Method Details

    • getProjectLabels

      public List<Label> getProjectLabels(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<Label> getProjectLabels(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 Stream<Label> getProjectLabelsStream(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 Label getProjectLabel(Object projectIdOrPath, 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 Optional<Label> getOptionalProjectLabel(Object projectIdOrPath, 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 Label createProjectLabel(Object projectIdOrPath, 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 Label updateProjectLabel(Object projectIdOrPath, Object labelIdOrName, 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(Object projectIdOrPath, 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 Label subscribeProjectLabel(Object projectIdOrPath, 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 Label unsubscribeProjectLabel(Object projectIdOrPath, 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 List<Label> getGroupLabels(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<Label> getGroupLabels(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 Stream<Label> getGroupLabelsStream(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 Label getGroupLabel(Object groupIdOrPath, 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 Optional<Label> getOptionalGroupLabel(Object groupIdOrPath, 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 Label createGroupLabel(Object groupIdOrPath, 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 Label updateGroupLabel(Object groupIdOrPath, Object labelIdOrName, 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(Object groupIdOrPath, 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 Label subscribeGroupLabel(Object groupIdOrPath, 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 Label unsubscribeGroupLabel(Object groupIdOrPath, 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