export type GetApiQuestionnaireResponseArgs = {_id?: (string | null) | undefined, patient?: (string | null) | undefined, _revinclude?: (string | null) | undefined, _lastUpdated?: (string | null) | undefined, _maxresults?: (string | null) | undefined}; export type GetApiQuestionnaireResponseOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets bundle of QuestionnaireResponse resource. * * GET /QuestionnaireResponse */ export const getApiQuestionnaireResponse = async (args: GetApiQuestionnaireResponseArgs, options?: GetApiQuestionnaireResponseOptions) => { const {baseUrl = "https://fhir.nextgen.com/nge/prod/fhir-api-r4/fhir/R4", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args._id != null) query.append("_id", String(args._id)) if (args.patient != null) query.append("patient", String(args.patient)) if (args._revinclude != null) query.append("_revinclude", String(args._revinclude)) if (args._lastUpdated != null) query.append("_lastUpdated", String(args._lastUpdated)) if (args._maxresults != null) query.append("_maxresults", String(args._maxresults)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/QuestionnaireResponse${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };