Class GHTeam

All Implemented Interfaces:
Refreshable

public class GHTeam extends GHObject implements Refreshable
A team in GitHub organization.
Author:
Kohsuke Kawaguchi
  • Constructor Details

    • GHTeam

      public GHTeam()
      Create default GHTeam instance
  • Method Details

    • getName

      public String getName()
      Gets name.
      Returns:
      the name
    • getPermission

      public String getPermission()
      Gets permission.
      Returns:
      the permission
    • getSlug

      public String getSlug()
      Gets slug.
      Returns:
      the slug
    • getDescription

      public String getDescription()
      Gets description.
      Returns:
      the description
    • getPrivacy

      public GHTeam.Privacy getPrivacy()
      Gets the privacy state.
      Returns:
      the privacy state.
    • setDescription

      public void setDescription(String description) throws IOException
      Sets description.
      Parameters:
      description - the description
      Throws:
      IOException - the io exception
    • setPrivacy

      public void setPrivacy(GHTeam.Privacy privacy) throws IOException
      Updates the team's privacy setting.
      Parameters:
      privacy - the privacy
      Throws:
      IOException - the io exception
    • listDiscussions

      @Nonnull public PagedIterable<GHDiscussion> listDiscussions() throws IOException
      Retrieves the discussions.
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
    • listMembers

      public PagedIterable<GHUser> listMembers(String role) throws IOException
      List members with specified role paged iterable.
      Parameters:
      role - the role
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
    • listMembers

      public PagedIterable<GHUser> listMembers(GHTeam.Role role) throws IOException
      List members with specified role paged iterable.
      Parameters:
      role - the role
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
    • getDiscussion

      @Nonnull public GHDiscussion getDiscussion(long discussionNumber) throws IOException
      Gets a single discussion by ID.
      Parameters:
      discussionNumber - id of the discussion that we want to query for
      Returns:
      the discussion
      Throws:
      IOException - the io exception
      See Also:
    • listMembers

      public PagedIterable<GHUser> listMembers() throws IOException
      Retrieves the current members.
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
    • listChildTeams

      public PagedIterable<GHTeam> listChildTeams() throws IOException
      Retrieves the teams that are children of this team.
      Returns:
      the paged iterable
      Throws:
      IOException - the io exception
    • getMembers

      public Set<GHUser> getMembers() throws IOException
      Gets members.
      Returns:
      the members
      Throws:
      IOException - the io exception
    • hasMember

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

      public Map<String,GHRepository> getRepositories() throws IOException
      Gets repositories.
      Returns:
      the repositories
      Throws:
      IOException - the io exception
    • listRepositories

      public PagedIterable<GHRepository> listRepositories()
      List repositories paged iterable.
      Returns:
      the paged iterable
    • add

      public void add(GHUser u) throws IOException
      Adds a member to the team.

      The user will be invited to the organization if required.

      Parameters:
      u - the u
      Throws:
      IOException - the io exception
      Since:
      1.59
    • add

      public void add(GHUser user, GHTeam.Role role) throws IOException
      Adds a member to the team

      The user will be invited to the organization if required.

      Parameters:
      user - github user
      role - role for the new member
      Throws:
      IOException - the io exception
    • remove

      public void remove(GHUser u) throws IOException
      Removes a member to the team.
      Parameters:
      u - the u
      Throws:
      IOException - the io exception
    • add

      public void add(GHRepository r) throws IOException
      Add.
      Parameters:
      r - the r
      Throws:
      IOException - the io exception
    • add

      public void add(GHRepository r, GHOrganization.RepositoryRole permission) throws IOException
      Add.
      Parameters:
      r - the r
      permission - the permission
      Throws:
      IOException - the io exception
    • remove

      public void remove(GHRepository r) throws IOException
      Remove.
      Parameters:
      r - the r
      Throws:
      IOException - the io exception
    • delete

      public void delete() throws IOException
      Deletes this team.
      Throws:
      IOException - the io exception
    • createDiscussion

      public GHDiscussion.Creator createDiscussion(String title) throws IOException
      Begins the creation of a new instance. Consumer must call AbstractBuilder.done() to commit changes.
      Parameters:
      title - title of the discussion to be created
      Returns:
      a GHDiscussion.Creator
      Throws:
      IOException - the io exception
    • getExternalGroups

      public List<GHExternalGroup> getExternalGroups() throws IOException
      Get the external groups connected to the team
      Returns:
      the external groups
      Throws:
      IOException - the io exception
      See Also:
    • connectToExternalGroup

      public GHExternalGroup connectToExternalGroup(GHExternalGroup group) throws IOException
      Connect an external group to the team
      Parameters:
      group - the group to connect
      Returns:
      the external group
      Throws:
      IOException - in case of failure
      See Also:
    • connectToExternalGroup

      public GHExternalGroup connectToExternalGroup(long group_id) throws IOException
      Connect an external group to the team
      Parameters:
      group_id - the identifier of the group to connect
      Returns:
      the external group
      Throws:
      IOException - in case of failure
      See Also:
    • deleteExternalGroupConnection

      public void deleteExternalGroupConnection() throws IOException
      Remove the connection of the team to an external group
      Throws:
      IOException - in case of failure
      See Also:
    • getOrganization

      public GHOrganization getOrganization() throws IOException
      Gets organization.
      Returns:
      the organization
      Throws:
      IOException - the io exception
    • refresh

      public void refresh() throws IOException
      Refresh.
      Specified by:
      refresh in interface Refreshable
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getHtmlUrl

      public URL getHtmlUrl()
      Gets the html url.
      Returns:
      the html url
    • equals

      public boolean equals(Object o)
      Equals.
      Overrides:
      equals in class Object
      Parameters:
      o - the o
      Returns:
      true, if successful
    • hashCode

      public int hashCode()
      Hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the int