UNPKG

gohl

Version:

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

94 lines 4.12 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.Tag = void 0; const axios_1 = require("axios"); class Tag { /** * Endpoints For Tags */ constructor(authData) { this.authData = authData; } /** * Get Tags * Documentation - https://highlevel.stoplight.io/docs/integrations/00a65a984720b-get-tags * @param locationId * @returns */ 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}/location/${locationId}/tags`, { headers }); return response.data.tags; }); } /** * Get Tag * Documentation - https://highlevel.stoplight.io/docs/integrations/2be6f9044b427-get-tag-by-id * @param locationId * @returns */ get(tagId, 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}/location/${locationId}/tags/${tagId}`, { headers }); return response.data.tag; }); } /** * Create Tag * Documentation - https://highlevel.stoplight.io/docs/integrations/64433faeaa52e-create-tag * @param tag * @returns */ add(locationId, tag) { 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}/location/${locationId}/tags`, tag, { headers }); return response.data.tag; }); } /** * Update Tag * Documentation - https://highlevel.stoplight.io/docs/integrations/809b211aaf37a-update-tag * @param tag * @param locationId * @returns */ update(tagId, locationId, tag) { 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}/location/${locationId}/tags/${tagId}`, tag, { headers }); return response.data.tag; }); } /** * Delete Tag * Documentation - https://highlevel.stoplight.io/docs/integrations/8742f26722f45-delete-tag * @param tagId * @returns */ remove(tagId, 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.delete(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/location/${locationId}/tags/${tagId}`, { headers }); return response.data.succeded; }); } } exports.Tag = Tag; //# sourceMappingURL=subaccounts.tags.js.map