listGroupsForEntity method

Future<ListGroupsForEntityResponse> listGroupsForEntity({
  1. required String entityId,
  2. required String organizationId,
  3. ListGroupsForEntityFilters? filters,
  4. int? maxResults,
  5. String? nextToken,
})

Returns all the groups to which an entity belongs.

May throw EntityNotFoundException. May throw EntityStateException. May throw InvalidParameterException. May throw OrganizationNotFoundException. May throw OrganizationStateException.

Parameter entityId : The identifier for the entity.

The entity ID can accept UserId or GroupID, Username or Groupname, or email.

  • Entity ID: 12345678-1234-1234-1234-123456789012 or S-1-1-12-1234567890-123456789-123456789-1234
  • Email address: entity@domain.tld
  • Entity name: entity

Parameter organizationId : The identifier for the organization under which the entity exists.

Parameter filters : Limit the search results based on the filter criteria.

Parameter maxResults : The maximum number of results to return in a single call.

Parameter nextToken : The token to use to retrieve the next page of results. The first call does not contain any tokens.

Implementation

Future<ListGroupsForEntityResponse> listGroupsForEntity({
  required String entityId,
  required String organizationId,
  ListGroupsForEntityFilters? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkMailService.ListGroupsForEntity'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EntityId': entityId,
      'OrganizationId': organizationId,
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListGroupsForEntityResponse.fromJson(jsonResponse.body);
}