Commit 6d1aa4cd authored by Greg Messner's avatar Greg Messner
Browse files

Initial commit (#424).

parent 09aff841
package org.gitlab4j.api.models;
import org.gitlab4j.api.utils.JacksonJson;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class IssuesStatistics {
private Statistics statistics;
public Statistics getStatistics() {
return statistics;
}
public void setStatistics(Statistics statistics) {
this.statistics = statistics;
}
@JsonIgnore
public Counts getCounts() {
return (statistics != null ? statistics.counts : null);
}
public static class Statistics {
private Counts counts;
public Counts getCounts() {
return counts;
}
public void setCounts(Counts counts) {
this.counts = counts;
}
}
public static class Counts {
private Integer all;
private Integer closed;
private Integer opened;
public Integer getAll() {
return all;
}
public void setAll(Integer all) {
this.all = all;
}
public Integer getClosed() {
return closed;
}
public void setClosed(Integer closed) {
this.closed = closed;
}
public Integer getOpened() {
return opened;
}
public void setOpened(Integer opened) {
this.opened = opened;
}
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
package org.gitlab4j.api.models;
import java.util.Date;
import java.util.List;
import org.gitlab4j.api.Constants.IssueScope;
import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.GitLabApiForm;
import org.gitlab4j.api.utils.ISO8601;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* This class is used to filter issues when getting issue statistics. of them.
*/
public class IssuesStatisticsFilter {
private List<String> labels;
private String milestone;
private IssueScope scope;
private Integer authorId;
private Integer assigneeId;
private String myReactionEmoji;
private List<Integer> iids;
private String search;
private String in;
private Date createdAfter;
private Date createdBefore;
private Date updatedAfter;
private Date updatedBefore;
private Boolean confidential;
public IssuesStatisticsFilter withLabels(List<String> labels) {
this.labels = labels;
return (this);
}
public IssuesStatisticsFilter withIids(List<Integer> iids) {
this.iids = iids;
return (this);
}
public IssuesStatisticsFilter withMilestone(String milestone) {
this.milestone = milestone;
return (this);
}
public IssuesStatisticsFilter withScope(IssueScope scope) {
this.scope = scope;
return (this);
}
public IssuesStatisticsFilter withAuthorId(Integer authorId) {
this.authorId = authorId;
return (this);
}
public IssuesStatisticsFilter withAssigneeId(Integer assigneeId) {
this.assigneeId = assigneeId;
return (this);
}
public IssuesStatisticsFilter withMyReactionEmoji(String myReactionEmoji) {
this.myReactionEmoji = myReactionEmoji;
return (this);
}
public IssuesStatisticsFilter withSearch(String search) {
this.search = search;
return (this);
}
public IssuesStatisticsFilter withIn(String in) {
this.in = in;
return (this);
}
public IssuesStatisticsFilter withCreatedAfter(Date createdAfter) {
this.createdAfter = createdAfter;
return (this);
}
public IssuesStatisticsFilter withCreatedBefore(Date createdBefore) {
this.createdBefore = createdBefore;
return (this);
}
public IssuesStatisticsFilter withUpdatedAfter(Date updatedAfter) {
this.updatedAfter = updatedAfter;
return (this);
}
public IssuesStatisticsFilter withUpdatedBefore(Date updatedBefore) {
this.updatedBefore = updatedBefore;
return (this);
}
public IssuesStatisticsFilter withConfidential(Boolean confidential) {
this.confidential = confidential;
return (this);
}
@JsonIgnore
public GitLabApiForm getQueryParams() throws GitLabApiException {
return (new GitLabApiForm()
.withParam("labels", (labels != null ? String.join(",", labels) : null))
.withParam("iids", iids)
.withParam("milestone", milestone)
.withParam("scope", scope)
.withParam("author_id", authorId)
.withParam("assignee_id", assigneeId)
.withParam("my_reaction_emoji", myReactionEmoji)
.withParam("search", search)
.withParam("in", in)
.withParam("created_after", ISO8601.toString(createdAfter, false))
.withParam("created_before", ISO8601.toString(createdBefore, false))
.withParam("updated_after", ISO8601.toString(updatedAfter, false))
.withParam("updated_before", ISO8601.toString(updatedBefore, false))
.withParam("confidential", confidential));
}
}
package org.gitlab4j.api.models;
import java.util.Date;
import java.util.List;
import org.gitlab4j.api.utils.JacksonJson;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
public class ProjectFetches {
public static class DateCount {
private Integer count;
@JsonSerialize(using = JacksonJson.DateOnlySerializer.class)
private Date date;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
public static class Fetches {
private Integer total;
private List<DateCount> days;
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public List<DateCount> getDays() {
return days;
}
public void setDays(List<DateCount> days) {
this.days = days;
}
}
private Fetches fetches;
public Fetches getFetches() {
return fetches;
}
public void setFetches(Fetches fetches) {
this.fetches = fetches;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
{
"statistics": {
"counts": {
"all": 20,
"closed": 5,
"opened": 15
}
}
}
\ No newline at end of file
{
"fetches": {
"total": 50,
"days": [
{
"count": 10,
"date": "2018-01-10"
},
{
"count": 10,
"date": "2018-01-09"
},
{
"count": 10,
"date": "2018-01-08"
},
{
"count": 10,
"date": "2018-01-07"
},
{
"count": 10,
"date": "2018-01-06"
}
]
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment