norberteder / trello Goto Github PK
View Code? Open in Web Editor NEWUse the Trello API from Node
Use the Trello API from Node
to easily use API endpoints not supported yet by the lib.
The makeRequest
would mix in the key
and token
query params to whatever the user hands in as ? query
main.js:325
return this.upadateLabel(labelId, 'color', color, callback);
thanks for this package, cheers!
The underlying restler
package doesn't appear to have been updated in 4-5 years. It uses octal literals. the problem is when running something with use_strict mode on, this causes failures. Any chance restler
could be replaced with a maintained package?
It would be nice if you guys added a function to set the card pos.
Hi, how can I add local file as an Attachment? Thanks :)
I'm trying to run this scripts under Node v6 and v7:
const Trello = require("trello_ex")
const trello = new Trello(APP_KEY, USER_TOKEN)
trello.getListsOnBoardByFilter(BOARD_ID, "open", (err, lists) => {
if (err) console.error(err)
console.log(lists)
})
And the STDOUT is just:
"[STATUS] RestClient request send, U…trello.com/1/boards/BOARD_ID/lists"
"[STATUS] RestClient request send, Method: GET"
Error: [object Object]
I'm trying to debug it and found where the problem exists but its not clear enough. I'm trying to use this package because of https://github.com/devtyr/trello-burndown
I am trying to make a script to basically clone a Trello board and if something happens to it I can just revert it with a simple command (using discord js as well) that will send all lists and cards on the original board (I am going to define the original board's id's in multiple variables.
So basically I am asking if I can get all the lists on the board and send the lists and cards in the exact same place to another board.
Thanks
It would be extremely useful if we could have JsDoc annotations or a .d.ts typings export for all of the Trello package's methods. Not only are they super useful, but they make it easier to document and write fluent quick code without moving tabs or checking docs for a method.
I'd be willing to write a PR starting this off if needed, as I've already written out the types for the methods I use in my typescript applications, but would need some contributions for other methods assuming there's support for this idea.
Thanks!
If an addAttachment is added I could start using this.
Is there a way you can add these methods onto the trello API? Or at least provide code for us to do it. Here are the parameters for it:
getCardID(cardName, listID)
getListID(listName, boardID)
getBoardID(boardName)
looks like @devtyr has bit more up to date fork, maybe you could add him as maintainer on npm and use this more obvious package name trello?
Hi!
Since this module is number 1 at npm for trello
I thought I'd mention that the links to generate token, app secret and app key in the readme are dead. A logged in user can generate them at /app-key. If you don't have time to update - do you accept PRs?
I'm trying to use the updateCard() function to change a card's closed property to true. I'm not sure how to pass the argument through to achieve this.
When installing this package with Node v16.1.0, I get 3 high severity vulnerabilities. If I try to run
npm audit fix --force
I get an error that process.EventEmitter is not a constructor.
Suggestion:
process.EventEmitter was deprecated in Node.js 6 and is removed in Node.js 7, use require('events') as a drop-in replacement.
Right now releases are manual and there can be some lag between new code being merged and that code being available via npm. It would be nice if new pushes to master automatically generated a new release. It looks like Travis can support this, and I'd be happy to do the initial work to get things configured in the .travis.yml file as long as there's interest in getting the feature added/enabled.
Travis documentation on this - https://docs.travis-ci.com/user/deployment/releases/
I just spent 2 hours trying to figure out why I couldn't create a board. I kept getting an odd error saying I didn't have permission to access the API... despite having an auth token with the proper read/write permissions.
I referenced the Trello API and noticed that the Docs use this api call "http://api.trello.com/1/boards/" and on on line 95 of main.js you are missing the trailing slash. https://github.com/norberteder/trello/blob/master/main.js#L95
I popped into node_modules and made the edit and the issue i was having vanished. First try, new board created itself no problem.
How would I go about changing custom fields on a card?
For example, let's say I want to:
Please help!
I've got another issue, and rather than spending lots of time figuring it out, I thought I'd take a minute to mention what I'm experiencing in hopes that I'm just doing it wrong.
I am trying to move a card from to a list that i know the list id of.
trello.updateCard(myCard.id, myList.id).then((update) => { console.log("that should have done it"); });
My node app kicks out that should have done it
but the card didn't move. I looked for clues inside of updateCard()
in main.js
.
Here it is:
`Trello.prototype.updateCard = function (cardId, field, value, callback) {
var query = this.createQuery();
query.value = value;
return makeRequest(rest.put, this.uri + '/1/cards/' + cardId + '/' + field, {query: query}, callback);
}; `
In comparing that to the Trello API I see that the Endpoint is 'https://api.trello.com/1/cards/myCard' and to move it, you specify an query object that includes a idList
parameter like { idList: 'myListID' }
Which would indicate that updateCard wasn't meant to be used to move a card from list to list. So given this, how might I go about implementing a Trello.prototype.moveCard
?
I can't seem to find any Docs, I'd love to use this module properly but there is no documentation to find out how something works
I am trying to get all customFields
on board and currently, we don't have support for this.
Thanks
Reference:
https://developers.trello.com/reference#boardsidcustomfields
Hello!
I was looking to use your library for interacting with trello but when I went to install with npm, I'm seeing this warning in the console:
3 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
When I try to run that second command it puts your package all the way back to 0.3.0! And that version unfortunately doesn't have the features that I was hoping to use. Might be a good idea for you all to audit your dependencies and figure out what's giving you those vulnerabilities.
The getCardsOnBoard works fine, and the promise variant of getListsOnBoard works fine, but just not the callback one.
I love this package but i can't save data into var like this
var id ="";
api.getBoards('Shinkoz').then(boardName => {
id = boardName[0].id
}
is there a method for this?
According to Snyk the version of qs that is being used at the moment is not secure.
Hmm. Looks like "restler" is the culprit here. And that project has not seen a commit in 4 years.
There is an outstanding issue in the restler project addressing this: #89 (comment)
https://developers.trello.com/reference#custom-fields-object
I can do this when have time, maybe next week.
It'd be awesome if there were some! ✨
I'd like to add type safety to the package.
I have already started working on it, it would benefit the project by adding type safety and allowing developers to use the package in Typescript.
If you'd like me to continue contributing, let me know.
I'm having to submodule this repo in order to get it - please and thank you
As far as I can see it's not possible to use e.g. pagination (before
) or other parameters when getting cards on a list? Unless I missed something, it would be nice to be able to use all Trello API params
I am getting this "possible EventEmitter memory leak detected" when I try to create more than 10 cards at the same time.
This could be the expected behavior but the thing is that I am using promises so I am chaining the card creation in this way:
var promise;
var cardCreationPromise;
_.each(myData, function (ticket) {
if(!promise) {
cardCreationPromise = Q.defer();
trello.addCard(ticket.summary, ticket.description, listId, cardCreationPromise.makeNodeResolver());
promise = cardCreationPromise.promise;
} else {
promise = promise.then(function(e) {
cardCreationPromise = Q.defer();
trello.addCard(ticket.summary, ticket.description, listId, cardCreationPromise.makeNodeResolver());
return cardCreationPromise.promise;
});
}
});
Typical chaining...
After some research I have learned that this "memory leak issue "is a common problem in Restler and in Node JS in general.
You can do your own research and see if you end up with the same solution as I. The main problem is that when we use the "on" event, the listener is still registered so we are "leaking" (It is not technically a leak) listeners even if we chain the calls. But if you use "once" instead of "on" we are calling to the next card creating after the listener is cleared, and we should clear the "error" listener too:
function makeRequest(fn, uri, options, callback) {
var request = fn(uri, options);
request.once('complete', function (result) {
if (result instanceof Error) {
callback(result);
} else {
callback(null, result);
}
request.removeAllListeners('error');
});
}
These two changes fix the issue in my scenario.
Hey would be really cool if you could be able to copy a list (and all the cards in it) like you can on the website.
I want to make a backup system that checks for lists and for every list it copies the list (and all the cards) (coz then it saves comments) and then catches the ID and sends to the the backup board.
Hi, I've been trying to use your project for making requests and noticed that none of the functions work (tried with addCard
, addBoard
, getCardsOnBoard
, so it might be the same for the rest of them), however the tests pass.
So, making tests and comparing to a previous version, I realized that the method makeReqest
calls completeCallback
once the request method (put, post, delete ...) returns a ReadableStream event "complete".
fn(uri, options).once('complete', completeCallback);
But this only exists in restler:
complete: function(result, response)
- emitted when the request has finished whether it was successful or not. Gets passed the response result and the response object as arguments. If some error has occurred, result is always instance of Error, otherwise it contains response data.
I looked at the documentation for needle, and found an almost equivalent event:
done
(previously 'end') - Emitted when the request/response process has finished, either because all data was consumed or an error ocurred somewhere in between. Unlike a regular stream's end event, Needle's done will be fired either on success or on failure...
I tried just replacing it, but this are different events in core, so it doesn't even get triggered, and I think the params passed as arguments are different as well...
So I suggest either going back to restler or maybe find a way to fix this with needle.
Having an issue with this package's dependencies:
ERROR Failed to compile with 1 errors
This dependency was not found:
* fs in ./~/restler/lib/multipartform.js
To install it, you can run: npm install --save fs
I have manually added fs
as a dependency to my project, but that doensn't fix the issue.
If you don't have the user token yet, how do you pull up the auth popup?
The following code which is there in the source tree at https://github.com/norberteder/trello/blob/master/main.js line 163-165
Trello.prototype.getMember = function(memberId, callback) {
return makeRequest(rest.get, this.uri + '/1/member/' + memberId, {query: this.createQuery()}, callback);
}
is not there in the main.js of the node module I installed using npm install trello.
dependency entry in package.json after npm install trello is
"trello": "^0.5.1",
Thus I am unable to get the member details.
Add so I can clone a board and define a name for it, and move card so I can send cards to and from boards where I can define what card & what board & what placement
I'd like this kind of signature to be supported:
getCardById("id", { checklists: "all" })
This could be implemented in a backward compatible way, as a new argument right before the callback
.
The createQuery
could be extended to accept an object as argument, which it mixes with key
and token
.
Trello.prototype.createQuery = function (options = {}) {
return { ...options, key: this.key, token: this.token};
};
Trello.prototype.getCard = function (boardId, cardId, fields, callback) {
// Back compatible: If last argument is a callback, then no fields are given
if (typeof fields === "function") {
callback = fields
}
if(boardId === null)
return makeRequest(rest.get, this.uri + '/1/cards/' + cardId, fields, callback);
return makeRequest(rest.get, this.uri + '/1/boards/' + boardId + '/cards/' + cardId, fields, callback);
};
Does this make sense?
Hello,
i'm trying to use getCardsOnBoardWithExtraParams
, but i don't know what i'm doing wrong.
I want to return only cards with due date equals false.
let params = { dueComplete: false }
let boardId = "......"
trello.getCardsOnBoardWithExtraParams(boardId, params)
.then(boards => {
// My implementation
})
Can anyone help me?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.