java.lang.Object
org.kohsuke.github.GHObject
org.kohsuke.github.GHPerson
org.kohsuke.github.GHOrganization
The type GHOrganization.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The enum Permission.static class
Repository permissions (roles) for teams and collaborators.static enum
Member'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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(GHUser user, GHOrganization.Role role) Adds (invites) a user to the organization.boolean
Are projects enabled for organization boolean.void
Conceals the membership.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.createProject
(String name, String body) Creates a project for the organization.createRepository
(String name) Starts a builder that creates a new repository.createTeam
(String name) Starts a builder that creates a new team.createWebHook
(URL url) Create web hook gh hook.createWebHook
(URL url, Collection<GHEvent> events) Create web hook gh hook.void
deleteHook
(int id) Deletes hook.void
enableOrganizationProjects
(boolean newStatus) Sets organization projects enabled status boolean.getExternalGroup
(long groupId) Gets a single external group by ID.getHook
(int id) Gets hook.getHooks()
Retrieves the currently configured hooks.getMembership
(String username) Obtains the object that represents the user membership.Gets all the open pull requests in this organization.List repositories that has some open pull requests.getTeam
(long teamId) Gets a single team by ID.getTeamByName
(String name) Finds a team that has the given name in itsGHTeam.getName()
.getTeamBySlug
(String slug) Finds a team that has the given slug in itsGHTeam.getSlug()
.getTeams()
Teams by their names.boolean
Checks if this organization has the specified user as a member.boolean
hasPublicMember
(GHUser user) Checks if this organization has the specified user as a public member.Lists events performed by a user (this includes private events if the caller is authenticated.List up all the external groups.listExternalGroups
(String displayName) List up all the external groups with a given text in their nameAll the members of this organization.listMembersWithFilter
(String filter) List members with filter paged iterable.listMembersWithRole
(String role) List members with specified role paged iterable.All the outside collaborators of this organization.List outside collaborators with filter paged iterable.Returns all open projects for the organization.Returns the projects for this organization.All the public members of this organization.List all the repositories using a default of 30 items page size.List up all the security managers.List up all the teams.void
Publicizes the membership.void
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, getHtmlUrl, getLocation, getLogin, getName, getPublicGistCount, getPublicRepoCount, getRepositories, getRepository, getTotalPrivateRepoCount, getTwitterUsername, getType, getUpdatedAt, isSiteAdmin, listRepositories, populate
Methods inherited from class org.kohsuke.github.GHObject
getId, getNodeId, getResponseHeaderFields, getUrl, setResponseHeaderFields, toString
-
Constructor Details
-
GHOrganization
public GHOrganization()Create default GHOrganization instance
-
-
Method Details
-
createRepository
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
Teams by their names.- Returns:
- the teams
- Throws:
IOException
- the io exception
-
listTeams
List up all the teams.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
getTeam
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:
-
getTeamByName
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
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:
-
listExternalGroups
List up all the external groups.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception- See Also:
-
listExternalGroups
List up all the external groups with a given text in their name- Parameters:
displayName
- the text that must be part of the returned groups name- Returns:
- the paged iterable
- Throws:
IOException
- the io exception- See Also:
-
getExternalGroup
Gets a single external group by ID.- Parameters:
groupId
- id of the external group that we want to query for- Returns:
- the external group
- Throws:
IOException
- the io exception- See Also:
-
add
Adds (invites) a user to the organization.- Parameters:
user
- the userrole
- the role- Throws:
IOException
- the io exception- See Also:
-
hasMember
Checks if this organization has the specified user as a member.- Parameters:
user
- the user- Returns:
- the boolean
-
getMembership
Obtains the object that represents the user membership. In order to get a user's membership with an organization, the authenticated user must be an organization member. The state parameter in the response can be used to identify the user's membership status.- Parameters:
username
- the user's username- Returns:
- the GHMembership if the username belongs to the organisation, otherwise null
- Throws:
IOException
- the io exception- See Also:
-
remove
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
Checks if this organization has the specified user as a public member.- Parameters:
user
- the user- Returns:
- the boolean
-
publicize
Publicizes the membership.- Parameters:
u
- the u- Throws:
IOException
- the io exception
-
listMembers
All the members of this organization.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listPublicMembers
All the public members of this organization.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listOutsideCollaborators
All the outside collaborators of this organization.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listMembersWithFilter
List members with filter paged iterable.- Parameters:
filter
- the filter- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listOutsideCollaboratorsWithFilter
List outside collaborators with filter paged iterable.- Parameters:
filter
- the filter- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listMembersWithRole
List members with specified role paged iterable.- Parameters:
role
- the role- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
listSecurityManagers
List up all the security managers.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
conceal
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
Sets 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
Returns all open projects for the organization.- Returns:
- the paged iterable
- Throws:
IOException
- the io exception
-
createProject
Creates a project for the organization.- Parameters:
name
- the namebody
- the body- Returns:
- the gh project
- Throws:
IOException
- the io exception
-
createTeam
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
List 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
Gets all the open pull requests in this organization.- Returns:
- the pull requests
- Throws:
IOException
- the io exception
-
listEvents
Lists events performed by a user (this includes private events if the caller is authenticated.- Specified by:
listEvents
in classGHPerson
- Returns:
- the paged iterable
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
listRepositories
List all the repositories using a default of 30 items page size.- Overrides:
listRepositories
in classGHPerson
- Returns:
- the paged iterable
-
getHooks
Retrieves the currently configured hooks.- Returns:
- the hooks
- Throws:
IOException
- the io exception
-
getHook
Gets hook.- Parameters:
id
- the id- Returns:
- the hook
- Throws:
IOException
- the io exception
-
deleteHook
Deletes 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 IOExceptionSee 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
Create web hook gh hook.- Parameters:
url
- the urlevents
- the events- Returns:
- the gh hook
- Throws:
IOException
- the io exception
-
createWebHook
Create web hook gh hook.- Parameters:
url
- the url- Returns:
- the gh hook
- Throws:
IOException
- the io exception
-