export type Model228 = {street1: string, street2?: string | undefined, city: string, state: string, zip: string}; export type TransferTo = {pharmacy_name: string, pharmacist_name?: string | undefined, npi?: string | undefined, phone?: string | undefined, fax?: string | undefined, address: Model228}; export type Model229 = {reason_code: 'RETAIL' | 'MAIL' | 'OON' | 'NOT_COVERED' | 'OTHER', additional_information: string, transfer_to: TransferTo}; export type CreateApiApiV1PrescriptionPrescriptionTokenTransferOutArgs = {body: Model229}; export type CreateApiApiV1PrescriptionPrescriptionTokenTransferOutOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * TransferOut a Prescription by token * * POST /api/v1/prescription/{prescription_token}/transfer_out */ export const createApiApiV1PrescriptionPrescriptionTokenTransferOut = async (args: CreateApiApiV1PrescriptionPrescriptionTokenTransferOutArgs, options?: CreateApiApiV1PrescriptionPrescriptionTokenTransferOutOptions) => { const {baseUrl = "https://api.truepill.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/prescription/${encodeURIComponent(String(args.prescription_token))}/transfer_out${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };