public PagedIterator<GHDeployment> _iterator(int pageSize) { return new PagedIterator<GHDeployment>(root.retrieve().asIterator(deploymentsUrl, GHDeployment[].class, pageSize)) { @Override protected void wrapUp(GHDeployment[] page) { for (GHDeployment c : page) c.wrap(GHRepository.this); } }; } };
public PagedIterator<GHContent> _iterator(int pageSize) { return new PagedIterator<GHContent>(root.retrieve().asIterator(url, GHContent[].class, pageSize)) { @Override protected void wrapUp(GHContent[] page) { GHContent.wrap(page, repository); } }; } };
public PagedIterator<GHEventInfo> _iterator(int pageSize) { return new PagedIterator<GHEventInfo>(root.retrieve().asIterator(String.format("/orgs/%s/events", login), GHEventInfo[].class, pageSize)) { @Override protected void wrapUp(GHEventInfo[] page) { for (GHEventInfo c : page) c.wrapUp(root); } }; } };
public PagedIterator<GHPullRequestCommitDetail> _iterator(int pageSize) { return new PagedIterator<GHPullRequestCommitDetail>(root.retrieve().asIterator( String.format("%s/commits", getApiRoute()), GHPullRequestCommitDetail[].class, pageSize)) { @Override protected void wrapUp(GHPullRequestCommitDetail[] page) { for (GHPullRequestCommitDetail c : page) c.wrapUp(GHPullRequest.this); } }; } };
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); } }; } };
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); } }; } };
/** * Checks if this team has the specified user as a member. */ public boolean hasMember(GHUser user) { try { org.root.retrieve().to("/teams/" + id + "/members/" + user.getLogin()); return true; } catch (IOException ignore) { return false; } }
/** * 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<GHReaction> _iterator(int pageSize) { return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiRoute()+"/reactions", GHReaction[].class, pageSize)) { @Override protected void wrapUp(GHReaction[] page) { for (GHReaction c : page) c.wrap(owner.root); } }; } };
/** * Gets branches by {@linkplain GHBranch#getName() their names}. */ public Map<String,GHBranch> getBranches() throws IOException { Map<String,GHBranch> r = new TreeMap<String,GHBranch>(); for (GHBranch p : root.retrieve().to(getApiTailUrl("branches"), GHBranch[].class)) { p.wrap(this); r.put(p.getName(),p); } return r; }
/** * Gets your membership in a specific organization. */ public GHMembership getMembership(GHOrganization o) throws IOException { return root.retrieve().to("/user/memberships/orgs/"+o.getLogin(),GHMembership.class).wrap(root); }
/** * 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; }
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); } } }; } };
/** * 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); }
/** * Conceals the membership. */ public void conceal(GHUser u) throws IOException { root.retrieve().method("DELETE").to("/orgs/" + login + "/public_members/" + u.getLogin(), null); }
/** * Accepts a pending invitation to an organization. * * @see GHMyself#getMembership(GHOrganization) */ public void activate() throws IOException { root.retrieve().method("PATCH").with("state",State.ACTIVE).to(url,this); }
public PagedIterator<GHReaction> _iterator(int pageSize) { return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiRoute()+"/reactions", GHReaction[].class, pageSize)) { @Override protected void wrapUp(GHReaction[] page) { for (GHReaction c : page) c.wrap(owner.root); } }; } };
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 GHLabel createLabel(String name, String color) throws IOException { return root.retrieve().method("POST") .with("name",name) .with("color", color) .to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this); }