upvest v0.1.1 Upvest.API View Source
Shared utilities for interacting with the Upvest API.
It contains shared implementations of endpoints methods for
creating, listing, retrieving and deleting resources. Where possible,
transforms the raw result from the Upvest API into a final struct. This is achieved
through the use of the Upvest.Utils.to_struct/2
.
Intended for internal use by Upvest endpoint modules.
An Upvest endpoint module is usually mappped to an Upvest resource, containing logic for interacting with the associated resource.
To implement this behaviour, simply add use Upvest.API, [list_of_methods]
to the top of
the entity module and make sure it defines a struct mapped to the Upvest resource.
The parameter to the use Upvest.API
construct is a list of HTTP
methods you want to expose in the module:
- create/2 - create a new resource
- retrive/2 - retrieve a resource
- update/3 - update a resource
- delete/2 - delete a resource
- list/1 - list all resources
- list_n/2 - list all resources, capped to specified limit