Class ApprovalRuleParams

  • All Implemented Interfaces:
    java.io.Serializable

    public class ApprovalRuleParams
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Detail

      • ApprovalRuleParams

        public ApprovalRuleParams()
    • Method Detail

      • withApprovalsRequired

        public ApprovalRuleParams withApprovalsRequired​(java.lang.Integer approvalsRequired)
        Parameters:
        approvalsRequired - The number of required approvals for this rule.
        Returns:
        this ApprovalRuleParams instance
      • withName

        public ApprovalRuleParams withName​(java.lang.String name)
        Parameters:
        name - The name of the approval rule.
        Returns:
        this ApprovalRuleParams instance
      • withAppliesToAllProtectedBranches

        public ApprovalRuleParams withAppliesToAllProtectedBranches​(java.lang.Boolean appliesToAllProtectedBranches)
        Parameters:
        appliesToAllProtectedBranches - Whether the rule is applied to all protected branches. If set to true, the value of protected_branch_ids is ignored. Default is false. Introduced in GitLab 15.3.
        Returns:
        this ApprovalRuleParams instance
      • withGroupIds

        public ApprovalRuleParams withGroupIds​(java.util.List<java.lang.Long> groupIds)
        Parameters:
        groupIds - The IDs of groups as approvers.
        Returns:
        this ApprovalRuleParams instance
      • withProtectedBranchIds

        public ApprovalRuleParams withProtectedBranchIds​(java.util.List<java.lang.Long> protectedBranchIds)
        Parameters:
        protectedBranchIds - The IDs of protected branches to scope the rule by. To identify the ID, use the API.
        Returns:
        this ApprovalRuleParams instance
      • withReportType

        public ApprovalRuleParams withReportType​(java.lang.String reportType)
        Parameters:
        reportType - The report type required when the rule type is report_approver. The supported report types are license_scanning (Deprecated in GitLab 15.9) and code_coverage.
        Returns:
        this ApprovalRuleParams instance
      • withRuleType

        public ApprovalRuleParams withRuleType​(java.lang.String ruleType)
        Parameters:
        ruleType - The type of rule. any_approver is a pre-configured default rule with approvals_required at 0. Other rules are regular and report_approver.
        Returns:
        this ApprovalRuleParams instance
      • withUserIds

        public ApprovalRuleParams withUserIds​(java.util.List<java.lang.Long> userIds)
        Parameters:
        userIds - The IDs of users as approvers. If you provide both user_ids and usernames, both lists of users are added.
        Returns:
        this ApprovalRuleParams instance
      • withUsernames

        public ApprovalRuleParams withUsernames​(java.util.List<java.lang.String> usernames)
        Parameters:
        usernames - The usernames of approvers for this rule (same as user_ids but requires a list of usernames). If you provide both user_ids and usernames, both lists of users are added.
        Returns:
        this ApprovalRuleParams instance
      • getForm

        public GitLabApiForm getForm()
        Get the form params specified by this instance.
        Returns:
        a GitLabApiForm instance holding the form parameters for this ApprovalRuleParams instance