@getevy/api-client
v0.0.32
Published
A JS client for the Evy API
Downloads
144
Keywords
Readme
JS Evy API Client
An extended JS/TS client for Evy API.
Works in browsers and node.
Add the dependency to your project
npm i @getevy/api-client
Initialization
import EvyApi from '@getevy/api-client';
const apiClient = new EvyApi({ apiKey: 'your_api_key' });
Configuration object
| Key | Required | Description |
| ------------ | ------------ | --------------------------------------------------------------------------- |
| apiKey | yes | your API key |
| apiURL | no | the URL of the API to target |
| language | no | the prefered language of the user, only en
and fr
are supported for now |
Usage
Get offers
Usage
const offers = await apiClient.offers.get('product_id', 1000, 'en');
Interface
apiClient.offers.get(product_id: string, price: number, language?: string) => Promise<IOffersData>
Parameters (from left to right)
| Name | Required | Description | | -------------- | ------------ | ------------------------------------------------ | | product_id | yes | The product for which we want insurance offers | | price | yes | The current price of the product | | language | no | The locale (overrides the initial configuration) |
Result: IOffersData
| Key | Description | | ----------- | ----------------------------------------------------- | | offers | The offers attachable on the product | | locales | The translations of the wording to use with the offer |
See the types or the API documentation for further descriptions.
License
The MIT License (MIT). Please see the License File for more information.