Class GHOrganization


public class GHOrganization extends GHPerson
The type GHOrganization.
Author:
Kohsuke Kawaguchi
  • Constructor Details

    • GHOrganization

      public GHOrganization()
      Create default GHOrganization instance
  • Method Details

    • 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

      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:
    • getTeamByName

      public GHTeam getTeamByName(String name) throws IOException
      Finds a team that has the given name in its GHTeam.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 its GHTeam.getSlug().
      Parameters:
      slug - the slug
      Returns:
      the team by slug
      Throws:
      IOException - the io exception
      See Also:
    • listExternalGroups

      public PagedIterable<GHExternalGroup> listExternalGroups() throws IOException
      List up all the external groups.
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
      See Also:
    • listExternalGroups

      public PagedIterable<GHExternalGroup> listExternalGroups(String displayName) throws IOException
      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

      public GHExternalGroup getExternalGroup(long groupId) throws IOException
      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

      public void add(GHUser user, GHOrganization.Role role) throws IOException
      Adds (invites) a user to the organization.
      Parameters:
      user - the user
      role - the role
      Throws:
      IOException - the io exception
      See Also:
    • hasMember

      public boolean hasMember(GHUser user)
      Checks if this organization has the specified user as a member.
      Parameters:
      user - the user
      Returns:
      the boolean
    • getMembership

      public GHMembership getMembership(String username) throws IOException
      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

      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
    • 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
    • listSecurityManagers

      public PagedIterable<GHTeam> listSecurityManagers() throws IOException
      List up all the security managers.
      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 IOException
      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

      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 name
      body - the body
      Returns:
      the gh project
      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 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:
      listEvents in class GHPerson
      Returns:
      the paged iterable
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • listRepositories

      public PagedIterable<GHRepository> listRepositories()
      List all the repositories using a default of 30 items page size.
      Overrides:
      listRepositories in class GHPerson
      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 IOException
      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 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 url
      events - 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