Class DirectoryGroupsConnection

java.lang.Object
google.registry.groups.DirectoryGroupsConnection
All Implemented Interfaces:
GroupsConnection

public class DirectoryGroupsConnection extends Object implements GroupsConnection
Class encapsulating methods to access Google Groups API.
  • Method Details

    • addMemberToGroup

      public void addMemberToGroup(String groupKey, String email, GroupsConnection.Role role) throws IOException
      Description copied from interface: GroupsConnection
      Adds a member to the specified group with the given role. This function is idempotent; if the member already exists in the group, then it returns normally. If the group doesn't exist, then it is created.
      Specified by:
      addMemberToGroup in interface GroupsConnection
      Throws:
      IOException
    • removeMemberFromGroup

      public void removeMemberFromGroup(String groupKey, String email) throws IOException
      Description copied from interface: GroupsConnection
      Removes a member from the specified group, or throws GoogleJsonResponseException if the member doesn't exist.
      Specified by:
      removeMemberFromGroup in interface GroupsConnection
      Throws:
      IOException
    • getMembersOfGroup

      public Set<String> getMembersOfGroup(String groupKey) throws IOException
      Description copied from interface: GroupsConnection
      Returns all of the members of the specified group. Note that it gets members only; not owners or managers. Returns an empty set if the group in question does not exist.
      Specified by:
      getMembersOfGroup in interface GroupsConnection
      Throws:
      IOException
    • createGroup

      public com.google.api.services.directory.model.Group createGroup(String groupKey) throws IOException
      Description copied from interface: GroupsConnection
      Creates a group with the given email address (groupKey) that is open for external members to join, and returns it. This function is idempotent; if the given group already exists, then this function returns as normal without error (and without modifying the existing group in any way, including permissions on who is able to join). The configured admin owner for the Google App is automatically added as an owner.
      Specified by:
      createGroup in interface GroupsConnection
      Throws:
      IOException
    • isMemberOfGroup

      public boolean isMemberOfGroup(String memberEmail, String groupKey)
      Description copied from interface: GroupsConnection
      Checks whether the given email belongs to the "support" group.
      Specified by:
      isMemberOfGroup in interface GroupsConnection