Class MergeRequestParams

java.lang.Object
org.gitlab4j.api.models.MergeRequestParams

public class MergeRequestParams extends Object
This class provides the form parameters for creating and updating merge requests.
  • Constructor Details

    • MergeRequestParams

      public MergeRequestParams()
  • Method Details

    • withSourceBranch

      public MergeRequestParams withSourceBranch(String sourceBranch)
      Set the source branch. This is for merge request creation only.
      Parameters:
      sourceBranch - the sourceBranch to set
      Returns:
      the reference to this MergeRequestParams instance
    • withTargetBranch

      public MergeRequestParams withTargetBranch(String targetBranch)
      Set the target branch.
      Parameters:
      targetBranch - the targetBranch to set
      Returns:
      the reference to this MergeRequestParams instance
    • withTitle

      public MergeRequestParams withTitle(String title)
      Set the title of the merge request.
      Parameters:
      title - the title to set
      Returns:
      the reference to this MergeRequestParams instance
    • withAssigneeId

      public MergeRequestParams withAssigneeId(Long assigneeId)
      Set the assignee user ID.
      Parameters:
      assigneeId - the assigneeId to set
      Returns:
      the reference to this MergeRequestParams instance
    • withAssigneeIds

      public MergeRequestParams withAssigneeIds(List<Long> assigneeIds)
      The ID of the user(s) to assign the merge request to. Set to 0 or provide an empty value to unassign all assignees.
      Parameters:
      assigneeIds - the assigneeIds to set
      Returns:
      the reference to this MergeRequestParams instance
    • withReviewerIds

      public MergeRequestParams withReviewerIds(List<Long> reviewerIds)
      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.
      Parameters:
      reviewerIds - the reviewerIds to set
      Returns:
      the reference to this MergeRequestParams instance
    • withMilestoneId

      public MergeRequestParams withMilestoneId(Long milestoneId)
      Set the milestone ID field value.
      Parameters:
      milestoneId - the milestoneId to set
      Returns:
      the reference to this MergeRequestParams instance
    • withLabels

      public MergeRequestParams withLabels(List<String> labels)
      Set the labels for the merge request.
      Parameters:
      labels - the List of labels to set
      Returns:
      the reference to this MergeRequestParams instance
    • withLabels

      public MergeRequestParams withLabels(String[] labels)
      Set the labels for the merge request.
      Parameters:
      labels - the array of labels to set
      Returns:
      the reference to this MergeRequestParams instance
    • withDescription

      public MergeRequestParams withDescription(String description)
      Set the description of the merge request. Limited to 1,048,576 characters.
      Parameters:
      description - the description to set
      Returns:
      the reference to this MergeRequestParams instance
    • withTargetProjectId

      public MergeRequestParams withTargetProjectId(Long targetProjectId)
      Set the target project ID. This is for merge request creation only.
      Parameters:
      targetProjectId - the targetProjectId to set
      Returns:
      the reference to this MergeRequestParams instance
    • withStateEvent

      public MergeRequestParams withStateEvent(Constants.StateEvent stateEvent)
      New state (close/reopen). This is for merge request updates only.
      Parameters:
      stateEvent - the stateEvent to set
      Returns:
      the reference to this MergeRequestParams instance
    • withRemoveSourceBranch

      public MergeRequestParams withRemoveSourceBranch(Boolean removeSourceBranch)
      Flag indicating if a merge request should remove the source branch when merging.
      Parameters:
      removeSourceBranch - the removeSourceBranch to set
      Returns:
      the reference to this MergeRequestParams instance
    • withSquash

      public MergeRequestParams withSquash(Boolean squash)
      Squash commits into a single commit when merging.
      Parameters:
      squash - the squash to set
      Returns:
      the reference to this MergeRequestParams instance
    • withDiscussionLocked

      public MergeRequestParams withDiscussionLocked(Boolean discussionLocked)
      Flag indicating if the merge request’s discussion is locked. If the discussion is locked only project members can add, edit or resolve comments. This is for merge request updates only.
      Parameters:
      discussionLocked - the discussionLocked to set
      Returns:
      the reference to this MergeRequestParams instance
    • withAllowCollaboration

      public MergeRequestParams withAllowCollaboration(Boolean allowCollaboration)
      Allow commits from members who can merge to the target branch.
      Parameters:
      allowCollaboration - the allowCollaboration to set
      Returns:
      the reference to this MergeRequestParams instance
    • withApprovalsBeforeMerge

      public MergeRequestParams withApprovalsBeforeMerge(Integer approvalsBeforeMerge)
      Set the approvals_before_merge field value. This is for merge request creation only.
      Parameters:
      approvalsBeforeMerge - the approvalsBeforeMerge to set
      Returns:
      the reference to this MergeRequestParams instance
    • getForm

      public GitLabApiForm getForm(boolean isCreate)
      Get the form params specified by this instance.
      Parameters:
      isCreate - set to true if this is for a create merge request API call, set to false if this is for an update merge request
      Returns:
      a GitLabApiForm instance holding the form parameters for this MergeRequestParams instance