Releae 4.1.2
Release 4.1.2 Latest
New Release Candidate: 4.1.2
Features
Notes on Migration documentation (Moving from 4.0 to 4.1.2):
Stop using Popsicle and start using Axios
• Axios is not a drop-in replacement for Popsicle. Here are a few of the API differences:
Request config:
Axios uses data instead of body.
Axios.get() will override the the method option.
There is no transport option.
Response schema:
Headers are turned into an object with lower cased names.
Response data is atomically parsed and can be accessed with res.data.
The response can't be stringified using JSON.stringify() because of res.request.
Breaking Changes:
• getJson() function is now not available, while making the makeApiCall() function. Instead response.json is used.
• JSON.stringify(authResponse.getJson()) ==> should now been changed to JSON.stringify(authResponse.json)
• getting the error message/code. Before, it was under this path: authResponse.json.Fault.Error
Now it's under this path: response.data.Fault.Error
• Given the transport changes, please note that transport needs to be replaced with responseType:
e.g. Users that receive a PDF will have to change their code from this:
oauthClient.makeApiCall({
url: ${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59,
headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'},
transport: popsicle.createTransport({type: 'buffer'})
})
To this:
oauthClient.makeApiCall({
url: ${url}v3/company/${companyID}/invoice/${invoiceNumber}/pdf?minorversion=59,
headers:{'Content-Type': 'application/pdf','Accept':'application/pdf'},
responseType: 'arraybuffer'
})
Issues Fixed
#168