Class GHRepository


  • public class GHRepository
    extends GHObject
    A repository on GitHub.
    Author:
    Kohsuke Kawaguchi
    • Constructor Detail

      • GHRepository

        public GHRepository()
    • Method Detail

      • createDeployment

        public GHDeploymentBuilder createDeployment​(String ref)
        Create deployment gh deployment builder.
        Parameters:
        ref - the ref
        Returns:
        the gh deployment builder
      • listDeployments

        public PagedIterable<GHDeployment> listDeployments​(String sha,
                                                           String ref,
                                                           String task,
                                                           String environment)
        List deployments paged iterable.
        Parameters:
        sha - the sha
        ref - the ref
        task - the task
        environment - the environment
        Returns:
        the paged iterable
      • createDeployStatus

        @Deprecated
        public GHDeploymentStatusBuilder createDeployStatus​(int deploymentId,
                                                            GHDeploymentState ghDeploymentState)
                                                     throws IOException
        Deprecated.
        Use getDeployment(deploymentId).createStatus(ghDeploymentState)
        Gets deploy status.
        Parameters:
        deploymentId - the deployment id
        ghDeploymentState - the gh deployment state
        Returns:
        the deploy status
        Throws:
        IOException - the io exception
      • getDescription

        public String getDescription()
        Gets description.
        Returns:
        the description
      • getHomepage

        public String getHomepage()
        Gets homepage.
        Returns:
        the homepage
      • getGitTransportUrl

        public String getGitTransportUrl()
        Gets the git:// URL to this repository, such as "git://github.com/kohsuke/jenkins.git" This URL is read-only.
        Returns:
        the git transport url
      • getHttpTransportUrl

        public String getHttpTransportUrl()
        Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git" This URL is read-only.
        Returns:
        the http transport url
      • getSvnUrl

        public String getSvnUrl()
        Gets the Subversion URL to access this repository: https://github.com/rails/rails
        Returns:
        the svn url
      • getMirrorUrl

        public String getMirrorUrl()
        Gets the Mirror URL to access this repository: https://github.com/apache/tomee mirrored from git://git.apache.org/tomee.git
        Returns:
        the mirror url
      • getSshUrl

        public String getSshUrl()
        Gets the SSH URL to access this repository, such as git@github.com:rails/rails.git
        Returns:
        the ssh url
      • getHtmlUrl

        public URL getHtmlUrl()
        Description copied from class: GHObject
        Gets html url.
        Specified by:
        getHtmlUrl in class GHObject
        Returns:
        URL of this object for humans, which renders some HTML.
      • getName

        public String getName()
        Short repository name without the owner. For example 'jenkins' in case of http://github.com/jenkinsci/jenkins
        Returns:
        the name
      • getFullName

        public String getFullName()
        Full repository name including the owner or organization. For example 'jenkinsci/jenkins' in case of http://github.com/jenkinsci/jenkins
        Returns:
        the full name
      • hasPullAccess

        public boolean hasPullAccess()
        Has pull access boolean.
        Returns:
        the boolean
      • hasPushAccess

        public boolean hasPushAccess()
        Has push access boolean.
        Returns:
        the boolean
      • hasAdminAccess

        public boolean hasAdminAccess()
        Has admin access boolean.
        Returns:
        the boolean
      • getLanguage

        public String getLanguage()
        Gets the primary programming language.
        Returns:
        the language
      • getIssue

        public GHIssue getIssue​(int id)
                         throws IOException
        Gets issue.
        Parameters:
        id - the id
        Returns:
        the issue
        Throws:
        IOException - the io exception
      • createIssue

        public GHIssueBuilder createIssue​(String title)
        Create issue gh issue builder.
        Parameters:
        title - the title
        Returns:
        the gh issue builder
      • listIssues

        public PagedIterable<GHIssue> listIssues​(GHIssueState state)
        Lists up all the issues in this repository.
        Parameters:
        state - the state
        Returns:
        the paged iterable
      • createRelease

        public GHReleaseBuilder createRelease​(String tag)
        Create release gh release builder.
        Parameters:
        tag - the tag
        Returns:
        the gh release builder
      • createRef

        public GHRef createRef​(String name,
                               String sha)
                        throws IOException
        Creates a named ref, such as tag, branch, etc.
        Parameters:
        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 to
        Returns:
        the gh ref
        Throws:
        IOException - the io exception
      • getRelease

        public GHRelease getRelease​(long id)
                             throws IOException
        Gets release.
        Parameters:
        id - the id
        Returns:
        the release
        Throws:
        IOException - the io exception
      • getReleaseByTagName

        public GHRelease getReleaseByTagName​(String tag)
                                      throws IOException
        Gets release by tag name.
        Parameters:
        tag - the tag
        Returns:
        the release by tag name
        Throws:
        IOException - the io exception
      • getLatestRelease

        public GHRelease getLatestRelease()
                                   throws IOException
        Gets latest release.
        Returns:
        the latest release
        Throws:
        IOException - the io exception
      • listLanguages

        public Map<String,​Long> listLanguages()
                                             throws IOException
        List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. { "C": 78769, "Python": 7769 }
        Returns:
        the map
        Throws:
        IOException - the io exception
      • getOwnerName

        public String getOwnerName()
        Gets owner name.
        Returns:
        the owner name
      • hasIssues

        public boolean hasIssues()
        Has issues boolean.
        Returns:
        the boolean
      • hasProjects

        public boolean hasProjects()
        Has projects boolean.
        Returns:
        the boolean
      • hasWiki

        public boolean hasWiki()
        Has wiki boolean.
        Returns:
        the boolean
      • isFork

        public boolean isFork()
        Is fork boolean.
        Returns:
        the boolean
      • isArchived

        public boolean isArchived()
        Is archived boolean.
        Returns:
        the boolean
      • isAllowSquashMerge

        public boolean isAllowSquashMerge()
        Is allow squash merge boolean.
        Returns:
        the boolean
      • isAllowMergeCommit

        public boolean isAllowMergeCommit()
        Is allow merge commit boolean.
        Returns:
        the boolean
      • isAllowRebaseMerge

        public boolean isAllowRebaseMerge()
        Is allow rebase merge boolean.
        Returns:
        the boolean
      • isDeleteBranchOnMerge

        public boolean isDeleteBranchOnMerge()
        Automatically deleting head branches when pull requests are merged
        Returns:
        the boolean
      • getForks

        @Deprecated
        public int getForks()
        Deprecated.
        use getForksCount() instead
        Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks, and so on.
        Returns:
        the forks
      • getForksCount

        public int getForksCount()
        Returns the number of all forks of this repository. This not only counts direct forks, but also forks of forks, and so on.
        Returns:
        the forks
      • getStargazersCount

        public int getStargazersCount()
        Gets stargazers count.
        Returns:
        the stargazers count
      • isPrivate

        public boolean isPrivate()
        Is private boolean.
        Returns:
        the boolean
      • isTemplate

        @Deprecated
        @Preview
        public boolean isTemplate()
        Deprecated.
        Is template boolean.
        Returns:
        the boolean
      • hasDownloads

        public boolean hasDownloads()
        Has downloads boolean.
        Returns:
        the boolean
      • hasPages

        public boolean hasPages()
        Has pages boolean.
        Returns:
        the boolean
      • getWatchersCount

        public int getWatchersCount()
        Gets the count of watchers.
        Returns:
        the watchers
      • getOpenIssueCount

        public int getOpenIssueCount()
        Gets open issue count.
        Returns:
        the open issue count
      • getSubscribersCount

        public int getSubscribersCount()
        Gets subscribers count.
        Returns:
        the subscribers count
      • getPushedAt

        public Date getPushedAt()
        Gets pushed at.
        Returns:
        null if the repository was never pushed at.
      • getDefaultBranch

        public String getDefaultBranch()
        Returns the primary branch you'll configure in the "Admin > Options" config page.
        Returns:
        This field is null until the user explicitly configures the master branch.
      • getSize

        public int getSize()
        Gets size.
        Returns:
        the size
      • listCollaborators

        public PagedIterable<GHUser> listCollaborators()
                                                throws IOException
        Lists up the collaborators on this repository.
        Returns:
        Users paged iterable
        Throws:
        IOException - the io exception
      • hasAssignee

        public boolean hasAssignee​(GHUser u)
                            throws IOException
        Checks if the given user is an assignee for this repository.
        Parameters:
        u - the u
        Returns:
        the boolean
        Throws:
        IOException - the io exception
      • getCollaboratorNames

        public Set<String> getCollaboratorNames()
                                         throws IOException
        Gets the names of the collaborators on this repository. This method deviates from the principle of this library but it works a lot faster than getCollaborators().
        Returns:
        the collaborator names
        Throws:
        IOException - the io exception
      • getPermission

        public GHPermissionType getPermission​(GHUser u)
                                       throws IOException
        Obtain permission for a given user in this repository.
        Parameters:
        u - the user
        Returns:
        the permission
        Throws:
        IOException - the io exception
      • getTeams

        public Set<GHTeam> getTeams()
                             throws IOException
        If this repository belongs to an organization, return a set of teams.
        Returns:
        the teams
        Throws:
        IOException - the io exception
      • addCollaborators

        public void addCollaborators​(GHUser... users)
                              throws IOException
        Add collaborators.
        Parameters:
        users - the users
        Throws:
        IOException - the io exception
      • removeCollaborators

        public void removeCollaborators​(GHUser... users)
                                 throws IOException
        Remove collaborators.
        Parameters:
        users - the users
        Throws:
        IOException - the io exception
      • removeCollaborators

        public void removeCollaborators​(Collection<GHUser> users)
                                 throws IOException
        Remove collaborators.
        Parameters:
        users - the users
        Throws:
        IOException - the io exception
      • setEmailServiceHook

        public void setEmailServiceHook​(String address)
                                 throws IOException
        Sets email service hook.
        Parameters:
        address - the address
        Throws:
        IOException - the io exception
      • enableIssueTracker

        public void enableIssueTracker​(boolean v)
                                throws IOException
        Enables or disables the issue tracker for this repository.
        Parameters:
        v - the v
        Throws:
        IOException - the io exception
      • enableProjects

        public void enableProjects​(boolean v)
                            throws IOException
        Enables or disables projects for this repository.
        Parameters:
        v - the v
        Throws:
        IOException - the io exception
      • enableWiki

        public void enableWiki​(boolean v)
                        throws IOException
        Enables or disables Wiki for this repository.
        Parameters:
        v - the v
        Throws:
        IOException - the io exception
      • enableDownloads

        public void enableDownloads​(boolean v)
                             throws IOException
        Enable downloads.
        Parameters:
        v - the v
        Throws:
        IOException - the io exception
      • renameTo

        public void renameTo​(String name)
                      throws IOException
        Rename this repository.
        Parameters:
        name - the name
        Throws:
        IOException - the io exception
      • setDescription

        public void setDescription​(String value)
                            throws IOException
        Sets description.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • setHomepage

        public void setHomepage​(String value)
                         throws IOException
        Sets homepage.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • setDefaultBranch

        public void setDefaultBranch​(String value)
                              throws IOException
        Sets default branch.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • setPrivate

        public void setPrivate​(boolean value)
                        throws IOException
        Sets private.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • allowSquashMerge

        public void allowSquashMerge​(boolean value)
                              throws IOException
        Allow squash merge.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • allowMergeCommit

        public void allowMergeCommit​(boolean value)
                              throws IOException
        Allow merge commit.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • allowRebaseMerge

        public void allowRebaseMerge​(boolean value)
                              throws IOException
        Allow rebase merge.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • deleteBranchOnMerge

        public void deleteBranchOnMerge​(boolean value)
                                 throws IOException
        After pull requests are merged, you can have head branches deleted automatically.
        Parameters:
        value - the value
        Throws:
        IOException - the io exception
      • delete

        public void delete()
                    throws IOException
        Deletes this repository.
        Throws:
        IOException - the io exception
      • archive

        public void archive()
                     throws IOException
        Will archive and this repository as read-only. When a repository is archived, any operation that can change its state is forbidden. This applies symmetrically if trying to unarchive it.

        When you try to do any operation that modifies a read-only repository, it returns the response:

         org.kohsuke.github.HttpException: {
             "message":"Repository was archived so is read-only.",
             "documentation_url":"https://developer.github.com/v3/repos/#edit"
         }
         
        Throws:
        IOException - In case of any networking error or error from the server.
      • fork

        public GHRepository fork()
                          throws IOException
        Forks this repository as your repository.
        Returns:
        Newly forked repository that belong to you.
        Throws:
        IOException - the io exception
      • forkTo

        public GHRepository forkTo​(GHOrganization org)
                            throws IOException
        Forks this repository into an organization.
        Parameters:
        org - the org
        Returns:
        Newly forked repository that belong to you.
        Throws:
        IOException - the io exception
      • getPullRequest

        public GHPullRequest getPullRequest​(int i)
                                     throws IOException
        Retrieves a specified pull request.
        Parameters:
        i - the
        Returns:
        the pull request
        Throws:
        IOException - the io exception
      • queryPullRequests

        public GHPullRequestQueryBuilder queryPullRequests()
        Retrieves pull requests.
        Returns:
        the gh pull request query builder
      • createPullRequest

        public GHPullRequest createPullRequest​(String title,
                                               String head,
                                               String base,
                                               String body)
                                        throws IOException
        Creates a new pull request.
        Parameters:
        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.
        Returns:
        the gh pull request
        Throws:
        IOException - the io exception
      • createPullRequest

        public GHPullRequest createPullRequest​(String title,
                                               String head,
                                               String base,
                                               String body,
                                               boolean maintainerCanModify)
                                        throws IOException
        Creates a new pull request. Maintainer's permissions aware.
        Parameters:
        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.
        maintainerCanModify - Indicates whether maintainers can modify the pull request.
        Returns:
        the gh pull request
        Throws:
        IOException - the io exception
      • createPullRequest

        public GHPullRequest createPullRequest​(String title,
                                               String head,
                                               String base,
                                               String body,
                                               boolean maintainerCanModify,
                                               boolean draft)
                                        throws IOException
        Creates a new pull request. Maintainer's permissions and draft aware.
        Parameters:
        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.
        maintainerCanModify - Indicates whether maintainers can modify the pull request.
        draft - Indicates whether to create a draft pull request or not.
        Returns:
        the gh pull request
        Throws:
        IOException - the io exception
      • getHooks

        public List<GHHook> getHooks()
                              throws IOException
        Retrieves the currently configured hooks.
        Returns:
        the hooks
        Throws:
        IOException - the io exception
      • getHook

        public GHHook getHook​(int id)
                       throws IOException
        Gets hook.
        Parameters:
        id - the id
        Returns:
        the hook
        Throws:
        IOException - the io exception
      • getCompare

        public GHCompare getCompare​(String id1,
                                    String id2)
                             throws IOException
        Gets a comparison between 2 points in the repository. This would be similar to calling git log id1...id2 against a local repository.
        Parameters:
        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 name
        id2 - an identifier for the second point to compare to. Can be the same as the first point.
        Returns:
        the comparison output
        Throws:
        IOException - on failure communicating with GitHub
      • getRefs

        public GHRef[] getRefs()
                        throws IOException
        Retrieves all refs for the github repository.
        Returns:
        an array of GHRef elements coresponding with the refs in the remote repository.
        Throws:
        IOException - on failure communicating with GitHub
      • listRefs

        public PagedIterable<GHRef> listRefs()
                                      throws IOException
        Retrieves all refs for the github repository.
        Returns:
        paged iterable of all refs
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid ref type being requested
      • getRefs

        public GHRef[] getRefs​(String refType)
                        throws IOException
        Retrieves all refs of the given type for the current GitHub repository.
        Parameters:
        refType - the type of reg to search for e.g. tags or commits
        Returns:
        an array of all refs matching the request type
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid ref type being requested
      • listRefs

        public PagedIterable<GHRef> listRefs​(String refType)
                                      throws IOException
        Retrieves all refs of the given type for the current GitHub repository.
        Parameters:
        refType - the type of reg to search for e.g. tags or commits
        Returns:
        paged iterable of all refs of the specified type
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid ref type being requested
      • getRef

        public GHRef getRef​(String refName)
                     throws IOException
        Retrive a ref of the given type for the current GitHub repository.
        Parameters:
        refName - eg: heads/branch
        Returns:
        refs matching the request type
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid ref type being requested
      • getTree

        public GHTree getTree​(String sha)
                       throws IOException
        Retrive a tree of the given type for the current GitHub repository.
        Parameters:
        sha - sha number or branch name ex: "master"
        Returns:
        refs matching the request type
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid tree type being requested
      • createTree

        public GHTreeBuilder createTree()
        Create tree gh tree builder.
        Returns:
        the gh tree builder
      • getTreeRecursive

        public GHTree getTreeRecursive​(String sha,
                                       int recursive)
                                throws IOException
        Retrieves the tree for the current GitHub repository, recursively as described in here: https://developer.github.com/v3/git/trees/#get-a-tree-recursively
        Parameters:
        sha - sha number or branch name ex: "master"
        recursive - use 1
        Returns:
        the tree recursive
        Throws:
        IOException - on failure communicating with GitHub, potentially due to an invalid tree type being requested
      • getBlob

        public GHBlob getBlob​(String blobSha)
                       throws IOException
        Obtains the metadata & the content of a blob.

        This method retrieves the whole content in memory, so beware when you are dealing with large BLOB.

        Parameters:
        blobSha - the blob sha
        Returns:
        the blob
        Throws:
        IOException - the io exception
        See Also:
        Get a blob, #readBlob(String)
      • createBlob

        public GHBlobBuilder createBlob()
        Create blob gh blob builder.
        Returns:
        the gh blob builder
      • getCommit

        public GHCommit getCommit​(String sha1)
                           throws IOException
        Gets a commit object in this repository.
        Parameters:
        sha1 - the sha 1
        Returns:
        the commit
        Throws:
        IOException - the io exception
      • createCommit

        public GHCommitBuilder createCommit()
        Create commit gh commit builder.
        Returns:
        the gh commit builder
      • listCommits

        public PagedIterable<GHCommit> listCommits()
        Lists all the commits.
        Returns:
        the paged iterable
      • queryCommits

        public GHCommitQueryBuilder queryCommits()
        Search commits by specifying filters through a builder pattern.
        Returns:
        the gh commit query builder
      • listCommitComments

        public PagedIterable<GHCommitComment> listCommitComments()
        Lists up all the commit comments in this repository.
        Returns:
        the paged iterable
      • getLicense

        public GHLicense getLicense()
                             throws IOException
        Gets the basic license details for the repository.

        Returns:
        null if there's no license.
        Throws:
        IOException - as usual but also if you don't use the preview connector
      • getLicenseContent

        public GHContent getLicenseContent()
                                    throws IOException
        Retrieves the contents of the repository's license file - makes an additional API call

        Returns:
        details regarding the license contents, or null if there's no license.
        Throws:
        IOException - as usual but also if you don't use the preview connector
      • listCommitStatuses

        public PagedIterable<GHCommitStatus> listCommitStatuses​(String sha1)
                                                         throws IOException
        /** Lists all the commit statuses attached to the given commit, newer ones first.
        Parameters:
        sha1 - the sha 1
        Returns:
        the paged iterable
        Throws:
        IOException - the io exception
      • getLastCommitStatus

        public GHCommitStatus getLastCommitStatus​(String sha1)
                                           throws IOException
        Gets the last status of this commit, which is what gets shown in the UI.
        Parameters:
        sha1 - the sha 1
        Returns:
        the last commit status
        Throws:
        IOException - the io exception
      • createCommitStatus

        public GHCommitStatus createCommitStatus​(String sha1,
                                                 GHCommitState state,
                                                 String targetUrl,
                                                 String description,
                                                 String context)
                                          throws IOException
        Creates a commit status
        Parameters:
        sha1 - the sha 1
        state - the state
        targetUrl - Optional parameter that points to the URL that has more details.
        description - Optional short description.
        context - Optinal commit status context.
        Returns:
        the gh commit status
        Throws:
        IOException - the io exception
      • listLabels

        public PagedIterable<GHLabel> listLabels()
                                          throws IOException
        Lists labels in this repository.

        https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository

        Returns:
        the paged iterable
        Throws:
        IOException - the io exception
      • createLabel

        public GHLabel createLabel​(String name,
                                   String color)
                            throws IOException
        Create label gh label.
        Parameters:
        name - the name
        color - the color
        Returns:
        the gh label
        Throws:
        IOException - the io exception
      • createLabel

        public GHLabel createLabel​(String name,
                                   String color,
                                   String description)
                            throws IOException
        Description is still in preview.
        Parameters:
        name - the name
        color - the color
        description - the description
        Returns:
        gh label
        Throws:
        IOException - the io exception
      • listInvitations

        public PagedIterable<GHInvitation> listInvitations()
        Lists all the invitations.
        Returns:
        the paged iterable
      • listSubscribers

        public PagedIterable<GHUser> listSubscribers()
        Lists all the subscribers (aka watchers.)

        https://developer.github.com/v3/activity/watching/

        Returns:
        the paged iterable
      • listStargazers

        public PagedIterable<GHUser> listStargazers()
        Lists all the users who have starred this repo based on the old version of the API. For additional information, like date when the repository was starred, see listStargazers2()
        Returns:
        the paged iterable
      • listStargazers2

        public 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. For compatibility with the old API see listStargazers()
        Returns:
        the paged iterable
      • createHook

        public GHHook createHook​(String name,
                                 Map<String,​String> config,
                                 Collection<GHEvent> events,
                                 boolean active)
                          throws IOException
        See https://api.github.com/hooks for possible names and their configuration scheme. TODO: produce type-safe binding
        Parameters:
        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.
        active - the active
        Returns:
        the gh hook
        Throws:
        IOException - the io exception
      • createWebHook

        public GHHook createWebHook​(URL url)
                             throws IOException
        Create web hook gh hook.
        Parameters:
        url - the url
        Returns:
        the gh hook
        Throws:
        IOException - the io exception
      • listMilestones

        public PagedIterable<GHMilestone> listMilestones​(GHIssueState state)
        Lists up all the milestones in this repository.
        Parameters:
        state - the state
        Returns:
        the paged iterable
      • getMilestone

        public GHMilestone getMilestone​(int number)
                                 throws IOException
        Gets milestone.
        Parameters:
        number - the number
        Returns:
        the milestone
        Throws:
        IOException - the io exception
      • getFileContent

        public GHContent getFileContent​(String path)
                                 throws IOException
        Gets file content.
        Parameters:
        path - the path
        Returns:
        the file content
        Throws:
        IOException - the io exception
      • getFileContent

        public GHContent getFileContent​(String path,
                                        String ref)
                                 throws IOException
        Gets file content.
        Parameters:
        path - the path
        ref - the ref
        Returns:
        the file content
        Throws:
        IOException - the io exception
      • getDirectoryContent

        public List<GHContent> getDirectoryContent​(String path)
                                            throws IOException
        Gets directory content.
        Parameters:
        path - the path
        Returns:
        the directory content
        Throws:
        IOException - the io exception
      • getDirectoryContent

        public List<GHContent> getDirectoryContent​(String path,
                                                   String ref)
                                            throws IOException
        Gets directory content.
        Parameters:
        path - the path
        ref - the ref
        Returns:
        the directory content
        Throws:
        IOException - the io exception
      • getReadme

        public GHContent getReadme()
                            throws IOException
        https://developer.github.com/v3/repos/contents/#get-the-readme
        Returns:
        the readme
        Throws:
        IOException - the io exception
      • createContent

        public GHContentBuilder createContent()
        Creates a new content, or update an existing content.
        Returns:
        the gh content builder
      • createMilestone

        public GHMilestone createMilestone​(String title,
                                           String description)
                                    throws IOException
        Create milestone gh milestone.
        Parameters:
        title - the title
        description - the description
        Returns:
        the gh milestone
        Throws:
        IOException - the io exception
      • addDeployKey

        public GHDeployKey addDeployKey​(String title,
                                        String key)
                                 throws IOException
        Add deploy key gh deploy key.
        Parameters:
        title - the title
        key - the key
        Returns:
        the gh deploy key
        Throws:
        IOException - the io exception
      • getSource

        public GHRepository getSource()
                               throws IOException
        Forked repositories have a 'source' attribute that specifies the ultimate source of the forking chain.
        Returns:
        GHRepository that points to the root repository where this repository is forked (indirectly or directly) from. Otherwise null.
        Throws:
        IOException - the io exception
        See Also:
        #getParent()
      • getParent

        public GHRepository getParent()
                               throws IOException
        Forked repositories have a 'parent' attribute that specifies the repository this repository is directly forked from. If we keep traversing getParent() until it returns null, that is getSource().
        Returns:
        GHRepository that points to the repository where this repository is forked directly from. Otherwise null.
        Throws:
        IOException - the io exception
        See Also:
        #getSource()
      • subscribe

        public GHSubscription subscribe​(boolean subscribed,
                                        boolean ignored)
                                 throws IOException
        Subscribes to this repository to get notifications.
        Parameters:
        subscribed - the subscribed
        ignored - the ignored
        Returns:
        the gh subscription
        Throws:
        IOException - the io exception
      • getSubscription

        public GHSubscription getSubscription()
                                       throws IOException
        Returns the current subscription.
        Returns:
        null if no subscription exists.
        Throws:
        IOException - the io exception
      • getStatistics

        public GHRepositoryStatistics getStatistics()
        Returns the statistics for this repository.
        Returns:
        the statistics
      • createProject

        public GHProject createProject​(String name,
                                       String body)
                                throws IOException
        Create a project for this repository.
        Parameters:
        name - the name
        body - the body
        Returns:
        the gh project
        Throws:
        IOException - the io exception
      • listNotifications

        public GHNotificationStream listNotifications()
        List all the notifications in a repository for the current user.
        Returns:
        the gh notification stream
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • listIssueEvents

        public PagedIterable<GHIssueEvent> listIssueEvents()
                                                    throws IOException
        Get all issue events for this repository. See https://developer.github.com/v3/issues/events/#list-events-for-a-repository
        Returns:
        the paged iterable
        Throws:
        IOException - the io exception
      • getIssueEvent

        public GHIssueEvent getIssueEvent​(long id)
                                   throws IOException
        Get a single issue event. See https://developer.github.com/v3/issues/events/#get-a-single-event
        Parameters:
        id - the id
        Returns:
        the issue event
        Throws:
        IOException - the io exception
      • listTopics

        public List<String> listTopics()
                                throws IOException
        Return the topics for this repository. See https://developer.github.com/v3/repos/#list-all-topics-for-a-repository
        Returns:
        the list
        Throws:
        IOException - the io exception
      • setTopics

        public void setTopics​(List<String> topics)
                       throws IOException
        Set the topics for this repository. See https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository
        Parameters:
        topics - the topics
        Throws:
        IOException - the io exception
      • createTag

        public GHTagObject createTag​(String tag,
                                     String message,
                                     String object,
                                     String type)
                              throws IOException
        Create a tag. See https://developer.github.com/v3/git/tags/#create-a-tag-object
        Parameters:
        tag - The tag's name.
        message - The tag message.
        object - The SHA of the git object this is tagging.
        type - The type of the object we're tagging: "commit", "tree" or "blob".
        Returns:
        The newly created tag.
        Throws:
        IOException - The IO exception.