Class GHCreateRepositoryBuilder

java.lang.Object
org.kohsuke.github.GHCreateRepositoryBuilder
All Implemented Interfaces:
GitHubRequestBuilderDone<GHRepository>

public class GHCreateRepositoryBuilder extends Object
Creates a repository.
Author:
Kohsuke Kawaguchi
  • Field Details

    • requester

      @Nonnull protected final org.kohsuke.github.Requester requester
      The requester.
    • updateInPlace

      protected boolean updateInPlace
      The update in place.
  • Constructor Details

    • GHCreateRepositoryBuilder

      public GHCreateRepositoryBuilder(String name, GitHub root, String apiTail)
      Instantiates a new GH create repository builder.
      Parameters:
      name - the name
      root - the root
      apiTail - the api tail
  • Method Details

    • gitignoreTemplate

      public GHCreateRepositoryBuilder gitignoreTemplate(String language) throws IOException
      Creates a default .gitignore
      Parameters:
      language - template to base the ignore file on
      Returns:
      a builder to continue with building See https://developer.github.com/v3/repos/#create
      Throws:
      IOException - In case of any networking error or error from the server.
    • licenseTemplate

      public GHCreateRepositoryBuilder licenseTemplate(String license) throws IOException
      Desired license template to apply.
      Parameters:
      license - template to base the license file on
      Returns:
      a builder to continue with building See https://developer.github.com/v3/repos/#create
      Throws:
      IOException - In case of any networking error or error from the server.
    • autoInit

      public GHCreateRepositoryBuilder autoInit(boolean enabled) throws IOException
      If true, create an initial commit with empty README.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • team

      public GHCreateRepositoryBuilder team(GHTeam team) throws IOException
      The team that gets granted access to this repository. Only valid for creating a repository in an organization.
      Parameters:
      team - team to grant access to
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • owner

      public GHCreateRepositoryBuilder owner(String owner) throws IOException
      Specifies the ownership of the repository.
      Parameters:
      owner - organization or personage
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • fromTemplateRepository

      public GHCreateRepositoryBuilder fromTemplateRepository(String templateOwner, String templateRepo)
      Create repository from template repository.
      Parameters:
      templateOwner - template repository owner
      templateRepo - template repository
      Returns:
      a builder to continue with building
    • fromTemplateRepository

      public GHCreateRepositoryBuilder fromTemplateRepository(GHRepository templateRepository)
      Create repository from template repository.
      Parameters:
      templateRepository - the template repository as a GHRepository
      Returns:
      a builder to continue with building
    • create

      public GHRepository create() throws IOException
      Creates a repository with all the parameters.
      Returns:
      the gh repository
      Throws:
      IOException - if repository cannot be created
    • allowSquashMerge

      public GHCreateRepositoryBuilder allowSquashMerge(boolean enabled) throws IOException
      Allow or disallow squash-merging pull requests.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • allowMergeCommit

      public GHCreateRepositoryBuilder allowMergeCommit(boolean enabled) throws IOException
      Allow or disallow merging pull requests with a merge commit.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • allowRebaseMerge

      public GHCreateRepositoryBuilder allowRebaseMerge(boolean enabled) throws IOException
      Allow or disallow rebase-merging pull requests.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • allowForking

      public GHCreateRepositoryBuilder allowForking(boolean enabled) throws IOException
      Allow or disallow private forks
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • deleteBranchOnMerge

      public GHCreateRepositoryBuilder deleteBranchOnMerge(boolean enabled) throws IOException
      After pull requests are merged, you can have head branches deleted automatically.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • defaultBranch

      public GHCreateRepositoryBuilder defaultBranch(String branch) throws IOException
      Default repository branch.
      Parameters:
      branch - branch name
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • description

      public GHCreateRepositoryBuilder description(String description) throws IOException
      Description for repository.
      Parameters:
      description - description of repository
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • homepage

      public GHCreateRepositoryBuilder homepage(URL homepage) throws IOException
      Homepage for repository.
      Parameters:
      homepage - homepage of repository
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • homepage

      public GHCreateRepositoryBuilder homepage(String homepage) throws IOException
      Homepage for repository.
      Parameters:
      homepage - homepage of repository
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • private_

      public GHCreateRepositoryBuilder private_(boolean enabled) throws IOException
      Sets the repository to private.
      Parameters:
      enabled - private if true
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • visibility

      public GHCreateRepositoryBuilder visibility(GHRepository.Visibility visibility) throws IOException
      Sets the repository visibility.
      Parameters:
      visibility - visibility of repository
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • issues

      public GHCreateRepositoryBuilder issues(boolean enabled) throws IOException
      Enables issue tracker.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • projects

      public GHCreateRepositoryBuilder projects(boolean enabled) throws IOException
      Enables projects.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • wiki

      public GHCreateRepositoryBuilder wiki(boolean enabled) throws IOException
      Enables wiki.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • downloads

      public GHCreateRepositoryBuilder downloads(boolean enabled) throws IOException
      Enables downloads.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • isTemplate

      public GHCreateRepositoryBuilder isTemplate(boolean enabled) throws IOException
      Specifies whether the repository is a template.
      Parameters:
      enabled - true if enabled
      Returns:
      a builder to continue with building
      Throws:
      IOException - In case of any networking error or error from the server.
    • done

      public GHRepository done() throws IOException
      Done.
      Specified by:
      done in interface GitHubRequestBuilderDone<S>
      Returns:
      the GH repository
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • with

      @Nonnull @BetaApi protected GHCreateRepositoryBuilder with(@Nonnull String name, Object value) throws IOException
      Applies a value to a name for this builder. If S is the same as R, this method will commit changes after the first value change and return a R from GitHubRequestBuilderDone.done(). If S is not the same as R, this method will return an S and letting the caller batch together multiple changes and call GitHubRequestBuilderDone.done() when they are ready.
      Parameters:
      name - the name of the field
      value - the value of the field
      Returns:
      either a continuing builder or an updated data record
      Throws:
      IOException - if an I/O error occurs
    • continueOrDone

      @Nonnull @BetaApi protected GHCreateRepositoryBuilder continueOrDone() throws IOException
      Chooses whether to return a continuing builder or an updated data record If S is the same as R, this method will commit changes after the first value change and return a R from GitHubRequestBuilderDone.done(). If S is not the same as R, this method will return an S and letting the caller batch together multiple changes and call GitHubRequestBuilderDone.done() when they are ready.
      Returns:
      either a continuing builder or an updated data record
      Throws:
      IOException - if an I/O error occurs