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 Details

    • 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
    • shaEntry

      @Deprecated public GHTreeBuilder shaEntry(String path, String sha, boolean executable)
      Specialized version of entry() for adding an existing blob referred by its SHA.
      Parameters:
      path - the path
      sha - the sha
      executable - the executable
      Returns:
      the gh tree builder
    • textEntry

      @Deprecated public GHTreeBuilder textEntry(String path, String content, boolean executable)
      Specialized version of entry() for adding an existing blob specified content.
      Parameters:
      path - the path
      content - the content
      executable - 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 tree
      content - the file content as byte array
      executable - 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 tree
      content - the file content as UTF-8 encoded string
      executable - true, if the file should be executable
      Returns:
      this GHTreeBuilder
    • delete

      public GHTreeBuilder delete(String path)
      Removes an entry with the given path from base tree.
      Parameters:
      path - the file path in the tree
      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