Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jhermsmeier/node-flightstats

FlightStats API Client
https://github.com/jhermsmeier/node-flightstats

api api-client flightstats

Last synced: about 2 months ago
JSON representation

FlightStats API Client

Awesome Lists containing this project

README

        

# FlightStats
[![npm](https://img.shields.io/npm/v/flightstats.svg?style=flat-square)](https://npmjs.com/flightstats)
[![npm license](https://img.shields.io/npm/l/flightstats.svg?style=flat-square)](https://npmjs.com/flightstats)
[![npm downloads](https://img.shields.io/npm/dm/flightstats.svg?style=flat-square)](https://npmjs.com/flightstats)
[![build status](https://img.shields.io/travis/jhermsmeier/node-flightstats.svg?style=flat-square)](https://travis-ci.org/jhermsmeier/node-flightstats)

## Install via [npm](https://npmjs.com)

```sh
$ npm install --save flightstats
```

## Index

- [Usage](#usage)
- [Testing](#testing)
- [API Reference](#api-reference)

## Usage

```js
var FlightStatsAPI = require( 'flightstats' )
```

```js
var api = new FlightStatsAPI({
appId: 'xxxxxxxxxx',
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxx',
// optional, defaults to `node flightstats/{package.version}`
userAgent: 'FlightBot',
})
```

Get a list of airlines
```js
// Options are optional;
// defaults to retrieve all currently active airlines
api.getAirlines( options, callback )
// Options (iata, icao, fs are mutually exclusive):
var options = {
all: {Boolean},
date: {Date},
iata: {String},
icao: {String},
fs: {String},
}
```

Look up a flight by airline & flight number
```js
api.lookup( options, callback )
// Options:
var options = {
date: {Date},
airlineCode: {String},
flightNumber: {String},
airport: {String}, // optional
direction: {String}, // optional, defaults to `arriving`
extendedOptions: {Array}, // optional
}
```

## Testing

You'll need FlightStats API credentials to run the tests;
Save them to an `.env` file in the repository root:
```ini
FLIGHTSTATS_APP_ID = xxxxxxxxxx
FLIGHTSTATS_API_KEY = xxxxxxxxxxxxxxxxxxxxxxxxx
```

Running the tests:
```sh
$ npm test
```

## API Reference

See [docs/API.md](https://github.com/jhermsmeier/node-flightstats/blob/master/docs/API.md)