gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
50 lines • 2.67 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.Survey = void 0;
const axios_1 = require("axios");
class Survey {
/**
* Endpoints For Surveys
* https://highlevel.stoplight.io/docs/integrations/3c7cf6a44f362-workflows-api
*/
constructor(authData) {
this.authData = authData;
}
/**
* Get Surveys
* https://highlevel.stoplight.io/docs/integrations/1e9fdbe3f2013-get-surveys
* @param locationId
*/
getAll(locationId_1) {
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}/surveys/?locationId=${locationId}&limit=${limit}&skip=${skip}${type ? `&type=${type}` : ""}`, { headers });
return response.data;
});
}
/**
* Get Survey Submissions
* https://highlevel.stoplight.io/docs/integrations/288c25c7e319a-get-surveys-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}/surveys/submissions/?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.Survey = Survey;
//# sourceMappingURL=surveys.js.map