gohl
Version:
Go Highlevel Node Js ease of use library implementation to their API
98 lines • 4.31 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.Note = void 0;
const axios_1 = require("axios");
class Note {
/**
* Endpoints For Contacts Notes
* https://highlevel.stoplight.io/docs/integrations/db572d519b209-get-all-notes
*/
constructor(authData) {
this.authData = authData;
}
/**
* Get all Notes
* Documentation - https://highlevel.stoplight.io/docs/integrations/73decb4b6d0c2-get-all-notes
* @param contactId
*/
getAll(contactId) {
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}/contacts/${contactId}/notes`, { headers });
return response.data.notes;
});
}
/**
* Get Note
* Documentation - https://highlevel.stoplight.io/docs/integrations/24cab1c2b3dfb-get-note
* @param contactId
* @param noteId
* @returns
*/
get(contactId, noteId) {
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}/contacts/${contactId}/notes/${noteId}`, { headers });
return response.data.note;
});
}
/**
* Create Note
* Documentation - https://highlevel.stoplight.io/docs/integrations/5eab1684a9948-create-note
* @param contactId
* @param note
* @returns
*/
add(contactId, note) {
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}/notes`, note, { headers });
return response.data.note;
});
}
/**
* Update Note
* Documentation - https://highlevel.stoplight.io/docs/integrations/71814e115658f-update-note
* @param contactId
* @param noteId
* @param note
* @returns
*/
update(contactId, noteId, note) {
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}/contacts/${contactId}/notes/${noteId}`, note, { headers });
return response.data.note;
});
}
/**
* Delete Note
* Documentation - https://highlevel.stoplight.io/docs/integrations/d7e867be69e9f-delete-note
* @param contactId
* @param noteId
* @returns
*/
remove(contactId, noteId) {
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}/notes/${noteId}`, { headers });
return response.data.succeded;
});
}
}
exports.Note = Note;
//# sourceMappingURL=contacts.notes.js.map