/** * Removes this subscription. */ public void delete() throws IOException { new Requester(root).method("DELETE").to(url); }
/** * 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); }
/** * 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; }
/** * Deletes this review comment. */ public void delete() throws IOException { new Requester(owner.root).method("DELETE").to(getApiRoute()); }
/** * 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); }
/** * 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); }
/** * Forks this gist into your own. */ public GHGist fork() throws IOException { return new Requester(root).to(getApiTailUrl("forks"),GHGist.class).wrapUp(root); }
/** * Updates the body of the commit message. */ public void update(String body) throws IOException { new Requester(owner.root) .with("body", body) .method("PATCH").to(getApiTail(), GHCommitComment.class); this.body = body; }
/** * Creates a blob based on the parameters specified thus far. */ public GHCommit create() throws IOException { req._with("parents", parents); return req.method("POST").to(getApiTail(), GHCommit.class).wrapUp(repo); } }
public void requestReviewers(List<GHUser> reviewers) throws IOException { new Requester(root).method("POST") .withLogins("reviewers", reviewers) .to(getApiRoute() + REQUEST_REVIEWERS); }
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); }
/** * Updates the body of the issue comment. */ public void update(String body) throws IOException { new Requester(owner.root).with("body", body).method("PATCH").to(getApiRoute(), GHIssueComment.class); this.body = body; }
/** * Subscribes to this conversation to get notifications. */ public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException { return new Requester(root) .with("subscribed", subscribed) .with("ignored", ignored) .method("PUT").to(subscription_url, GHSubscription.class).wrapUp(root); }
@Preview @Deprecated public GHReaction createReaction(ReactionContent content) throws IOException { return new Requester(owner.root) .withPreview(SQUIRREL_GIRL) .with("content", content.getContent()) .to(getApiRoute()+"/reactions", GHReaction.class).wrap(root); }
/** * Updates this ref to the specified commit. * * @param sha * The SHA1 value to set this reference to * @param force * Whether or not to force this ref update. */ public void updateTo(String sha, Boolean force) throws IOException { new Requester(root) .with("sha", sha).with("force", force).method("PATCH").to(url, GHRef.class).wrap(root); }
public GHBranchProtection enable() throws IOException { return requester().method("PUT") .withNullable("required_status_checks", statusChecks) .withNullable("required_pull_request_reviews", prReviews) .withNullable("restrictions", restrictions) .withNullable("enforce_admins", enforceAdmins) .to(branch.getProtectionUrl().toString(), GHBranchProtection.class) .wrap(branch); }
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); }