Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6377342

Browse filesBrowse files
authored
feat: expose fields & extend content builder with commiter and author (#28)
* feat: expose fields & extend content builder with commiter and author * fix: annotations
1 parent 97d1453 commit 6377342
Copy full SHA for 6377342

File tree

Expand file treeCollapse file tree

4 files changed

+43
-5
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+43
-5
lines changed

‎pom.xml

Copy file name to clipboardExpand all lines: pom.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.kohsuke</groupId>
44
<artifactId>cortexapps-github-api</artifactId>
5-
<version>1.322</version>
5+
<version>1.323</version>
66
<name>GitHub API for Java</name>
77
<url>https://github-api.kohsuke.org/</url>
88
<description>GitHub API for Java</description>

‎src/main/java/org/kohsuke/github/GHCommit.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCommit.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ public String getSha() {
243243
public static class Parent {
244244

245245
/** The url. */
246-
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
247-
String url;
246+
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "used in backend code")
247+
public String url;
248248

249249
/** The sha. */
250-
String sha;
250+
public String sha;
251251
}
252252

253253
/**

‎src/main/java/org/kohsuke/github/GHContentBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContentBuilder.java
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ public final class GHContentBuilder {
1919
private final Requester req;
2020
private String path;
2121

22+
private static final class UserInfo {
23+
private final String name;
24+
private final String email;
25+
26+
private UserInfo(String name, String email) {
27+
this.name = name;
28+
this.email = email;
29+
}
30+
}
31+
2232
/**
2333
* Instantiates a new GH content builder.
2434
*
@@ -102,6 +112,34 @@ public GHContentBuilder message(String commitMessage) {
102112
return this;
103113
}
104114

115+
/**
116+
* Configures the author of this content.
117+
*
118+
* @param name
119+
* the name
120+
* @param email
121+
* the email
122+
* @return the gh commit builder
123+
*/
124+
public GHContentBuilder author(String name, String email) {
125+
req.with("author", new UserInfo(name, email));
126+
return this;
127+
}
128+
129+
/**
130+
* Configures the committer of this content.
131+
*
132+
* @param name
133+
* the name
134+
* @param email
135+
* the email
136+
* @return the gh commit builder
137+
*/
138+
public GHContentBuilder committer(String name, String email) {
139+
req.with("committer", new UserInfo(name, email));
140+
return this;
141+
}
142+
105143
/**
106144
* Commits a new content.
107145
*

‎src/main/java/org/kohsuke/github/GitCommit.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitCommit.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public String getTreeUrl() {
241241
* @return the parents
242242
*/
243243
@SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "acceptable")
244-
List<GHCommit.Parent> getParents() {
244+
public List<GHCommit.Parent> getParents() {
245245
return parents;
246246
}
247247

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.