Package org.kohsuke.github
Class GHTreeBuilder
- java.lang.Object
-
- org.kohsuke.github.GHTreeBuilder
-
public class GHTreeBuilder extends Object
Builder pattern for creating a new tree. Based on https://developer.github.com/v3/git/trees/#create-a-tree
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description GHTreeBuilderadd(String path, byte[] content, boolean executable)Adds a new entry with the given binary content to the tree.GHTreeBuilderadd(String path, String content, boolean executable)Adds a new entry with the given text content to the tree.GHTreeBuilderbaseTree(String baseTree)Base tree gh tree builder.GHTreecreate()Creates a tree based on the parameters specified thus far.GHTreeBuilderentry(String path, String mode, String type, String sha, String content)Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.GHTreeBuildershaEntry(String path, String sha, boolean executable)Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.GHTreeBuildertextEntry(String path, String content, boolean executable)Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.
-
-
-
Method Detail
-
baseTree
public GHTreeBuilder baseTree(String baseTree)
Base tree gh tree builder.- Parameters:
baseTree- the SHA of tree you want to update with new data- Returns:
- the gh tree builder
-
entry
@Deprecated public GHTreeBuilder entry(String path, String mode, String type, String sha, String content)
Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.Adds a new entry to the tree. Exactly one of the parametersshaandcontentmust be non-null.- Parameters:
path- the pathmode- the modetype- the typesha- the shacontent- the content- Returns:
- the gh tree builder
-
shaEntry
@Deprecated public GHTreeBuilder shaEntry(String path, String sha, boolean executable)
Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.Specialized version ofentry(String, String, String, String, String)for adding an existing blob referred by its SHA.- Parameters:
path- the pathsha- the shaexecutable- the executable- Returns:
- the gh tree builder
-
textEntry
@Deprecated public GHTreeBuilder textEntry(String path, String content, boolean executable)
Deprecated.useadd(String, String, boolean)oradd(String, byte[], boolean)instead.Specialized version ofentry(String, String, String, String, String)for adding a text file with the specifiedcontent.- Parameters:
path- the pathcontent- the contentexecutable- the executable- Returns:
- the gh tree builder
-
add
public GHTreeBuilder add(String path, byte[] content, boolean executable)
Adds a new entry with the given binary content to the tree.- Parameters:
path- the file path in the treecontent- the file content as byte arrayexecutable- true, if the file should be executable- Returns:
- this GHTreeBuilder
-
add
public GHTreeBuilder add(String path, String content, boolean executable)
Adds a new entry with the given text content to the tree.- Parameters:
path- the file path in the treecontent- the file content as UTF-8 encoded stringexecutable- true, if the file should be executable- Returns:
- this GHTreeBuilder
-
create
public GHTree create() throws IOException
Creates a tree based on the parameters specified thus far.- Returns:
- the gh tree
- Throws:
IOException- the io exception
-
-