gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
70 lines • 3.36 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.Campaign = void 0;
const axios_1 = require("axios");
class Campaign {
/**
* Endpoints For Contacts for Campaigns
* Documentation: https://highlevel.stoplight.io/docs/integrations/ecf9b5b45deaf-add-contact-to-campaign
*/
constructor(authData) {
this.authData = authData;
}
/**
* Add Contact to Campaign
* Documentation: https://highlevel.stoplight.io/docs/integrations/ecf9b5b45deaf-add-contact-to-campaign
* https://public-api.gohighlevel.com/#8a506dff-cea3-48bc-909f-4f85a0e8a7be
* @param contactId
* @param campaignId
* @returns
*/
add(contactId, campaignId) {
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}/contacts/${contactId}/campaigns/${campaignId}`, {}, { headers });
return response.data.succeded;
});
}
/**
* Delete Contact from Campaign
* Documentation: https://highlevel.stoplight.io/docs/integrations/e88fc8bf2a781-remove-contact-from-campaign
* @param contactId
* @param campaignId
* @returns
*/
remove(contactId, campaignId) {
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}/contacts/${contactId}/campaigns/${campaignId}`, { headers });
return response.data.succeded;
});
}
/**
* Delete Contact from all Campaign
* Documentation: https://highlevel.stoplight.io/docs/integrations/e9642e2d8bc8a-remove-contact-from-every-campaign
* @param contactId
* @param campaignId
* @returns
*/
removeAll(contactId, campaignId) {
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}/contacts/${contactId}/campaigns/${campaignId}/removeAll`, { headers });
return response.data.succeded;
});
}
}
exports.Campaign = Campaign;
//# sourceMappingURL=contacts.campaigns.js.map