UNPKG

trello-for-wolves

Version:
97 lines (96 loc) 3.87 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.Checklist = void 0; var TrelloForWolvesError_1 = require("../TrelloForWolvesError"); var BaseResource_1 = require("./BaseResource"); var Board_1 = require("./Board"); var Card_1 = require("./Card"); var CheckItem_1 = require("./CheckItem"); /** * Checklists are lists on boards that have items that can be completed or * "checked off". * @see https://developers.trello.com/reference#checklist * @class */ var Checklist = /** @class */ (function (_super) { __extends(Checklist, _super); function Checklist() { return _super !== null && _super.apply(this, arguments) || this; } Checklist.prototype.getChecklist = function (params) { return this.apiGet("/", params); }; Checklist.prototype.getChecklists = function (params) { return this.apiGet("/", params); }; Checklist.prototype.getFieldValue = function (field) { return this.apiGet("/".concat(field)); }; Checklist.prototype.addChecklist = function (params) { var updatedParams = __assign({}, params); if (this.isChildOf("card")) { updatedParams.idCard = this.parentElements[1]; } if (!updatedParams.idCard) { throw new TrelloForWolvesError_1.TrelloForWolvesError("You must specify the \"idCard\" param when calling addLabel()"); } return this.apiPost("/", updatedParams); }; Checklist.prototype.updateChecklist = function (params) { return this.apiPut("/", params); }; Checklist.prototype.updateName = function (value) { return this.apiPut("/name", { value: value }); }; Checklist.prototype.updatePosition = function (value) { return this.apiPut("/pos", { value: value }); }; Checklist.prototype.deleteChecklist = function () { return this.apiDelete("/"); }; Checklist.prototype.board = function () { return new Board_1.Board(this.config, this.pathElements, "board"); }; Checklist.prototype.cards = function () { return new Card_1.Card(this.config, this.pathElements, "cards"); }; Checklist.prototype.checkItem = function (idCheckItem) { return new CheckItem_1.CheckItem(this.config, this.pathElements, "checkItem", { identifier: idCheckItem, }); }; Checklist.prototype.checkItems = function (idCheckItem) { if (idCheckItem === void 0) { idCheckItem = ""; } return new CheckItem_1.CheckItem(this.config, this.pathElements, "checkItems", { identifier: idCheckItem, }); }; return Checklist; }(BaseResource_1.BaseResource)); exports.Checklist = Checklist;