UNPKG

@oystehr/sdk

Version:

Oystehr SDK

85 lines (81 loc) 4.95 kB
'use strict'; var client = require('../../client/client.cjs'); var conversationExt = require('./conversation-ext.cjs'); // AUTOGENERATED -- DO NOT EDIT class Conversation extends client.SDKResource { constructor(config) { super(config); } #baseUrlThunk() { return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1'; } ENCOUNTER_VS_EXTENSION_URL = conversationExt.ENCOUNTER_VS_EXTENSION_URL; ENCOUNTER_VS_EXTENSION_RELATIVE_URL = conversationExt.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 = conversationExt.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); } } exports.Conversation = Conversation; //# sourceMappingURL=conversation.cjs.map