Skip to content
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

Add group api parameters #1073

Merged
merged 3 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
68 changes: 68 additions & 0 deletions src/main/java/org/gitlab4j/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1029,5 +1029,73 @@ public String toString() {
return (enumHelper.toString(this));
}
}

/**
* Constant to specify the project_creation_level for the group.
*/
public enum ProjectCreationLevel {
NOONE, DEVELOPER, MAINTAINER;

private static JacksonJsonEnumHelper<ProjectCreationLevel> enumHelper = new JacksonJsonEnumHelper<>(ProjectCreationLevel.class);

@JsonCreator
public static ProjectCreationLevel forValue(String value) {
return enumHelper.forValue(value);
}

@JsonValue
public String toValue() {
return (enumHelper.toString(this));
}

@Override
public String toString() {
return (enumHelper.toString(this));
}
}

/**
* Constant to specify the subgroup_creation_level for the group.
*/
public enum SubgroupCreationLevel {
OWNER, MAINTAINER;

private static JacksonJsonEnumHelper<SubgroupCreationLevel> enumHelper = new JacksonJsonEnumHelper<>(SubgroupCreationLevel.class);

@JsonCreator
public static SubgroupCreationLevel forValue(String value) {
return enumHelper.forValue(value);
}

@JsonValue
public String toValue() {
return (enumHelper.toString(this));
}

@Override
public String toString() {
return (enumHelper.toString(this));
}
}

public enum DefaultBranchProtectionLevel {
NOT_PROTECTED(0),
PARTIALLY_PROTECTED(1),
FULLY_PROTECTED(2),
PROTECTED_AGAINST_PUSHES(3),
FULL_PROTECTION_AFTER_INITIAL_PUSH(4);

@JsonValue
private final int value;

private DefaultBranchProtectionLevel(int value) {
this.value = value;
}

@Override
public String toString() {
return Integer.toString(value);
}
}
}

74 changes: 74 additions & 0 deletions src/main/java/org/gitlab4j/api/models/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
package org.gitlab4j.api.models;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import org.gitlab4j.api.Constants.DefaultBranchProtectionLevel;
import org.gitlab4j.api.Constants.ProjectCreationLevel;
import org.gitlab4j.api.Constants.SubgroupCreationLevel;
import org.gitlab4j.api.utils.JacksonJson;

import java.util.Date;
Expand Down Expand Up @@ -63,6 +67,11 @@ public void setJobArtifactsSize(Long jobArtifactsSize) {
private Date createdAt;
private List<SharedGroup> sharedWithGroups;
private String runnersToken;
private Boolean preventSharingGroupsOutsideHierarchy;
private Boolean preventForkingOutsideGroup;
private ProjectCreationLevel projectCreationLevel;
private SubgroupCreationLevel subgroupCreationLevel;
private DefaultBranchProtectionLevel defaultBranchProtection;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date markedForDeletionOn;
Expand Down Expand Up @@ -179,6 +188,46 @@ public void setRunnersToken(String runnersToken) {
this.runnersToken = runnersToken;
}

public Boolean getPreventSharingGroupsOutsideHierarchy() {
return preventSharingGroupsOutsideHierarchy;
}

public void setPreventSharingGroupsOutsideHierarchy(Boolean preventSharingGroupsOutsideHierarchy) {
this.preventSharingGroupsOutsideHierarchy = preventSharingGroupsOutsideHierarchy;
}

public Boolean getPreventForkingOutsideGroup() {
return preventForkingOutsideGroup;
}

public void setPreventForkingOutsideGroup(Boolean preventForkingOutsideGroup) {
this.preventForkingOutsideGroup = preventForkingOutsideGroup;
}

public ProjectCreationLevel getProjectCreationLevel() {
return this.projectCreationLevel;
}

public void setProjectCreationLevel(ProjectCreationLevel projectCreationLevel) {
this.projectCreationLevel = projectCreationLevel;
}

public SubgroupCreationLevel getSubgroupCreationLevel() {
return this.subgroupCreationLevel;
}

public void setSubgroupCreationLevel(SubgroupCreationLevel subgroupCreationLevel) {
this.subgroupCreationLevel = subgroupCreationLevel;
}

public DefaultBranchProtectionLevel getDefaultBranchProtection() {
return this.defaultBranchProtection;
}

public void setDefaultBranchProtection(DefaultBranchProtectionLevel defaultBranchProtection) {
this.defaultBranchProtection = defaultBranchProtection;
}

public Group withPath(String path) {
this.path = path;
return this;
Expand Down Expand Up @@ -229,6 +278,31 @@ public Group withSharedProjects(List<Project> sharedProjects) {
return this;
}

public Group withPreventSharingGroupsOutsideHierarchy(Boolean preventSharingGroupsOutsideHierarchy) {
this.preventSharingGroupsOutsideHierarchy = preventSharingGroupsOutsideHierarchy;
return this;
}

public Group withPreventForkingOutsideGroup(Boolean preventForkingOutsideGroup) {
this.preventForkingOutsideGroup = preventForkingOutsideGroup;
return this;
}

public Group withProjectCreationLevel(ProjectCreationLevel projectCreationLevel) {
this.projectCreationLevel = projectCreationLevel;
return this;
}

public Group withSubgroupCreationLevel(SubgroupCreationLevel subgroupCreationLevel) {
this.subgroupCreationLevel = subgroupCreationLevel;
return this;
}

public Group withDefaultBranchProtection(DefaultBranchProtectionLevel defaultBranchProtection) {
this.defaultBranchProtection = defaultBranchProtection;
return this;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down
Loading