UNPKG

gohl

Version:

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

91 lines 4.36 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.CustomField = void 0; const axios_1 = require("axios"); class CustomField { constructor(authData) { this.authData = authData; } /** * Get CustomFields * Documentation - https://highlevel.stoplight.io/docs/integrations/791462a3367b9-get-custom-fields * @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}/customFields`, { headers }); return response.data.customFields; }); } /** * Get CustomField * Documentation - https://highlevel.stoplight.io/docs/integrations/791462a3367b9-get-custom-fields * @param locationId * @returns */ get(customFieldId, 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}/customFields/${customFieldId}`, { headers }); return response.data.customField; }); } /** * Create CustomField * Documentation - https://highlevel.stoplight.io/docs/integrations/7b2584aa2450c-create-custom-field * @param customField * @returns */ add(locationId, customField) { 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}/customFields`, customField, { headers }); return response.data.customField; }); } /** * Update CustomField * Documentation - https://highlevel.stoplight.io/docs/integrations/a96e05f71bdf4-update-custom-field * @param customField * @param locationId * @returns */ update(customFieldId, locationId, customField) { 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}/customFields/${customFieldId}`, customField, { headers }); return response.data.customField; }); } /** * Delete CustomField * Documentation - https://highlevel.stoplight.io/docs/integrations/ca83b24e1ca24-delete-custom-field * @param customFieldId * @returns */ remove(customFieldId, 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}/customFields/${customFieldId}`, { headers }); return response.data.succeded; }); } } exports.CustomField = CustomField; //# sourceMappingURL=subaccounts.customfields.js.map