UNPKG

trello-for-wolves

Version:
82 lines (81 loc) 3.44 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CheckItem = void 0; var TrelloForWolvesError_1 = require("../TrelloForWolvesError"); var BaseResource_1 = require("./BaseResource"); var CheckItem = /** @class */ (function (_super) { __extends(CheckItem, _super); function CheckItem() { return _super !== null && _super.apply(this, arguments) || this; } CheckItem.prototype.getCheckItem = function (params) { return this.apiGet("/", params); }; CheckItem.prototype.getCheckItems = function (params) { return this.apiGet("/", params); }; CheckItem.prototype.getCheckItemStates = function (params) { return this.apiGet("/", params); }; CheckItem.prototype.addCheckItem = function (params) { return this.apiPost("/", params); }; CheckItem.prototype.convertToCard = function () { return this.apiPost("/convertToCard"); }; CheckItem.prototype.updateCheckItem = function (params) { var _a; var updatedParams = __assign({}, params); // If this method is called from the path // /cards/{idCard}/checklist/{idChecklist}/checkItem/{idCheckItem} // Set the idChecklist equal to the {idChecklist}: var firstChildPath = (_a = this.parentElements[2]) !== null && _a !== void 0 ? _a : ""; if (firstChildPath === "checklist") { updatedParams.idChecklist = params.idChecklist || this.parentElements[3]; } if (!updatedParams.idChecklist) { throw new TrelloForWolvesError_1.TrelloForWolvesError("You must specify the \"idChecklist\" param when calling updateCheckItem()"); } return this.apiPut("/", updatedParams); }; CheckItem.prototype.updateName = function (value) { return this.apiPut("/name", { value: value }); }; CheckItem.prototype.updatePosition = function (value) { return this.apiPut("/pos", { value: value }); }; CheckItem.prototype.updateState = function (value) { return this.apiPut("/state", { value: value }); }; CheckItem.prototype.deleteCheckItem = function () { return this.apiDelete("/"); }; return CheckItem; }(BaseResource_1.BaseResource)); exports.CheckItem = CheckItem;