listDocuments method

Future<ListDocumentsResponse> listDocuments({
  1. required String applicationId,
  2. required String indexId,
  3. List<String>? dataSourceIds,
  4. int? maxResults,
  5. String? nextToken,
})

A list of documents attached to an index.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter applicationId : The identifier of the application id the documents are attached to.

Parameter indexId : The identifier of the index the documents are attached to.

Parameter dataSourceIds : The identifier of the data sources the documents are attached to.

Parameter maxResults : The maximum number of documents to return.

Parameter nextToken : If the maxResults response was incomplete because there is more data to retrieve, Amazon Q Business returns a pagination token in the response. You can use this pagination token to retrieve the next set of documents.

Implementation

Future<ListDocumentsResponse> listDocuments({
  required String applicationId,
  required String indexId,
  List<String>? dataSourceIds,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (dataSourceIds != null) 'dataSourceIds': dataSourceIds,
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/index/${Uri.encodeComponent(indexId)}/documents',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListDocumentsResponse.fromJson(response);
}