Skip to content

Add "sharedWithGroups" to Group #1057

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 1 commit into from
Nov 16, 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
9 changes: 9 additions & 0 deletions src/main/java/org/gitlab4j/api/models/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void setJobArtifactsSize(Long jobArtifactsSize) {
private List<Project> projects;
private List<Project> sharedProjects;
private Date createdAt;
private List<SharedGroup> sharedWithGroups;
private String runnersToken;

@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
Expand Down Expand Up @@ -161,6 +162,14 @@ public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

public List<SharedGroup> getSharedWithGroups() {
return sharedWithGroups;
}

public void setSharedWithGroups(List<SharedGroup> sharedWithGroups) {
this.sharedWithGroups = sharedWithGroups;
}

public String getRunnersToken() {
return runnersToken;
}
Expand Down
50 changes: 5 additions & 45 deletions src/main/java/org/gitlab4j/api/models/ProjectSharedGroup.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,8 @@
package org.gitlab4j.api.models;

import org.gitlab4j.api.utils.JacksonJson;

public class ProjectSharedGroup {

private Long groupId;
private String groupName;
private String groupFullPath;
private AccessLevel groupAccessLevel;

public long getGroupId() {
return groupId;
}

public void setGroupId(long groupId) {
this.groupId = groupId;
}

public String getGroupName() {
return groupName;
}

public void setGroupName(String groupName) {
this.groupName = groupName;
}

public AccessLevel getGroupAccessLevel() {
return (groupAccessLevel);
}

public void setGroupAccessLevel(AccessLevel accessLevel) {
this.groupAccessLevel = accessLevel;
}

public String getGroupFullPath() {
return groupFullPath;
}

public void setGroupFullPath(String groupFullPath) {
this.groupFullPath = groupFullPath;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
/**
* @deprecated use {@link SharedGroup} instead
*/
@Deprecated
public class ProjectSharedGroup extends SharedGroup {
}
62 changes: 62 additions & 0 deletions src/main/java/org/gitlab4j/api/models/SharedGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package org.gitlab4j.api.models;

import java.util.Date;

import org.gitlab4j.api.utils.JacksonJson;

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

public class SharedGroup {

private Long groupId;
private String groupName;
private String groupFullPath;
private AccessLevel groupAccessLevel;
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date expiresAt;

public long getGroupId() {
return groupId;
}

public void setGroupId(long groupId) {
this.groupId = groupId;
}

public String getGroupName() {
return groupName;
}

public void setGroupName(String groupName) {
this.groupName = groupName;
}

public AccessLevel getGroupAccessLevel() {
return (groupAccessLevel);
}

public void setGroupAccessLevel(AccessLevel accessLevel) {
this.groupAccessLevel = accessLevel;
}

public String getGroupFullPath() {
return groupFullPath;
}

public void setGroupFullPath(String groupFullPath) {
this.groupFullPath = groupFullPath;
}

public Date getExpiresAt() {
return expiresAt;
}

public void setExpiresAt(Date expiresAt) {
this.expiresAt = expiresAt;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
10 changes: 10 additions & 0 deletions src/test/resources/org/gitlab4j/api/group.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
"lfs_objects_size" : 123,
"job_artifacts_size" : 57
},
"shared_with_groups": [
{
"group_id": 104,
"group_name": "A Group",
"group_full_path": "a-group",
"group_access_level": 10,
"expires_at": "2023-11-19"
}
],
"runners_token": "GRnEE2mDc13489411jmS2d5R1XTfM",
"projects": [
{
"id": 7,
Expand Down
6 changes: 4 additions & 2 deletions src/test/resources/org/gitlab4j/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@
"group_id": 4,
"group_name": "Twitter",
"group_full_path": "twitter",
"group_access_level": 30
"group_access_level": 30,
"expires_at": "2023-11-19"
},
{
"group_id": 3,
"group_name": "Gitlab Org",
"group_full_path": "gitlab-org",
"group_access_level": 10
"group_access_level": 10,
"expires_at": "2023-11-19"
}
],
"repository_storage": "default",
Expand Down