gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
116 lines • 5.42 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.Opportunities = void 0;
const axios_1 = require("axios");
const opportunities_search_1 = require("./opportunities.search");
const opportunities_pipelines_1 = require("./opportunities.pipelines");
const opportunities_followers_1 = require("./opportunities.followers");
class Opportunities {
/**
* Endpoints For Opportunities
* https://highlevel.stoplight.io/docs/integrations/31798edaafcba-get-opportunity
*/
constructor(authData) {
this.authData = authData;
this.search = new opportunities_search_1.OpportunitiesSearch(authData);
this.pipelines = new opportunities_pipelines_1.OpportunitiesPipelines(authData);
this.followers = new opportunities_followers_1.OpportunitiesFollowers(authData);
}
/**
* Get Opportunity
* Documentation - https://highlevel.stoplight.io/docs/integrations/31798edaafcba-get-opportunity
* @param opportunityId
* @returns
*/
get(opportunityId) {
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}/opportunities/${opportunityId}`, { headers });
return response.data;
});
}
/**
* Create Opportunity
* Documentation - https://highlevel.stoplight.io/docs/integrations/802093aa63900-create-opportunity
* @param data
* @returns
*/
create(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}/opportunities`, data, { headers });
return response.data;
});
}
/**
* Update Opportunity
* Documentation - https://highlevel.stoplight.io/docs/integrations/ca75b3ab9e828-update-opportunity
* @param opportunityId
* @param data
* @returns
*/
update(opportunityId, 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.put(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/opportunities/${opportunityId}`, data, { headers });
return response.data;
});
}
/**
* Update Opportunity Status
* Documentation - https://highlevel.stoplight.io/docs/integrations/d595e6fa2b666-update-opportunity-status
* @param opportunityId
* @param data
* @returns
*/
updateStatus(opportunityId, 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.put(`${(_b = this.authData) === null || _b === void 0 ? void 0 : _b.baseurl}/opportunities/${opportunityId}/status`, data, { headers });
return response.data;
});
}
/**
* Upsert Opportunity
* Documentation - https://highlevel.stoplight.io/docs/integrations/9df1c12e5da99-upsert-opportunity
* @param data
* @returns
*/
upsert(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}/opportunities/upsert`, data, { headers });
return response.data;
});
}
/**
* Delete Opportunity
* Documentation - https://highlevel.stoplight.io/docs/integrations/11568af679dff-delete-opportunity
* @param opportunityId
* @returns
*/
remove(opportunityId) {
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}/opportunities/${opportunityId}`, { headers });
return response.data;
});
}
}
exports.Opportunities = Opportunities;
//# sourceMappingURL=opportunities.js.map