UNPKG

gohl

Version:

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

94 lines 4.17 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.Location = void 0; const axios_1 = require("axios"); class Location { /** * Endpoints For Locations */ constructor(authData) { this.authData = authData; } /** * Get all Locations * Documentation - https://public-api.gohighlevel.com/#b2157151-366b-4625-b1f8-d77458d0cf9f */ getAll() { 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}/locations/`, { headers }); return response.data.notes; }); } /** * Lookup location by email * Documentation - https://public-api.gohighlevel.com/#e74596d5-360c-46cb-b3dd-e065d62c29ee * @param email * @returns */ lookup(email) { 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}/locations/lookup?email=${email}`, { headers }); return response.data.note; }); } /** * Add Location * Documentation - https://public-api.gohighlevel.com/#2be923cc-fcbf-466a-8d8e-ff5ee1cfc244 * @param location * @returns */ add(location) { 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}/locations/`, location, { headers }); return response.data.note; }); } /** * Update a Location. * Documentation - https://public-api.gohighlevel.com/#4554e49d-0fc6-49d0-aa5c-feda76e522f0 * @param locationId * @param noteId * @param note * @returns */ update(locationId, location) { 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}/locations/${locationId}`, location, { headers }); return response.data.note; }); } /** * Delete location. * Documentation - https://public-api.gohighlevel.com/#a59b4ce5-0657-46c7-8351-cb42e166e276 * @param locationId * @param deleteTwilioAccount * @returns */ remove(locationId, deleteTwilioAccount) { 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}/locations/${locationId}?deleteTwilioAccount=${deleteTwilioAccount}`, { headers }); return response.data.msg; }); } } exports.Location = Location; //# sourceMappingURL=location.js.map