An open API service indexing awesome lists of open source software.

https://github.com/teslahunt/inventory

Retrieve real-time data from Tesla Inventory.
https://github.com/teslahunt/inventory

cpo inventory tesla tesla-api teslaapi teslamotors

Last synced: 3 months ago
JSON representation

Retrieve real-time data from Tesla Inventory.

Awesome Lists containing this project

README

        






![Last version](https://img.shields.io/github/tag/teslahunt/tesla-inventory.svg?style=flat-square)
[![NPM Status](https://img.shields.io/npm/dm/tesla-inventory.svg?style=flat-square)](https://www.npmjs.org/package/tesla-inventory)

> Retrieve real-time data from Tesla Inventory.

## Install

```bash
$ npm install tesla-inventory --save
```

## Usage

```js
const createTeslaInventory = require('tesla-inventory')

const fetcher = url => fetch(url).then(res => res.text())

const teslaInventory = createTeslaInventory(fetcher)

teslaInventory('fr', {
model: 's',
condition: 'used'
}).then(results => console.log(results))
```

## API

### teslaInventory(fetcher)

#### fetcher

*Required*

Type: `function`

The fetcher function used for performing the networking calls. It should return text ([example](https://github.com/teslahunt/inventory/blob/master/test/index.js#L6)).

### .teslaInventory([inventory], [query], [fetcherOpts])

#### inventory

*Required*

Type: `string`

The Tesla Inventory identifier, see [`inventories`](/inventories.js).

#### query

Type: `object`

The query options to be passed agaisnt [Tesla Inventory API](https://www.tesla.com/inventory/api/v1/inventory-results).

These options can be:

- **arrangeby**: Price
- **condition**: used|new
- **model**: ms|mx|m3
- **order**: asc|desc

#### fetcherOpts

Type: `object`

The options to be passed against `fetcher`.

## License

**tesla-inventory** © [Tesla Hunt](https://teslahunt.io), released under the [MIT](https://github.com/teslahunt/inventory/blob/master/LICENSE.md) License.

Authored and maintained by [Tesla Hunt](https://teslahunt.io) with help from [contributors](https://github.com/teslahunt/inventory/contributors).

> [teslahunt.io](https://teslahunt.io) · GitHub [teslahunt](https://github.com/teslahunt) · Twitter [@teslahuntio](https://twitter.com/teslahuntio)