gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
51 lines • 2.7 kB
JavaScript
;
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.Form = void 0;
const axios_1 = require("axios");
class Form {
/**
* Endpoints For Forms
* https://highlevel.stoplight.io/docs/integrations/0af2368376eb2-forms-api
*/
constructor(authData) {
this.authData = authData;
}
/**
* Get Forms
* https://highlevel.stoplight.io/docs/integrations/49e29c1716c61-get-forms
* https://public-api.gohighlevel.com/#29a44f93-8ec3-464d-a2d2-a3bce3d70ffc
* @param locationId
*/
getAll() {
return __awaiter(this, arguments, void 0, function* (locationId = "", skip = 0, limit = 20, type = "") {
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}/forms?locationId=${locationId}&limit=${limit}&skip=${skip}${type ? `&type=${type}` : ""}`, { headers });
return response.data;
});
}
/**
* Get Form Submissions
* https://highlevel.stoplight.io/docs/integrations/a6114bd7685d1-get-forms-submissions
* @param locationId
*/
getSubmissions(locationId_1) {
return __awaiter(this, arguments, void 0, function* (locationId, skip = 0, limit = 20, page = 1, search = "", type = "", startAt = "", endAt = "") {
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}/forms?locationId=${locationId}&limit=${limit}&page=${page}&skip=${skip}${type ? `&type=${type}` : ""}${startAt ? `&startAt=${startAt}` : ""}${endAt ? `&endAt=${endAt}` : ""}${search ? `&q=${search}` : ""}`, { headers });
return response.data;
});
}
}
exports.Form = Form;
//# sourceMappingURL=forms.js.map