Skip to content

Commit 552ac9c

Browse files
authored
Add missing attributes in EventMergeRequest (#980)
* Add missing attributes in EventMergeRequest * Fix duration and tests
1 parent c839da8 commit 552ac9c

File tree

4 files changed

+81
-6
lines changed

4 files changed

+81
-6
lines changed

src/main/java/org/gitlab4j/api/utils/DurationUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static final String toString(int durationSeconds, boolean includeMonths)
107107
}
108108

109109
} else {
110-
buf.append(' ').append(seconds).append('s');
110+
buf.append(seconds).append('s');
111111
}
112112

113113
return (buf.toString());

src/main/java/org/gitlab4j/api/webhook/EventMergeRequest.java

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import org.gitlab4j.api.models.Duration;
99
import org.gitlab4j.api.utils.JacksonJson;
1010

11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
1113
public class EventMergeRequest {
1214

1315
private Long assigneeId;
@@ -29,6 +31,7 @@ public class EventMergeRequest {
2931
private String stCommits;
3032
private String stDiffs;
3133
private String state;
34+
private Long stateId;
3235
private String targetBranch;
3336
private Long targetProjectId;
3437
private String title;
@@ -54,17 +57,20 @@ public class EventMergeRequest {
5457
private String inProgressMergeCommitSha;
5558
private Integer lockVersion;
5659

57-
private Date last_editedAt;
60+
private Date lastEditedAt;
5861
private Long lastEditedById;
5962
private Long headPipelineId;
6063
private Boolean refFetched;
6164
private Long mergeIid;
6265
private Integer totalTimeSpent;
6366
private Duration humanTotalTimeSpent;
67+
private Integer timeChange;
6468
private Integer timeEstimate;
6569
private Duration humanTimeEstimate;
70+
private Duration humanTimeChange;
6671
private List<Long> assigneeIds;
6772
private List<Long> reviewerIds;
73+
private String oldrev;
6874

6975
public Long getAssigneeId() {
7076
return this.assigneeId;
@@ -218,6 +224,14 @@ public void setState(String state) {
218224
this.state = state;
219225
}
220226

227+
public Long getStateId() {
228+
return stateId;
229+
}
230+
231+
public void setStateId(Long stateId) {
232+
this.stateId = stateId;
233+
}
234+
221235
public String getTargetBranch() {
222236
return this.targetBranch;
223237
}
@@ -394,12 +408,31 @@ public void setLockVersion(Integer lockVersion) {
394408
this.lockVersion = lockVersion;
395409
}
396410

411+
/**
412+
* @deprecated used {@link #getLastEditedAt()}
413+
* @return date
414+
*/
415+
@Deprecated
416+
@JsonIgnore
397417
public Date getLast_editedAt() {
398-
return last_editedAt;
418+
return getLastEditedAt();
399419
}
400420

421+
/**
422+
* @deprecated used {@link #setLastEditedAt(Date)}
423+
*/
424+
@Deprecated
425+
@JsonIgnore
401426
public void setLast_editedAt(Date last_editedAt) {
402-
this.last_editedAt = last_editedAt;
427+
setLastEditedAt(last_editedAt);
428+
}
429+
430+
public Date getLastEditedAt() {
431+
return lastEditedAt;
432+
}
433+
434+
public void setLastEditedAt(Date lastEditedAt) {
435+
this.lastEditedAt = lastEditedAt;
403436
}
404437

405438
public Long getLastEditedById() {
@@ -450,6 +483,14 @@ public void setHumanTotalTimeSpent(Duration humanTotalTimeSpent) {
450483
this.humanTotalTimeSpent = humanTotalTimeSpent;
451484
}
452485

486+
public Integer getTimeChange() {
487+
return timeChange;
488+
}
489+
490+
public void setTimeChange(Integer timeChange) {
491+
this.timeChange = timeChange;
492+
}
493+
453494
public Integer getTimeEstimate() {
454495
return timeEstimate;
455496
}
@@ -466,6 +507,14 @@ public void setHumanTimeEstimate(Duration humanTimeEstimate) {
466507
this.humanTimeEstimate = humanTimeEstimate;
467508
}
468509

510+
public Duration getHumanTimeChange() {
511+
return humanTimeChange;
512+
}
513+
514+
public void setHumanTimeChange(Duration humanTimeChange) {
515+
this.humanTimeChange = humanTimeChange;
516+
}
517+
469518
public List<Long> getAssigneeIds() {
470519
return assigneeIds;
471520
}
@@ -482,6 +531,14 @@ public void setReviewerIds(List<Long> reviewerIds) {
482531
this.reviewerIds = reviewerIds;
483532
}
484533

534+
public String getOldrev() {
535+
return oldrev;
536+
}
537+
538+
public void setOldrev(String oldrev) {
539+
this.oldrev = oldrev;
540+
}
541+
485542
@Override
486543
public String toString() {
487544
return (JacksonJson.toJsonString(this));

src/test/java/org/gitlab4j/api/TestDuration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ public void testBadParse() {
112112
@Test
113113
public void testToString() {
114114

115-
String duration = DurationUtils.toString(60 + 1);
115+
String duration = DurationUtils.toString(5);
116+
assertEquals("5s", duration);
117+
118+
duration = DurationUtils.toString(60 + 1);
116119
assertEquals("1m1s", duration);
117120

118121
duration = DurationUtils.toString(60 * 60 + 60 + 1);

src/test/resources/org/gitlab4j/api/merge-request-event.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,23 @@
112112
"group_id": 41
113113
}
114114
],
115+
"head_pipeline_id": 848574,
116+
"last_edited_at": "2014-04-03T17:23:34Z",
117+
"last_edited_by_id": 59,
118+
"merge_commit_sha": "e3b7e97417fd6318a5c31b21b29d2acc5c86c3ae",
119+
"merge_user_id": 59,
120+
"merge_when_pipeline_succeeds": false,
121+
"state_id": 1,
122+
"time_estimate": 0,
123+
"updated_by_id": 6,
124+
"total_time_spent": 0,
125+
"time_change": 0,
126+
"human_total_time_spent": "30m",
127+
"human_time_change": "30s",
128+
"human_time_estimate": "30m",
115129
"action": "open",
116-
"detailed_merge_status": "mergeable"
130+
"detailed_merge_status": "mergeable",
131+
"oldrev": "8ad9e9f37b007d15c102da002c2a7133a5ca3737"
117132
},
118133
"labels": [
119134
{

0 commit comments

Comments
 (0)