listUsersInGroup method

Future<ListUsersInGroupResponse> listUsersInGroup({
  1. required String groupName,
  2. required String userPoolId,
  3. int? limit,
  4. String? nextToken,
})

Lists the users in the specified group.

Calling this action requires developer credentials.

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

Parameter groupName : The name of the group.

Parameter userPoolId : The user pool ID for the user pool.

Parameter limit : The limit of the request to list users.

Parameter nextToken : An identifier that was returned from the previous call to this operation, which can be used to return the next set of items in the list.

Implementation

Future<ListUsersInGroupResponse> listUsersInGroup({
  required String groupName,
  required String userPoolId,
  int? limit,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(groupName, 'groupName');
  _s.validateStringLength(
    'groupName',
    groupName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  _s.validateNumRange(
    'limit',
    limit,
    0,
    60,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.ListUsersInGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GroupName': groupName,
      'UserPoolId': userPoolId,
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListUsersInGroupResponse.fromJson(jsonResponse.body);
}