Package google.registry.groups
Class DirectoryGroupsConnection
java.lang.Object
google.registry.groups.DirectoryGroupsConnection
- All Implemented Interfaces:
GroupsConnection
Class encapsulating methods to access Google Groups API.
-
Nested Class Summary
Nested classes/interfaces inherited from interface google.registry.groups.GroupsConnection
GroupsConnection.Role
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMemberToGroup
(String groupKey, String email, GroupsConnection.Role role) Adds a member to the specified group with the given role.com.google.api.services.directory.model.Group
createGroup
(String groupKey) Creates a group with the given email address (groupKey) that is open for external members to join, and returns it.getMembersOfGroup
(String groupKey) Returns all of the members of the specified group.boolean
isMemberOfGroup
(String memberEmail, String groupKey) Checks whether the given email belongs to the "support" group.void
removeMemberFromGroup
(String groupKey, String email) Removes a member from the specified group, or throwsGoogleJsonResponseException
if the member doesn't exist.
-
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 interfaceGroupsConnection
- Throws:
IOException
-
removeMemberFromGroup
Description copied from interface:GroupsConnection
Removes a member from the specified group, or throwsGoogleJsonResponseException
if the member doesn't exist.- Specified by:
removeMemberFromGroup
in interfaceGroupsConnection
- Throws:
IOException
-
getMembersOfGroup
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 interfaceGroupsConnection
- 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 interfaceGroupsConnection
- Throws:
IOException
-
isMemberOfGroup
Description copied from interface:GroupsConnection
Checks whether the given email belongs to the "support" group.- Specified by:
isMemberOfGroup
in interfaceGroupsConnection
-