Skip to content

Commit 1929d5d

Browse files
committed
Initial commit (#122).
1 parent 3f0c1d0 commit 1929d5d

File tree

3 files changed

+225
-0
lines changed

3 files changed

+225
-0
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
package org.gitlab4j.api.models;
2+
3+
import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
4+
5+
import com.fasterxml.jackson.annotation.JsonCreator;
6+
import com.fasterxml.jackson.annotation.JsonValue;
7+
8+
public class CommitAction {
9+
10+
public enum Action {
11+
12+
CREATE, DELETE, MOVE, UPDATE;
13+
14+
private static JacksonJsonEnumHelper<Action> enumHelper = new JacksonJsonEnumHelper<>(Action.class);
15+
16+
@JsonCreator
17+
public static Action forValue(String value) {
18+
return enumHelper.forValue(value);
19+
}
20+
21+
@JsonValue
22+
public String toValue() {
23+
return (enumHelper.toString(this));
24+
}
25+
26+
@Override
27+
public String toString() {
28+
return (enumHelper.toString(this));
29+
}
30+
}
31+
32+
public enum Encoding {
33+
34+
BASE64, TEXT;
35+
36+
private static JacksonJsonEnumHelper<Encoding> enumHelper = new JacksonJsonEnumHelper<>(Encoding.class);
37+
38+
@JsonCreator
39+
public static Encoding forValue(String value) {
40+
return enumHelper.forValue(value);
41+
}
42+
43+
@JsonValue
44+
public String toValue() {
45+
return (enumHelper.toString(this));
46+
}
47+
48+
@Override
49+
public String toString() {
50+
return (enumHelper.toString(this));
51+
}
52+
}
53+
54+
private Action action;
55+
private String filePath;
56+
private String previousPath;
57+
private String content;
58+
private Encoding encoding;
59+
private String lastCommitId;
60+
61+
public Action getAction() {
62+
return action;
63+
}
64+
65+
public void setAction(Action action) {
66+
this.action = action;
67+
}
68+
69+
public CommitAction withAction(Action action) {
70+
this.action = action;
71+
return this;
72+
}
73+
74+
public String getFilePath() {
75+
return filePath;
76+
}
77+
78+
public void setFilePath(String filePath) {
79+
this.filePath = filePath;
80+
}
81+
82+
public CommitAction withFilePath(String filePath) {
83+
this.filePath = filePath;
84+
return this;
85+
}
86+
87+
public String getPreviousPath() {
88+
return previousPath;
89+
}
90+
91+
public void setPreviousPath(String previousPath) {
92+
this.previousPath = previousPath;
93+
}
94+
95+
public CommitAction withPreviousPath(String previousPath) {
96+
this.previousPath = previousPath;
97+
return this;
98+
}
99+
100+
public String getContent() {
101+
return content;
102+
}
103+
104+
public void setContent(String content) {
105+
this.content = content;
106+
}
107+
108+
public CommitAction withContent(String content) {
109+
this.content = content;
110+
return this;
111+
}
112+
113+
public Encoding getEncoding() {
114+
return encoding;
115+
}
116+
117+
public void setEncoding(Encoding encoding) {
118+
this.encoding = encoding;
119+
}
120+
121+
public CommitAction withEncoding(Encoding encoding) {
122+
this.encoding = encoding;
123+
return this;
124+
}
125+
126+
public String getLastCommitId() {
127+
return lastCommitId;
128+
}
129+
130+
public void setLastCommitId(String lastCommitId) {
131+
this.lastCommitId = lastCommitId;
132+
}
133+
134+
public CommitAction withLastCommitId(String lastCommitId) {
135+
this.lastCommitId = lastCommitId;
136+
return this;
137+
}
138+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package org.gitlab4j.api.models;
2+
3+
import java.util.List;
4+
5+
public class CommitPayload {
6+
7+
private String branch;
8+
private String commitMessage;
9+
private String startBranch;
10+
private List<CommitAction> actions;
11+
private String authorEmail;
12+
private String authorName;
13+
14+
public String getBranch() {
15+
return branch;
16+
}
17+
18+
public void setBranch(String branch) {
19+
this.branch = branch;
20+
}
21+
22+
public String getCommitMessage() {
23+
return commitMessage;
24+
}
25+
26+
public void setCommitMessage(String commitMessage) {
27+
this.commitMessage = commitMessage;
28+
}
29+
30+
public String getStartBranch() {
31+
return startBranch;
32+
}
33+
34+
public void setStartBranch(String startBranch) {
35+
this.startBranch = startBranch;
36+
}
37+
38+
public List<CommitAction> getActions() {
39+
return actions;
40+
}
41+
42+
public void setActions(List<CommitAction> actions) {
43+
this.actions = actions;
44+
}
45+
46+
public String getAuthorEmail() {
47+
return authorEmail;
48+
}
49+
50+
public void setAuthorEmail(String authorEmail) {
51+
this.authorEmail = authorEmail;
52+
}
53+
54+
public String getAuthorName() {
55+
return authorName;
56+
}
57+
58+
public void setAuthorName(String authorName) {
59+
this.authorName = authorName;
60+
}
61+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"branch": "master",
3+
"commit_message": "some commit message",
4+
"actions": [
5+
{
6+
"action": "create",
7+
"file_path": "foo/bar",
8+
"content": "some content"
9+
},
10+
{
11+
"action": "delete",
12+
"file_path": "foo/bar2"
13+
},
14+
{
15+
"action": "move",
16+
"file_path": "foo/bar3",
17+
"previous_path": "foo/bar4",
18+
"content": "some content"
19+
},
20+
{
21+
"action": "update",
22+
"file_path": "foo/bar5",
23+
"content": "new content"
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)