UNPKG

gohl

Version:

Go Highlevel Node Js ease of use library implementation to their API

154 lines 7.33 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConversationsMessage = void 0; const axios_1 = require("axios"); class ConversationsMessage { /** * Endpoints For Conversation Messages * https://highlevel.stoplight.io/docs/integrations/a503551cadede-get-message-by-message-id */ constructor(authData) { this.authData = authData; } /** * Get Message by Message ID * Documentation - https://highlevel.stoplight.io/docs/integrations/a503551cadede-get-message-by-message-id * @param messageId * @returns */ get(messageId) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/${messageId}`, { headers }); return response.data; }); } /** * Get Messages by Conversation ID * Documentation - https://highlevel.stoplight.io/docs/integrations/ab21134dad173-get-messages-by-conversation-id * @param conversationId * @returns */ getByConversation(conversationId) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/${conversationId}/messages`, { headers }); return response.data; }); } /** * Send a New Message * Documentation - https://highlevel.stoplight.io/docs/integrations/5853cb0a54971-send-a-new-message * @param conversationId * @param message * @returns */ send(conversationId, message) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.post(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/${conversationId}/messages`, message, { headers }); return response.data; }); } /** * Add an Inbound Message * Documentation - https://highlevel.stoplight.io/docs/integrations/3c9036411fcc3-add-an-inbound-message * @param conversationId * @param message * @returns */ addInbound(conversationId, message) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.post(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/inbound`, Object.assign(Object.assign({}, message), { conversationId, direction: "inbound" }), { headers }); return response.data; }); } /** * Add an External Outbound Call * Documentation - https://highlevel.stoplight.io/docs/integrations/d032812b4e850-add-an-external-outbound-call * @param conversationId * @param call * @returns */ addOutboundCall(conversationId, call) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.post(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/${conversationId}/calls/outbound`, call, { headers }); return response.data; }); } /** * Cancel a Scheduled Message * Documentation - https://highlevel.stoplight.io/docs/integrations/f7e0bc96bf0a4-cancel-a-scheduled-message * @param messageId * @returns */ cancel(messageId) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.post(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/${messageId}/cancel`, {}, { headers }); return response.data; }); } /** * Update Message Status * Documentation - https://highlevel.stoplight.io/docs/integrations/4518573836035-update-message-status * @param messageId * @param status * @returns */ updateStatus(messageId, status) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.put(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/${messageId}/status`, status, { headers }); return response.data; }); } /** * Get Recording by Message ID * Documentation - https://highlevel.stoplight.io/docs/integrations/72f801089fbac-get-recording-by-message-id * @param messageId * @returns */ getRecording(messageId) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/${messageId}/recording`, { headers }); return response.data; }); } /** * Get Transcription by Message ID * Documentation - https://highlevel.stoplight.io/docs/integrations/9f8e2c1696a55-get-transcription-by-message-id * @param messageId * @returns */ getTranscription(messageId) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/conversations/messages/${messageId}/transcription`, { headers }); return response.data; }); } } exports.ConversationsMessage = ConversationsMessage; //# sourceMappingURL=conversations.messages.js.map