@@ -653,6 +653,35 @@ public GHRef getRef(String refName) throws IOException {
653653 return root .retrieve ().to (String .format ("/repos/%s/%s/git/refs/%s" , owner .login , name , refName ), GHRef .class ).wrap (root );
654654 }
655655 /**
656+ * Retrive a tree of the given type for the current GitHub repository.
657+ *
658+ * @param sha - sha number or branch name ex: "master"
659+ * @return refs matching the request type
660+ * @throws IOException
661+ * on failure communicating with GitHub, potentially due to an
662+ * invalid tree type being requested
663+ */
664+ public GHTree getTree (String sha ) throws IOException {
665+ String url = String .format ("/repos/%s/%s/git/trees/%s" , owner .login , name , sha );
666+ return root .retrieve ().to (url , GHTree .class ).wrap (root );
667+ }
668+
669+ /**
670+ * Retrieves the tree for the current GitHub repository, recursively as described in here:
671+ * https://developer.github.com/v3/git/trees/#get-a-tree-recursively
672+ *
673+ * @param sha - sha number or branch name ex: "master"
674+ * @param recursive use 1
675+ * @throws IOException
676+ * on failure communicating with GitHub, potentially due to an
677+ * invalid tree type being requested
678+ */
679+ public GHTree getTreeRecursive (String sha , int recursive ) throws IOException {
680+ String url = String .format ("/repos/%s/%s/git/trees/%s?recursive=%d" , owner .login , name , sha , recursive );
681+ return root .retrieve ().to (url , GHTree .class ).wrap (root );
682+ }
683+
684+ /**
656685 * Gets a commit object in this repository.
657686 */
658687 public GHCommit getCommit (String sha1 ) throws IOException {
0 commit comments