@oystehr/sdk
Version:
Oystehr SDK
83 lines (80 loc) • 4.95 kB
JavaScript
import { SDKResource } from '../../client/client.js';
import { ENCOUNTER_VS_EXTENSION_URL, ENCOUNTER_VS_EXTENSION_RELATIVE_URL, getConversationIdFromEncounter } from './conversation-ext.js';
// AUTOGENERATED -- DO NOT EDIT
class Conversation extends SDKResource {
constructor(config) {
super(config);
}
#baseUrlThunk() {
return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';
}
ENCOUNTER_VS_EXTENSION_URL = ENCOUNTER_VS_EXTENSION_URL;
ENCOUNTER_VS_EXTENSION_RELATIVE_URL = ENCOUNTER_VS_EXTENSION_RELATIVE_URL;
/**
* Helper function to get a conversationId from an encounter created as an Oystehr Conversation
* @param encounter well-formed FHIR R4B or R5 Encounter
* @returns conversationId
*/
getConversationIdFromEncounter = getConversationIdFromEncounter;
/**
* Create a new Conversation. [Conversations](https://docs.oystehr.com/oystehr/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
*
* Access Policy Requirements:
* Action: `Messaging:CreateConversation`
* Access Policy Resource: `Messaging:Conversation`
* Action: `FHIR:Create`
* Access Policy Resource: `FHIR:Encounter`
* Action: `FHIR:Update`
* Access Policy Resource: `FHIR:Encounter`
*/
create(params, request) {
return this.request('/messaging/conversation', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Get a Conversation Token. Conversation Tokens are used to join the Conversation with the Twilio Conversations SDKs. [Conversations](https://docs.oystehr.com/oystehr/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
*
* Access Policy Action: `Messaging:GetConversationToken`
* Access Policy Resource: `Messaging:Conversation`.
*/
getToken(request) {
return this.request('/messaging/conversation/token', 'get', this.#baseUrlThunk.bind(this))(request);
}
/**
* Add a participant to a Conversation. [Conversations](https://docs.oystehr.com/oystehr/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
*
* Access Policy Requirements:
* Action: `Messaging:ConversationAddParticipant`
* Access Policy Resource: `Messaging:Conversation`
* Action: `FHIR:Read`
* Access Policy Resource: `FHIR:Encounter`
* Action: `FHIR:Update`
* Access Policy Resource: `FHIR:Encounter`
*/
addParticipant(params, request) {
return this.request('/messaging/conversation/{conversationId}/participant', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Remove a participant from a Conversation. [Conversations](https://docs.oystehr.com/oystehr/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
*
* Access Policy Requirements:
* Action: `Messaging:ConversationRemoveParticipant`
* Access Policy Resource: `Messaging:Conversation`
* Action: `FHIR:Read`
* Access Policy Resource: `FHIR:Patient`, `FHIR:Practitioner`, or `FHIR:RelatedPerson`
*/
removeParticipant(params, request) {
return this.request('/messaging/conversation/{conversationId}/participant', 'delete', this.#baseUrlThunk.bind(this))(params, request);
}
/**
* Send a message to a Conversation. [Conversations](https://docs.oystehr.com/oystehr/services/messaging/conversations/) allow you to build multi-channel bi-directional messaging workflows. For example, you might create a Conversation where a provider messages with a patient through a web app, and the patient receives and responds to messages via SMS on their phone.
*
* Access Policy Requirements:
* Action: `Messaging:ConversationSendMessage`
* Access Policy Resource: `Messaging:Conversation`
*/
message(params, request) {
return this.request('/messaging/conversation/{conversationId}/message', 'post', this.#baseUrlThunk.bind(this))(params, request);
}
}
export { Conversation };
//# sourceMappingURL=conversation.js.map