Package org.kohsuke.github
Class GHOrganization
- java.lang.Object
-
- org.kohsuke.github.GHObject
-
- org.kohsuke.github.GHPerson
-
- org.kohsuke.github.GHOrganization
-
public class GHOrganization extends GHPerson
The type GHOrganization.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGHOrganization.PermissionThe enum Permission.static classGHOrganization.RepositoryRoleRepository permissions (roles) for teams and collaborators.static classGHOrganization.RoleMember's role in an organization.
-
Field Summary
-
Fields inherited from class org.kohsuke.github.GHPerson
avatar_url, bio, blog, company, email, followers, following, hireable, html_url, location, login, name, public_gists, public_repos, site_admin, total_private_repos, twitter_username, type
-
Fields inherited from class org.kohsuke.github.GHObject
responseHeaderFields
-
-
Constructor Summary
Constructors Constructor Description GHOrganization()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(GHUser user, GHOrganization.Role role)Adds (invites) a user to the organization.booleanareOrganizationProjectsEnabled()Are projects enabled for organization boolean.voidconceal(GHUser u)Conceals the membership.GHHookcreateHook(String name, Map<String,String> config, Collection<GHEvent> events, boolean active)See https://api.github.com/hooks for possible names and their configuration scheme.GHProjectcreateProject(String name, String body)Creates a project for the organization.GHCreateRepositoryBuildercreateRepository(String name)Starts a builder that creates a new repository.GHRepositorycreateRepository(String name, String description, String homepage, String team, boolean isPublic)Deprecated.UsecreateRepository(String)that uses a builder pattern to let you control every aspect.GHRepositorycreateRepository(String name, String description, String homepage, GHTeam team, boolean isPublic)Deprecated.UsecreateRepository(String)that uses a builder pattern to let you control every aspect.GHTeamBuildercreateTeam(String name)Starts a builder that creates a new team.GHTeamcreateTeam(String name, Collection<GHRepository> repositories)Deprecated.UsecreateTeam(String)that uses a builder pattern to let you control every aspect.GHTeamcreateTeam(String name, GHOrganization.Permission p, Collection<GHRepository> repositories)Deprecated.https://developer.github.com/v3/teams/#create-team deprecates permission field usecreateTeam(String)GHTeamcreateTeam(String name, GHOrganization.Permission p, GHRepository... repositories)Deprecated.https://developer.github.com/v3/teams/#create-team deprecates permission field usecreateTeam(String)GHTeamcreateTeam(String name, GHRepository... repositories)Deprecated.UsecreateTeam(String)that uses a builder pattern to let you control every aspect.GHHookcreateWebHook(URL url)Create web hook gh hook.GHHookcreateWebHook(URL url, Collection<GHEvent> events)Create web hook gh hook.voiddeleteHook(int id)Deletes hook.voidenableOrganizationProjects(boolean newStatus)Sets organization projects enabled status boolean.GHHookgetHook(int id)Gets hook.List<GHHook>getHooks()Retrieves the currently configured hooks.List<GHUser>getMembers()Deprecated.uselistMembers()List<GHPullRequest>getPullRequests()Gets all the open pull requests in this organization.List<GHRepository>getRepositoriesWithOpenPullRequests()List up repositories that has some open pull requests.GitHubgetRoot()Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.GHTeamgetTeam(int teamId)Deprecated.UsegetTeam(long)GHTeamgetTeam(long teamId)Gets a single team by ID.GHTeamgetTeamByName(String name)Finds a team that has the given name in itsGHTeam.getName().GHTeamgetTeamBySlug(String slug)Finds a team that has the given slug in itsGHTeam.getSlug().Map<String,GHTeam>getTeams()Teams by their names.booleanhasMember(GHUser user)Checks if this organization has the specified user as a member.booleanhasPublicMember(GHUser user)Checks if this organization has the specified user as a public member.PagedIterable<GHEventInfo>listEvents()Lists events performed by a user (this includes private events if the caller is authenticated.PagedIterable<GHUser>listMembers()All the members of this organization.PagedIterable<GHUser>listMembersWithFilter(String filter)List members with filter paged iterable.PagedIterable<GHUser>listMembersWithRole(String role)List members with specified role paged iterable.PagedIterable<GHUser>listOutsideCollaborators()All the outside collaborators of this organization.PagedIterable<GHUser>listOutsideCollaboratorsWithFilter(String filter)List outside collaborators with filter paged iterable.PagedIterable<GHProject>listProjects()Returns all open projects for the organization.PagedIterable<GHProject>listProjects(GHProject.ProjectStateFilter status)Returns the projects for this organization.PagedIterable<GHUser>listPublicMembers()All the public members of this organization.PagedIterable<GHRepository>listRepositories(int pageSize)Lists up all the repositories using the specified page size.PagedIterable<GHTeam>listTeams()List up all the teams.voidpublicize(GHUser u)Publicizes the membership.voidremove(GHUser user)Remove a member of the organisation - which will remove them from all teams, and remove their access to the organization’s repositories.-
Methods inherited from class org.kohsuke.github.GHPerson
getAvatarUrl, getBlog, getCompany, getCreatedAt, getEmail, getFollowersCount, getFollowingCount, getGravatarId, getHtmlUrl, getLocation, getLogin, getName, getPublicGistCount, getPublicRepoCount, getRepositories, getRepository, getTotalPrivateRepoCount, getTwitterUsername, getType, getUpdatedAt, isSiteAdmin, iterateRepositories, listRepositories, populate
-
Methods inherited from class org.kohsuke.github.GHObject
getId, getNodeId, getResponseHeaderFields, getUrl, setResponseHeaderFields, toString
-
-
-
-
Method Detail
-
createRepository
@Deprecated public GHRepository createRepository(String name, String description, String homepage, String team, boolean isPublic) throws IOException
Deprecated.UsecreateRepository(String)that uses a builder pattern to let you control every aspect.Creates a new repository.- Parameters:
name- the namedescription- the descriptionhomepage- the homepageteam- the teamisPublic- the is public- Returns:
- Newly created repository.
- Throws:
IOException- the io exception
-
createRepository
@Deprecated public GHRepository createRepository(String name, String description, String homepage, GHTeam team, boolean isPublic) throws IOException
Deprecated.UsecreateRepository(String)that uses a builder pattern to let you control every aspect.Create repository gh repository.- Parameters:
name- the namedescription- the descriptionhomepage- the homepageteam- the teamisPublic- the is public- Returns:
- the gh repository
- Throws:
IOException- the io exception
-
createRepository
public GHCreateRepositoryBuilder createRepository(String name)
Starts a builder that creates a new repository.You use the returned builder to set various properties, then call
GHCreateRepositoryBuilder.create()to finally create a repository.- Parameters:
name- the name- Returns:
- the gh create repository builder
-
getTeams
public Map<String,GHTeam> getTeams() throws IOException
Teams by their names.- Returns:
- the teams
- Throws:
IOException- the io exception
-
listTeams
public PagedIterable<GHTeam> listTeams() throws IOException
List up all the teams.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
getTeam
@Deprecated public GHTeam getTeam(int teamId) throws IOException
Deprecated.UsegetTeam(long)Gets a single team by ID.- Parameters:
teamId- id of the team that we want to query for- Returns:
- the team
- Throws:
IOException- the io exception
-
getTeam
public GHTeam getTeam(long teamId) throws IOException
Gets a single team by ID.- Parameters:
teamId- id of the team that we want to query for- Returns:
- the team
- Throws:
IOException- the io exception- See Also:
- documentation
-
getTeamByName
public GHTeam getTeamByName(String name) throws IOException
Finds a team that has the given name in itsGHTeam.getName().- Parameters:
name- the name- Returns:
- the team by name
- Throws:
IOException- the io exception
-
getTeamBySlug
public GHTeam getTeamBySlug(String slug) throws IOException
Finds a team that has the given slug in itsGHTeam.getSlug().- Parameters:
slug- the slug- Returns:
- the team by slug
- Throws:
IOException- the io exception- See Also:
- documentation
-
add
public void add(GHUser user, GHOrganization.Role role) throws IOException
Adds (invites) a user to the organization.- Parameters:
user- the userrole- the role- Throws:
IOException- the io exception- See Also:
- documentation
-
hasMember
public boolean hasMember(GHUser user)
Checks if this organization has the specified user as a member.- Parameters:
user- the user- Returns:
- the boolean
-
remove
public void remove(GHUser user) throws IOException
Remove a member of the organisation - which will remove them from all teams, and remove their access to the organization’s repositories.- Parameters:
user- the user- Throws:
IOException- the io exception
-
hasPublicMember
public boolean hasPublicMember(GHUser user)
Checks if this organization has the specified user as a public member.- Parameters:
user- the user- Returns:
- the boolean
-
publicize
public void publicize(GHUser u) throws IOException
Publicizes the membership.- Parameters:
u- the u- Throws:
IOException- the io exception
-
getMembers
public List<GHUser> getMembers() throws IOException
Deprecated.uselistMembers()Gets members.- Returns:
- the members
- Throws:
IOException- the io exception
-
listMembers
public PagedIterable<GHUser> listMembers() throws IOException
All the members of this organization.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listPublicMembers
public PagedIterable<GHUser> listPublicMembers() throws IOException
All the public members of this organization.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listOutsideCollaborators
public PagedIterable<GHUser> listOutsideCollaborators() throws IOException
All the outside collaborators of this organization.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listMembersWithFilter
public PagedIterable<GHUser> listMembersWithFilter(String filter) throws IOException
List members with filter paged iterable.- Parameters:
filter- the filter- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listOutsideCollaboratorsWithFilter
public PagedIterable<GHUser> listOutsideCollaboratorsWithFilter(String filter) throws IOException
List outside collaborators with filter paged iterable.- Parameters:
filter- the filter- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listMembersWithRole
public PagedIterable<GHUser> listMembersWithRole(String role) throws IOException
List members with specified role paged iterable.- Parameters:
role- the role- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
conceal
public void conceal(GHUser u) throws IOException
Conceals the membership.- Parameters:
u- the u- Throws:
IOException- the io exception
-
areOrganizationProjectsEnabled
public boolean areOrganizationProjectsEnabled()
Are projects enabled for organization boolean.- Returns:
- the boolean
-
enableOrganizationProjects
public void enableOrganizationProjects(boolean newStatus) throws IOExceptionSets organization projects enabled status boolean.- Parameters:
newStatus- enable status- Throws:
IOException- the io exception
-
listProjects
public PagedIterable<GHProject> listProjects(GHProject.ProjectStateFilter status) throws IOException
Returns the projects for this organization.- Parameters:
status- The status filter (all, open or closed).- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
listProjects
public PagedIterable<GHProject> listProjects() throws IOException
Returns all open projects for the organization.- Returns:
- the paged iterable
- Throws:
IOException- the io exception
-
createProject
public GHProject createProject(String name, String body) throws IOException
Creates a project for the organization.- Parameters:
name- the namebody- the body- Returns:
- the gh project
- Throws:
IOException- the io exception
-
createTeam
@Deprecated public GHTeam createTeam(String name, GHOrganization.Permission p, Collection<GHRepository> repositories) throws IOException
Deprecated.https://developer.github.com/v3/teams/#create-team deprecates permission field usecreateTeam(String)Creates a new team and assigns the repositories.- Parameters:
name- the namep- the prepositories- the repositories- Returns:
- the gh team
- Throws:
IOException- the io exception
-
createTeam
@Deprecated public GHTeam createTeam(String name, GHOrganization.Permission p, GHRepository... repositories) throws IOException
Deprecated.https://developer.github.com/v3/teams/#create-team deprecates permission field usecreateTeam(String)Create team gh team.- Parameters:
name- the namep- the prepositories- the repositories- Returns:
- the gh team
- Throws:
IOException- the io exception
-
createTeam
@Deprecated public GHTeam createTeam(String name, Collection<GHRepository> repositories) throws IOException
Deprecated.UsecreateTeam(String)that uses a builder pattern to let you control every aspect.Creates a new team and assigns the repositories.- Parameters:
name- the namerepositories- the repositories- Returns:
- the gh team
- Throws:
IOException- the io exception
-
createTeam
@Deprecated public GHTeam createTeam(String name, GHRepository... repositories) throws IOException
Deprecated.UsecreateTeam(String)that uses a builder pattern to let you control every aspect.Create team gh team.- Parameters:
name- the namerepositories- the repositories- Returns:
- the gh team
- Throws:
IOException- the io exception
-
createTeam
public GHTeamBuilder createTeam(String name)
Starts a builder that creates a new team.You use the returned builder to set various properties, then call
GHTeamBuilder.create()to finally create a team.- Parameters:
name- the name- Returns:
- the gh create repository builder
-
getRepositoriesWithOpenPullRequests
public List<GHRepository> getRepositoriesWithOpenPullRequests() throws IOException
List up repositories that has some open pull requests.This used to be an efficient method that didn't involve traversing every repository, but now it doesn't do any optimization.
- Returns:
- the repositories with open pull requests
- Throws:
IOException- the io exception
-
getPullRequests
public List<GHPullRequest> getPullRequests() throws IOException
Gets all the open pull requests in this organization.- Returns:
- the pull requests
- Throws:
IOException- the io exception
-
listEvents
public PagedIterable<GHEventInfo> listEvents() throws IOException
Lists events performed by a user (this includes private events if the caller is authenticated.- Specified by:
listEventsin classGHPerson- Returns:
- the paged iterable
- Throws:
IOException- Signals that an I/O exception has occurred.
-
listRepositories
public PagedIterable<GHRepository> listRepositories(int pageSize)
Lists up all the repositories using the specified page size.- Overrides:
listRepositoriesin classGHPerson- Parameters:
pageSize- size for each page of items returned by GitHub. Maximum page size is 100. UnlikeGHPerson.getRepositories(), this does not wait until all the repositories are returned.- Returns:
- the paged iterable
-
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
-
deleteHook
public void deleteHook(int id) throws IOExceptionDeletes hook.- Parameters:
id- the id- Throws:
IOException- the io exception
-
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, Collection<GHEvent> events) throws IOException
Create web hook gh hook.- Parameters:
url- the urlevents- the events- 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
-
getRoot
@Deprecated public GitHub getRoot()
Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.Get the rootGitHubinstance for this object.- Returns:
- the root
GitHubinstance
-
-