Skip to content

Commit f2fe693

Browse files
authored
Add "sharedWithGroups" to Group (#1057)
Fixes #1053
1 parent 5890189 commit f2fe693

File tree

5 files changed

+90
-47
lines changed

5 files changed

+90
-47
lines changed

src/main/java/org/gitlab4j/api/models/Group.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void setJobArtifactsSize(Long jobArtifactsSize) {
6060
private List<Project> projects;
6161
private List<Project> sharedProjects;
6262
private Date createdAt;
63+
private List<SharedGroup> sharedWithGroups;
6364
private String runnersToken;
6465

6566
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
@@ -161,6 +162,14 @@ public void setCreatedAt(Date createdAt) {
161162
this.createdAt = createdAt;
162163
}
163164

165+
public List<SharedGroup> getSharedWithGroups() {
166+
return sharedWithGroups;
167+
}
168+
169+
public void setSharedWithGroups(List<SharedGroup> sharedWithGroups) {
170+
this.sharedWithGroups = sharedWithGroups;
171+
}
172+
164173
public String getRunnersToken() {
165174
return runnersToken;
166175
}
Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,8 @@
11
package org.gitlab4j.api.models;
22

3-
import org.gitlab4j.api.utils.JacksonJson;
4-
5-
public class ProjectSharedGroup {
6-
7-
private Long groupId;
8-
private String groupName;
9-
private String groupFullPath;
10-
private AccessLevel groupAccessLevel;
11-
12-
public long getGroupId() {
13-
return groupId;
14-
}
15-
16-
public void setGroupId(long groupId) {
17-
this.groupId = groupId;
18-
}
19-
20-
public String getGroupName() {
21-
return groupName;
22-
}
23-
24-
public void setGroupName(String groupName) {
25-
this.groupName = groupName;
26-
}
27-
28-
public AccessLevel getGroupAccessLevel() {
29-
return (groupAccessLevel);
30-
}
31-
32-
public void setGroupAccessLevel(AccessLevel accessLevel) {
33-
this.groupAccessLevel = accessLevel;
34-
}
35-
36-
public String getGroupFullPath() {
37-
return groupFullPath;
38-
}
39-
40-
public void setGroupFullPath(String groupFullPath) {
41-
this.groupFullPath = groupFullPath;
42-
}
43-
44-
@Override
45-
public String toString() {
46-
return (JacksonJson.toJsonString(this));
47-
}
3+
/**
4+
* @deprecated use {@link SharedGroup} instead
5+
*/
6+
@Deprecated
7+
public class ProjectSharedGroup extends SharedGroup {
488
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
5+
import org.gitlab4j.api.utils.JacksonJson;
6+
7+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
8+
9+
public class SharedGroup {
10+
11+
private Long groupId;
12+
private String groupName;
13+
private String groupFullPath;
14+
private AccessLevel groupAccessLevel;
15+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
16+
private Date expiresAt;
17+
18+
public long getGroupId() {
19+
return groupId;
20+
}
21+
22+
public void setGroupId(long groupId) {
23+
this.groupId = groupId;
24+
}
25+
26+
public String getGroupName() {
27+
return groupName;
28+
}
29+
30+
public void setGroupName(String groupName) {
31+
this.groupName = groupName;
32+
}
33+
34+
public AccessLevel getGroupAccessLevel() {
35+
return (groupAccessLevel);
36+
}
37+
38+
public void setGroupAccessLevel(AccessLevel accessLevel) {
39+
this.groupAccessLevel = accessLevel;
40+
}
41+
42+
public String getGroupFullPath() {
43+
return groupFullPath;
44+
}
45+
46+
public void setGroupFullPath(String groupFullPath) {
47+
this.groupFullPath = groupFullPath;
48+
}
49+
50+
public Date getExpiresAt() {
51+
return expiresAt;
52+
}
53+
54+
public void setExpiresAt(Date expiresAt) {
55+
this.expiresAt = expiresAt;
56+
}
57+
58+
@Override
59+
public String toString() {
60+
return (JacksonJson.toJsonString(this));
61+
}
62+
}

src/test/resources/org/gitlab4j/api/group.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
"lfs_objects_size" : 123,
1818
"job_artifacts_size" : 57
1919
},
20+
"shared_with_groups": [
21+
{
22+
"group_id": 104,
23+
"group_name": "A Group",
24+
"group_full_path": "a-group",
25+
"group_access_level": 10,
26+
"expires_at": "2023-11-19"
27+
}
28+
],
29+
"runners_token": "GRnEE2mDc13489411jmS2d5R1XTfM",
2030
"projects": [
2131
{
2232
"id": 7,

src/test/resources/org/gitlab4j/api/project.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@
7373
"group_id": 4,
7474
"group_name": "Twitter",
7575
"group_full_path": "twitter",
76-
"group_access_level": 30
76+
"group_access_level": 30,
77+
"expires_at": "2023-11-19"
7778
},
7879
{
7980
"group_id": 3,
8081
"group_name": "Gitlab Org",
8182
"group_full_path": "gitlab-org",
82-
"group_access_level": 10
83+
"group_access_level": 10,
84+
"expires_at": "2023-11-19"
8385
}
8486
],
8587
"repository_storage": "default",

0 commit comments

Comments
 (0)