listDatasets method

Future<ListDatasetsResponse> listDatasets({
  1. required String identityId,
  2. required String identityPoolId,
  3. int? maxResults,
  4. String? nextToken,
})

Lists datasets for an identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.

ListDatasets can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use the Cognito Identity credentials to make this API call.

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

Parameter identityId : A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

Parameter identityPoolId : A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.

Parameter maxResults : The maximum number of results to be returned.

Parameter nextToken : A pagination token for obtaining the next page of results.

Implementation

Future<ListDatasetsResponse> listDatasets({
  required String identityId,
  required String identityPoolId,
  int? maxResults,
  String? nextToken,
}) async {
  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 $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/identitypools/${Uri.encodeComponent(identityPoolId)}/identities/${Uri.encodeComponent(identityId)}/datasets',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListDatasetsResponse.fromJson(response);
}