O3 Framework / getAttachments
getAttachments(
patientUuid,includeEncounterless,abortController,encounterUuid?):Promise<FetchResponse<any>>
Defined in: packages/framework/esm-emr-api/src/attachments.ts:53
Fetches attachments for a specific patient from the OpenMRS server.
string
The UUID of the patient whose attachments should be fetched.
boolean
Whether to include attachments that are not associated
with any encounter. Ignored when encounterUuid is set.
AbortController
An AbortController to allow cancellation of the request.
string
When set, only attachments recorded on this encounter are returned.
The includeEncounterless parameter is not sent in that case, because the server
ignores the encounter filter whenever includeEncounterless is present. Pass a UUID
the server can resolve: an unknown encounter UUID makes the server fall back to every
attachment of the patient, encounterless ones included.
Promise<FetchResponse<any>>
A Promise that resolves with the FetchResponse containing an array of attachments.
import { getAttachments } from '@openmrs/esm-framework';
const abortController = new AbortController();
const response = await getAttachments('patient-uuid', true, abortController);
console.log(response.data.results);
const forEncounter = await getAttachments('patient-uuid', false, abortController, 'encounter-uuid');