UNPKG

gohl

Version:

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

90 lines 4.21 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.Funnels = void 0; const axios_1 = require("axios"); const funnels_redirect_1 = require("./funnels.redirect"); class Funnels { /** * Endpoints For Funnels * https://highlevel.stoplight.io/docs/integrations/80d7ad39f1e90-fetch-list-of-funnels */ constructor(authData) { this.authData = authData; this.redirect = new funnels_redirect_1.FunnelRedirect(authData); } /** * Fetch List of Funnels * Documentation - https://highlevel.stoplight.io/docs/integrations/80d7ad39f1e90-fetch-list-of-funnels * @param params * @returns */ getAll(params) { 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 queryParams = new URLSearchParams(); // Required parameter queryParams.append("locationId", params.locationId); // Optional parameters if (params.page) queryParams.append("page", params.page.toString()); if (params.limit) queryParams.append("limit", params.limit.toString()); if (params.search) queryParams.append("search", params.search); const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/funnels?${queryParams.toString()}`, { headers }); return response.data; }); } /** * Fetch List of Funnel Pages * Documentation - https://highlevel.stoplight.io/docs/integrations/99a6409949f15-fetch-list-of-funnel-pages * @param funnelId * @param params * @returns */ getPages(funnelId, params) { 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 queryParams = new URLSearchParams(); // Required parameter queryParams.append("locationId", params.locationId); // Optional parameters if (params.page) queryParams.append("page", params.page.toString()); if (params.limit) queryParams.append("limit", params.limit.toString()); if (params.search) queryParams.append("search", params.search); const response = yield axios_1.default.get(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/funnels/${funnelId}/pages?${queryParams.toString()}`, { headers }); return response.data; }); } /** * Fetch Count of Funnel Pages * Documentation - https://highlevel.stoplight.io/docs/integrations/6bee319f931fa-fetch-count-of-funnel-pages * @param funnelId * @param locationId * @returns */ getPagesCount(funnelId, 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}/funnels/${funnelId}/pages/count?locationId=${locationId}`, { headers }); return response.data; }); } } exports.Funnels = Funnels; //# sourceMappingURL=funnels.js.map