/*package*/ static GHRef[] wrap(GHRef[] in, GitHub root) { for (GHRef r : in) { r.wrap(root); } return in; }
/*package*/ static GHRef[] wrap(GHRef[] in, GitHub root) { for (GHRef r : in) { r.wrap(root); } return in; }
/*package*/ static GHRef[] wrap(GHRef[] in, GitHub root) { for (GHRef r : in) { r.wrap(root); } return in; }
/** * Retrieves all refs for the github repository. * @return an array of GHRef elements coresponding with the refs in the remote repository. * @throws IOException on failure communicating with GitHub */ public GHRef[] getRefs() throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs", owner.login, name), GHRef[].class),root); }
/** * Retrieves all refs of the given type for the current GitHub repository. * @param refType the type of reg to search for e.g. <tt>tags</tt> or <tt>commits</tt> * @return an array of all refs matching the request type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ public GHRef[] getRefs(String refType) throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", owner.login, name, refType), GHRef[].class),root); } /**
/** * Retrive a ref of the given type for the current GitHub repository. * * @param refName * eg: heads/branch * @return refs matching the request type * @throws IOException * on failure communicating with GitHub, potentially due to an * invalid ref type being requested */ public GHRef getRef(String refName) throws IOException { return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", owner.login, name, refName), GHRef.class).wrap(root); } /**
/** * Retrieves all refs of the given type for the current GitHub repository. * @param refType the type of reg to search for e.g. <tt>tags</tt> or <tt>commits</tt> * @return an array of all refs matching the request type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ public GHRef[] getRefs(String refType) throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType), GHRef[].class),root); }
/** * Retrieves all refs for the github repository. * @return an array of GHRef elements coresponding with the refs in the remote repository. * @throws IOException on failure communicating with GitHub */ public GHRef[] getRefs() throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root); }
/** * Retrieves all refs of the given type for the current GitHub repository. * @param refType the type of reg to search for e.g. <tt>tags</tt> or <tt>commits</tt> * @return an array of all refs matching the request type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ public GHRef[] getRefs(String refType) throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType), GHRef[].class),root); }
/** * Retrieves all refs for the github repository. * @return an array of GHRef elements coresponding with the refs in the remote repository. * @throws IOException on failure communicating with GitHub */ public GHRef[] getRefs() throws IOException { return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root); }
/** * Retrive a ref of the given type for the current GitHub repository. * * @param refName * eg: heads/branch * @return refs matching the request type * @throws IOException * on failure communicating with GitHub, potentially due to an * invalid ref type being requested */ public GHRef getRef(String refName) throws IOException { // hashes in branch names must be replaced with the url encoded equivalent or this call will fail // FIXME: how about other URL unsafe characters, like space, @, : etc? do we need to be using URLEncoder.encode()? // OTOH, '/' need no escaping refName = refName.replaceAll("#", "%23"); return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class).wrap(root); }
/** * Retrive a ref of the given type for the current GitHub repository. * * @param refName * eg: heads/branch * @return refs matching the request type * @throws IOException * on failure communicating with GitHub, potentially due to an * invalid ref type being requested */ public GHRef getRef(String refName) throws IOException { // hashes in branch names must be replaced with the url encoded equivalent or this call will fail // FIXME: how about other URL unsafe characters, like space, @, : etc? do we need to be using URLEncoder.encode()? // OTOH, '/' need no escaping refName = refName.replaceAll("#", "%23"); return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.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); }
/** * 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); }
/** * 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); }
/** * Creates a named ref, such as tag, branch, etc. * * @param name * The name of the fully qualified reference (ie: refs/heads/master). * If it doesn't start with 'refs' and have at least two slashes, it will be rejected. * @param sha * The SHA1 value to set this reference to */ public GHRef createRef(String name, String sha) throws IOException { return new Requester(root) .with("ref", name).with("sha", sha).method("POST").to(getApiTailUrl("git/refs"), GHRef.class).wrap(root); }
/** * Creates a named ref, such as tag, branch, etc. * * @param name * The name of the fully qualified reference (ie: refs/heads/master). * If it doesn't start with 'refs' and have at least two slashes, it will be rejected. * @param sha * The SHA1 value to set this reference to */ public GHRef createRef(String name, String sha) throws IOException { return new Requester(root) .with("ref", name).with("sha", sha).method("POST").to(getApiTailUrl("git/refs"), GHRef.class).wrap(root); }
/** * Creates a named ref, such as tag, branch, etc. * * @param name * The name of the fully qualified reference (ie: refs/heads/master). * If it doesn't start with 'refs' and have at least two slashes, it will be rejected. * @param sha * The SHA1 value to set this reference to */ public GHRef createRef(String name, String sha) throws IOException { return new Requester(root) .with("ref", name).with("sha", sha).method("POST").to(getApiTailUrl("git/refs"), GHRef.class).wrap(root); }