Skip to content

Commit 6d1aa4c

Browse files
committed
Initial commit (#424).
1 parent 09aff84 commit 6d1aa4c

File tree

5 files changed

+301
-0
lines changed

5 files changed

+301
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJson;
4+
5+
import com.fasterxml.jackson.annotation.JsonIgnore;
6+
7+
public class IssuesStatistics {
8+
9+
private Statistics statistics;
10+
11+
public Statistics getStatistics() {
12+
return statistics;
13+
}
14+
15+
public void setStatistics(Statistics statistics) {
16+
this.statistics = statistics;
17+
}
18+
19+
@JsonIgnore
20+
public Counts getCounts() {
21+
return (statistics != null ? statistics.counts : null);
22+
}
23+
24+
public static class Statistics {
25+
private Counts counts;
26+
27+
public Counts getCounts() {
28+
return counts;
29+
}
30+
31+
public void setCounts(Counts counts) {
32+
this.counts = counts;
33+
}
34+
}
35+
36+
public static class Counts {
37+
38+
private Integer all;
39+
private Integer closed;
40+
private Integer opened;
41+
42+
public Integer getAll() {
43+
return all;
44+
}
45+
46+
public void setAll(Integer all) {
47+
this.all = all;
48+
}
49+
50+
public Integer getClosed() {
51+
return closed;
52+
}
53+
54+
public void setClosed(Integer closed) {
55+
this.closed = closed;
56+
}
57+
58+
public Integer getOpened() {
59+
return opened;
60+
}
61+
62+
public void setOpened(Integer opened) {
63+
this.opened = opened;
64+
}
65+
}
66+
67+
@Override
68+
public String toString() {
69+
return (JacksonJson.toJsonString(this));
70+
}
71+
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
import java.util.List;
5+
6+
import org.gitlab4j.api.Constants.IssueScope;
7+
import org.gitlab4j.api.GitLabApiException;
8+
import org.gitlab4j.api.GitLabApiForm;
9+
import org.gitlab4j.api.utils.ISO8601;
10+
11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
13+
/**
14+
* This class is used to filter issues when getting issue statistics. of them.
15+
*/
16+
public class IssuesStatisticsFilter {
17+
18+
private List<String> labels;
19+
private String milestone;
20+
private IssueScope scope;
21+
private Integer authorId;
22+
private Integer assigneeId;
23+
private String myReactionEmoji;
24+
private List<Integer> iids;
25+
private String search;
26+
private String in;
27+
private Date createdAfter;
28+
private Date createdBefore;
29+
private Date updatedAfter;
30+
private Date updatedBefore;
31+
private Boolean confidential;
32+
33+
public IssuesStatisticsFilter withLabels(List<String> labels) {
34+
this.labels = labels;
35+
return (this);
36+
}
37+
38+
public IssuesStatisticsFilter withIids(List<Integer> iids) {
39+
this.iids = iids;
40+
return (this);
41+
}
42+
43+
public IssuesStatisticsFilter withMilestone(String milestone) {
44+
this.milestone = milestone;
45+
return (this);
46+
}
47+
48+
public IssuesStatisticsFilter withScope(IssueScope scope) {
49+
this.scope = scope;
50+
return (this);
51+
}
52+
53+
public IssuesStatisticsFilter withAuthorId(Integer authorId) {
54+
this.authorId = authorId;
55+
return (this);
56+
}
57+
58+
public IssuesStatisticsFilter withAssigneeId(Integer assigneeId) {
59+
this.assigneeId = assigneeId;
60+
return (this);
61+
}
62+
63+
public IssuesStatisticsFilter withMyReactionEmoji(String myReactionEmoji) {
64+
this.myReactionEmoji = myReactionEmoji;
65+
return (this);
66+
}
67+
68+
public IssuesStatisticsFilter withSearch(String search) {
69+
this.search = search;
70+
return (this);
71+
}
72+
73+
public IssuesStatisticsFilter withIn(String in) {
74+
this.in = in;
75+
return (this);
76+
}
77+
78+
public IssuesStatisticsFilter withCreatedAfter(Date createdAfter) {
79+
this.createdAfter = createdAfter;
80+
return (this);
81+
}
82+
83+
public IssuesStatisticsFilter withCreatedBefore(Date createdBefore) {
84+
this.createdBefore = createdBefore;
85+
return (this);
86+
}
87+
88+
public IssuesStatisticsFilter withUpdatedAfter(Date updatedAfter) {
89+
this.updatedAfter = updatedAfter;
90+
return (this);
91+
}
92+
93+
public IssuesStatisticsFilter withUpdatedBefore(Date updatedBefore) {
94+
this.updatedBefore = updatedBefore;
95+
return (this);
96+
}
97+
98+
public IssuesStatisticsFilter withConfidential(Boolean confidential) {
99+
this.confidential = confidential;
100+
return (this);
101+
}
102+
103+
@JsonIgnore
104+
public GitLabApiForm getQueryParams() throws GitLabApiException {
105+
106+
return (new GitLabApiForm()
107+
.withParam("labels", (labels != null ? String.join(",", labels) : null))
108+
.withParam("iids", iids)
109+
.withParam("milestone", milestone)
110+
.withParam("scope", scope)
111+
.withParam("author_id", authorId)
112+
.withParam("assignee_id", assigneeId)
113+
.withParam("my_reaction_emoji", myReactionEmoji)
114+
.withParam("search", search)
115+
.withParam("in", in)
116+
.withParam("created_after", ISO8601.toString(createdAfter, false))
117+
.withParam("created_before", ISO8601.toString(createdBefore, false))
118+
.withParam("updated_after", ISO8601.toString(updatedAfter, false))
119+
.withParam("updated_before", ISO8601.toString(updatedBefore, false))
120+
.withParam("confidential", confidential));
121+
}
122+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.Date;
4+
import java.util.List;
5+
6+
import org.gitlab4j.api.utils.JacksonJson;
7+
8+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
9+
10+
public class ProjectFetches {
11+
12+
public static class DateCount {
13+
14+
private Integer count;
15+
16+
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
17+
private Date date;
18+
19+
public Integer getCount() {
20+
return count;
21+
}
22+
23+
public void setCount(Integer count) {
24+
this.count = count;
25+
}
26+
27+
public Date getDate() {
28+
return date;
29+
}
30+
31+
public void setDate(Date date) {
32+
this.date = date;
33+
}
34+
}
35+
36+
public static class Fetches {
37+
38+
private Integer total;
39+
private List<DateCount> days;
40+
41+
public Integer getTotal() {
42+
return total;
43+
}
44+
45+
public void setTotal(Integer total) {
46+
this.total = total;
47+
}
48+
49+
public List<DateCount> getDays() {
50+
return days;
51+
}
52+
53+
public void setDays(List<DateCount> days) {
54+
this.days = days;
55+
}
56+
}
57+
58+
private Fetches fetches;
59+
60+
public Fetches getFetches() {
61+
return fetches;
62+
}
63+
64+
public void setFetches(Fetches fetches) {
65+
this.fetches = fetches;
66+
}
67+
68+
@Override
69+
public String toString() {
70+
return (JacksonJson.toJsonString(this));
71+
}
72+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"statistics": {
3+
"counts": {
4+
"all": 20,
5+
"closed": 5,
6+
"opened": 15
7+
}
8+
}
9+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"fetches": {
3+
"total": 50,
4+
"days": [
5+
{
6+
"count": 10,
7+
"date": "2018-01-10"
8+
},
9+
{
10+
"count": 10,
11+
"date": "2018-01-09"
12+
},
13+
{
14+
"count": 10,
15+
"date": "2018-01-08"
16+
},
17+
{
18+
"count": 10,
19+
"date": "2018-01-07"
20+
},
21+
{
22+
"count": 10,
23+
"date": "2018-01-06"
24+
}
25+
]
26+
}
27+
}

0 commit comments

Comments
 (0)