getGroup method

Future<GetGroupResponse> getGroup({
  1. required String groupName,
  2. required String userPoolId,
})

Given a user pool ID and a group name, returns information about the user group.

For more information about user pool groups, see Adding groups to a user pool.

Learn more

May throw InternalErrorException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw ResourceNotFoundException. May throw TooManyRequestsException.

Parameter groupName : The name of the group that you want to get information about.

Parameter userPoolId : The ID of the user pool that contains the group that you want to query.

Implementation

Future<GetGroupResponse> getGroup({
  required String groupName,
  required String userPoolId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.GetGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GroupName': groupName,
      'UserPoolId': userPoolId,
    },
  );

  return GetGroupResponse.fromJson(jsonResponse.body);
}