/** * Checks if the given user is an assignee for this repository. */ public boolean hasAssignee(GHUser u) throws IOException { return root.retrieve().asHttpStatusCode(getApiTailUrl("assignees/" + u.getLogin()))/100==2; }
/** * Commits a new content. */ public GHContentUpdateResponse commit() throws IOException { GHContentUpdateResponse response = req.to(repo.getApiTailUrl("contents/" + path), GHContentUpdateResponse.class); response.getContent().wrap(repo); response.getCommit().wrapUp(repo); return response; } }
public GHContent getFileContent(String path, String ref) throws IOException { Requester requester = root.retrieve(); String target = getApiTailUrl("contents/" + path); return requester.with("ref",ref).to(target, GHContent.class).wrap(this); }
public GHRelease getReleaseByTagName(String tag) throws IOException { try { return root.retrieve().to(getApiTailUrl("releases/tags/" + tag), GHRelease.class).wrap(this); } catch (FileNotFoundException e) { return null; // no release for this tag } }
/** * Retrieves a specified pull request. */ public GHPullRequest getPullRequest(int i) throws IOException { return root.retrieve().to(getApiTailUrl("pulls/" + i), GHPullRequest.class).wrapUp(this); }
/** * Returns the current subscription. * * @return null if no subscription exists. */ public GHSubscription getSubscription() throws IOException { try { return root.retrieve().to(getApiTailUrl("subscription"), GHSubscription.class).wrapUp(this); } catch (FileNotFoundException e) { return null; } }
public PagedIterator<GHRepository> _iterator(int pageSize) { return new PagedIterator<GHRepository>(root.retrieve().with("sort",sort).asIterator(getApiTailUrl("forks"), GHRepository[].class, pageSize)) { @Override protected void wrapUp(GHRepository[] page) { for (GHRepository c : page) { c.wrap(root); } } }; } };
public PagedIterator<GHUser> _iterator(int pageSize) { return new PagedIterator<GHUser>(root.retrieve().asIterator(getApiTailUrl(suffix), GHUser[].class, pageSize)) { protected void wrapUp(GHUser[] page) { GHUser.wrap(page,root); } }; } };
public PagedIterator<GHPullRequestReviewComment> _iterator(int pageSize) { return new PagedIterator<GHPullRequestReviewComment>(root.retrieve().asIterator(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment[].class, pageSize)) { protected void wrapUp(GHPullRequestReviewComment[] page) { for (GHPullRequestReviewComment c : page) c.wrapUp(GHPullRequest.this); } }; } };
/** * List languages for the specified repository. * The value on the right of a language is the number of bytes of code written in that language. * { "C": 78769, "Python": 7769 } */ public Map<String,Long> listLanguages() throws IOException { return root.retrieve().to(getApiTailUrl("languages"), HashMap.class); }
public PagedIterator<GHPullRequestReviewComment> _iterator(int pageSize) { return new PagedIterator<GHPullRequestReviewComment>( owner.root.retrieve() .asIterator(getApiRoute() + "/comments", GHPullRequestReviewComment[].class, pageSize)) { protected void wrapUp(GHPullRequestReviewComment[] page) { for (GHPullRequestReviewComment c : page) c.wrapUp(owner); } }; } };
/** * https://developer.github.com/v3/repos/contents/#get-the-readme */ public GHContent getReadme() throws IOException { Requester requester = root.retrieve(); return requester.to(getApiTailUrl("readme"), GHContent.class).wrap(this); }