trello-for-wolves
Version:
Node.js wrapper for Trello API...for wolves.
110 lines (109 loc) • 4.52 kB
JavaScript
;
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.List = void 0;
var TrelloForWolvesError_1 = require("../TrelloForWolvesError");
var Action_1 = require("./Action");
var BaseResource_1 = require("./BaseResource");
var Board_1 = require("./Board");
var Card_1 = require("./Card");
var List = /** @class */ (function (_super) {
__extends(List, _super);
function List() {
return _super !== null && _super.apply(this, arguments) || this;
}
List.prototype.getList = function (params) {
return this.apiGet("/", params);
};
List.prototype.getLists = function (params) {
return this.apiGet("/", params);
};
List.prototype.getListsFilteredBy = function (filter) {
return this.apiGet("/".concat(filter));
};
List.prototype.getFieldValue = function (field) {
return this.apiGet("/".concat(field));
};
List.prototype.addList = function (params) {
var updatedParams = __assign({}, params);
if (this.isChildOf("board")) {
updatedParams.idBoard = this.pathElements[1];
}
if (!updatedParams.idBoard) {
throw new TrelloForWolvesError_1.TrelloForWolvesError("You must specify the \"idBoard\" param when calling addList()");
}
return this.apiPost("/", updatedParams);
};
List.prototype.updateList = function (params) {
return this.apiPut("/", params);
};
List.prototype.updateClosedStatus = function (value) {
return this.apiPut("/closed", { value: value });
};
List.prototype.moveToBoard = function (idBoard) {
return this.apiPut("/idBoard", { value: idBoard });
};
List.prototype.updateName = function (value) {
return this.apiPut("/name", { value: value });
};
List.prototype.updatePosition = function (value) {
return this.apiPut("/pos", { value: value });
};
/**
* Alters the soft limit for number of cards in the list. This is used in conjunction
* with the List Limits Power-Up which will highlight lists that go over their set limit.
* @param value A number between 0 and 5000 or "none" to remove the limit.
*/
List.prototype.updateSoftLimit = function (value) {
// Passing an empty value removes the limit on lists. We're forcing the
// user to either specify "none" or a number to make the purpose of the
// empty value clearer:
var validValue = value === "none" ? "" : value;
return this.apiPut("/softLimit", { value: validValue });
};
List.prototype.updateSubscribed = function (value) {
return this.apiPut("/subscribed", { value: value });
};
List.prototype.archiveAllCards = function () {
return this.apiPost("/archiveAllCards");
};
List.prototype.moveAllCards = function (params) {
return this.apiPost("/moveAllCards", params);
};
List.prototype.actions = function () {
return new Action_1.Action(this.config, this.pathElements, "actions");
};
List.prototype.board = function () {
return new Board_1.Board(this.config, this.pathElements, "board");
};
List.prototype.cards = function () {
return new Card_1.Card(this.config, this.pathElements, "cards");
};
return List;
}(BaseResource_1.BaseResource));
exports.List = List;