public GHContentUpdateResponse createContent( String content, 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())) .method("PUT"); if (branch != null) { requester.with("branch", branch); } GHContentUpdateResponse response = requester.to(getApiTailUrl("contents/" + path), GHContentUpdateResponse.class); response.getContent().wrap(this); response.getCommit().wrapUp(this); return response; }
private void edit(String key, String value) throws IOException { Requester requester = new Requester(root); if (!key.equals("name")) requester.with("name", name); // even when we don't change the name, we need to send it in requester.with(key, value).method("PATCH").to("/repos/" + owner.login + "/" + name); }