org.kohsuke.github
Class GHRepository

java.lang.Object
  extended by org.kohsuke.github.GHRepository

public class GHRepository
extends Object

A repository on GitHub.

Author:
Kohsuke Kawaguchi

Constructor Summary
GHRepository()
           
 
Method Summary
 void addCollaborators(Collection<GHUser> users)
           
 void addCollaborators(GHUser... users)
           
 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.
 GHMilestone createMilestone(String title, String description)
           
 GHHook createWebHook(URL url)
           
 GHHook createWebHook(URL url, Collection<GHEvent> events)
           
 void delete()
          Deletes this repository.
 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.
 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.
 Date getCreatedAt()
           
 String getDescription()
           
 int getForks()
           
 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.
 List<GHIssue> getIssues(GHIssueState state)
           
 GHMilestone getMilestone(int number)
           
 Map<Integer,GHMilestone> getMilestones()
           
 String getName()
          Short repository name without the owner.
 int getOpenIssueCount()
           
 GHUser getOwner()
           
protected  String getOwnerName()
           
 Set<URL> getPostCommitHooks()
          Deprecated. Use getHooks() and createHook(String, Map, Collection, boolean)
 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()
           
 Set<GHTeam> getTeams()
          If this repository belongs to an organization, return a set of teams.
 String getUrl()
          URL of this repository, like 'http://github.com/kohsuke/jenkins'
 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 hasDownloads()
           
 int hashCode()
           
 boolean hasIssues()
           
 boolean hasWiki()
           
 boolean isFork()
           
 boolean isPrivate()
           
 void removeCollaborators(Collection<GHUser> users)
           
 void removeCollaborators(GHUser... users)
           
 void renameTo(String newName)
          Rename this repository.
 void setEmailServiceHook(String address)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GHRepository

public GHRepository()
Method Detail

getDescription

public String getDescription()

getHomepage

public String getHomepage()

getUrl

public String getUrl()
URL of this repository, like 'http://github.com/kohsuke/jenkins'


getGitTransportUrl

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


gitHttpTransportUrl

public String gitHttpTransportUrl()
Gets the HTTPS URL to this repository, such as "https://github.com/kohsuke/jenkins.git" This URL is read-only.


getName

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


getOwner

public GHUser getOwner()
                throws IOException
Throws:
IOException

getIssues

public List<GHIssue> getIssues(GHIssueState state)
                        throws IOException
Throws:
IOException

getOwnerName

protected String getOwnerName()

hasIssues

public boolean hasIssues()

hasWiki

public boolean hasWiki()

isFork

public boolean isFork()

getForks

public int getForks()

isPrivate

public boolean isPrivate()

hasDownloads

public boolean hasDownloads()

getWatchers

public int getWatchers()

getOpenIssueCount

public int getOpenIssueCount()

getPushedAt

public Date getPushedAt()

getCreatedAt

public Date getCreatedAt()

getCollaborators

@WithBridgeMethods(value=java.util.Set.class)
public GHPersonSet<GHUser> getCollaborators()
                                     throws IOException
Gets the collaborators on this repository. This set always appear to include the owner.

Throws:
IOException

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().

Throws:
IOException

getTeams

public Set<GHTeam> getTeams()
                     throws IOException
If this repository belongs to an organization, return a set of teams.

Throws:
IOException

addCollaborators

public void addCollaborators(GHUser... users)
                      throws IOException
Throws:
IOException

addCollaborators

public void addCollaborators(Collection<GHUser> users)
                      throws IOException
Throws:
IOException

removeCollaborators

public void removeCollaborators(GHUser... users)
                         throws IOException
Throws:
IOException

removeCollaborators

public void removeCollaborators(Collection<GHUser> users)
                         throws IOException
Throws:
IOException

setEmailServiceHook

public void setEmailServiceHook(String address)
                         throws IOException
Throws:
IOException

enableIssueTracker

public void enableIssueTracker(boolean v)
                        throws IOException
Enables or disables the issue tracker for this repository.

Throws:
IOException

enableWiki

public void enableWiki(boolean v)
                throws IOException
Enables or disables Wiki for this repository.

Throws:
IOException

delete

public void delete()
            throws IOException
Deletes this repository.

Throws:
IOException

fork

public GHRepository fork()
                  throws IOException
Forks this repository as your repository.

Returns:
Newly forked repository that belong to you.
Throws:
IOException

forkTo

public GHRepository forkTo(GHOrganization org)
                    throws IOException
Forks this repository into an organization.

Returns:
Newly forked repository that belong to you.
Throws:
IOException

renameTo

public void renameTo(String newName)
              throws IOException
Rename this repository.

Throws:
IOException

getPullRequest

public GHPullRequest getPullRequest(int i)
                             throws IOException
Retrieves a specified pull request.

Throws:
IOException

getPullRequests

public List<GHPullRequest> getPullRequests(GHIssueState state)
                                    throws IOException
Retrieves all the pull requests of a particular state.

Throws:
IOException

getHooks

public List<GHHook> getHooks()
                      throws IOException
Retrieves the currently configured hooks.

Throws:
IOException

getHook

public GHHook getHook(int id)
               throws IOException
Throws:
IOException

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.
Throws:
IOException

createWebHook

public GHHook createWebHook(URL url,
                            Collection<GHEvent> events)
                     throws IOException
Throws:
IOException

createWebHook

public GHHook createWebHook(URL url)
                     throws IOException
Throws:
IOException

getPostCommitHooks

public Set<URL> getPostCommitHooks()
Deprecated. Use getHooks() and createHook(String, Map, Collection, boolean)

Returns a set that represents the post-commit hook URLs. The returned set is live, and changes made to them are reflected to GitHub.


getBranches

public Map<String,GHBranch> getBranches()
                                 throws IOException
Gets branches by their names.

Throws:
IOException

getMilestones

public Map<Integer,GHMilestone> getMilestones()
                                       throws IOException
Throws:
IOException

getMilestone

public GHMilestone getMilestone(int number)
                         throws IOException
Throws:
IOException

createMilestone

public GHMilestone createMilestone(String title,
                                   String description)
                            throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012. All Rights Reserved.