adminGetDevice method

Future<AdminGetDeviceResponse> adminGetDevice({
  1. required String deviceKey,
  2. required String userPoolId,
  3. required String username,
})

Gets the device, as an administrator.

Calling this action requires developer credentials.

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

Parameter deviceKey : The device key.

Parameter userPoolId : The user pool ID.

Parameter username : The user name.

Implementation

Future<AdminGetDeviceResponse> adminGetDevice({
  required String deviceKey,
  required String userPoolId,
  required String username,
}) async {
  ArgumentError.checkNotNull(deviceKey, 'deviceKey');
  _s.validateStringLength(
    'deviceKey',
    deviceKey,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(username, 'username');
  _s.validateStringLength(
    'username',
    username,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.AdminGetDevice'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DeviceKey': deviceKey,
      'UserPoolId': userPoolId,
      'Username': username,
    },
  );

  return AdminGetDeviceResponse.fromJson(jsonResponse.body);
}