mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Added binary content support.
This commit is contained in:
@@ -129,11 +129,19 @@ public class GHContent {
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse update(String newContent, String commitMessage) throws IOException {
|
||||
return update(newContent, commitMessage, null);
|
||||
return update(newContent.getBytes(), commitMessage, null);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException {
|
||||
String encodedContent = DatatypeConverter.printBase64Binary(newContent.getBytes());
|
||||
public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException {
|
||||
return update(newContent.getBytes(), commitMessage, branch);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage) throws IOException {
|
||||
return update(newContentBytes, commitMessage, null);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException {
|
||||
String encodedContent = DatatypeConverter.printBase64Binary(newContentBytes);
|
||||
|
||||
Requester requester = new Requester(owner.root)
|
||||
.with("path", path)
|
||||
|
||||
@@ -939,15 +939,24 @@ public class GHRepository {
|
||||
return getFileContent("readme");
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException {
|
||||
return createContent(content, commitMessage, path, null);
|
||||
|
||||
public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException {
|
||||
return createContent(content.getBytes(), commitMessage, path, null);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException {
|
||||
return createContent(content.getBytes(), commitMessage, path, branch);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException {
|
||||
return createContent(contentBytes, commitMessage, path, null);
|
||||
}
|
||||
|
||||
public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException {
|
||||
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException {
|
||||
Requester requester = new Requester(root)
|
||||
.with("path", path)
|
||||
.with("message", commitMessage)
|
||||
.with("content", DatatypeConverter.printBase64Binary(content.getBytes()))
|
||||
.with("content", DatatypeConverter.printBase64Binary(contentBytes))
|
||||
.method("PUT");
|
||||
|
||||
if (branch != null) {
|
||||
|
||||
Reference in New Issue
Block a user