n8n-nodes-warmr
Version:
n8n community node for Warmr integration
71 lines (70 loc) • 3.62 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.PipelinesService = void 0;
const request_1 = require("../utils/request");
const BASE_URL = "https://api.warmr.app/v1";
class PipelinesService {
// --- Pipelines ---
static listPipelines(apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines`, {}, apiKey);
});
}
static createPipeline(data, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines`, { method: "POST", body: JSON.stringify(data) }, apiKey);
});
}
static updatePipeline(uuid, data, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines/${uuid}`, { method: "PATCH", body: JSON.stringify(data) }, apiKey);
});
}
static deletePipeline(uuid, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, request_1.apiRequest)(`${BASE_URL}/pipelines/${uuid}`, { method: "DELETE" }, apiKey);
});
}
// --- Stages ---
static listStages(pipelineUuid, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines/${pipelineUuid}/stages`, {}, apiKey);
});
}
static createStage(pipelineUuid, data, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines/${pipelineUuid}/stages`, { method: "POST", body: JSON.stringify(data) }, apiKey);
});
}
static updateStage(stageUuid, data, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines/stages/${stageUuid}`, { method: "PATCH", body: JSON.stringify(data) }, apiKey);
});
}
static deleteStage(stageUuid, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, request_1.apiRequest)(`${BASE_URL}/pipelines/stages/${stageUuid}`, { method: "DELETE" }, apiKey);
});
}
// --- Stage contacts ---
static addContactsToStage(stageUuid, contactUuids, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
return (0, request_1.apiRequest)(`${BASE_URL}/pipelines/stages/${stageUuid}/contacts`, { method: "POST", body: JSON.stringify({ contactUuids }) }, apiKey);
});
}
static removeContactFromStage(stageUuid, contactUuid, apiKey) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, request_1.apiRequest)(`${BASE_URL}/pipelines/stages/${stageUuid}/contacts/${contactUuid}`, { method: "DELETE" }, apiKey);
});
}
}
exports.PipelinesService = PipelinesService;