@oystehr/sdk
Version:
Oystehr SDK
156 lines (153 loc) • 5.85 kB
text/typescript
// AUTOGENERATED -- DO NOT EDIT
import {
ErxCancelPrescriptionParams,
ErxCheckAllergyInteractionsParams,
ErxCheckAllergyInteractionsResponse,
ErxCheckMedicationInteractionsParams,
ErxCheckMedicationInteractionsResponse,
ErxCheckPractitionerEnrollmentParams,
ErxCheckPractitionerEnrollmentResponse,
ErxCheckPrecheckInteractionsParams,
ErxCheckPrecheckInteractionsResponse,
ErxConnectPractitionerParams,
ErxConnectPractitionerResponse,
ErxEnrollPractitionerParams,
ErxGetConfigurationResponse,
ErxSearchAllergensParams,
ErxSearchAllergensResponse,
ErxSearchMedicationsParams,
ErxSearchMedicationsResponse,
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.
*/
searchAllergens(
params: ErxSearchAllergensParams,
request?: OystehrClientRequest
): Promise<ErxSearchAllergensResponse> {
return this.request('/allergen', 'get', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Search for medications.
*/
searchMedications(
params: ErxSearchMedicationsParams,
request?: OystehrClientRequest
): Promise<ErxSearchMedicationsResponse> {
return this.request('/medication', 'get', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Get eRx configuration for project.
*/
getConfiguration(request?: OystehrClientRequest): Promise<ErxGetConfigurationResponse> {
return this.request('/config', 'get', this.#baseUrlThunk.bind(this))(request);
}
/**
* Checks for drug-allergy interactions for a patient. This endpoint requires the patient's allergies to be synced with the upstream eRx provider.
*/
checkAllergyInteractions(
params: ErxCheckAllergyInteractionsParams,
request?: OystehrClientRequest
): Promise<ErxCheckAllergyInteractionsResponse> {
return this.request(
'/patient/{patientId}/interactions/allergy',
'get',
this.#baseUrlThunk.bind(this)
)(params, request);
}
/**
* Checks for drug-drug interactions for a patient. This endpoint requires the patient's medications to be synced with the upstream eRx provider.
*/
checkMedicationInteractions(
params: ErxCheckMedicationInteractionsParams,
request?: OystehrClientRequest
): Promise<ErxCheckMedicationInteractionsResponse> {
return this.request(
'/patient/{patientId}/interactions/medication',
'get',
this.#baseUrlThunk.bind(this)
)(params, request);
}
/**
* 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.
*/
checkPrecheckInteractions(
params: ErxCheckPrecheckInteractionsParams,
request?: OystehrClientRequest
): Promise<ErxCheckPrecheckInteractionsResponse> {
return this.request(
'/patient/{patientId}/interactions/precheck/{drugId}',
'get',
this.#baseUrlThunk.bind(this)
)(params, request);
}
/**
* Cancel prescription for patient.
*/
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.
*/
syncPatient(params: ErxSyncPatientParams, request?: OystehrClientRequest): Promise<void> {
return this.request('/patient/{patientId}/sync', 'post', 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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
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.
*/
unenrollPractitioner(params: ErxUnenrollPractitionerParams, request?: OystehrClientRequest): Promise<void> {
return this.request('/practitioner/{practitionerId}', 'delete', this.#baseUrlThunk.bind(this))(params, request);
}
}