UNPKG

@oystehr/sdk

Version:

Oystehr SDK

246 lines (243 loc) 9.19 kB
// AUTOGENERATED -- DO NOT EDIT import { ErxAddPatientPharmacyParams, ErxCancelPrescriptionParams, ErxCheckAllergyInteractionsParams, ErxCheckAllergyInteractionsResponse, ErxCheckMedicationInteractionsParams, ErxCheckMedicationInteractionsResponse, ErxCheckPractitionerEnrollmentParams, ErxCheckPractitionerEnrollmentResponse, ErxCheckPrecheckInteractionsParams, ErxCheckPrecheckInteractionsResponse, ErxConnectPractitionerParams, ErxConnectPractitionerResponse, ErxEnrollPractitionerParams, ErxGetConfigurationResponse, ErxGetMedicationParams, ErxGetMedicationResponse, ErxSearchAllergensParams, ErxSearchAllergensResponse, ErxSearchMedicationsParams, ErxSearchMedicationsResponse, ErxSearchPharmaciesParams, ErxSearchPharmaciesResponse, ErxSyncPatientParams, ErxUnenrollPractitionerParams, OystehrClientRequest, } from '../..'; import { SDKResource } from '../../client/client'; import { OystehrConfig } from '../../config'; export class Erx extends SDKResource { constructor(config: OystehrConfig) { super(config); } #baseUrlThunk(): string { return this.config.services?.['erxApiUrl'] ?? 'https://erx-api.zapehr.com/v3'; } /** * Search for allergens. * Action: `eRx:SearchAllergen` * Access Policy Resource: `eRx:Allergen` */ searchAllergens( params: ErxSearchAllergensParams, request?: OystehrClientRequest ): Promise<ErxSearchAllergensResponse> { return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Search for medications. * Action: `eRx:SearchMedication` * Access Policy Resource: `eRx:Medication` */ searchMedications( params: ErxSearchMedicationsParams, request?: OystehrClientRequest ): Promise<ErxSearchMedicationsResponse> { return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Get full medication details. * Action: `eRx:GetMedication` * Access Policy Resource: `eRx:Medication` */ getMedication(params: ErxGetMedicationParams, request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>; /** * Get full medication details. * Action: `eRx:GetMedication` * Access Policy Resource: `eRx:Medication` */ getMedication(request?: OystehrClientRequest): Promise<ErxGetMedicationResponse>; /** * Get full medication details. * Action: `eRx:GetMedication` * Access Policy Resource: `eRx:Medication` */ getMedication( params?: ErxGetMedicationParams | OystehrClientRequest, request?: OystehrClientRequest ): Promise<ErxGetMedicationResponse> { return this.request('/medication/details', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Get eRx configuration for project. * Action: `eRx:GetConfiguration` * Access Policy Resource: `eRx:Configuration` */ getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> { return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request); } /** * Check for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider. * Action: `eRx:Check` * Access Policy Resource: `eRx:Interaction` */ checkAllergyInteractions( params: ErxCheckAllergyInteractionsParams, request?: OystehrClientRequest ): Promise<ErxCheckAllergyInteractionsResponse> { return this.request( '/patient/{patientId}/interactions/allergy', 'get', this.#baseUrlThunk.bind(this) )(params, request); } /** * Check for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider. * Action: `eRx:Check` * Access Policy Resource: `eRx:Interaction` */ checkMedicationInteractions( params: ErxCheckMedicationInteractionsParams, request?: OystehrClientRequest ): Promise<ErxCheckMedicationInteractionsResponse> { return this.request( '/patient/{patientId}/interactions/medication', 'get', this.#baseUrlThunk.bind(this) )(params, request); } /** * Check 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. * Action: `eRx:Check` * Access Policy Resource: `eRx:Interaction` */ checkPrecheckInteractions( params: ErxCheckPrecheckInteractionsParams, request?: OystehrClientRequest ): Promise<ErxCheckPrecheckInteractionsResponse> { return this.request( '/patient/{patientId}/interactions/precheck/{drugId}', 'get', this.#baseUrlThunk.bind(this) )(params, request); } /** * Adds pharmacy for a patient with the upstream eRx provider, setting it as primary if specified. * Action: `eRx:AddPatientPharmacy` * Access Policy Resource: `eRx:Patient` */ addPatientPharmacy(params: ErxAddPatientPharmacyParams, request?: OystehrClientRequest): Promise<void> { return this.request('/patient/{patientId}/pharmacies', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Cancel prescription for patient. * Action: `eRx:CancelPrescription` * Access Policy Resource: `eRx:Prescription` */ cancelPrescription(params: ErxCancelPrescriptionParams, request?: OystehrClientRequest): Promise<void> { return this.request( '/patient/{patientId}/prescriptions/{medicationRequestId}', 'delete', this.#baseUrlThunk.bind(this) )(params, request); } /** * Syncs demographic, allergy, and medication data for a patient with the upstream eRx provider. * Action: `eRx:SyncPatient` * Access Policy Resource: `eRx:Patient` */ syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> { return this.request('/patient/{patientId}/sync', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Search for pharmacies by a variety of criteria. * Action: `eRx:SearchPharmacy` * Access Policy Resource: `eRx:Pharmacy` */ searchPharmacies( params: ErxSearchPharmaciesParams, request?: OystehrClientRequest ): Promise<ErxSearchPharmaciesResponse>; /** * Search for pharmacies by a variety of criteria. * Action: `eRx:SearchPharmacy` * Access Policy Resource: `eRx:Pharmacy` */ searchPharmacies(request?: OystehrClientRequest): Promise<ErxSearchPharmaciesResponse>; /** * Search for pharmacies by a variety of criteria. * Action: `eRx:SearchPharmacy` * Access Policy Resource: `eRx:Pharmacy` */ searchPharmacies( params?: ErxSearchPharmaciesParams | OystehrClientRequest, request?: OystehrClientRequest ): Promise<ErxSearchPharmaciesResponse> { return this.request('/pharmacy', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner. * Action: `eRx:Connect` * Access Policy Resource: `eRx:SSO` */ connectPractitioner( params: ErxConnectPractitionerParams, request?: OystehrClientRequest ): Promise<ErxConnectPractitionerResponse>; /** * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner. * Action: `eRx:Connect` * Access Policy Resource: `eRx:SSO` */ connectPractitioner(request?: OystehrClientRequest): Promise<ErxConnectPractitionerResponse>; /** * Create an SSO link for a practitioner. This link can be used to log in to the eRx service as the specified practitioner. * Action: `eRx:Connect` * Access Policy Resource: `eRx:SSO` */ connectPractitioner( params?: ErxConnectPractitionerParams | OystehrClientRequest, request?: OystehrClientRequest ): Promise<ErxConnectPractitionerResponse> { return this.request('/practitioner/connect', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Check eRx enrollment for a practitioner. * Action: `eRx:Read` * Access Policy Resource: `eRx:Enrollment` */ checkPractitionerEnrollment( params: ErxCheckPractitionerEnrollmentParams, request?: OystehrClientRequest ): Promise<ErxCheckPractitionerEnrollmentResponse> { return this.request('/practitioner/{practitionerId}', 'get', this.#baseUrlThunk.bind(this))(params, request); } /** * Enroll a practitioner in the eRx service. * Action: `eRx:Create` * Access Policy Resource: `eRx:Enrollment` */ enrollPractitioner(params: ErxEnrollPractitionerParams, request?: OystehrClientRequest): Promise<void> { return this.request('/practitioner/{practitionerId}', 'post', this.#baseUrlThunk.bind(this))(params, request); } /** * Unenroll a practitioner from the eRx service. * Action: `eRx:Delete` * Access Policy Resource: `eRx:Enrollment` */ unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> { return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request); } }