UNPKG

gohl

Version:

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

91 lines 4.28 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.CalendarAppointmentNote = void 0; const axios_1 = require("axios"); class CalendarAppointmentNote { /** * Endpoints For Calendars Appointments Notes * https://highlevel.stoplight.io/docs/integrations/e04d0822bd613-get-notes */ constructor(authData) { this.authData = authData; } /** * Get Appointment Notes * Documentation - https://highlevel.stoplight.io/docs/integrations/e04d0822bd613-get-notes * @param appointmentId * @param limit * @param offset */ getAll(appointmentId, limit, offset) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; if (!limit || isNaN(limit) || limit < 0) return []; if (!offset || isNaN(offset) || offset < 0) return []; 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}/calendars/appointments/${appointmentId}/notes?limit=${limit}&offset=${offset}`, { headers }); return response.data.notes; }); } /** * Create Appointment Note * Documentation - https://highlevel.stoplight.io/docs/integrations/dcdda866d8b49-create-note * @param appointmentId * @param body - Note body (<= 5000 characters) * @param userId * @returns */ add(appointmentId, body, userId) { 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}/appointments/${appointmentId}/notes`, { body, userId }, { headers }); return response.data.note; }); } /** * Update Appointment Note * Documentation - https://highlevel.stoplight.io/docs/integrations/f27408b1ae367-update-note * @param appointmentId * @param noteId * @param body - Note body (<= 5000 characters) * @param userId * @returns */ update(appointmentId, noteId, body, userId) { 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}/appointments/${appointmentId}/notes/${noteId}`, { body, userId }, { headers }); return response.data.note; }); } /** * Delete Appointment Note * Documentation - https://highlevel.stoplight.io/docs/integrations/fe10a2bff1674-delete-note * @param appointmentId * @param noteId * @returns */ remove(appointmentId, noteId) { 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.delete(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/appointments/${appointmentId}/notes/${noteId}`, { headers }); return response.data.succeded; }); } } exports.CalendarAppointmentNote = CalendarAppointmentNote; //# sourceMappingURL=calendars.appointmentsnotes.js.map