UNPKG

gohl

Version:

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

95 lines 4.51 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.CustomValue = void 0; const axios_1 = require("axios"); class CustomValue { /** * Endpoints For Subaccounts * https://highlevel.stoplight.io/docs/integrations/e283eac258a96-sub-account-formerly-location-api */ constructor(authData) { this.authData = authData; } /** * Get CustomValues * Documentation - https://highlevel.stoplight.io/docs/integrations/d40742c5e3e7d-get-custom-values * @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}/customValues`, { headers }); return response.data.customValues; }); } /** * Get CustomValue * Documentation - https://highlevel.stoplight.io/docs/integrations/1c982c0816621-get-custom-value * @param locationId * @returns */ get(customValueId, 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}/customValues/${customValueId}`, { headers }); return response.data.customValue; }); } /** * Create CustomValue * Documentation - https://highlevel.stoplight.io/docs/integrations/e0c3b7e6d196c-create-custom-value * @param customValue * @returns */ add(locationId, customValue) { 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}/customValues`, customValue, { headers }); return response.data.customValue; }); } /** * Update CustomValue * Documentation - https://highlevel.stoplight.io/docs/integrations/c5c9b99b0e74f-update-custom-value * @param customValue * @param locationId * @returns */ update(customValueId, locationId, customValue) { 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}/customValues/${customValueId}`, customValue, { headers }); return response.data.customValue; }); } /** * Delete CustomValue * Documentation - https://highlevel.stoplight.io/docs/integrations/40e00c29eb2da-delete-custom-value * @param customValueId * @returns */ remove(customValueId, 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}/customValues/${customValueId}`, { headers }); return response.data.succeded; }); } } exports.CustomValue = CustomValue; //# sourceMappingURL=subaccounts.customvalues.js.map