{"version":3,"file":"erx.cjs","sources":["../../../../src/resources/classes/erx.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n  ErxCancelPrescriptionParams,\n  ErxCheckAllergyInteractionsParams,\n  ErxCheckAllergyInteractionsResponse,\n  ErxCheckMedicationInteractionsParams,\n  ErxCheckMedicationInteractionsResponse,\n  ErxCheckPractitionerEnrollmentParams,\n  ErxCheckPractitionerEnrollmentResponse,\n  ErxCheckPrecheckInteractionsParams,\n  ErxCheckPrecheckInteractionsResponse,\n  ErxConnectPractitionerParams,\n  ErxConnectPractitionerResponse,\n  ErxEnrollPractitionerParams,\n  ErxGetConfigurationResponse,\n  ErxSearchAllergensParams,\n  ErxSearchAllergensResponse,\n  ErxSearchMedicationsParams,\n  ErxSearchMedicationsResponse,\n  ErxSyncPatientParams,\n  ErxUnenrollPractitionerParams,\n  OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\n\nexport class Erx extends SDKResource {\n  constructor(config: OystehrConfig) {\n    super(config);\n  }\n  #baseUrlThunk(): string {\n    return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3';\n  }\n  /**\n   * Search for allergens.\n   */\n  searchAllergens(\n    params: ErxSearchAllergensParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxSearchAllergensResponse> {\n    return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Search for medications.\n   */\n  searchMedications(\n    params: ErxSearchMedicationsParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxSearchMedicationsResponse> {\n    return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Get eRx configuration for project.\n   */\n  getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {\n    return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);\n  }\n  /**\n   * Checks for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.\n   */\n  checkAllergyInteractions(\n    params: ErxCheckAllergyInteractionsParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxCheckAllergyInteractionsResponse> {\n    return this.request(\n      '/patient/{patientId}/interactions/allergy',\n      'get',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * Checks for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.\n   */\n  checkMedicationInteractions(\n    params: ErxCheckMedicationInteractionsParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxCheckMedicationInteractionsResponse> {\n    return this.request(\n      '/patient/{patientId}/interactions/medication',\n      'get',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * Checks for drug-allergy and drug-drug interactions with a specific drug for a patient. This endpoint requires the patient's allergies and medications to be synced with the upstream eRx provider.\n   */\n  checkPrecheckInteractions(\n    params: ErxCheckPrecheckInteractionsParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxCheckPrecheckInteractionsResponse> {\n    return this.request(\n      '/patient/{patientId}/interactions/precheck/{drugId}',\n      'get',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * Cancel prescription for patient.\n   */\n  cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request(\n      '/patient/{patientId}/prescriptions/{medicationRequestId}',\n      'delete',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider.\n   */\n  syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n   */\n  connectPractitioner(\n    params: ErxConnectPractitionerParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxConnectPractitionerResponse>;\n  /**\n   * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n   */\n  connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>;\n  /**\n   * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner.\n   */\n  connectPractitioner(\n    params?: ErxConnectPractitionerParams | OystehrClientRequest,\n    request?: OystehrClientRequest\n  ): Promise<ErxConnectPractitionerResponse> {\n    return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Check eRx enrollment for a practitioner.\n   */\n  checkPractitionerEnrollment(\n    params: ErxCheckPractitionerEnrollmentParams,\n    request?: OystehrClientRequest\n  ): Promise<ErxCheckPractitionerEnrollmentResponse> {\n    return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Enroll a practitioner in the eRx service.\n   */\n  enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * Unenroll a practitioner from the eRx service.\n   */\n  unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);\n  }\n}\n"],"names":["SDKResource"],"mappings":";;;;AAAA;AA2BM,MAAO,GAAI,SAAQA,kBAAW,CAAA;AAClC,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;IACD,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,+BAA+B,CAAC;KAC/E;AACD;;AAEG;IACH,eAAe,CACb,MAAgC,EAChC,OAA8B,EAAA;QAE9B,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CA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