UNPKG

gohl

Version:

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

113 lines 5.3 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.CalendarNotification = void 0; const axios_1 = require("axios"); class CalendarNotification { /** * Endpoints For Calendar Notificationss * https://highlevel.stoplight.io/docs/integrations/a83f44a3112a4-get-calendar-events */ constructor(authData) { this.authData = authData; } /** * * Documentation - https://highlevel.stoplight.io/docs/integrations/8a5a55426e404-get-notifications * @param calendarId */ getAll(calendarId, extra) { return __awaiter(this, void 0, void 0, function* () { var _a, _b; const headers = (_a = this.authData) === null || _a === void 0 ? void 0 : _a.headers; let query = ''; if (extra) { if (extra.altId) query = `altId=${extra.altId}&`; if (extra.altType) query = `altType=${extra.altType}&`; if (extra.deleted) query = `deleted=${extra.deleted}&`; if (extra.isActive) query = `isActive=${extra.isActive}&`; if (extra.limit) query = `limit=${extra.limit}&`; if (extra.skip) query = `skip=${extra.skip}&`; } const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/calendars/${calendarId}/notifications?${query}`, { headers }); return response.data; }); } /** * Get Calendar Notifications by calendar id * Documentation - https://highlevel.stoplight.io/docs/integrations/3a295c24b3d40-get-notification * @param calendarId * @param notificationId * @returns */ get(calendarId, notificationId) { 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}/notifications/${notificationId}`, { headers }); return response.data; }); } /** * Create Calendar Notifications * Documentation - https://highlevel.stoplight.io/docs/integrations/fbf84496c5327-create-notification * @param calendarId * @param notifications * @returns */ add(calendarId, notifications) { 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/${calendarId}/notifications/`, notifications, { headers }); return response.data; }); } /** * Update Calendar Notifications * Documentation - https://highlevel.stoplight.io/docs/integrations/ab6b01fe746d2-update-notification * @param calendarId * @param notificationId * @param notifcation * @returns */ update(calendarId, notificationId, notifcation) { 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/${calendarId}/notifications/${notificationId}`, notifcation, { headers }); return response.data.calendar; }); } /** * Delete Calendar Notifications * Documentation - https://highlevel.stoplight.io/docs/integrations/3287e5de5babf-delete-a-calendar-notification * @param calendarId * @param notificationId * @returns */ remove(calendarId, notificationId) { 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/${calendarId}/notifications/${notificationId}`, { headers }); return response.data.message; }); } } exports.CalendarNotification = CalendarNotification; //# sourceMappingURL=calendars.notifcations.js.map