Socket
Socket
Sign inDemoInstall

leankit-client

Package Overview
Dependencies
65
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta.4 to 1.0.0-beta.6

.babelrc

149

client.js
"use strict";
var _arguments = arguments;
Object.defineProperty(exports, "__esModule", {

@@ -7,11 +8,31 @@ value: true

var path = require("path");
var request = require("request-json");
var request = require("request");
var when = require("when");
var fs = require("fs");
var jetpack = require("fs-jetpack");
var LeanKitClient = function LeanKitClient(account, email, password, options) {
if (arguments.length === 2) {
options = arguments[1];
if (_arguments.length === 2) {
options = _arguments[1];
email = null;
password = null;
}
var buildUrl = function buildUrl(account) {
var url = "";
if (account.indexOf("http://") !== 0 && account.indexOf("https://") !== 0) {
url = "https://" + account;
// Assume leankit.com if no domain is specified
if (account.indexOf(".") === -1) {
url += ".leankit.com";
}
} else {
url = account;
}
if (url.indexOf("/", account.length - 1) !== 0) {
url += "/";
}
return url + "kanban/api/";
};
var boardIdentifiers = {};

@@ -21,2 +42,45 @@

var defaultWipOverrideReason = "WIP Override performed by external system";
var url = buildUrl(account);
if (!options.baseUrl && !options.uri && !options.url) {
options.baseUrl = url;
}
if (options.proxy && (options.proxy.indexOf("localhost") > -1 || options.proxy.indexOf("127.0.0.1") > -1)) {
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
}
if (!options.headers) {
options.headers = {};
}
if (!options.headers["User-Agent"]) {
var version = undefined;
if (jetpack.exists(__dirname + "/package.json")) {
var pkg = jetpack.read(__dirname + "/package.json", "json");
version = pkg.version;
} else {
version = "1.0.0";
}
options.headers["User-Agent"] = "leankit-node-client/" + version;
}
if (password) {
var cred = email + ":" + password;
var basicAuth = new Buffer(cred).toString("base64");
options.headers.authorization = "Basic " + basicAuth;
}
options.json = true;
if (!options.headers.accept) {
options.headers.accept = "application/json";
}
if (!options.headers["Content-Type"]) {
options.headers["Content-Type"] = "application/json";
}
var client = request.defaults(options);
var parseReplyData = function parseReplyData(error, response, callback, cacheCallback) {

@@ -67,19 +131,2 @@ if (error) {

var buildUrl = function buildUrl(account) {
var url = "";
if (account.indexOf("http://") !== 0 && account.indexOf("https://") !== 0) {
url = "https://" + account;
// Assume leankit.com if no domain is specified
if (account.indexOf(".") === -1) {
url += ".leankit.com";
}
} else {
url = account;
}
if (url.indexOf("/", account.length - 1) !== 0) {
url += "/";
}
return url + "kanban/api/";
};
var clientGet = function clientGet(path, callback) {

@@ -111,3 +158,3 @@ var p = when.promise(function (resolve, reject) {

return callback(null, res);
}, function (err) {
}).catch(function (err) {
return callback(err);

@@ -122,3 +169,3 @@ });

var p = when.promise(function (resolve, reject) {
client.post(path, data, function (err, res, body) {
client.post(path, { body: data }, function (err, res, body) {
if (err) {

@@ -140,6 +187,4 @@ reject(err);

return callback(null, res);
}, function (err) {
}).catch(function (err) {
return callback(err, null);
})["catch"](function (err) {
return callback(err, null);
});

@@ -151,10 +196,9 @@ } else {

var clientSaveFile = function clientSaveFile(path, filePath, callback) {
var clientSaveFile = function clientSaveFile(path, file, callback) {
var p = when.promise(function (resolve, reject) {
client.saveFile(path, filePath, function (err, res, body) {
if (err) {
reject(err);
} else {
resolve(body);
}
var f = typeof file === "string" ? fs.createWriteStream(file) : file;
var res = client.get(path);
res.pipe(f);
res.on("end", function () {
resolve(f);
});

@@ -165,3 +209,3 @@ });

return callback(null, res);
}, function (err) {
}).catch(function (err) {
return callback(err);

@@ -174,5 +218,16 @@ });

var sendFile = function sendFile(path, file, attachmentData, callback) {
if (typeof file === "string") {
attachmentData.file = fs.createReadStream(file);
} else {
attachmentData.file = file;
}
client.post({ url: path, formData: attachmentData }, function (err, res, body) {
callback(err, res, body);
});
};
var clientSendFile = function clientSendFile(path, file, attachmentData, callback) {
var p = when.promise(function (resolve, reject) {
client.sendFile(path, file, attachmentData, function (err, res, body) {
sendFile(path, file, attachmentData, function (err, res, body) {
if (err) {

@@ -193,3 +248,3 @@ reject(err);

return callback(null, res);
}, function (err) {
}).catch(function (err) {
return callback(err);

@@ -215,6 +270,4 @@ });

var getBoardByName = function getBoardByName(boardToFind, callback) {
var _this = this;
var p = when.promise(function (resolve, reject) {
_this.getBoards().then(function (boards) {
getBoards().then(function (boards) {
if (boards && boards.length > 0) {

@@ -225,3 +278,3 @@ var board = boards.find(function (b) {

if (board && board.Id > 0) {
_this.getBoard(board.Id).then(function (b) {
getBoard(board.Id).then(function (b) {
resolve(b);

@@ -318,3 +371,3 @@ }, function (err) {

var addCards = function addCards(boardId, cards, callback) {
return this.addCardsWithWipOverride(boardId, cards, defaultWipOverrideReason, callback);
return addCardsWithWipOverride(boardId, cards, defaultWipOverrideReason, callback);
};

@@ -435,4 +488,4 @@

var downloadAttachment = function downloadAttachment(boardId, attachmentId, filePath, callback) {
return clientSaveFile("card/DownloadAttachment/" + boardId + "/" + attachmentId, filePath, callback);
var downloadAttachment = function downloadAttachment(boardId, attachmentId, file, callback) {
return clientSaveFile("card/DownloadAttachment/" + boardId + "/" + attachmentId, file, callback);
};

@@ -460,9 +513,2 @@

var defaultWipOverrideReason = "WIP Override performed by external system";
var url = buildUrl(account);
var client = request.createClient(url, options);
if (password) {
client.setBasicAuth(email, password);
}
return {

@@ -512,7 +558,6 @@ addAttachment: addAttachment,

updateTask: updateTask,
_client: client
_options: options
};
};
exports["default"] = LeanKitClient;
module.exports = exports["default"];
exports.default = LeanKitClient;
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
Object.defineProperty(exports, "__esModule", {

@@ -7,8 +11,8 @@ value: true

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

@@ -26,9 +30,11 @@

_get(Object.getPrototypeOf(LeanKitNotifier.prototype), "constructor", this).call(this);
this.timer = 0;
this.client = client;
this.boardId = boardId;
this.version = version || 0;
this.pollInterval = pollInterval || 30;
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LeanKitNotifier).call(this));
_this.timer = 0;
_this.client = client;
_this.boardId = boardId;
_this.version = version || 0;
_this.pollInterval = pollInterval || 30;
// super.call( this );
return _this;
}

@@ -39,6 +45,6 @@

value: function waitForNextPoll() {
var _this = this;
var _this2 = this;
return setTimeout(function () {
_this.getUpdates();
_this2.getUpdates();
}, this.pollInterval * 1000);

@@ -52,3 +58,3 @@ }

var val = obj[key];
if (val && typeof val === "object") {
if (val && (typeof val === "undefined" ? "undefined" : _typeof(val)) === "object") {
val = this.camelClone(val);

@@ -63,3 +69,3 @@ }

value: function getUpdates(callback) {
var _this2 = this;
var _this3 = this;

@@ -72,4 +78,4 @@ this.timer = 0;

} else {
_this2.version = board.Version;
_this2.getUpdates(callback);
_this3.version = board.Version;
_this3.getUpdates(callback);
}

@@ -81,3 +87,3 @@ });

if (err) {
_get(Object.getPrototypeOf(LeanKitNotifier.prototype), "emit", _this2).call(_this2, "error", err);
_get(Object.getPrototypeOf(LeanKitNotifier.prototype), "emit", _this3).call(_this3, "error", err);
if (typeof callback === "function") {

@@ -88,14 +94,14 @@ callback(err);

(function () {
_this2.version = res.CurrentBoardVersion;
_this3.version = res.CurrentBoardVersion;
var events = [];
res.Events.forEach(function (e) {
var n = _this2.camelClone(e);
n.boardVersion = _this2.version;
var n = _this3.camelClone(e);
n.boardVersion = _this3.version;
n.eventType = changeCase.param(e.EventType).replace("-event", "");
if (n.eventType === "board-edit" && res.NewPayload) {
n.board = _this2.camelClone(res.NewPayload);
n.board = _this3.camelClone(res.NewPayload);
// console.log( n );
}
events.push(n);
_get(Object.getPrototypeOf(LeanKitNotifier.prototype), "emit", _this2).call(_this2, n.eventType, n);
_get(Object.getPrototypeOf(LeanKitNotifier.prototype), "emit", _this3).call(_this3, n.eventType, n);
});

@@ -106,7 +112,7 @@

} else {
_this2.timer = _this2.waitForNextPoll();
_this3.timer = _this3.waitForNextPoll();
}
})();
} else {
_this2.timer = _this2.waitForNextPoll();
_this3.timer = _this3.waitForNextPoll();
}

@@ -124,6 +130,6 @@ });

value: function waitForNextUpdate() {
var _this3 = this;
var _this4 = this;
return when.promise(function (resolve, reject) {
_this3.getUpdates(function (err, res) {
_this4.getUpdates(function (err, res) {
if (err) {

@@ -150,3 +156,2 @@ reject(err);

exports["default"] = LeanKitNotifier;
module.exports = exports["default"];
exports.default = LeanKitNotifier;
{
"name": "leankit-client",
"description": "API client for use with LeanKit Kanban",
"description": "Node.js API client for use with LeanKit",
"readme": "https://github.com/LeanKit/leankit-node-client/blob/master/README.md",

@@ -18,3 +18,3 @@ "keywords": [

"license": "SEE LICENSE IN https://github.com/LeanKit/leankit-node-client/blob/master/LICENSE",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.6",
"homepage": "https://github.com/LeanKit/leankit-node-client/",

@@ -38,8 +38,10 @@ "bugs": {

"dependencies": {
"babel": "~5.0",
"change-case": "^2.3.0",
"request-json": "~0.5.2",
"request": "^2.67.0",
"when": "~3.7.4"
},
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.3.26",
"babel-preset-es2015": "^6.3.13",
"chai": "^3.4.1",

@@ -54,6 +56,7 @@ "chai-as-promised": "^5.1.0",

"scripts": {
"test": "./node_modules/mocha/bin/mocha --compilers js:babel/register --reporter spec",
"test-events": "./node_modules/mocha/bin/mocha ./test/event-tests.js --compilers js:babel/register --reporter spec",
"test-client": "./node_modules/mocha/bin/mocha ./test/client-tests.js --compilers js:babel/register --reporter spec",
"compile": "babel ./src --out-dir ./"
"compile": "./node_modules/.bin/babel ./src -d ./",
"prepublish": "npm run compile",
"test": "npm run compile && ./node_modules/mocha/bin/mocha --compilers js:babel-core/register --reporter spec ./test/*.js",
"test-events": "npm run compile && ./node_modules/mocha/bin/mocha ./test/event-tests.js --compilers js:babel-core/register --reporter spec",
"test-client": "npm run compile && ./node_modules/mocha/bin/mocha ./test/client-tests.js --compilers js:babel-core/register --reporter spec"
},

@@ -60,0 +63,0 @@ "repository": {

const path = require( "path" );
const request = require( "request-json" );
const request = require( "request" );
const when = require( "when" );
const fs = require( "fs" );
const jetpack = require( "fs-jetpack" );
let LeanKitClient = function( account, email, password, options ) {
const LeanKitClient = ( account, email, password, options ) => {
if ( arguments.length === 2 ) {

@@ -11,2 +13,20 @@ options = arguments[ 1 ];

}
const buildUrl = ( account ) => {
let url = "";
if ( account.indexOf( "http://" ) !== 0 && account.indexOf( "https://" ) !== 0 ) {
url = "https://" + account;
// Assume leankit.com if no domain is specified
if ( account.indexOf( "." ) === -1 ) {
url += ".leankit.com";
}
} else {
url = account;
}
if ( url.indexOf( "/", account.length - 1 ) !== 0 ) {
url += "/";
}
return url + "kanban/api/";
};
let boardIdentifiers = {};

@@ -16,3 +36,46 @@

let parseReplyData = function( error, response, callback, cacheCallback ) {
const defaultWipOverrideReason = "WIP Override performed by external system";
const url = buildUrl( account );
if ( !options.baseUrl && !options.uri && !options.url ) {
options.baseUrl = url;
}
if ( options.proxy && ( options.proxy.indexOf( "localhost" ) > -1 || options.proxy.indexOf( "127.0.0.1" ) > -1 ) ) {
process.env[ "NODE_TLS_REJECT_UNAUTHORIZED" ] = "0";
}
if ( !options.headers ) {
options.headers = {};
}
if ( !options.headers["User-Agent"] ) {
let version;
if ( jetpack.exists( __dirname + "/package.json" ) ) {
let pkg = jetpack.read( __dirname + "/package.json", "json" );
version = pkg.version;
} else {
version = "1.0.0";
}
options.headers["User-Agent"] = `leankit-node-client/${version}`;
}
if ( password ) {
let cred = `${email}:${password}`;
let basicAuth = new Buffer( cred ).toString( "base64" );
options.headers.authorization = `Basic ${basicAuth}`;
}
options.json = true;
if ( !options.headers.accept ) {
options.headers.accept = "application/json";
}
if ( !options.headers["Content-Type"] ) {
options.headers["Content-Type"] = "application/json";
}
const client = request.defaults( options );
const parseReplyData = ( error, response, callback, cacheCallback ) => {
if ( error ) {

@@ -46,3 +109,3 @@ if ( error instanceof Error ) {

let parseBody = function( body ) {
const parseBody = ( body ) => {
let err, parsed;

@@ -62,20 +125,3 @@ if ( typeof body === "string" && body !== "" ) {

let buildUrl = function( account ) {
let url = "";
if ( account.indexOf( "http://" ) !== 0 && account.indexOf( "https://" ) !== 0 ) {
url = "https://" + account;
// Assume leankit.com if no domain is specified
if ( account.indexOf( "." ) === -1 ) {
url += ".leankit.com";
}
} else {
url = account;
}
if ( url.indexOf( "/", account.length - 1 ) !== 0 ) {
url += "/";
}
return url + "kanban/api/";
};
let clientGet = function( path, callback ) {
const clientGet = ( path, callback ) => {
let p = when.promise( ( resolve, reject ) => {

@@ -106,3 +152,3 @@ client.get( path, ( err, res, body ) => {

return callback( null, res );
}, ( err ) => {
} ).catch( ( err ) => {
return callback( err );

@@ -115,5 +161,5 @@ } );

let clientPost = function( path, data, callback ) {
const clientPost = ( path, data, callback ) => {
let p = when.promise( ( resolve, reject ) => {
client.post( path, data, ( err, res, body ) => {
client.post( path, { body: data }, ( err, res, body ) => {
if ( err ) {

@@ -135,6 +181,5 @@ reject( err );

return callback( null, res );
}, ( err ) => {
} )
.catch( ( err ) => {
return callback( err, null );
} ).catch( ( err ) => {
return callback( err, null );
} );

@@ -146,10 +191,9 @@ } else {

let clientSaveFile = function( path, filePath, callback ) {
const clientSaveFile = ( path, file, callback ) => {
let p = when.promise( ( resolve, reject ) => {
client.saveFile( path, filePath, ( err, res, body ) => {
if ( err ) {
reject( err );
} else {
resolve( body );
}
let f = ( typeof file === "string" ) ? fs.createWriteStream( file ) : file;
let res = client.get( path );
res.pipe( f );
res.on( "end", () => {
resolve( f );
} );

@@ -160,3 +204,3 @@ } );

return callback( null, res );
}, ( err ) => {
} ).catch( ( err ) => {
return callback( err );

@@ -169,5 +213,16 @@ } );

let clientSendFile = function( path, file, attachmentData, callback ) {
const sendFile = ( path, file, attachmentData, callback ) => {
if ( typeof file === "string" ) {
attachmentData.file = fs.createReadStream( file );
} else {
attachmentData.file = file;
}
client.post( { url: path, formData: attachmentData }, ( err, res, body ) => {
callback( err, res, body );
} );
};
const clientSendFile = ( path, file, attachmentData, callback ) => {
let p = when.promise( ( resolve, reject ) => {
client.sendFile( path, file, attachmentData, ( err, res, body ) => {
sendFile( path, file, attachmentData, ( err, res, body ) => {
if ( err ) {

@@ -188,3 +243,3 @@ reject( err );

return callback( null, res );
}, ( err ) => {
} ).catch( ( err ) => {
return callback( err );

@@ -197,17 +252,17 @@ } );

let getBoards = function( callback ) {
const getBoards = ( callback ) => {
return clientGet( "boards", callback );
};
let getNewBoards = function( callback ) {
const getNewBoards = ( callback ) => {
return clientGet( "ListNewBoards", callback );
};
let getBoard = function( boardId, callback ) {
const getBoard = ( boardId, callback ) => {
return clientGet( `boards/${boardId}`, callback );
};
let getBoardByName = function( boardToFind, callback ) {
const getBoardByName = ( boardToFind, callback ) => {
let p = when.promise( ( resolve, reject ) => {
this.getBoards().then( ( boards ) => {
getBoards().then( ( boards ) => {
if ( boards && boards.length > 0 ) {

@@ -218,3 +273,3 @@ let board = boards.find( ( b ) => {

if ( board && board.Id > 0 ) {
this.getBoard( board.Id ).then( ( b ) => {
getBoard( board.Id ).then( ( b ) => {
resolve( b );

@@ -245,3 +300,3 @@ }, ( err ) => {

let getBoardIdentifiers = function( boardId, callback ) {
const getBoardIdentifiers = ( boardId, callback ) => {
let p = when.promise( ( resolve, reject ) => {

@@ -270,39 +325,39 @@ if ( boardId in boardIdentifiers ) {

let getBoardBacklogLanes = function( boardId, callback ) {
const getBoardBacklogLanes = ( boardId, callback ) => {
return clientGet( `board/${boardId}/backlog`, callback );
};
let getBoardArchiveLanes = function( boardId, callback ) {
const getBoardArchiveLanes = ( boardId, callback ) => {
return clientGet( `board/${boardId}/archive`, callback );
};
let getBoardArchiveCards = function( boardId, callback ) {
const getBoardArchiveCards = ( boardId, callback ) => {
return clientGet( `board/${boardId}/archivecards`, callback );
};
let getNewerIfExists = function( boardId, version, callback ) {
const getNewerIfExists = ( boardId, version, callback ) => {
return clientGet( `board/${boardId}/boardversion/${version}/getnewerifexists`, callback );
};
let getBoardHistorySince = function( boardId, version, callback ) {
const getBoardHistorySince = ( boardId, version, callback ) => {
return clientGet( `board/${boardId}/boardversion/${version}/getboardhistorysince`, callback );
};
let getBoardUpdates = function( boardId, version, callback ) {
const getBoardUpdates = ( boardId, version, callback ) => {
return clientGet( `board/${boardId}/boardversion/${version}/checkforupdates`, callback );
};
let getCard = function( boardId, cardId, callback ) {
const getCard = ( boardId, cardId, callback ) => {
return clientGet( `board/${boardId}/getcard/${cardId}`, callback );
};
let getCardByExternalId = function( boardId, externalCardId, callback ) {
const getCardByExternalId = ( boardId, externalCardId, callback ) => {
return clientGet( `board/${boardId}/getcardbyexternalid/${encodeURIComponent( externalCardId )}`, callback );
};
let addCard = function( boardId, laneId, position, card, callback ) {
const addCard = ( boardId, laneId, position, card, callback ) => {
return addCardWithWipOverride( boardId, laneId, position, defaultWipOverrideReason, card, callback );
};
let addCardWithWipOverride = function( boardId, laneId, position, wipOverrideReason, card, callback ) {
const addCardWithWipOverride = ( boardId, laneId, position, wipOverrideReason, card, callback ) => {
card.UserWipOverrideComment = wipOverrideReason;

@@ -312,11 +367,11 @@ return clientPost( `board/${boardId}/AddCardWithWipOverride/Lane/${laneId}/Position/${position}`, card, callback );

let addCards = function( boardId, cards, callback ) {
return this.addCardsWithWipOverride( boardId, cards, defaultWipOverrideReason, callback );
const addCards = ( boardId, cards, callback ) => {
return addCardsWithWipOverride( boardId, cards, defaultWipOverrideReason, callback );
};
let addCardsWithWipOverride = function( boardId, cards, wipOverrideReason, callback ) {
const addCardsWithWipOverride = ( boardId, cards, wipOverrideReason, callback ) => {
return clientPost( `board/${boardId}/AddCards?wipOverrideComment=${encodeURIComponent( wipOverrideReason )}`, cards, callback );
};
let moveCard = function( boardId, cardId, toLaneId, position, wipOverrideReason, callback ) {
const moveCard = ( boardId, cardId, toLaneId, position, wipOverrideReason, callback ) => {
return clientPost( `board/${boardId}/movecardwithwipoverride/${cardId}/lane/${toLaneId}/position/${position}`, {

@@ -327,3 +382,3 @@ comment: wipOverrideReason

let moveCardByExternalId = function( boardId, externalCardId, toLaneId, position, wipOverrideReason, callback ) {
const moveCardByExternalId = ( boardId, externalCardId, toLaneId, position, wipOverrideReason, callback ) => {
return clientPost( `board/${boardId}/movecardbyexternalid/${encodeURIComponent( externalCardId )}/lane/${toLaneId}/position/${position}`, {

@@ -334,7 +389,7 @@ comment: wipOverrideReason

let moveCardToBoard = function( cardId, destinationBoardId, callback ) {
const moveCardToBoard = ( cardId, destinationBoardId, callback ) => {
return clientPost( `card/movecardtoanotherboard/${cardId}/${destinationBoardId}`, null, callback );
};
let updateCard = function( boardId, card, callback ) {
const updateCard = ( boardId, card, callback ) => {
card.UserWipOverrideComment = defaultWipOverrideReason;

@@ -344,15 +399,15 @@ return clientPost( `board/${boardId}/UpdateCardWithWipOverride`, card, callback );

let updateCardFields = function( updateFields, callback ) {
const updateCardFields = ( updateFields, callback ) => {
return clientPost( "card/update", updateFields, callback );
};
let updateCards = function( boardId, cards, callback ) {
const updateCards = ( boardId, cards, callback ) => {
return clientPost( `board/${boardId}/updatecards?wipoverridecomment=${encodeURIComponent( defaultWipOverrideReason )}`, cards, callback );
};
let getComments = function( boardId, cardId, callback ) {
const getComments = ( boardId, cardId, callback ) => {
return clientGet( `card/getcomments/${boardId}/${cardId}`, callback );
};
let addComment = function( boardId, cardId, userId, comment, callback ) {
const addComment = ( boardId, cardId, userId, comment, callback ) => {
let data;

@@ -366,3 +421,3 @@ data = {

let addCommentByExternalId = function( boardId, externalCardId, userId, comment, callback ) {
const addCommentByExternalId = ( boardId, externalCardId, userId, comment, callback ) => {
let data;

@@ -376,27 +431,27 @@ data = {

let getCardHistory = function( boardId, cardId, callback ) {
const getCardHistory = ( boardId, cardId, callback ) => {
return clientGet( `card/history/${boardId}/${cardId}`, callback );
};
let searchCards = function( boardId, options, callback ) {
const searchCards = ( boardId, options, callback ) => {
return clientPost( `board/${boardId}/searchcards`, options, callback );
};
let getNewCards = function( boardId, callback ) {
const getNewCards = ( boardId, callback ) => {
return clientGet( `board/${boardId}/listnewcards`, callback );
};
let deleteCard = function( boardId, cardId, callback ) {
const deleteCard = ( boardId, cardId, callback ) => {
return clientPost( `board/${boardId}/deletecard/${cardId}`, null, callback );
};
let deleteCards = function( boardId, cardIds, callback ) {
const deleteCards = ( boardId, cardIds, callback ) => {
return clientPost( `board/${boardId}/deletecards`, cardIds, callback );
};
let getTaskboard = function( boardId, cardId, callback ) {
const getTaskboard = ( boardId, cardId, callback ) => {
return clientGet( `v1/board/${boardId}/card/${cardId}/taskboard`, callback );
};
let addTask = function( boardId, cardId, taskCard, callback ) {
const addTask = ( boardId, cardId, taskCard, callback ) => {
taskCard.UserWipOverrideComment = defaultWipOverrideReason;

@@ -406,3 +461,3 @@ return clientPost( `v1/board/${boardId}/card/${cardId}/tasks/lane/${taskCard.LaneId}/position/${taskCard.Index}`, taskCard, callback );

let updateTask = function( boardId, cardId, taskCard, callback ) {
const updateTask = ( boardId, cardId, taskCard, callback ) => {
taskCard.UserWipOverrideComment = defaultWipOverrideReason;

@@ -412,35 +467,35 @@ return clientPost( `v1/board/${boardId}/update/card/${cardId}/tasks/${taskCard.Id}`, taskCard, callback );

let deleteTask = function( boardId, cardId, taskId, callback ) {
const deleteTask = ( boardId, cardId, taskId, callback ) => {
return clientPost( `v1/board/${boardId}/delete/card/${cardId}/tasks/${taskId}`, null, callback );
};
let getTaskBoardUpdates = function( boardId, cardId, version, callback ) {
const getTaskBoardUpdates = ( boardId, cardId, version, callback ) => {
return clientGet( `v1/board/${boardId}/card/${cardId}/tasks/boardversion/${version}`, callback );
};
let moveTask = function( boardId, cardId, taskId, toLaneId, position, callback ) {
const moveTask = ( boardId, cardId, taskId, toLaneId, position, callback ) => {
return clientPost( `v1/board/${boardId}/move/card/${cardId}/tasks/${taskId}/lane/${toLaneId}/position/${position}`, null, callback );
};
let getAttachmentCount = function( boardId, cardId, callback ) {
const getAttachmentCount = ( boardId, cardId, callback ) => {
return clientGet( `card/GetAttachmentsCount/${boardId}/${cardId}`, callback );
};
let getAttachments = function( boardId, cardId, callback ) {
const getAttachments = ( boardId, cardId, callback ) => {
return clientGet( `card/GetAttachments/${boardId}/${cardId}`, callback );
};
let getAttachment = function( boardId, cardId, attachmentId, callback ) {
const getAttachment = ( boardId, cardId, attachmentId, callback ) => {
return clientGet( `card/GetAttachments/${boardId}/${cardId}/${attachmentId}`, callback );
};
let downloadAttachment = function( boardId, attachmentId, filePath, callback ) {
return clientSaveFile( `card/DownloadAttachment/${boardId}/${attachmentId}`, filePath, callback );
const downloadAttachment = ( boardId, attachmentId, file, callback ) => {
return clientSaveFile( `card/DownloadAttachment/${boardId}/${attachmentId}`, file, callback );
};
let deleteAttachment = function( boardId, cardId, attachmentId, callback ) {
const deleteAttachment = ( boardId, cardId, attachmentId, callback ) => {
return clientPost( `card/DeleteAttachment/${boardId}/${cardId}/${attachmentId}`, null, callback );
};
let addAttachment = function( boardId, cardId, description, file, callback ) {
const addAttachment = ( boardId, cardId, description, file, callback ) => {
let attachmentData, fileName;

@@ -460,9 +515,2 @@ if ( typeof file === "string" ) {

let defaultWipOverrideReason = "WIP Override performed by external system";
const url = buildUrl( account );
let client = request.createClient( url, options );
if ( password ) {
client.setBasicAuth( email, password );
}
return {

@@ -512,3 +560,3 @@ addAttachment: addAttachment,

updateTask: updateTask,
_client: client
_options: options
};

@@ -515,0 +563,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc