A point-free, monadic JS API wrapping the Skyscanner Live Flights API
You can either refer to the documentation or use the test harness, to obtain valid parameters.
-
Ensure that you have an
API_KEY
environment variable set, whose value is your API key. -
Construct the query
import submitQuery from 'skyscanner-liveflights-api';
submitQuery({
adults: 1,
cabinclass: 'Economy',
originplace: 'SFO-iata',
outbounddate: '2017-03-24',
inbounddate: '2017-05-30',
destinationplace: 'BOS-iata'
}).fork(
console.error,
console.log
);
Currently the only supported parameters are:
adults
cabinclass
originplace
outbounddate
,inbounddate
,destinationplace
If you inspect the source code, you'll notice that all integral functionality is encapsulated in function compositions.
This concept means that, if required, you can build your own custom interface of skyscanner-liveflights-api
- itself, a composition of functions.
For example, the main entrypoint, is a composition of two other functions (pollForResults
and createSession
) that, when used together, make up the standard interface.
You could very easily extend this continutation. E.g
import { compose, lensProp, lensIndex, map, view } from 'ramda';
import submitQuery from 'skyscanner-liveflights-api';
const focusLens = compose(lensProp('Itineraries'), lensProp(0));
const focusOnItineraryItem = map(view(focusLens)))
const getTheFirstItemInTheItinerary = compose(
focusOnItineraryItem,
submitQuery
);
getTheFirstItemInTheItinerary({
adults: 1,
cabinclass: 'Economy',
originplace: 'SFO-iata',
outbounddate: '2017-03-24',
inbounddate: '2017-05-30',
destinationplace: 'BOS-iata'
}).fork(
console.error,
console.log
);
debug
is supported, so you can log the individual transactions in the orchestration to stdout, by prepending DEBUG=skyscanner-liveflights-api
to the script that starts your consumer application.
make test
# OR
make coverage
- Fork the repo and create your branch from
master
yarn
- Add tests
- Do your shizzle
- Create a PR