Package org.gitlab4j.api
Class LabelsApi
java.lang.Object
org.gitlab4j.api.AbstractApi
org.gitlab4j.api.LabelsApi
- All Implemented Interfaces:
Constants
This class provides an entry point to all the GitLab API project and group label calls.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gitlab4j.api.Constants
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
-
Field Summary
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
Fields inherited from interface org.gitlab4j.api.Constants
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateGroupLabel
(Object groupIdOrPath, Label labelProperties) Create a group label.createLabel
(Object projectIdOrPath, String name, String color) Deprecated.createLabel
(Object projectIdOrPath, String name, String color, Integer priority) Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.createLabel
(Object projectIdOrPath, String name, String color, String description) Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.createLabel
(Object projectIdOrPath, String name, String color, String description, Integer priority) Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.createProjectLabel
(Object projectIdOrPath, Label labelProperties) Create a project label.void
deleteGroupLabel
(Object groupIdOrPath, Object labelIdOrName) Delete the specified labelvoid
deleteLabel
(Object projectIdOrPath, String name) Deprecated.Replaced by thedeleteProjectLabel(Object, Object)
method.void
deleteProjectLabel
(Object projectIdOrPath, Object labelIdOrName) Delete the specified project label.getGroupLabel
(Object groupIdOrPath, Object labelIdOrName) Get a single group label.getGroupLabels
(Object groupIdOrPath) Get all labels of the specified group.getGroupLabels
(Object groupIdOrPath, int itemsPerPage) Get a Pager of all labels of the specified group.getGroupLabelsStream
(Object groupIdOrPath) Get a Stream of all labels of the specified group.Deprecated.Replaced by thegetProjectLabels(Object)
method.Deprecated.Replaced by thegetProjectLabels(Object, int)
method.Deprecated.Will be removed in the next major release (6.0.0)getLabelsStream
(Object projectIdOrPath) Deprecated.Replaced by thegetProjectLabelsStream(Object)
method.getOptionalGroupLabel
(Object groupIdOrPath, Object labelIdOrName) Get a single group label as the value of an Optional.getOptionalProjectLabel
(Object projectIdOrPath, Object labelIdOrName) Get a single project label as the value of an Optional.getProjectLabel
(Object projectIdOrPath, Object labelIdOrName) Get a single project label.getProjectLabels
(Object projectIdOrPath) Get all labels of the specified project.getProjectLabels
(Object projectIdOrPath, int itemsPerPage) Get a Pager of all labels of the specified project.getProjectLabelsStream
(Object projectIdOrPath) Get a Stream of all labels of the specified project.subscribeGroupLabel
(Object groupIdOrPath, Object labelIdOrName) Subscribe a specified group label.subscribeLabel
(Object projectIdOrPath, Long labelId) Deprecated.Replaced by thesubscribeProjectLabel(Object, Object)
method.subscribeProjectLabel
(Object projectIdOrPath, Object labelIdOrName) Subscribe a specified project label.unsubscribeGroupLabel
(Object groupIdOrPath, Object labelIdOrName) Unsubscribe a specified group label.unsubscribeLabel
(Object projectIdOrPath, Long labelId) Deprecated.Replaced by theunsubscribeProjectLabel(Object, Object)
method.unsubscribeProjectLabel
(Object projectIdOrPath, Object labelIdOrName) Unsubscribe a specified project label.updateGroupLabel
(Object groupIdOrPath, Object labelIdOrName, Label labelConfig) Update the specified label.updateLabel
(Object projectIdOrPath, String name, String newName, String color, String description, Integer priority) Deprecated.updateLabelColor
(Object projectIdOrPath, String name, String color, String description, Integer priority) Deprecated.updateLabelName
(Object projectIdOrPath, String name, String newName, String description, Integer priority) Deprecated.updateProjectLabel
(Object projectIdOrPath, Object labelIdOrName, Label labelConfig) Update the specified project label.Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
Constructor Details
-
LabelsApi
-
-
Method Details
-
getProjectLabels
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 instanceitemsPerPage
- the number of items per page- Returns:
- a list of project's labels in the specified range
- Throws:
GitLabApiException
- if any exception occurs
-
getProjectLabelsStream
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 instancelabelIdOrName
- 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 instancelabelIdOrName
- 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 instancelabelProperties
- 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 instancelabelIdOrName
- the label in the form of an Long(ID), String(name), or Label instancelabelConfig
- 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 instancelabelIdOrName
- 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 instancelabelIdOrName
- 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 instancelabelIdOrName
- the label in the form of an Long(ID), String(name), or Label instance- Returns:
- HttpStatusCode 503
- Throws:
GitLabApiException
- if any exception occurs
-
getGroupLabels
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 instanceitemsPerPage
- the number of items per page- Returns:
- a list of group's labels in the specified range
- Throws:
GitLabApiException
- if any exception occurs
-
getGroupLabelsStream
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
Get a single group label.- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instancelabelIdOrName
- 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 instancelabelIdOrName
- 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 instancelabelProperties
- 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 instancelabelIdOrName
- the label in the form of an Long(ID), String(name), or Label instancelabelConfig
- a Label instance holding the label properties to update- Returns:
- the updated Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
deleteGroupLabel
Delete the specified label- Parameters:
groupIdOrPath
- the group in the form of an Long(ID), String(path), or Group instancelabelIdOrName
- 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 instancelabelIdOrName
- 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 instancelabelIdOrName
- 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.Replaced by thegetProjectLabels(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 List<Label> getLabels(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 instancepage
- the page to getperPage
- 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<Label> getLabels(Object projectIdOrPath, int itemsPerPage) throws GitLabApiException Deprecated.Replaced by thegetProjectLabels(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 instanceitemsPerPage
- 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.Replaced by thegetProjectLabelsStream(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 Label createLabel(Object projectIdOrPath, String name, String color, String description) throws GitLabApiException Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.Create a label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelcolor
- the color for the labeldescription
- the description for the label- Returns:
- the created Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
createLabel
@Deprecated public Label createLabel(Object projectIdOrPath, String name, String color) throws GitLabApiException Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.Create a label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelcolor
- the color for the label- Returns:
- the created Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
createLabel
@Deprecated public Label createLabel(Object projectIdOrPath, String name, String color, Integer priority) throws GitLabApiException Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.Create a label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelcolor
- the color for the labelpriority
- the priority for the label- Returns:
- the created Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
createLabel
@Deprecated public Label createLabel(Object projectIdOrPath, String name, String color, String description, Integer priority) throws GitLabApiException Deprecated.Replaced by thecreateProjectLabel(Object, Label)
method.Create a label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelcolor
- the color for the labeldescription
- the description for the labelpriority
- the priority for the label- Returns:
- the created Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
updateLabelName
@Deprecated public Label updateLabelName(Object projectIdOrPath, String name, String newName, String description, Integer priority) throws GitLabApiException Deprecated.Update the specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelnewName
- the new name for the labeldescription
- the description for the labelpriority
- the priority for the label- Returns:
- the modified Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
updateLabelColor
@Deprecated public Label updateLabelColor(Object projectIdOrPath, String name, String color, String description, Integer priority) throws GitLabApiException Deprecated.Update the specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelcolor
- the color for the labeldescription
- the description for the labelpriority
- the priority for the label- Returns:
- the modified Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
updateLabel
@Deprecated public Label updateLabel(Object projectIdOrPath, String name, String newName, String color, String description, Integer priority) throws GitLabApiException Deprecated.Update the specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the labelnewName
- the new name for the labelcolor
- the color for the labeldescription
- the description for the labelpriority
- the priority for the label- Returns:
- the modified Label instance
- Throws:
GitLabApiException
- if any exception occurs
-
deleteLabel
Deprecated.Replaced by thedeleteProjectLabel(Object, Object)
method.Delete the specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancename
- the name for the label- Throws:
GitLabApiException
- if any exception occurs
-
subscribeLabel
@Deprecated public Label subscribeLabel(Object projectIdOrPath, Long labelId) throws GitLabApiException Deprecated.Replaced by thesubscribeProjectLabel(Object, Object)
method.Subscribe a specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancelabelId
- the label ID- Returns:
- HttpStatusCode 503
- Throws:
GitLabApiException
- if any exception occurs
-
unsubscribeLabel
@Deprecated public Label unsubscribeLabel(Object projectIdOrPath, Long labelId) throws GitLabApiException Deprecated.Replaced by theunsubscribeProjectLabel(Object, Object)
method.Unsubscribe a specified label- Parameters:
projectIdOrPath
- the project in the form of an Long(ID), String(path), or Project instancelabelId
- the label ID- Returns:
- HttpStatusCode 503
- Throws:
GitLabApiException
- if any exception occurs
-
createProjectLabel(Object, Label)
method.