UNPKG

gohl

Version:

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

127 lines 5.69 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.CalendarGroup = void 0; const axios_1 = require("axios"); class CalendarGroup { /** * Endpoints For Calendars * https://highlevel.stoplight.io/docs/integrations/89e47b6c05e67-get-groups */ constructor(authData) { this.authData = authData; } /** * * Documentation - https://highlevel.stoplight.io/docs/integrations/89e47b6c05e67-get-groups * @param locationId */ getAll() { 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}/calendars/groups`, { headers }); return response.data.calendars; }); } /** * Get Calendar by calendar id * Documentation - https://highlevel.stoplight.io/docs/integrations/946f5e91e2532-get-calendar * @param calendarId * @returns */ get(calendarId) { 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}/calendars/${calendarId}`, { headers }); return response.data.calendar; }); } /** * Validate group slug * Documentation - https://highlevel.stoplight.io/docs/integrations/afefaa9b33ca0-validate-group-slug * @param locationId * @param slug * @returns */ verifySlug(locationId, slug) { 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}/calendars/groups/validate-slug`, { locationId, slug }, { headers }); return response.data.available; }); } /** * Create Calendar Group * Documentation - https://highlevel.stoplight.io/docs/integrations/fefceb241288c-create-calendar-group * @param calendargroup * @returns */ add(calendargroup) { 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}/calendars/groups`, calendargroup, { headers }); return response.data.group; }); } /** * Update Group * Documentation - https://highlevel.stoplight.io/docs/integrations/585481332e909-update-group * @param groupId * @param name * @param description * @param slug * @returns */ update(groupId, name, description, slug) { 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}/calendars/groups/${groupId}`, { name, description, slug }, { headers }); return response.data.group; }); } /** * Delete Group * Documentation - https://highlevel.stoplight.io/docs/integrations/e8c53752f025d-delete-group * @param groupId * @returns */ remove(groupId) { 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}/calendars/groups/${groupId}`, { headers }); return response.data.succeded; }); } /** * Disable Group * Documentation - http://highlevel.stoplight.io/docs/integrations/aed8aeb313d97-disable-group * @param groupId * @param isActive * @returns */ disabled(groupId, isActive) { 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 data = { isActive }; const response = yield axios_1.default.put(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/calendars/groups/${groupId}/status`, data, { headers }); return response.data.success; }); } } exports.CalendarGroup = CalendarGroup; //# sourceMappingURL=calendars.groups.js.map