listKnowledgeBaseDocuments method
Retrieves all the documents contained in a data source that is connected to a knowledge base. For more information, see Ingest changes directly into a knowledge base in the Amazon Bedrock User Guide.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter dataSourceId :
The unique identifier of the data source that contains the documents.
Parameter knowledgeBaseId :
The unique identifier of the knowledge base that is connected to the data
source.
Parameter maxResults :
The maximum number of results to return in the response. If the total
number of results is greater than this value, use the token returned in
the response in the nextToken field when making another
request to return the next batch of results.
Parameter nextToken :
If the total number of results is greater than the maxResults
value provided in the request, enter the token returned in the
nextToken field in the response in this field to return the
next batch of results.
Implementation
Future<ListKnowledgeBaseDocumentsResponse> listKnowledgeBaseDocuments({
required String dataSourceId,
required String knowledgeBaseId,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1000,
);
final $payload = <String, dynamic>{
if (maxResults != null) 'maxResults': maxResults,
if (nextToken != null) 'nextToken': nextToken,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgebases/${Uri.encodeComponent(knowledgeBaseId)}/datasources/${Uri.encodeComponent(dataSourceId)}/documents',
exceptionFnMap: _exceptionFns,
);
return ListKnowledgeBaseDocumentsResponse.fromJson(response);
}