Closed chulkilee closed 4 years ago
Using an internal struct instead of Tesla's would also be convenient to use the Composite and Batch endpoints. An %ExForce.Request{}
could enable control over how we compose sets of requests. Since a composite request is a list of subrequests we could build an %ExForce.CompositeRequest{}
with some helper functions.
Same concept for Batch requests. You build a valid %ExForce.BatchRequest{}
struct out of a list of %ExForce.Request{}
structs, and do some struct -> map conversion prior to hitting the endpoints.
Since Composite requests use a referenceId
and Batch has it's own unique request parameters the builder pipeline could require those keys to build a valid Composite/Batch struct.
Then we'd just need some mapping functions that take a valid Request struct of any kind and make compatible for Tesla.
Currently ExForce returns plain Tesla struct, such as
Tesla.Env
. That works well for ad-hoc client, but since ExForce is standalone application, it may be better to use own struct.