Package org.kohsuke.github
Class GHCreateRepositoryBuilder
- java.lang.Object
-
- org.kohsuke.github.GHCreateRepositoryBuilder
-
public class GHCreateRepositoryBuilder extends Object
Creates a repository- Author:
- Kohsuke Kawaguchi
-
-
Field Summary
Fields Modifier and Type Field Description protected org.kohsuke.github.Requesterrequesterprotected booleanupdateInPlace
-
Constructor Summary
Constructors Constructor Description GHCreateRepositoryBuilder(String name, GitHub root, String apiTail)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SallowMergeCommit(boolean enabled)Allow or disallow merging pull requests with a merge commit.SallowRebaseMerge(boolean enabled)Allow or disallow rebase-merging pull requests.SallowSquashMerge(boolean enabled)Allow or disallow squash-merging pull requests.GHCreateRepositoryBuilderautoInit(boolean enabled)If true, create an initial commit with empty README.protected ScontinueOrDone()Chooses whether to return a continuing builder or an updated data record IfAbstractBuilderis the same asAbstractBuilder, this method will commit changes after the first value change and return aAbstractBuilderfromdone().GHRepositorycreate()Creates a repository with all the parameters.SdefaultBranch(String branch)Default repository branchSdeleteBranchOnMerge(boolean enabled)After pull requests are merged, you can have head branches deleted automatically.Sdescription(String description)Description for repositoryGHRepositorydone()Finishes an update, committing changes.Sdownloads(boolean enabled)Enables downloadsGHCreateRepositoryBuilderfromTemplateRepository(String templateOwner, String templateRepo)Create repository from template repositoryGHCreateRepositoryBuildergitignoreTemplate(String language)Creates a default .gitignoreShomepage(String homepage)Homepage for repositoryShomepage(URL homepage)Homepage for repositorySissues(boolean enabled)Enables issue trackerSisTemplate(boolean enabled)Specifies whether the repository is a template.GHCreateRepositoryBuilderlicenseTemplate(String license)Desired license template to applyGHCreateRepositoryBuilderowner(String owner)Specifies the ownership of the repository.Sprivate_(boolean enabled)Sets the repository to privateSprojects(boolean enabled)Enables projectsGHCreateRepositoryBuilderteam(GHTeam team)The team that gets granted access to this repository.GHCreateRepositoryBuildertemplateRepository(boolean enabled)Deprecated.UseisTemplate(boolean)method insteadSvisibility(GHRepository.Visibility visibility)Sets the repository visibilitySwiki(boolean enabled)Enables wikiprotected Swith(String name, Object value)Applies a value to a name for this builder.
-
-
-
Field Detail
-
requester
@Nonnull protected final org.kohsuke.github.Requester requester
-
updateInPlace
protected boolean updateInPlace
-
-
Method Detail
-
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.
-
templateRepository
@Deprecated public GHCreateRepositoryBuilder templateRepository(boolean enabled) throws IOException
Deprecated.UseisTemplate(boolean)method insteadSpecifies 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.
-
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
@Preview(BAPTISTE) public GHCreateRepositoryBuilder fromTemplateRepository(String templateOwner, String templateRepo)
Create repository from template repository- Parameters:
templateOwner- template repository ownertemplateRepo- template repository- Returns:
- a builder to continue with building
- See Also:
- GitHub API Previews
-
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 S allowSquashMerge(boolean enabled) throws IOExceptionAllow 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 S allowMergeCommit(boolean enabled) throws IOExceptionAllow 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 S allowRebaseMerge(boolean enabled) throws IOExceptionAllow 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.
-
deleteBranchOnMerge
public S deleteBranchOnMerge(boolean enabled) throws IOExceptionAfter 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 S 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 S 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 S 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 S 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 S private_(boolean enabled) throws IOExceptionSets 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 S 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 S issues(boolean enabled) throws IOExceptionEnables 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 S projects(boolean enabled) throws IOExceptionEnables 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 S wiki(boolean enabled) throws IOExceptionEnables 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 S downloads(boolean enabled) throws IOExceptionEnables 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
@Preview(BAPTISTE) public S 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
Finishes an update, committing changes. This method may update-in-place or not. Either way it returns the resulting instance.- Returns:
- an instance with updated current data
- Throws:
IOException- if there is an I/O Exception
-
with
@Nonnull @BetaApi protected S with(@Nonnull String name, Object value) throws IOException
Applies a value to a name for this builder. IfAbstractBuilderis the same asAbstractBuilder, this method will commit changes after the first value change and return aAbstractBuilderfromdone(). IfAbstractBuilderis not the same asAbstractBuilder, this method will return anAbstractBuilderand letting the caller batch together multiple changes and calldone()when they are ready.- Parameters:
name- the name of the fieldvalue- 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 S continueOrDone() throws IOException
Chooses whether to return a continuing builder or an updated data record IfAbstractBuilderis the same asAbstractBuilder, this method will commit changes after the first value change and return aAbstractBuilderfromdone(). IfAbstractBuilderis not the same asAbstractBuilder, this method will return anAbstractBuilderand letting the caller batch together multiple changes and calldone()when they are ready.- Returns:
- either a continuing builder or an updated data record
- Throws:
IOException- if an I/O error occurs
-
-