Class GHOrganization


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

    • GHOrganization

      public GHOrganization()
  • Method Details

    • createRepository

      @Deprecated public GHRepository createRepository(String name, String description, String homepage, String team, boolean isPublic) throws IOException
      Deprecated.
      Use createRepository(String) that uses a builder pattern to let you control every aspect.
      Creates a new repository.
      Parameters:
      name - the name
      description - the description
      homepage - the homepage
      team - the team
      isPublic - 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.
      Use createRepository(String) that uses a builder pattern to let you control every aspect.
      Create repository gh repository.
      Parameters:
      name - the name
      description - the description
      homepage - the homepage
      team - the team
      isPublic - 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.
      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:
    • 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:
    • 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
    • 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.
      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 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

      @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 use createTeam(String)
      Creates a new team and assigns the repositories.
      Parameters:
      name - the name
      p - the p
      repositories - 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 use createTeam(String)
      Create team gh team.
      Parameters:
      name - the name
      p - the p
      repositories - the repositories
      Returns:
      the gh team
      Throws:
      IOException - the io exception
    • createTeam

      @Deprecated public GHTeam createTeam(String name, Collection<GHRepository> repositories) throws IOException
      Deprecated.
      Use createTeam(String) that uses a builder pattern to let you control every aspect.
      Creates a new team and assigns the repositories.
      Parameters:
      name - the name
      repositories - the repositories
      Returns:
      the gh team
      Throws:
      IOException - the io exception
    • createTeam

      @Deprecated public GHTeam createTeam(String name, GHRepository... repositories) throws IOException
      Deprecated.
      Use createTeam(String) that uses a builder pattern to let you control every aspect.
      Create team gh team.
      Parameters:
      name - the name
      repositories - 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:
      listEvents in class GHPerson
      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:
      listRepositories in class GHPerson
      Parameters:
      pageSize - size for each page of items returned by GitHub. Maximum page size is 100. Unlike GHPerson.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 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
    • getRoot

      @Deprecated public GitHub getRoot()
      Deprecated.
      For access to the GitHub instance, use a local copy instead of pulling it out of objects.
      Get the root GitHub instance for this object.
      Returns:
      the root GitHub instance