Skip to content

Commit a6b7c78

Browse files
authored
Audited and updated all user related data models (#349, #350)
* Updated user related data models and tests to match latest GitLab API specs.
1 parent a285be4 commit a6b7c78

File tree

13 files changed

+495
-536
lines changed

13 files changed

+495
-536
lines changed

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

Lines changed: 0 additions & 362 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
package org.gitlab4j.api.models;
22

3+
/**
4+
* This class models the object for a repository contributor.
5+
* See <a href="https://docs.gitlab.com/ee/api/repositories.html#contributors">Contributors at GitLab</a>.
6+
*/
37
public class Contributor extends AbstractUser<Contributor> {
8+
9+
private Integer commits;
10+
private Integer additions;
11+
private Integer deletions;
12+
13+
public Integer getCommits() {
14+
return commits;
15+
}
16+
17+
public void setCommits(Integer commits) {
18+
this.commits = commits;
19+
}
20+
21+
public Integer getAdditions() {
22+
return additions;
23+
}
24+
25+
public void setAdditions(Integer additions) {
26+
this.additions = additions;
27+
}
28+
29+
public Integer getDeletions() {
30+
return deletions;
31+
}
32+
33+
public void setDeletions(Integer deletions) {
34+
this.deletions = deletions;
35+
}
436
}

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

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@
55

66
import org.gitlab4j.api.utils.JacksonJson;
77

8-
public class Member {
8+
public class Member extends AbstractUser<Member> {
99

1010
private AccessLevel accessLevel;
11-
private Date createdAt;
12-
private Integer id;
13-
private String name;
14-
private String state;
15-
private String username;
11+
private Date expiresAt;
1612

1713
public AccessLevel getAccessLevel() {
1814
return this.accessLevel;
@@ -22,68 +18,21 @@ public void setAccessLevel(AccessLevel accessLevel) {
2218
this.accessLevel = accessLevel;
2319
}
2420

25-
public Date getCreatedAt() {
26-
return this.createdAt;
21+
public Date getExpiresAt() {
22+
return this.expiresAt;
2723
}
2824

29-
public void setCreatedAt(Date createdAt) {
30-
this.createdAt = createdAt;
31-
}
32-
33-
public Integer getId() {
34-
return this.id;
35-
}
36-
37-
public void setId(Integer id) {
38-
this.id = id;
39-
}
40-
41-
public String getName() {
42-
return this.name;
43-
}
44-
45-
public void setName(String name) {
46-
this.name = name;
47-
}
48-
49-
public String getState() {
50-
return this.state;
51-
}
52-
53-
public void setState(String state) {
54-
this.state = state;
55-
}
56-
57-
public String getUsername() {
58-
return this.username;
59-
}
60-
61-
public void setUsername(String username) {
62-
this.username = username;
25+
public void setExpiresAt(Date expiresAt) {
26+
this.expiresAt = expiresAt;
6327
}
6428

6529
public Member withAccessLevel(AccessLevel accessLevel) {
6630
this.accessLevel = accessLevel;
6731
return this;
6832
}
6933

70-
public Member withCreatedAt(Date createdAt) {
71-
this.createdAt = createdAt;
72-
return this;
73-
}
74-
75-
public Member withId(Integer id) {
76-
this.id = id;
77-
return this;
78-
}
79-
80-
public Member withState(String state) {
81-
this.state = state;
82-
return this;
83-
}
84-
85-
public Member withUsername(String username) {
86-
this.username = username;
34+
public Member withExpiresAt(Date expiresAt) {
35+
this.expiresAt = expiresAt;
8736
return this;
8837
}
8938

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,4 @@
11
package org.gitlab4j.api.models;
22

3-
import java.util.Date;
4-
5-
import org.gitlab4j.api.utils.JacksonJson;
6-
7-
public class Owner {
8-
9-
private Date createdAt;
10-
private Integer id;
11-
private String name;
12-
13-
public Date getCreatedAt() {
14-
return this.createdAt;
15-
}
16-
17-
public void setCreatedAt(Date createdAt) {
18-
this.createdAt = createdAt;
19-
}
20-
21-
public Integer getId() {
22-
return this.id;
23-
}
24-
25-
public void setId(Integer id) {
26-
this.id = id;
27-
}
28-
29-
public String getName() {
30-
return this.name;
31-
}
32-
33-
public void setName(String name) {
34-
this.name = name;
35-
}
36-
37-
@Override
38-
public String toString() {
39-
return (JacksonJson.toJsonString(this));
40-
}
3+
public class Owner extends AbstractUser<Owner> {
414
}
Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,4 @@
11
package org.gitlab4j.api.models;
22

3-
import org.gitlab4j.api.utils.JacksonJson;
4-
5-
public class ProjectUser {
6-
7-
private Integer id;
8-
private String username;
9-
private String name;
10-
private String state;
11-
private String avatarUrl;
12-
private String webUrl;
13-
14-
public Integer getId() {
15-
return id;
16-
}
17-
18-
public void setId(Integer id) {
19-
this.id = id;
20-
}
21-
22-
public String getUsername() {
23-
return username;
24-
}
25-
26-
public void setUsername(String username) {
27-
this.username = username;
28-
}
29-
30-
public String getName() {
31-
return name;
32-
}
33-
34-
public void setName(String name) {
35-
this.name = name;
36-
}
37-
38-
public String getState() {
39-
return state;
40-
}
41-
42-
public void setState(String state) {
43-
this.state = state;
44-
}
45-
46-
public String getAvatarUrl() {
47-
return avatarUrl;
48-
}
49-
50-
public void setAvatarUrl(String avatarUrl) {
51-
this.avatarUrl = avatarUrl;
52-
}
53-
54-
public String getWebUrl() {
55-
return webUrl;
56-
}
57-
58-
public void setWebUrl(String webUrl) {
59-
this.webUrl = webUrl;
60-
}
61-
62-
@Override
63-
public String toString() {
64-
return (JacksonJson.toJsonString(this));
65-
}
3+
public class ProjectUser extends AbstractUser<ProjectUser> {
664
}

0 commit comments

Comments
 (0)