unsubscribeFromDataset method

Future<void> unsubscribeFromDataset({
  1. required String datasetName,
  2. required String deviceId,
  3. required String identityId,
  4. required String identityPoolId,
})

Unsubscribes from receiving notifications when a dataset is modified by another device.

This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

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

Parameter datasetName : The name of the dataset from which to unsubcribe.

Parameter deviceId : The unique ID generated for this device by Cognito.

Parameter identityId : Unique ID for this identity.

Parameter identityPoolId : A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which this identity belongs.

Implementation

Future<void> unsubscribeFromDataset({
  required String datasetName,
  required String deviceId,
  required String identityId,
  required String identityPoolId,
}) async {
  ArgumentError.checkNotNull(datasetName, 'datasetName');
  _s.validateStringLength(
    'datasetName',
    datasetName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(deviceId, 'deviceId');
  _s.validateStringLength(
    'deviceId',
    deviceId,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(identityId, 'identityId');
  _s.validateStringLength(
    'identityId',
    identityId,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(identityPoolId, 'identityPoolId');
  _s.validateStringLength(
    'identityPoolId',
    identityPoolId,
    1,
    55,
    isRequired: true,
  );
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/identitypools/${Uri.encodeComponent(identityPoolId)}/identities/${Uri.encodeComponent(identityId)}/datasets/${Uri.encodeComponent(datasetName)}/subscriptions/${Uri.encodeComponent(deviceId)}',
    exceptionFnMap: _exceptionFns,
  );
}