gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
109 lines • 5.06 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.SaaS = void 0;
const axios_1 = require("axios");
class SaaS {
constructor(authData) {
this.authData = authData;
}
/**
* Get Locations by Stripe ID with Company ID
* Documentation - https://highlevel.stoplight.io/docs/integrations/17e63a64621dc-get-locations-by-stripe-id-with-company-id
* @param companyId
* @param stripeId
* @returns
*/
getLocationsByStripeId(companyId, stripeId) {
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}/companies/${companyId}/locations/stripe/${stripeId}`, { headers });
return response.data;
});
}
/**
* Update SaaS Subscription
* Documentation - https://highlevel.stoplight.io/docs/integrations/3ed6984d6d3d3-update-saa-s-subscription
* @param locationId
* @param data
* @returns
*/
updateSubscription(locationId, data) {
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.patch(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/locations/${locationId}/subscription`, data, { headers });
return response.data;
});
}
/**
* Disable SaaS for Locations
* Documentation - https://highlevel.stoplight.io/docs/integrations/ae2bab1a54b4b-disable-saa-s-for-locations
* @param locationIds
* @returns
*/
disable(locationIds) {
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/disable`, { locationIds }, { headers });
return response.data;
});
}
/**
* Enable SaaS for Sub Account (formerly Location)
* Documentation - https://highlevel.stoplight.io/docs/integrations/b7ee10fc892a5-enable-saa-s-for-sub-account-formerly-location
* @param locationId
* @param data
* @returns
*/
enable(locationId, data) {
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/${locationId}/enable`, data, { headers });
return response.data;
});
}
/**
* Pause Location
* Documentation - https://highlevel.stoplight.io/docs/integrations/7ad2b7afa2a8c-pause-location
* @param locationId
* @param data
* @returns
*/
pause(locationId, data) {
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/${locationId}/pause`, data || {}, { headers });
return response.data;
});
}
/**
* Update Rebilling
* Documentation - https://highlevel.stoplight.io/docs/integrations/cad43318bd5dc-update-rebilling
* @param locationId
* @param data
* @returns
*/
updateRebilling(locationId, data) {
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.patch(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/locations/${locationId}/rebilling`, data, { headers });
return response.data;
});
}
}
exports.SaaS = SaaS;
//# sourceMappingURL=saas.js.map