adminListDevices method

Future<AdminListDevicesResponse> adminListDevices({
  1. required String userPoolId,
  2. required String username,
  3. int? limit,
  4. String? paginationToken,
})

Lists devices, as an administrator.

Calling this action requires developer credentials.

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

Parameter userPoolId : The user pool ID.

Parameter username : The user name.

Parameter limit : The limit of the devices request.

Parameter paginationToken : The pagination token.

Implementation

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

  return AdminListDevicesResponse.fromJson(jsonResponse.body);
}