Skip to content

feat: add support for GitLab merge request reviewers #655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/org/gitlab4j/api/models/MergeRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class MergeRequest {
private Integer approvalsBeforeMerge;
private Assignee assignee;
private List<Assignee> assignees;
private List<Assignee> reviewers;
private Author author;
private Boolean blockingDiscussionsResolved;
private List<Diff> changes;
Expand Down Expand Up @@ -548,6 +549,14 @@ public static final boolean isValid(MergeRequest mergeRequest) {
return (mergeRequest != null && mergeRequest.getId() != null);
}

public List<Assignee> getReviewers() {
return reviewers;
}

public void setReviewers(List<Assignee> reviewers) {
this.reviewers = reviewers;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/gitlab4j/api/models/MergeRequestParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class MergeRequestParams {
private String title;
private Integer assigneeId;
private List<Integer> assigneeIds;
private List<Integer> reviewerIds;
private Integer milestoneId;
private List<String> labels;
private String description;
Expand Down Expand Up @@ -83,6 +84,18 @@ public MergeRequestParams withAssigneeIds(List<Integer> assigneeIds) {
return (this);
}

/**
* The ID of the user(s) to assign to the review of the merge request. Set to 0 or provide
* an empty value to unassign all reviewers.
*
* @param reviewerIds the reviewerIds to set
* @return the reference to this MergeRequestParams instance
*/
public MergeRequestParams withReviewerIds(List<Integer> reviewerIds) {
this.reviewerIds = reviewerIds;
return (this);
}

/**
* Set the milestone ID field value.
*
Expand Down Expand Up @@ -219,6 +232,7 @@ public GitLabApiForm getForm(boolean isCreate) {
.withParam("title", title, isCreate)
.withParam("assignee_id", assigneeId)
.withParam("assignee_ids", assigneeIds)
.withParam("reviewer_ids", reviewerIds)
.withParam("milestone_id", milestoneId)
.withParam("labels", (labels != null ? String.join(",", labels) : null))
.withParam("description", description)
Expand Down