UNPKG

gohl

Version:

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

83 lines (79 loc) 3.52 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.TriggerLink = void 0; const axios_1 = require("axios"); class TriggerLink { /** * Endpoints For Trigger Links * https://highlevel.stoplight.io/docs/integrations/85c4db13a5d69-links-api */ constructor(authData) { this.authData = authData; } /** * Get all Links * Documentation - https://highlevel.stoplight.io/docs/integrations/7b6e00ee0f653-get-links */ getAll(locationId) { 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}/links?locationId=${locationId}`, { headers }); return response.data.links; }); } /** * Create Link * Documentation - https://highlevel.stoplight.io/docs/integrations/30442546481af-create-link * @param link * @returns */ add(link) { 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}/links`, link, { headers }); return response.data.link; }); } /** * Update Link * Documentation - https://highlevel.stoplight.io/docs/integrations/7fb0921457bdb-update-link * @param linkId * @param link * @returns */ update(linkId, link) { 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}/links/${linkId}`, link, { headers }); return response.data.link; }); } /** * Delete Link * Documentation - https://highlevel.stoplight.io/docs/integrations/b38b571ee30bd-delete-link * @param linkId * @returns */ remove(linkId) { 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}/links/${linkId}`, { headers }); return response.data.succeded; }); } } exports.TriggerLink = TriggerLink; //# sourceMappingURL=triggerlinks.js.map