getDocumentContent method
Retrieves the content of an ingested document from a knowledge base. Returns a pre-signed URL for secure document access.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter dataSourceId :
The unique identifier of the data source that contains the document.
Parameter documentId :
The unique identifier of the document to retrieve content for.
Parameter knowledgeBaseId :
The unique identifier of the knowledge base that contains the document.
Parameter outputFormat :
The output format for the document content. RAW returns the
original file. EXTRACTED returns parsed text as JSON.
Defaults to RAW.
Implementation
Future<GetDocumentContentResponse> getDocumentContent({
required String dataSourceId,
required String documentId,
required String knowledgeBaseId,
DocumentOutputFormat? outputFormat,
UserContext? userContext,
}) async {
final $payload = <String, dynamic>{
if (outputFormat != null) 'outputFormat': outputFormat.value,
if (userContext != null) 'userContext': userContext,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/knowledgebases/${Uri.encodeComponent(knowledgeBaseId)}/datasources/${Uri.encodeComponent(dataSourceId)}/documents/${Uri.encodeComponent(documentId)}/content',
exceptionFnMap: _exceptionFns,
);
return GetDocumentContentResponse.fromJson(response);
}