{"version":3,"file":"conversation.cjs","sources":["../../../../src/resources/classes/conversation.ts"],"sourcesContent":["// AUTOGENERATED -- DO NOT EDIT\n\nimport {\n  ConversationAddParticipantParams,\n  ConversationCreateParams,\n  ConversationCreateResponse,\n  ConversationGetTokenResponse,\n  ConversationMessageParams,\n  ConversationRemoveParticipantParams,\n  OystehrClientRequest,\n} from '../..';\nimport { SDKResource } from '../../client/client';\nimport { OystehrConfig } from '../../config';\nimport * as ext from './conversation-ext';\n\nexport class Conversation extends SDKResource {\n  constructor(config: OystehrConfig) {\n    super(config);\n  }\n  #baseUrlThunk(): string {\n    return this.config.services?.['projectApiUrl'] ?? 'https://project-api.zapehr.com/v1';\n  }\n  ENCOUNTER_VS_EXTENSION_URL = ext.ENCOUNTER_VS_EXTENSION_URL;\n  ENCOUNTER_VS_EXTENSION_RELATIVE_URL = ext.ENCOUNTER_VS_EXTENSION_RELATIVE_URL;\n  /**\n   * Helper function to get a conversationId from an encounter created as an Oystehr Conversation\n   * @param encounter well-formed FHIR R4B or R5 Encounter\n   * @returns conversationId\n   */\n  getConversationIdFromEncounter = ext.getConversationIdFromEncounter;\n  /**\n   * 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.\n   *\n   * Access Policy Requirements:\n   * Action: `Messaging:CreateConversation`\n   * Access Policy Resource: `Messaging:Conversation`\n   * Action: `FHIR:Create`\n   * Access Policy Resource: `FHIR:Encounter`\n   * Action: `FHIR:Update`\n   * Access Policy Resource: `FHIR:Encounter`\n   */\n  create(params: ConversationCreateParams, request?: OystehrClientRequest): Promise<ConversationCreateResponse> {\n    return this.request('/messaging/conversation', 'post', this.#baseUrlThunk.bind(this))(params, request);\n  }\n  /**\n   * 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.\n   *\n   * Access Policy Action: `Messaging:GetConversationToken`\n   * Access Policy Resource: `Messaging:Conversation`.\n   */\n  getToken(request?: OystehrClientRequest): Promise<ConversationGetTokenResponse> {\n    return this.request('/messaging/conversation/token', 'get', this.#baseUrlThunk.bind(this))(request);\n  }\n  /**\n   * 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.\n   *\n   * Access Policy Requirements:\n   * Action: `Messaging:ConversationAddParticipant`\n   * Access Policy Resource: `Messaging:Conversation`\n   * Action: `FHIR:Read`\n   * Access Policy Resource: `FHIR:Encounter`\n   * Action: `FHIR:Update`\n   * Access Policy Resource: `FHIR:Encounter`\n   */\n  addParticipant(params: ConversationAddParticipantParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request(\n      '/messaging/conversation/{conversationId}/participant',\n      'post',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * 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.\n   *\n   * Access Policy Requirements:\n   * Action: `Messaging:ConversationRemoveParticipant`\n   * Access Policy Resource: `Messaging:Conversation`\n   * Action: `FHIR:Read`\n   * Access Policy Resource: `FHIR:Patient`, `FHIR:Practitioner`, or `FHIR:RelatedPerson`\n   */\n  removeParticipant(params: ConversationRemoveParticipantParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request(\n      '/messaging/conversation/{conversationId}/participant',\n      'delete',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n  /**\n   * 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.\n   *\n   * Access Policy Requirements:\n   * Action: `Messaging:ConversationSendMessage`\n   * Access Policy Resource: `Messaging:Conversation`\n   */\n  message(params: ConversationMessageParams, request?: OystehrClientRequest): Promise<void> {\n    return this.request(\n      '/messaging/conversation/{conversationId}/message',\n      'post',\n      this.#baseUrlThunk.bind(this)\n    )(params, request);\n  }\n}\n"],"names":["SDKResource","ext.ENCOUNTER_VS_EXTENSION_URL","ext.ENCOUNTER_VS_EXTENSION_RELATIVE_URL","ext.getConversationIdFromEncounter"],"mappings":";;;;;AAAA;AAeM,MAAO,YAAa,SAAQA,kBAAW,CAAA;AAC3C,IAAA,WAAA,CAAY,MAAqB,EAAA;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;KACf;IACD,aAAa,GAAA;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,eAAe,CAAC,IAAI,mCAAmC,CAAC;KACvF;AACD,IAAA,0BAA0B,GAAGC,0CAA8B,CAAC;AAC5D,IAAA,mCAAmC,GAAGC,mDAAuC,CAAC;AAC9E;;;;AAIG;AACH,IAAA,8BAA8B,GAAGC,8CAAkC,CAAC;AACpE;;;;;;;;;;AAUG;IACH,MAAM,CAAC,MAAgC,EAAE,OAA8B,EAAA;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACxG;AACD;;;;;AAKG;AACH,IAAA,QAAQ,CAAC,OAA8B,EAAA;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;KACrG;AAC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