# Trailervote Fetch

[![Build Status](https://travis-ci.com/TrailerVote/trailervote-api-clients.svg?branch=master)](https://travis-ci.com/TrailerVote/trailervote-api-clients)
[![NPM Package Version](https://badge.fury.io/js/@trailervote%2Ffetch.svg)](https://npmjs.org/package/@trailervote/fetch)
[![Maintainability](https://api.codeclimate.com/v1/badges/da722ca43c5811db5926/maintainability)](https://codeclimate.com/github/TrailerVote/trailervote-api-clients/maintainability)

The TrailerVote Fetch package is the official interface to communicate with the TrailerVote product service. It allows you to
keep your code simple and not deal with the HTTP suite.

## Installation

```bash
yarn add '@trailervote/fetch'
```

And then execute:

    $ yarn

## Usage

The current JS package does not have the same fluent API as the ruby package, as of the current release, but might in the future.

```typescript
import { fetch } from '@trailervote/fetch/dist/audio_fragment'

const response = await fetch(url)
```

In the `/dist` folder you'll find all the types you can fetch. Currently you'll get generic types back, not based on the media type, but this will be changed in the future.
Each module has a main export `fetch` and a named `fetchModule` such as `fetchProduct`. These are aliases.

## Contributing

Deployments must be done with `yarn pack` and `yarn publish` instead of npm equivalents.

Bug reports and pull requests are welcome on GitHub at [TrailerVote/trailervote-api-clients](https://github.com/trailervote/trailervote-api-clients)
