export type GetApiPersonsPersonIdChartMedicationsMedidDurCheckArgs = {isRepresentativeNdc: string, personId: string, medid: string}; export type GetApiPersonsPersonIdChartMedicationsMedidDurCheckOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * {{baseUrl}}/persons/:personId/chart/medications/:medid/dur-check * * GET /persons/{personId}/chart/medications/{medid}/dur-check */ export const getApiPersonsPersonIdChartMedicationsMedidDurCheck = async (args: GetApiPersonsPersonIdChartMedicationsMedidDurCheckArgs, options?: GetApiPersonsPersonIdChartMedicationsMedidDurCheckOptions) => { const {baseUrl = "https://nativeapi.nextgen.com/nge/prod/nge-api/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.isRepresentativeNdc != null) query.append("isRepresentativeNdc", String(args.isRepresentativeNdc)) const url = `${baseUrl.replace(/\/+$/, '')}/persons/${encodeURIComponent(String(args.personId))}/chart/medications/${encodeURIComponent(String(args.medid))}/dur-check${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 undefined };