Open molinto opened 9 years ago
:+1: for node examples
:+1:
@molinto @jasonshouse @temsa if there were a node library / examples, are there any good libraries you like that you prefer how they handle things? Have any of you used https://github.com/baalexander/node-xmlrpc ?
@kressaty : so far I've used with success infusionsoft ^0.3.7 which runs on top of xmlrpc 1.3.0. Yet, it does not wrap the whole API, and seems unmaintained.
Raw code running on top of xmlrpc
would be ok :)
Ok cool. So here's the next question - do we want a specific method for each API request? Or a wrapper system that handles OAuth for you, and then lets you specify the XML-RPC request you're going to make as an argument to a generic "request" method?
infusionsoft.contactAdd(args, callback)
vs
infusionsoft.request('ContactService.add', args, callback)
For a library, maybe something more like this ?
// Allows multiple clients, could also use 'new' to be clear about that but not necessary
var client = require('infusionsoft').client()
// Could also be 'client.ContactService.add' yet does not feel right
// usual args could be given directly when few (less than 4) are needed
client.contact.add(arg1, arg2, arg3, callback)
// if you need more clarity regarding you API you may prefer 'client.contactService', yet 'Service' is not a very useful information in itself and gives less readability
// or, keep it always supported, at least for more complicated arguments, an object containing everything needed
client.contact.add({...}, callback)
// I'm not a promise fanboy, yet you could also return a promise if no callback
client.contact.add(arg1, arg2, arg3).then( function(res) { console.log(res) ))
Please add node examples guys