Skip to content

Add missing attributes in EventMergeRequest #980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/gitlab4j/api/utils/DurationUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static final String toString(int durationSeconds, boolean includeMonths)
}

} else {
buf.append(' ').append(seconds).append('s');
buf.append(seconds).append('s');
}

return (buf.toString());
Expand Down
63 changes: 60 additions & 3 deletions src/main/java/org/gitlab4j/api/webhook/EventMergeRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.gitlab4j.api.models.Duration;
import org.gitlab4j.api.utils.JacksonJson;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class EventMergeRequest {

private Long assigneeId;
Expand All @@ -29,6 +31,7 @@ public class EventMergeRequest {
private String stCommits;
private String stDiffs;
private String state;
private Long stateId;
private String targetBranch;
private Long targetProjectId;
private String title;
Expand All @@ -54,17 +57,20 @@ public class EventMergeRequest {
private String inProgressMergeCommitSha;
private Integer lockVersion;

private Date last_editedAt;
private Date lastEditedAt;
private Long lastEditedById;
private Long headPipelineId;
private Boolean refFetched;
private Long mergeIid;
private Integer totalTimeSpent;
private Duration humanTotalTimeSpent;
private Integer timeChange;
private Integer timeEstimate;
private Duration humanTimeEstimate;
private Duration humanTimeChange;
private List<Long> assigneeIds;
private List<Long> reviewerIds;
private String oldrev;

public Long getAssigneeId() {
return this.assigneeId;
Expand Down Expand Up @@ -218,6 +224,14 @@ public void setState(String state) {
this.state = state;
}

public Long getStateId() {
return stateId;
}

public void setStateId(Long stateId) {
this.stateId = stateId;
}

public String getTargetBranch() {
return this.targetBranch;
}
Expand Down Expand Up @@ -394,12 +408,31 @@ public void setLockVersion(Integer lockVersion) {
this.lockVersion = lockVersion;
}

/**
* @deprecated used {@link #getLastEditedAt()}
* @return date
*/
@Deprecated
@JsonIgnore
public Date getLast_editedAt() {
return last_editedAt;
return getLastEditedAt();
}

/**
* @deprecated used {@link #setLastEditedAt(Date)}
*/
@Deprecated
@JsonIgnore
public void setLast_editedAt(Date last_editedAt) {
this.last_editedAt = last_editedAt;
setLastEditedAt(last_editedAt);
}

public Date getLastEditedAt() {
return lastEditedAt;
}

public void setLastEditedAt(Date lastEditedAt) {
this.lastEditedAt = lastEditedAt;
}

public Long getLastEditedById() {
Expand Down Expand Up @@ -450,6 +483,14 @@ public void setHumanTotalTimeSpent(Duration humanTotalTimeSpent) {
this.humanTotalTimeSpent = humanTotalTimeSpent;
}

public Integer getTimeChange() {
return timeChange;
}

public void setTimeChange(Integer timeChange) {
this.timeChange = timeChange;
}

public Integer getTimeEstimate() {
return timeEstimate;
}
Expand All @@ -466,6 +507,14 @@ public void setHumanTimeEstimate(Duration humanTimeEstimate) {
this.humanTimeEstimate = humanTimeEstimate;
}

public Duration getHumanTimeChange() {
return humanTimeChange;
}

public void setHumanTimeChange(Duration humanTimeChange) {
this.humanTimeChange = humanTimeChange;
}

public List<Long> getAssigneeIds() {
return assigneeIds;
}
Expand All @@ -482,6 +531,14 @@ public void setReviewerIds(List<Long> reviewerIds) {
this.reviewerIds = reviewerIds;
}

public String getOldrev() {
return oldrev;
}

public void setOldrev(String oldrev) {
this.oldrev = oldrev;
}

@Override
public String toString() {
return (JacksonJson.toJsonString(this));
Expand Down
5 changes: 4 additions & 1 deletion src/test/java/org/gitlab4j/api/TestDuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public void testBadParse() {
@Test
public void testToString() {

String duration = DurationUtils.toString(60 + 1);
String duration = DurationUtils.toString(5);
assertEquals("5s", duration);

duration = DurationUtils.toString(60 + 1);
assertEquals("1m1s", duration);

duration = DurationUtils.toString(60 * 60 + 60 + 1);
Expand Down
17 changes: 16 additions & 1 deletion src/test/resources/org/gitlab4j/api/merge-request-event.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,23 @@
"group_id": 41
}
],
"head_pipeline_id": 848574,
"last_edited_at": "2014-04-03T17:23:34Z",
"last_edited_by_id": 59,
"merge_commit_sha": "e3b7e97417fd6318a5c31b21b29d2acc5c86c3ae",
"merge_user_id": 59,
"merge_when_pipeline_succeeds": false,
"state_id": 1,
"time_estimate": 0,
"updated_by_id": 6,
"total_time_spent": 0,
"time_change": 0,
"human_total_time_spent": "30m",
"human_time_change": "30s",
"human_time_estimate": "30m",
"action": "open",
"detailed_merge_status": "mergeable"
"detailed_merge_status": "mergeable",
"oldrev": "8ad9e9f37b007d15c102da002c2a7133a5ca3737"
},
"labels": [
{
Expand Down