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 387d4e5

Browse filesBrowse files
Return the new GHContentUpdateResponse from content changes.
1 parent 4ffd46b commit 387d4e5
Copy full SHA for 387d4e5

File tree

Expand file treeCollapse file tree

2 files changed

+25
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+25
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContent.java
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,20 @@ public boolean isDirectory() {
7979
return "dir".equals(type);
8080
}
8181

82-
public void update(String newContent, String commitMessage) throws IOException {
83-
new Requester(owner.root)
82+
public GHContentUpdateResponse update(String newContent, String commitMessage) throws IOException {
83+
GHContentUpdateResponse response = new Requester(owner.root)
8484
.with("path", path)
8585
.with("message", commitMessage)
8686
.with("sha", sha)
8787
.with("content", DatatypeConverter.printBase64Binary(newContent.getBytes()))
8888
.method("PUT")
89-
.to(getApiRoute());
89+
.to(getApiRoute(), GHContentUpdateResponse.class);
90+
91+
response.getContent().wrap(owner);
92+
response.getCommit().wrapUp(owner);
9093

9194
this.content = newContent;
95+
return response;
9296
}
9397

9498
private String getApiRoute() {
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.kohsuke.github;
2+
3+
/**
4+
* The response that is returned when updating
5+
* repository content.
6+
**/
7+
public final class GHContentUpdateResponse {
8+
private GHContent content;
9+
private GHCommit commit;
10+
11+
public GHContent getContent() {
12+
return content;
13+
}
14+
15+
public GHCommit getCommit() {
16+
return commit;
17+
}
18+
}

0 commit comments

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