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.
- Host: GitHub
- URL: https://github.com/teslahunt/inventory
- Owner: teslahunt
- License: mit
- Created: 2020-08-04T09:13:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T13:01:06.000Z (8 months ago)
- Last Synced: 2024-10-29T15:55:18.736Z (8 months ago)
- Topics: cpo, inventory, tesla, tesla-api, teslaapi, teslamotors
- Language: JavaScript
- Homepage: https://teslahunt.io
- Size: 1.34 MB
- Stars: 27
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
![]()

[](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)