trello-for-wolves
Version:
Node.js wrapper for Trello API...for wolves.
221 lines (220 loc) • 9.03 kB
JavaScript
"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);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Board = void 0;
var TrelloForWolvesError_1 = require("../TrelloForWolvesError");
var Action_1 = require("./Action");
var BaseResource_1 = require("./BaseResource");
var BoardMyPrefs_1 = require("./BoardMyPrefs");
var BoardPref_1 = require("./BoardPref");
var BoardStar_1 = require("./BoardStar");
var Card_1 = require("./Card");
var Checklist_1 = require("./Checklist");
var CustomField_1 = require("./CustomField");
var Label_1 = require("./Label");
var List_1 = require("./List");
var Member_1 = require("./Member");
var Membership_1 = require("./Membership");
var Organization_1 = require("./Organization");
var Plugin_1 = require("./Plugin");
/**
* Boards are fundamental to Trello. A board may belong to 0 or 1 teams and can
* have 0 or more lists.
* @see https://developers.trello.com/reference#boards-2
* @class
*/
var Board = /** @class */ (function (_super) {
__extends(Board, _super);
function Board() {
return _super !== null && _super.apply(this, arguments) || this;
}
Board.prototype.getBoard = function (params) {
return this.apiGet("/", params);
};
Board.prototype.getBoards = function (params) {
return this.apiGet("/", params);
};
Board.prototype.getBoardsFilteredBy = function (filter) {
return this.apiGet("/", { filter: filter });
};
Board.prototype.getFieldValue = function (field) {
return this.apiGet("/".concat(field));
};
Board.prototype.getBoardPlugins = function () {
return this.apiGet("/boardPlugins");
};
Board.prototype.getTags = function () {
return this.apiGet("/idTags");
};
/**
* This method can be used before moving a board into a paid organization to
* see if the board contains members that aren't already paid for in the
* organization.
* @see https://developers.trello.com/reference#organizationsidnewbillableguestsidboard
*/
Board.prototype.getIfHasNewBillableGuests = function () {
if (!this.isChildOf("organization")) {
throw new TrelloForWolvesError_1.TrelloForWolvesError("You can only call getIfHasNewBillableGuests() from an organization");
}
this.pathElements = __spreadArray(__spreadArray([], this.parentElements, true), [
"newBillableGuests",
this.identifier,
], false);
return this.apiGet("/");
};
Board.prototype.addBoard = function (params) {
return this.apiPost("/", __assign(__assign({}, params), { separator: "_" }));
};
Board.prototype.enableBoardPlugin = function (idPlugin) {
return this.apiPost("/boardPlugins", { idPlugin: idPlugin });
};
Board.prototype.enablePowerUp = function (value) {
return this.apiPost("/powerUps", { value: value });
};
Board.prototype.addTag = function (value) {
return this.apiPost("/idTags", { value: value });
};
Board.prototype.generateCalendarKey = function () {
return this.apiPost("/calendarKey/generate");
};
Board.prototype.generateEmailKey = function () {
return this.apiPost("/emailKey/generate");
};
Board.prototype.markAsViewed = function () {
return this.apiPost("/markAsViewed");
};
Board.prototype.updateBoard = function (params) {
return this.apiPut("/", __assign(__assign({}, params), { separator: "/" }));
};
Board.prototype.updateClosedStatus = function (value) {
return this.apiPut("/closed", { value: value });
};
Board.prototype.updateDescription = function (value) {
return this.apiPut("/desc", { value: value });
};
Board.prototype.moveToOrganization = function (organizationId) {
return this.apiPut("/idOrganization", { value: organizationId });
};
Board.prototype.updateLabelNameForColor = function (labelColor, labelName) {
return this.apiPut("/labelNames/".concat(labelColor), {
value: labelName,
});
};
Board.prototype.updateName = function (value) {
return this.apiPut("/name", { value: value });
};
Board.prototype.updateSubscribed = function (value) {
return this.apiPut("/subscribed", { value: value });
};
Board.prototype.deleteBoard = function () {
return this.apiDelete("/");
};
Board.prototype.disableBoardPlugin = function (idPlugin) {
return this.apiDelete("/boardPlugins/".concat(idPlugin));
};
Board.prototype.disablePowerUp = function (powerUp) {
return this.apiDelete("/powerUps/".concat(powerUp));
};
Board.prototype.actions = function (idAction) {
if (idAction === void 0) { idAction = ""; }
return new Action_1.Action(this.config, this.pathElements, "actions", {
identifier: idAction,
});
};
Board.prototype.boardStars = function (idBoardStar) {
if (idBoardStar === void 0) { idBoardStar = ""; }
return new BoardStar_1.BoardStar(this.config, this.pathElements, "boardStars", {
identifier: idBoardStar,
});
};
Board.prototype.cards = function (idCard) {
if (idCard === void 0) { idCard = ""; }
return new Card_1.Card(this.config, this.pathElements, "cards", {
identifier: idCard,
});
};
Board.prototype.checklists = function (idChecklist) {
if (idChecklist === void 0) { idChecklist = ""; }
return new Checklist_1.Checklist(this.config, this.pathElements, "checklists", {
identifier: idChecklist,
});
};
Board.prototype.customFields = function () {
return new CustomField_1.CustomField(this.config, this.pathElements, "customFields");
};
Board.prototype.labels = function (idLabel) {
if (idLabel === void 0) { idLabel = ""; }
return new Label_1.Label(this.config, this.pathElements, "labels", {
identifier: idLabel,
});
};
Board.prototype.lists = function (idList) {
if (idList === void 0) { idList = ""; }
return new List_1.List(this.config, this.pathElements, "lists", {
identifier: idList,
});
};
Board.prototype.members = function (idMember) {
if (idMember === void 0) { idMember = ""; }
return new Member_1.Member(this.config, this.pathElements, "members", {
identifier: idMember,
});
};
Board.prototype.membersInvited = function () {
return new Member_1.Member(this.config, this.pathElements, "membersInvited");
};
Board.prototype.memberships = function (idMembership) {
if (idMembership === void 0) { idMembership = ""; }
return new Membership_1.Membership(this.config, this.pathElements, "memberships", {
identifier: idMembership,
});
};
Board.prototype.myPrefs = function () {
return new BoardMyPrefs_1.BoardMyPrefs(this.config, this.pathElements, "myPrefs");
};
Board.prototype.organization = function () {
return new Organization_1.Organization(this.config, this.pathElements, "organization");
};
Board.prototype.plugins = function () {
return new Plugin_1.Plugin(this.config, this.pathElements, "plugins");
};
Board.prototype.prefs = function () {
return new BoardPref_1.BoardPref(this.config, this.pathElements, "prefs");
};
return Board;
}(BaseResource_1.BaseResource));
exports.Board = Board;