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, 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) |
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) |
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) |
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.
|
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() |
PagedIterable<GHDeploymentStatus> |
getDeploymentStatuses(int id) |
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.
|
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 git@github.com: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
|
int |
getWatchers() |
String |
gitHttpTransportUrl()
Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git"
This URL is read-only.
|
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, getUpdatedAt, getUrl, toStringpublic GHDeploymentBuilder createDeployment(String ref)
public PagedIterable<GHDeploymentStatus> getDeploymentStatuses(int id)
public PagedIterable<GHDeployment> listDeployments(String sha, String ref, String task, String environment)
public GHDeploymentStatusBuilder createDeployStatus(int deploymentId, GHDeploymentState ghDeploymentState)
public String getDescription()
public String getHomepage()
public String getGitTransportUrl()
public String gitHttpTransportUrl()
public String getSvnUrl()
public String getMirrorUrl()
public String getSshUrl()
public URL getHtmlUrl()
GHObjectgetHtmlUrl in class GHObjectpublic String getName()
public String getFullName()
public boolean hasPullAccess()
public boolean hasPushAccess()
public boolean hasAdminAccess()
public String getLanguage()
public GHUser getOwner() throws IOException
IOExceptionpublic GHIssue getIssue(int id) throws IOException
IOExceptionpublic GHIssueBuilder createIssue(String title)
public List<GHIssue> getIssues(GHIssueState state) throws IOException
IOExceptionpublic List<GHIssue> getIssues(GHIssueState state, GHMilestone milestone) throws IOException
IOExceptionpublic 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 toIOExceptionpublic List<GHRelease> getReleases() throws IOException
listReleases()IOExceptionpublic GHRelease getLatestRelease() throws IOException
IOExceptionpublic PagedIterable<GHRelease> listReleases() throws IOException
IOExceptionpublic PagedIterable<GHTag> listTags() throws IOException
IOExceptionpublic Map<String,Long> listLanguages() throws IOException
IOExceptionpublic 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
IOExceptionpublic PagedIterable<GHUser> listCollaborators() throws IOException
IOExceptionpublic PagedIterable<GHUser> listAssignees() throws IOException
IOExceptionpublic boolean hasAssignee(GHUser u) throws IOException
IOExceptionpublic Set<String> getCollaboratorNames() throws IOException
getCollaborators().IOExceptionpublic 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 unknownIOExceptionpublic 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 unknownIOExceptionpublic Set<GHTeam> getTeams() throws IOException
IOExceptionpublic void addCollaborators(GHUser... users) throws IOException
IOExceptionpublic void addCollaborators(Collection<GHUser> users) throws IOException
IOExceptionpublic void removeCollaborators(GHUser... users) throws IOException
IOExceptionpublic void removeCollaborators(Collection<GHUser> users) throws IOException
IOExceptionpublic void setEmailServiceHook(String address) throws IOException
IOExceptionpublic void enableIssueTracker(boolean v)
throws IOException
IOExceptionpublic void enableWiki(boolean v)
throws IOException
IOExceptionpublic void enableDownloads(boolean v)
throws IOException
IOExceptionpublic void renameTo(String name) throws IOException
IOExceptionpublic void setDescription(String value) throws IOException
IOExceptionpublic void setHomepage(String value) throws IOException
IOExceptionpublic void setDefaultBranch(String value) throws IOException
IOExceptionpublic void delete()
throws IOException
IOExceptionpublic 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
IOExceptionpublic GHRepository forkTo(GHOrganization org) throws IOException
IOExceptionpublic GHPullRequest getPullRequest(int i) throws IOException
IOExceptionpublic List<GHPullRequest> getPullRequests(GHIssueState state) throws IOException
IOExceptionlistPullRequests(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.IOExceptionpublic List<GHHook> getHooks() throws IOException
IOExceptionpublic GHHook getHook(int id) throws IOException
IOExceptionpublic 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
IOExceptionpublic GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException
IOExceptionpublic 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 objectIOExceptionpublic 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 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.
IOExceptionreadBlob(String)public InputStream readBlob(String blobSha) throws IOException
IOExceptiongetBlob(String)public GHCommit getCommit(String sha1) throws IOException
IOExceptionpublic 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
IOExceptionpublic GHCommitStatus getLastCommitStatus(String sha1) throws IOException
IOExceptionpublic 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.IOExceptionpublic GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description) throws IOException
IOExceptioncreateCommitStatus(String, GHCommitState,String,String,String)public PagedIterable<GHEventInfo> listEvents() throws IOException
IOExceptionpublic PagedIterable<GHLabel> listLabels() throws IOException
IOExceptionpublic GHLabel getLabel(String name) throws IOException
IOExceptionpublic GHLabel createLabel(String name, String color) throws IOException
IOExceptionpublic 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.IOExceptionpublic GHHook createWebHook(URL url, Collection<GHEvent> events) throws IOException
IOExceptionpublic GHHook createWebHook(URL url) throws IOException
IOExceptionpublic Set<URL> getPostCommitHooks()
getHooks() and createHook(String, Map, Collection, boolean)public Map<String,GHBranch> getBranches() throws IOException
IOExceptionpublic GHBranch getBranch(String name) throws IOException
IOExceptionpublic Map<Integer,GHMilestone> getMilestones() throws IOException
listMilestones(GHIssueState)IOExceptionpublic PagedIterable<GHMilestone> listMilestones(GHIssueState state)
public GHMilestone getMilestone(int number) throws IOException
IOExceptionpublic GHContent getFileContent(String path) throws IOException
IOExceptionpublic GHContent getFileContent(String path, String ref) throws IOException
IOExceptionpublic List<GHContent> getDirectoryContent(String path) throws IOException
IOExceptionpublic List<GHContent> getDirectoryContent(String path, String ref) throws IOException
IOExceptionpublic GHContent getReadme() throws IOException
IOExceptionpublic GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException
IOExceptionpublic GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException
IOExceptionpublic GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException
IOExceptionpublic GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException
IOExceptionpublic GHMilestone createMilestone(String title, String description) throws IOException
IOExceptionpublic GHDeployKey addDeployKey(String title, String key) throws IOException
IOExceptionpublic List<GHDeployKey> getDeployKeys() throws IOException
IOExceptionpublic GHRepository getSource() throws IOException
GHRepository that points to the root repository where this repository is forked
(indirectly or directly) from. Otherwise null.IOExceptiongetParent()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.IOExceptiongetSource()public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException
IOExceptionpublic GHSubscription getSubscription() throws IOException
IOExceptionpublic PagedIterable<GHRepository.Contributor> listContributors() throws IOException
IOExceptionpublic Reader renderMarkdown(String text, MarkdownMode mode) throws IOException
IOExceptionGitHub.renderMarkdown(String)public GHNotificationStream listNotifications()
Copyright © 2017. All rights reserved.