Class GHOrganization


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

      • GHOrganization

        public GHOrganization()
    • Method Detail

      • 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
      • 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
      • 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
      • 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
      • 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
      • 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 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 organizataion.
        Returns:
        the pull requests
        Throws:
        IOException - the io exception
      • 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
      • 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)
                             throws IOException
        Create web hook gh hook.
        Parameters:
        url - the url
        Returns:
        the gh hook
        Throws:
        IOException - the io exception