Closed s-ashwinkumar closed 3 years ago
Merging #133 (200ba42) into master (78bd052) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #133 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 220 220
=========================================
Hits 220 220
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 78bd052...200ba42. Read the comment docs.
BREAKING CHANGE: Update and streamline SDK This is a major release consisting of multiple usability improvements and additional features.
We have aimed to streamline the SDK with the Smartcar API interfaces in a way that the objects returned are closer to the API interface documented in API Docs. For ex.
vehicle.odometer()
will now return an object that looks like the response in the documentation and additionally the body will contain response headers defined in the documentation as a part of ameta
attribute.The methods to be used are broadly divided into three namespaces :
AuthClient
- This class is used for all OAuth related operationsSmartcar
- This class is used for all application level operationsVehicle
- This class is used for all vehicle operations/actions.Features
SMARTCAR_CLIENT_ID
), client secret(SMARTCAR_CLIENT_SECRET
) and redirect URL(SMARTCAR_REDIRECT_URL
). These can be used instead of having to pass these as arguments.hashChallenge
- Additional utility method defined inSmartcar
namespace to generate hash challenge for webhooks.verifyPayload
- Additional utility method defined inSmartcar
namespace to verify the payload returned by webhooks.getApiVersion
- Method defined inSmartcar
namespace to return the api version set globally.subscribe
- Additional method defined inVehicle
namespace to subscribe to a webhook.unsubscribe
- Additional method defined inVehicle
namespace to unsubscribe from a webhook.2.0
instead of1.0
. This can be overridden globally by using thesetApiVersion
method or by using optional arguments in different methods.Improvements
Following are the improvements made to the interfaces by namespace. For in-depth details of the interface please refer to the SDK documentation.
AuthClient
Constructor
- This only requires the set of parameters required by all of the functions defined in the class. Previously this was also taking in all the arguments used for generating auth URL. This has not been separated and streamlined.getAuthUrl
- Takes in scope as required argument and all the other optional arguments required to generate the Smartcar Connect URL as defined in the docsexchangeCode
- Added additional support for optional flags parameter for future usage.exchangeRefreshToken
- Added additional support for optional flags parameter for future usage.Smartcar
getVehicles
- Renamed fromgetVehicleIds
and changes in interface.getUser
- Moved and renamed fromVehicle#getUserIds
and changes in interface.getCompatibility
- Moved and renamed fromAuthClient#isCompatible
and changes in interface.Vehicle
Constructor
- Updated to now support a version parameter. Look at the interface for more details.attributes
- Renamed frominfo
.batch
- The return value of the method has been changed. This now returns a function for each attributes requested that either returns an object of the requested attribute OR throws an error if the attribute returned an error.SmartcarError
All the errors have been converged to a single
SmartcarError
class. This class can now support the error fields returned by v2.0 and v1.0. For detailed breakdown of both the error types, refer to the to the API Reference Errors section.