public class GHRepository extends GHObject
Modifier and Type | Class and Description |
---|---|
static class |
GHRepository.Contributor |
static class |
GHRepository.ForkSort
Sort orders for listing forks
|
created_at, id, responseHeaderFields, updated_at, url
Constructor and Description |
---|
GHRepository() |
Modifier and Type | Method and Description |
---|---|
void |
addCollaborators(Collection<GHUser> users) |
void |
addCollaborators(GHUser... users) |
GHDeployKey |
addDeployKey(String title,
String key) |
GHBlobBuilder |
createBlob() |
GHCommitBuilder |
createCommit() |
GHCommitStatus |
createCommitStatus(String sha1,
GHCommitState state,
String targetUrl,
String description) |
GHCommitStatus |
createCommitStatus(String sha1,
GHCommitState state,
String targetUrl,
String description,
String context)
Creates a commit status
|
GHContentUpdateResponse |
createContent(byte[] contentBytes,
String commitMessage,
String path) |
GHContentUpdateResponse |
createContent(byte[] contentBytes,
String commitMessage,
String path,
String branch) |
GHContentUpdateResponse |
createContent(String content,
String commitMessage,
String path) |
GHContentUpdateResponse |
createContent(String content,
String commitMessage,
String path,
String branch) |
GHDeploymentBuilder |
createDeployment(String ref) |
GHDeploymentStatusBuilder |
createDeployStatus(int deploymentId,
GHDeploymentState ghDeploymentState)
Deprecated.
Use
getDeployment(deploymentId).createStatus(ghDeploymentState) |
GHHook |
createHook(String name,
Map<String,String> config,
Collection<GHEvent> events,
boolean active)
See https://api.github.com/hooks for possible names and their configuration scheme.
|
GHIssueBuilder |
createIssue(String title) |
GHLabel |
createLabel(String name,
String color) |
GHMilestone |
createMilestone(String title,
String description) |
GHPullRequest |
createPullRequest(String title,
String head,
String base,
String body)
Creates a new pull request.
|
GHRef |
createRef(String name,
String sha)
Creates a named ref, such as tag, branch, etc.
|
GHReleaseBuilder |
createRelease(String tag) |
GHTreeBuilder |
createTree() |
GHHook |
createWebHook(URL url) |
GHHook |
createWebHook(URL url,
Collection<GHEvent> events) |
void |
delete()
Deletes this repository.
|
void |
enableDownloads(boolean v) |
void |
enableIssueTracker(boolean v)
Enables or disables the issue tracker for this repository.
|
void |
enableWiki(boolean v)
Enables or disables Wiki for this repository.
|
boolean |
equals(Object obj) |
GHRepository |
fork()
Forks this repository as your repository.
|
GHRepository |
forkTo(GHOrganization org)
Forks this repository into an organization.
|
GHBlob |
getBlob(String blobSha)
Obtains the metadata & the content of a blob.
|
GHBranch |
getBranch(String name) |
Map<String,GHBranch> |
getBranches()
Gets branches by their names.
|
GHRepositoryCloneTraffic |
getCloneTraffic()
|
Set<String> |
getCollaboratorNames()
Gets the names of the collaborators on this repository.
|
GHPersonSet<GHUser> |
getCollaborators()
Gets the collaborators on this repository.
|
GHCommit |
getCommit(String sha1)
Gets a commit object in this repository.
|
GHCompare |
getCompare(GHBranch id1,
GHBranch id2) |
GHCompare |
getCompare(GHCommit id1,
GHCommit id2) |
GHCompare |
getCompare(String id1,
String id2)
Gets a comparison between 2 points in the repository.
|
String |
getDefaultBranch()
Returns the primary branch you'll configure in the "Admin > Options" config page.
|
List<GHDeployKey> |
getDeployKeys() |
GHDeployment |
getDeployment(long id)
Obtains a single
GHDeployment by its ID. |
PagedIterable<GHDeploymentStatus> |
getDeploymentStatuses(int id)
Deprecated.
Use
getDeployment(id).listStatuses() |
String |
getDescription() |
List<GHContent> |
getDirectoryContent(String path) |
List<GHContent> |
getDirectoryContent(String path,
String ref) |
GHContent |
getFileContent(String path) |
GHContent |
getFileContent(String path,
String ref) |
int |
getForks()
Returns the number of all forks of this repository.
|
String |
getFullName()
Full repository name including the owner or organization.
|
String |
getGitTransportUrl()
Gets the git:// URL to this repository, such as "git://github.com/kohsuke/jenkins.git"
This URL is read-only.
|
String |
getHomepage() |
GHHook |
getHook(int id) |
List<GHHook> |
getHooks()
Retrieves the currently configured hooks.
|
URL |
getHtmlUrl()
URL of this object for humans, which renders some HTML.
|
String |
getHttpTransportUrl()
Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git"
This URL is read-only.
|
GHIssue |
getIssue(int id) |
List<GHIssue> |
getIssues(GHIssueState state) |
List<GHIssue> |
getIssues(GHIssueState state,
GHMilestone milestone) |
GHLabel |
getLabel(String name) |
String |
getLanguage()
Gets the primary programming language.
|
GHCommitStatus |
getLastCommitStatus(String sha1)
Gets the last status of this commit, which is what gets shown in the UI.
|
GHRelease |
getLatestRelease() |
GHLicense |
getLicense()
Deprecated.
|
GHContent |
getLicenseContent()
Deprecated.
|
String |
getMasterBranch()
Deprecated.
Renamed to
getDefaultBranch() |
GHMilestone |
getMilestone(int number) |
Map<Integer,GHMilestone> |
getMilestones()
Deprecated.
|
String |
getMirrorUrl()
Gets the Mirror URL to access this repository: https://github.com/apache/tomee
mirrored from git://git.apache.org/tomee.git
|
String |
getName()
Short repository name without the owner.
|
int |
getNetworkCount()
Deprecated.
This no longer exists in the official API documentation.
Use
getForks() |
int |
getOpenIssueCount() |
GHUser |
getOwner() |
String |
getOwnerName() |
GHRepository |
getParent()
Forked repositories have a 'parent' attribute that specifies the repository this repository
is directly forked from.
|
GHPermissionType |
getPermission(GHUser u)
Obtain permission for a given user in this repository.
|
GHPermissionType |
getPermission(String user)
Obtain permission for a given user in this repository.
|
Set<URL> |
getPostCommitHooks()
Deprecated.
|
GHPullRequest |
getPullRequest(int i)
Retrieves a specified pull request.
|
List<GHPullRequest> |
getPullRequests(GHIssueState state)
Retrieves all the pull requests of a particular state.
|
Date |
getPushedAt() |
GHContent |
getReadme()
https://developer.github.com/v3/repos/contents/#get-the-readme
|
GHRef |
getRef(String refName)
Retrive a ref of the given type for the current GitHub repository.
|
GHRef[] |
getRefs()
Retrieves all refs for the github repository.
|
GHRef[] |
getRefs(String refType)
Retrieves all refs of the given type for the current GitHub repository.
|
List<GHRelease> |
getReleases()
Deprecated.
use
listReleases() |
int |
getSize() |
GHRepository |
getSource()
Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain.
|
String |
getSshUrl()
Gets the SSH URL to access this repository, such as [email protected]:rails/rails.git
|
int |
getStargazersCount() |
int |
getSubscribersCount() |
GHSubscription |
getSubscription()
Returns the current subscription.
|
String |
getSvnUrl()
Gets the Subversion URL to access this repository: https://github.com/rails/rails
|
GHTagObject |
getTagObject(String sha)
Returns the annotated tag object.
|
Set<GHTeam> |
getTeams()
If this repository belongs to an organization, return a set of teams.
|
GHTree |
getTree(String sha)
Retrive a tree of the given type for the current GitHub repository.
|
GHTree |
getTreeRecursive(String sha,
int recursive)
Retrieves the tree for the current GitHub repository, recursively as described in here:
https://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
GHRepositoryViewTraffic |
getViewTraffic()
|
int |
getWatchers() |
String |
gitHttpTransportUrl()
Deprecated.
Typo of
getHttpTransportUrl() |
boolean |
hasAdminAccess() |
boolean |
hasAssignee(GHUser u)
Checks if the given user is an assignee for this repository.
|
boolean |
hasDownloads() |
int |
hashCode() |
boolean |
hasIssues() |
boolean |
hasPages() |
boolean |
hasPullAccess() |
boolean |
hasPushAccess() |
boolean |
hasWiki() |
boolean |
isFork() |
boolean |
isPrivate() |
PagedIterable<GHUser> |
listAssignees()
Lists all the available assignees
to which issues may be assigned.
|
PagedIterable<GHUser> |
listCollaborators()
Lists up the collaborators on this repository.
|
PagedIterable<GHCommitComment> |
listCommitComments()
Lists up all the commit comments in this repository.
|
PagedIterable<GHCommit> |
listCommits()
Lists all the commits.
|
PagedIterable<GHCommitStatus> |
listCommitStatuses(String sha1)
/**
Lists all the commit statues attached to the given commit, newer ones first.
|
PagedIterable<GHRepository.Contributor> |
listContributors() |
PagedIterable<GHDeployment> |
listDeployments(String sha,
String ref,
String task,
String environment) |
PagedIterable<GHEventInfo> |
listEvents()
Lists repository events.
|
PagedIterable<GHRepository> |
listForks()
Lists all the direct forks of this repository, sorted by
github api default, currently
ForkSort.NEWEST . |
PagedIterable<GHRepository> |
listForks(GHRepository.ForkSort sort)
Lists all the direct forks of this repository, sorted by the given sort order.
|
PagedIterable<GHIssue> |
listIssues(GHIssueState state)
Lists up all the issues in this repository.
|
PagedIterable<GHLabel> |
listLabels()
Lists labels in this repository.
|
Map<String,Long> |
listLanguages()
List languages for the specified repository.
|
PagedIterable<GHMilestone> |
listMilestones(GHIssueState state)
Lists up all the milestones in this repository.
|
GHNotificationStream |
listNotifications()
List all the notifications in a repository for the current user.
|
PagedIterable<GHPullRequest> |
listPullRequests(GHIssueState state)
Deprecated.
|
PagedIterable<GHRef> |
listRefs()
Retrieves all refs for the github repository.
|
PagedIterable<GHRef> |
listRefs(String refType)
Retrieves all refs of the given type for the current GitHub repository.
|
PagedIterable<GHRelease> |
listReleases() |
PagedIterable<GHUser> |
listStargazers()
Lists all the users who have starred this repo based on the old version of the API.
|
PagedIterable<GHStargazer> |
listStargazers2()
Lists all the users who have starred this repo based on new version of the API, having extended
information like the time when the repository was starred.
|
PagedIterable<GHUser> |
listSubscribers()
Lists all the subscribers (aka watchers.)
https://developer.github.com/v3/activity/watching/
|
PagedIterable<GHTag> |
listTags() |
GHCommitQueryBuilder |
queryCommits()
Search commits by specifying filters through a builder pattern.
|
GHPullRequestQueryBuilder |
queryPullRequests()
Retrieves pull requests.
|
InputStream |
readBlob(String blobSha)
Reads the content of a blob as a stream for better efficiency.
|
void |
removeCollaborators(Collection<GHUser> users) |
void |
removeCollaborators(GHUser... users) |
void |
renameTo(String name)
Rename this repository.
|
Reader |
renderMarkdown(String text,
MarkdownMode mode)
Render a Markdown document.
|
void |
setDefaultBranch(String value) |
void |
setDescription(String value) |
void |
setEmailServiceHook(String address) |
void |
setHomepage(String value) |
GHSubscription |
subscribe(boolean subscribed,
boolean ignored)
Subscribes to this repository to get notifications.
|
getCreatedAt, getId, getResponseHeaderFields, getUpdatedAt, getUrl, toString
public GHDeploymentBuilder createDeployment(String ref)
public PagedIterable<GHDeploymentStatus> getDeploymentStatuses(int id) throws IOException
getDeployment(id).listStatuses()
IOException
public PagedIterable<GHDeployment> listDeployments(String sha, String ref, String task, String environment)
public GHDeployment getDeployment(long id) throws IOException
GHDeployment
by its ID.IOException
public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState) throws IOException
getDeployment(deploymentId).createStatus(ghDeploymentState)
IOException
public String getDescription()
public String getHomepage()
public String getGitTransportUrl()
public String getHttpTransportUrl()
public String gitHttpTransportUrl()
getHttpTransportUrl()
public String getSvnUrl()
public String getMirrorUrl()
public String getSshUrl()
public URL getHtmlUrl()
GHObject
getHtmlUrl
in class GHObject
public String getName()
public String getFullName()
public boolean hasPullAccess()
public boolean hasPushAccess()
public boolean hasAdminAccess()
public String getLanguage()
public GHUser getOwner() throws IOException
IOException
public GHIssue getIssue(int id) throws IOException
IOException
public GHIssueBuilder createIssue(String title)
public List<GHIssue> getIssues(GHIssueState state) throws IOException
IOException
public List<GHIssue> getIssues(GHIssueState state, GHMilestone milestone) throws IOException
IOException
public PagedIterable<GHIssue> listIssues(GHIssueState state)
public GHReleaseBuilder createRelease(String tag)
public GHRef createRef(String name, String sha) throws IOException
name
- The name of the fully qualified reference (ie: refs/heads/master).
If it doesn't start with 'refs' and have at least two slashes, it will be rejected.sha
- The SHA1 value to set this reference toIOException
public List<GHRelease> getReleases() throws IOException
listReleases()
IOException
public GHRelease getLatestRelease() throws IOException
IOException
public PagedIterable<GHRelease> listReleases() throws IOException
IOException
public PagedIterable<GHTag> listTags() throws IOException
IOException
public Map<String,Long> listLanguages() throws IOException
IOException
public String getOwnerName()
public boolean hasIssues()
public boolean hasWiki()
public boolean isFork()
public int getForks()
public int getStargazersCount()
public boolean isPrivate()
public boolean hasDownloads()
public boolean hasPages()
public int getWatchers()
public int getOpenIssueCount()
public int getNetworkCount()
getForks()
public int getSubscribersCount()
public Date getPushedAt()
public String getDefaultBranch()
public String getMasterBranch()
getDefaultBranch()
public int getSize()
@WithBridgeMethods(value=java.util.Set.class) public GHPersonSet<GHUser> getCollaborators() throws IOException
IOException
public PagedIterable<GHUser> listCollaborators() throws IOException
IOException
public PagedIterable<GHUser> listAssignees() throws IOException
IOException
public boolean hasAssignee(GHUser u) throws IOException
IOException
public Set<String> getCollaboratorNames() throws IOException
getCollaborators()
.IOException
public GHPermissionType getPermission(String user) throws IOException
user
- a GHPerson.getLogin()
FileNotFoundException
- under some conditions (e.g., private repo you can see but are not an admin of); treat as unknownHttpException
- with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknownIOException
public GHPermissionType getPermission(GHUser u) throws IOException
FileNotFoundException
- under some conditions (e.g., private repo you can see but are not an admin of); treat as unknownHttpException
- with a 403 under other conditions (e.g., public repo you have no special rights to); treat as unknownIOException
public Set<GHTeam> getTeams() throws IOException
IOException
public void addCollaborators(GHUser... users) throws IOException
IOException
public void addCollaborators(Collection<GHUser> users) throws IOException
IOException
public void removeCollaborators(GHUser... users) throws IOException
IOException
public void removeCollaborators(Collection<GHUser> users) throws IOException
IOException
public void setEmailServiceHook(String address) throws IOException
IOException
public void enableIssueTracker(boolean v) throws IOException
IOException
public void enableWiki(boolean v) throws IOException
IOException
public void enableDownloads(boolean v) throws IOException
IOException
public void renameTo(String name) throws IOException
IOException
public void setDescription(String value) throws IOException
IOException
public void setHomepage(String value) throws IOException
IOException
public void setDefaultBranch(String value) throws IOException
IOException
public void delete() throws IOException
IOException
public PagedIterable<GHRepository> listForks()
ForkSort.NEWEST
.public PagedIterable<GHRepository> listForks(GHRepository.ForkSort sort)
sort
- the sort order. If null, defaults to github api default,
currently ForkSort.NEWEST
.public GHRepository fork() throws IOException
IOException
public GHRepository forkTo(GHOrganization org) throws IOException
IOException
public GHPullRequest getPullRequest(int i) throws IOException
IOException
public List<GHPullRequest> getPullRequests(GHIssueState state) throws IOException
IOException
listPullRequests(GHIssueState)
public PagedIterable<GHPullRequest> listPullRequests(GHIssueState state)
queryPullRequests()
public GHPullRequestQueryBuilder queryPullRequests()
public GHPullRequest createPullRequest(String title, String head, String base, String body) throws IOException
title
- Required. The title of the pull request.head
- Required. The name of the branch where your changes are implemented.
For cross-repository pull requests in the same network,
namespace head with a user like this: username:branch.base
- Required. The name of the branch you want your changes pulled into.
This should be an existing branch on the current repository.body
- The contents of the pull request. This is the markdown description
of a pull request.IOException
public List<GHHook> getHooks() throws IOException
IOException
public GHHook getHook(int id) throws IOException
IOException
public GHCompare getCompare(String id1, String id2) throws IOException
id1
- an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a direct tag nameid2
- an identifier for the second point to compare to. Can be the same as the first point.IOException
- on failure communicating with GitHubpublic GHCompare getCompare(GHCommit id1, GHCommit id2) throws IOException
IOException
public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException
IOException
public GHRef[] getRefs() throws IOException
IOException
- on failure communicating with GitHubpublic PagedIterable<GHRef> listRefs() throws IOException
IOException
- on failure communicating with GitHub, potentially due to an invalid ref type being requestedpublic GHRef[] getRefs(String refType) throws IOException
refType
- the type of reg to search for e.g. tags or commitsIOException
- on failure communicating with GitHub, potentially due to an invalid ref type being requestedpublic PagedIterable<GHRef> listRefs(String refType) throws IOException
refType
- the type of reg to search for e.g. tags or commitsIOException
- on failure communicating with GitHub, potentially due to an invalid ref type being requestedpublic GHRef getRef(String refName) throws IOException
refName
- eg: heads/branchIOException
- on failure communicating with GitHub, potentially due to an
invalid ref type being requestedpublic GHTagObject getTagObject(String sha) throws IOException
GHRef.getObject()
has a
GHRef.GHObject.getType()
of tag
.sha
- the sha of the tag objectIOException
public GHTree getTree(String sha) throws IOException
sha
- - sha number or branch name ex: "master"IOException
- on failure communicating with GitHub, potentially due to an
invalid tree type being requestedpublic GHTreeBuilder createTree()
public GHTree getTreeRecursive(String sha, int recursive) throws IOException
sha
- - sha number or branch name ex: "master"recursive
- use 1IOException
- on failure communicating with GitHub, potentially due to an
invalid tree type being requestedpublic GHBlob getBlob(String blobSha) throws IOException
This method retrieves the whole content in memory, so beware when you are dealing with large BLOB.
IOException
readBlob(String)
public GHBlobBuilder createBlob()
public InputStream readBlob(String blobSha) throws IOException
IOException
getBlob(String)
public GHCommit getCommit(String sha1) throws IOException
IOException
public GHCommitBuilder createCommit()
public PagedIterable<GHCommit> listCommits()
public GHCommitQueryBuilder queryCommits()
public PagedIterable<GHCommitComment> listCommitComments()
@Preview @Deprecated public GHLicense getLicense() throws IOException
This is a preview item and subject to change.
IOException
- as usual but also if you don't use the preview connector@Preview @Deprecated public GHContent getLicenseContent() throws IOException
This is a preview item and subject to change.
IOException
- as usual but also if you don't use the preview connectorpublic PagedIterable<GHCommitStatus> listCommitStatuses(String sha1) throws IOException
IOException
public GHCommitStatus getLastCommitStatus(String sha1) throws IOException
IOException
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description, String context) throws IOException
targetUrl
- Optional parameter that points to the URL that has more details.description
- Optional short description.context
- Optinal commit status context.IOException
public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException
IOException
createCommitStatus(String, GHCommitState,String,String,String)
public PagedIterable<GHEventInfo> listEvents() throws IOException
IOException
public PagedIterable<GHLabel> listLabels() throws IOException
IOException
public GHLabel getLabel(String name) throws IOException
IOException
public GHLabel createLabel(String name, String color) throws IOException
IOException
public PagedIterable<GHUser> listSubscribers()
public PagedIterable<GHUser> listStargazers()
listStargazers2()
public PagedIterable<GHStargazer> listStargazers2()
listStargazers()
public GHHook createHook(String name, Map<String,String> config, Collection<GHEvent> events, boolean active) throws IOException
name
- Type of the hook to be created. See https://api.github.com/hooks for possible names.config
- The configuration hash.events
- Can be null. Types of events to hook into.IOException
public GHHook createWebHook(URL url, Collection<GHEvent> events) throws IOException
IOException
public GHHook createWebHook(URL url) throws IOException
IOException
public Set<URL> getPostCommitHooks()
getHooks()
and createHook(String, Map, Collection, boolean)
public Map<String,GHBranch> getBranches() throws IOException
IOException
public GHBranch getBranch(String name) throws IOException
IOException
public Map<Integer,GHMilestone> getMilestones() throws IOException
listMilestones(GHIssueState)
IOException
public PagedIterable<GHMilestone> listMilestones(GHIssueState state)
public GHMilestone getMilestone(int number) throws IOException
IOException
public GHContent getFileContent(String path) throws IOException
IOException
public GHContent getFileContent(String path, String ref) throws IOException
IOException
public List<GHContent> getDirectoryContent(String path) throws IOException
IOException
public List<GHContent> getDirectoryContent(String path, String ref) throws IOException
IOException
public GHContent getReadme() throws IOException
IOException
public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException
IOException
public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException
IOException
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException
IOException
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException
IOException
public GHMilestone createMilestone(String title, String description) throws IOException
IOException
public GHDeployKey addDeployKey(String title, String key) throws IOException
IOException
public List<GHDeployKey> getDeployKeys() throws IOException
IOException
public GHRepository getSource() throws IOException
GHRepository
that points to the root repository where this repository is forked
(indirectly or directly) from. Otherwise null.IOException
getParent()
public GHRepository getParent() throws IOException
getParent()
until it returns null, that
is getSource()
.GHRepository
that points to the repository where this repository is forked
directly from. Otherwise null.IOException
getSource()
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException
IOException
public GHSubscription getSubscription() throws IOException
IOException
public PagedIterable<GHRepository.Contributor> listContributors() throws IOException
IOException
public Reader renderMarkdown(String text, MarkdownMode mode) throws IOException
IOException
GitHub.renderMarkdown(String)
public GHNotificationStream listNotifications()
public GHRepositoryViewTraffic getViewTraffic() throws IOException
IOException
public GHRepositoryCloneTraffic getCloneTraffic() throws IOException
IOException
Copyright © 2018. All rights reserved.