UNPKG

gohl

Version:

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

55 lines 2.7 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 Contacts Tags * https://highlevel.stoplight.io/docs/integrations/c9bbad7cdacf5-add-tags * https://public-api.gohighlevel.com/#dbb4ae8d-1fcc-45ce-a3f8-34fafe771e90 */ constructor(authData) { this.authData = authData; } /** * Add tag to contact. For both GHL App and API * Documentation - https://highlevel.stoplight.io/docs/integrations/6015cf49a7ae8-get-appointments-for-contact * Documentation - https://public-api.gohighlevel.com/#2b4583f4-d525-43a3-89dc-0034e864df02 */ add(contactId, tags) { 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}/contacts/${contactId}/tags/`, { tags }, { headers }); const events = response.data.tags; return events; }); } /** * Remove Tags from contact. For both GHL App and API * Documentation - https://highlevel.stoplight.io/docs/integrations/e5d269b7415bf-remove-tags * Documentation - https://public-api.gohighlevel.com/#14572da1-a341-42dc-a42c-ac0742d6178e * @param contactId * @param tags * @returns */ remove(contactId, tags) { 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}/contacts/${contactId}/tags/`, { headers }); return response.data; }); } } exports.Tag = Tag; //# sourceMappingURL=contacts.tags.js.map