UNPKG

n8n-nodes-warmr

Version:
48 lines (47 loc) 2.35 kB
"use strict"; 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.TagsService = void 0; const request_1 = require("../utils/request"); const BASE_URL = "https://api.warmr.app/v1"; class TagsService { static listTags(apiKey) { return __awaiter(this, void 0, void 0, function* () { return (0, request_1.apiRequest)(`${BASE_URL}/tags`, {}, apiKey); }); } static createTag(data, apiKey) { return __awaiter(this, void 0, void 0, function* () { return (0, request_1.apiRequest)(`${BASE_URL}/tags`, { method: "POST", body: JSON.stringify(data) }, apiKey); }); } static updateTag(id, data, apiKey) { return __awaiter(this, void 0, void 0, function* () { return (0, request_1.apiRequest)(`${BASE_URL}/tags/${id}`, { method: "PATCH", body: JSON.stringify(data) }, apiKey); }); } static deleteTag(id, apiKey) { return __awaiter(this, void 0, void 0, function* () { yield (0, request_1.apiRequest)(`${BASE_URL}/tags/${id}`, { method: "DELETE" }, apiKey); }); } static getContactTags(contactUuid, apiKey) { return __awaiter(this, void 0, void 0, function* () { return (0, request_1.apiRequest)(`${BASE_URL}/contacts/${contactUuid}/tags`, {}, apiKey); }); } static replaceContactTags(contactUuid, tagIds, apiKey) { return __awaiter(this, void 0, void 0, function* () { yield (0, request_1.apiRequest)(`${BASE_URL}/contacts/${contactUuid}/tags`, { method: "POST", body: JSON.stringify({ tagIds }) }, apiKey); }); } } exports.TagsService = TagsService;