DEPRECATED
Xero are now using this sdk as the base for the official nodejs SDK, so it's getting new love. https://github.com/XeroAPI/xero-node
An API wrapper for xero (http://developer.xero.com).
Supports all three applications types:
Private
Public
Partner
This module will be completed to support ALL Core and Payroll operations by the end of February 2014.
Create an Issue for any suggestions, specifically how to tidily support Where in a simple fashion.
Implemented/Planned
Support all API operations
Efficient paging
Support for Private, Public, and Partner applications (look at oauth_test/server.js for 3 stage support)
$ npm install node-xero
varPrivateApplication=require('node-xero').PrivateApplication;varprivateApp=newPrivateApplication({consumerSecret: 'AAAAA',consumerKey: 'BBBBBB',privateKeyPath: './cert/privatekey.pem'});varPublicApplication=require('node-xero').PublicApplication;varpublicApp=newPublicApplication({consumerSecret: 'AAAAA',consumerKey: 'BBBBBB'});varParnetApplication=require('node-xero').PartnerApplication;varpartnerApp=newPartnerApplication({consumerSecret: 'AAAAA',consumerKey: 'BBBBBB',privateKeyPath: './cert/privatekey.pem',sslCertPath: './cert/ssl.crt'});Efficient paging:
privateApp.core.contacts.getContacts({pager: {start:1/* page number */,callback:onContacts}}).fail(function(err){console.log('Oh no, an error');})/* Called per page */functiononContacts(err,response,cb){varcontacts=response.data;if(response.finished)// finished paging
....cb();// Async support}Filter support: Modified After
// No paging
publicApp.core.contacts.getContacts({ modifiedAfter: new Date(2013,1,1) })
.then(function(contacts)
{
_.each(contacts, function(contact)
{
// Do something with contact
})
})
npm test
- 0.0.2
- Added journals
- modifiedAfter support
- 0.0.1
- Initial Release
Copyright (c) 2014 Tim Shnaider
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.