1.0.0 • Published 10 years ago

tradepmr-integration-sdk v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

developer-integration-sdk-javascript

Requirements

The javascript developer SDK has a dependency on jQuery 1.5 and higher. There is compatible version checked into source control within this project or you can download a supported version at http://jquery.com/download/.

Using the SDK

In order to use the SDK to talk with the TradePMR integration API you need to configure your settings appropriately. On the settings object you need to set the following two fields:

TradePMR.settings.baseUrl = 'https://integration.tradepmr.com'
TradePMR.settings.bearerToken = '<Your token goes here>'

Make sure to never include your bearer token in your HTML or javascript as they are not secure.

Once you have the settings in place, you're free to use any of the functions defined in the TradePMR.resources object

The resources object

This object contains several sub objects all with functions that allow you to access the integration API. Each of these functions takes an options parameter and a callback. These functions are all simple wrappers around the endpoints documented at https://developer.tradepmr.com. Read the documentation there for a more in-depth coverage.

accounts

TradePMR.resources.accounts has the following functions:

all: function(options, callback)                 // options can contain properties named: repcode or branch
individual: function(options, callback)          // options must contain a property named: accountNumber
notes: function(options, callback)               // options must contain a property named: accountNumber
addNote: function(accountNumber, note, callback) // note must be a new Note resource
taxlots: function(options, callback)             // options must contain a property named: accountNumber. 
                                                 // options can contain a property named: status
positions: function(options, callback)           // options must contain a property named: accountNumber

alerts

TradePMR.resources.alerts has the following functions:

all: function(options, callback) // options can contain properties named: priority, type and isread
add: function(alert, callback)   // alert must be a new Alert resource

clients

TradePMR.resources.clients has the following functions:

all: function(options, callback)              // options can contain properties named: lastname, firstname, title, or company
individual: function(options, callback)       // options must contain a property named: guid
update: function(client, callback)            // client must be the Client resource to update
notes: function(options, callback)            // options must contain a property named: guid
addNote: function(clientGuid, note, callback) // note must be a new Note resource
accounts: function(options, callback)         // options must contain a property named: guid
taxlots: function(options, callback)          // options must contain a property named: guid. 
                                              // options can contain a property named: status
positions: function(options, callback)        // options must contain a property named: guid

phonenumbers: function(options, callback)                        // options must contain a property named: guid
updatePhoneNumber: function(clientGuid, phoneNumber, callback)   // phoneNumber must be the PhoneNumber resource to update
addresses: function (options, callback)                          // options must contain a property named: guid
updateAddress: function(clientGuid, address, callback)           // address must be the Address resource to update
emailaddresses: function(options, callback)                      // options must contain a property named: guid
updateEmailAddress: function(clientGuid, emailAddress, callback) // emailAddress must be the EmailAddress resource to update
websites: function(options, callback)                            // options must contain a property named: guid
updateWebsite: function(clientGuid, website, callback)           // website must be the Website resource to update

groups

TradePMR.resources.groups has the following functions:

all: function(options, callback)                 // options is not currently used
individual: function(options, callback)          // options must contain a property named: guid
update: function(group, callback)                // group must be the Group resource to update
accounts: function(group, callback)              // options must contain a property named: guid  
notes: function(options, callback)               // options must contain a property named: guid
taxlots: function(options, callback)             // options must contain a property named: guid. 
                                                 // options can contain a property named: status
positions: function(options, callback)           // options must contain a property named: guid