Giter Club home page Giter Club logo

node-trello's Introduction

Node wrapper for Trello’s HTTP API.

Build Status

View Trello’s API documentation online.

Install

npm install node-trello

Getting your key and token

  • Generate your developer key and supply it as the first constructor parameter.
  • To read a user’s private information, get a token by directing them to https://trello.com/1/connect?key=<PUBLIC_KEY>&name=MyApp&response_type=token replacing, of course, <PUBLIC_KEY> with the public key obtained in the first step.
  • If you never want the token to expire, include &expiration=never in the url from the previous step.
  • If you need write access as well as read, &scope=read,write to the request for your user token.

Example Code

Fetching card data

var Trello = require("node-trello");
var t = new Trello("<your key>", "<token>");

t.get("/1/members/me", function(err, data) {
  if (err) throw err;
  console.log(data);
});

// URL arguments are passed in as an object.
t.get("/1/members/me", { cards: "open" }, function(err, data) {
  if (err) throw err;
  console.log(data);
});

Uploading attachments to a card

var fs = require("fs");
var path = require("path");
var Trello = require("node-trello");
var t = new Trello("<your key>", "<token>");

var cardId = "<the card id>";
var pathToFile = path.resolve(__dirname, "/path/to/file.doc");

t.post("/1/cards/" + cardId + "/attachments", { attachment: fs.createReadStream(pathToFile) }, function (err, attachments) {
  if (err) throw err;
  console.log(attachments);
})

License

Released under MIT.

node-trello's People

Contributors

abtris avatar adrianfalleiro avatar adunkman avatar aflopes avatar bovine avatar emmanuelgautier avatar francois2metz avatar kyleamathews avatar lmatteis avatar malko avatar marg51 avatar mgduk avatar mrgusev avatar psyked avatar smert avatar steefmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-trello's Issues

Seems doesn't work well with React Native, for macOS

I'm using node-trello along with https://github.com/ptmt/react-native-macos trying to create something that is really useful to me. But seems it stuck at this point:

Unable to resolve module http from /Users/rankun203/LodeStreams/playground/lst/node_modules/node-trello/lib/node-trello.js: 
Unable to find this module in its module map or any of the node_modules directories under 

/Users/node_modules/http and its parent directories This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following: 

1. Clear watchman watches: `watchman watch-del-all`. 
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.

Above message was exactly I got when I try to access http://localhost:8081/index.macos.bundle?platform=macos&dev=true.

Please review co-node-trello

@adunkman When you have a moment, please review the code here at https://github.com/netpoetica/co-node-trello

I have wrapped the node-trello API in co and generator compatible code. It is released under the same license (MIT).

I would love to publish this to npm and list it under co's wiki of co-compatible modules, but first would like your blessing and I will incorporate any changes - mainly just want to make sure you are cool with author credits/licensing, etc

Thanks!

Update dependencies on npm?

Hi! I see you updated the request lib dependency to 2.74.0 but npm still has it at 2.51.0 and I get insecure alerts on install.

$ npm info node-trello dependencies
{ oauth: '0.9.7', request: '2.51.0' }

Would you mind updating on npm?

addAttachment

If an addAttachment is added I could start using this.

Ionic 2 code

Please post code to work in ionic 2 thanks. Existing code seems to be incompatible.

Attachment upload

Hello

I'm trying to use the library to upload XLS attachment. It doesn't allow me to set the filename and the content I'm passing as an 'attachment' arg (I'm passing a Buffer) is not readable after upload. Is this use case supported and I am missing something obvious?

Thanks!

npm error when trying to import... coffeescript in lib?

Greetings,

When I require("node-trello") I get an npm error stating that it can't find the module, I think because it's in Coffeescript.

Part of the error:

Error: Cannot find module './lib/node-trello'

When trying to dig in, it seems that the problem is the coffeescript in the lib directory. I came accross this Stack Overflow on the question of using coffeescript in npm packages... seems it's not supported? Not sure. Regardless, the problem remains.

I'd be happy to submit a PR with a fix, only I don't know how to fix this :)

