listFragments method

Future<ListFragmentsOutput> listFragments({
  1. required String streamName,
  2. FragmentSelector? fragmentSelector,
  3. int? maxResults,
  4. String? nextToken,
})

Returns a list of Fragment objects from the specified stream and timestamp range within the archived data.

Listing fragments is eventually consistent. This means that even if the producer receives an acknowledgment that a fragment is persisted, the result might not be returned immediately from a request to ListFragments. However, results are typically available in less than one second.

  • x-amz-ErrorType HTTP header – contains a more specific error type in addition to what the HTTP status code provides.
  • x-amz-RequestId HTTP header – if you want to report an issue to AWS, the support team can better diagnose the problem if given the Request Id.
Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again.

For more information, see the Errors section at the bottom of this topic, as well as Common Errors.

May throw ResourceNotFoundException. May throw InvalidArgumentException. May throw ClientLimitExceededException. May throw NotAuthorizedException.

Parameter streamName : The name of the stream from which to retrieve a fragment list.

Parameter fragmentSelector : Describes the timestamp range and timestamp origin for the range of fragments to return.

Parameter maxResults : The total number of fragments to return. If the total number of fragments available is more than the value specified in max-results, then a ListFragmentsOutput$NextToken is provided in the output that you can use to resume pagination.

Parameter nextToken : A token to specify where to start paginating. This is the ListFragmentsOutput$NextToken from a previously truncated response.

Implementation

Future<ListFragmentsOutput> listFragments({
  required String streamName,
  FragmentSelector? fragmentSelector,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(streamName, 'streamName');
  _s.validateStringLength(
    'streamName',
    streamName,
    1,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    4096,
  );
  final $payload = <String, dynamic>{
    'StreamName': streamName,
    if (fragmentSelector != null) 'FragmentSelector': fragmentSelector,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/listFragments',
    exceptionFnMap: _exceptionFns,
  );
  return ListFragmentsOutput.fromJson(response);
}