receive (generate) token

is there any function to receive a token through node-trello library instead of getting a token from trello.com site?
i would love to see an explanation in readme on how to use the function.
thanks

Access-Control-Allow-Origin error inside Meteor App

I'm attempting to use this package to interact with the Trello API inside a Meteor app. However running through setup and attempting to make an api call in my client-side javascript file, I get this error.

Link to error Image

This is my code in my javascript file, following the documentation for the package.

var Trello = require('node-trello');

var t = new Trello(Meteor.settings.public.trelloKey, Meteor.settings.public.trelloToken);
t.get('/1/members/me', function(err, data) {
    if(err) throw err;
    console.log(data);
});

Card parsing fails for fast git child process exit

If the spawned git child process exits too fast, the event handler for "exit" may trigger before the "stdout", causing commit message parsing to fail because the data buffer is null. There seems to be a race condition involved, as the Trello script sometimes succeeds and sometimes (often) not.
Using the "close" event instead of "exit" seems to solve the problem for me (Ubuntu VM on Cloud9), but I don't know if that might have unintended side effects.

Relevant SOO thread: http://stackoverflow.com/questions/26446791/node-read-spawn-stderr-stdout-after-quick-exit-event

Regards
Norbert

Response is full of symbols

The response to Trello.get('/member/me/boards', cb) is returning weird symbols. I followed the correct steps to get both keys but this is still what I get back

|sK�}��F{�����@��D����P��$0��U����]������E��m/��߽�������u������
��0��蕼�V��������s�7�[y8߳]�   �������/e�~���8ˋ�?�ԗ�����?|�������K<�N��7ąo1%�����\����8�}g8����=tw֛���U���~5�_��t��x�y��
A@����.����m�?D����� �```

Could not find a declaration file for module 'node-trello'.

error TS7016: Could not find a declaration file for module 'node-trello'. '/media/workplace/Work/Work/Pack3/TT/tt-api/node_modules/node-trello/index.js' implicitly has an 'any' type.
Try npm install @types/node-trello if it exists or add a new declaration (.d.ts) file containing declare module 'node-trello';

model not found

var trello = new Trello(TRELLO_API_KEY, user.Token);
trello.makeRequest('get', '/1/members/' + TRELLO_API_KEY + '/boards',
{
fields: 'name,url,shortLink'
}).then(function (boards) {
res.send(boards);
})
I am sure I am missing something, but somehow i am getting this message from trello.
model not found

In search of a new maintainer.

Hi!

I don’t really care about this anymore, which is probably frustrating for all of you that are using it.

Would you be interested in taking over the project?

model not found

I'm running a .get function to get the boards of my organization - when I run it via the browser, I get back an array, but when I run it over my express app I get this string "model not found" (if i console.log the object). I'm curious if you guys have any insight into this?

I also ran the node-trello app locally and the local version was able to complete this request sucesffully, giving me back an array of boards. Again, this only seems to happen when I run it inside of an express app.get() or app.post() function as a callback.

I couldn't find any info on this particular error from the Trello API website, so I am curious if maybe this is something that node-trello comes up with or if anyone else has encountered this?

No documentation for getting protected information

This repo could benefit from some guidance on how to use its features. There's support for Oauth, but no documentation on what functions need to go in what order. On my part despite being able to go through the authorise process I've still no idea how to use the tokens I have to my users' information. A few more examples would make this module a lot more useful.

Query params in PUT requests

It looks like PUT requests fail because the json body is not also added to the URL as query params. Annoying, but seemingly required for the trello API.

Am I missing some thing on this front?

Error: trello.get is not a function

I'm doing everything correctly according to documentation but I'm continually getting an error returned saying that trello.get is not a function.
Code:
trello.get("/1/lists/" + listId + "/cards?fields=id,name,desc",{ cards: "open" }, function(err, data){ if (err){ console.log(err) }else{ blacklists = data } });

My code above for logging into trello is:
var Trello = require('trello'); var trello = new Trello("KEY", "TOKEN");
I obviously have the Key and Token fields filled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.