npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

skypicker

v1.0.6

Published

Client to connect to the Skypicker API

Downloads

64

Readme

skypicker-client

Skypicker Client npm npm

Introduction

The skypicker API is a nifty REST API for obtaining flight and airline data. skypicker is a thin NodeJS wrapper around the API.

Install

npm install skypicker --save

API

searchLocationsByTerm

  • term: (required; string) - The search parameter used to identify a airport, city, country, etc.
  • locale: (optional; string) - The returned output matches the locale specified. The default value is en.
  • locationTypes: (optional; array) - There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in the LOCATION_TYPES constant. The default behavior is to search all location types.
  • limit: (optional; positive integer) - This specifies the number of records returned by the API. The default value is 20.
  • REST API documentation

Example

import { searchLocationsByTerm, LOCATION_TYPES } from 'skypicker';

const tenAirportsThatMatchLoganWithSpanishOutput = await searchLocationsByTerm({
  term: 'Logan',
  locale: 'es-ES',
  locationTypes: [LOCATION_TYPES.AIRPORT],
  limit: 10,
});

searchLocationsByRadius

  • coordinate: (required; object) - An object with latitude and longitude properties that represents a point
  • radius: (optional; non-negative integer) - Represents the kilometers from the specified coordinate to search. Defaults to 250 kilometers.
  • locale: (optional; string) - The returned output matches the locale specified. The default value is en.
  • locationTypes: (optional; array) - There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in the LOCATION_TYPES constant. The default behavior is to search all location types.
  • limit: (optional; positive integer) - This specifies the number of records returned by the API. The default value is 20.
  • sort: (optional: LOCATION_RESULTS_SORT_TYPES) - Specifies whether output should be sorted by name or rank in an ascending or descending manner
  • REST API documentation

Example

import { searchLocationsByRadius, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';

const tenAirportsWithinA100KilometerRadiusOfNewYorkCityWithSpanishOutput = await searchLocationsByRadius({
  coordinate: {
    latitude: 40.7128,
    longitude: -74.0059,
  },
  radius: 100,
  locale: 'es-ES',
  locationTypes: [LOCATION_TYPES.AIRPORT],
  limit: 10,
  sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})

searchLocationsByBox

  • lowCoordinate: (required; object) - Specifies a coordinate object with latitude and longitude properties that represent the southwest corner of the geo search box.
  • highCoordinate: (required; object) - Specifies a coordinate object with latitude and longitude properties that represent the northeast corner of the geo search box.
  • locale: (optional; string) - The returned output matches the locale specified. The default value is en.
  • locationTypes: (optional; array) - There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in the LOCATION_TYPES constant. The default behavior is to search all location types.
  • limit: (optional; positive integer) - This specifies the number of records returned by the API. The default value is 20.
  • sort: (optional: LOCATION_RESULTS_SORT_TYPES) - Specifies whether output should be sorted by name or rank in an ascending or descending manner
  • REST API documentation

Example

import { searchLocationsByBox, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';

const boxSearch = await searchLocationsByBox({
  lowCoordinate: {
    latitude: 40.200610,
    longitude: -74.624328,
  },
  highCoordinate: {
    latitude: 44.763212,
    longitude: -73.376543,
  },
  locale: 'es-ES',
  locationTypes: [LOCATION_TYPES.AIRPORT],
  limit: 10,
  sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})

getLocationById

getLocationDump

  • locale: (optional; string) - The returned output matches the locale specified. The default value is en.
  • locationTypes: (optional; array) - There are six types of locations: airports, autonomous territories, cities, countries, stations, and subdivisions. These location types are captured in the LOCATION_TYPES constant. The default behavior is to search all location types.
  • limit: (optional; positive integer) - This specifies the number of records returned by the API. The default value is 20.
  • sort: (optional: LOCATION_RESULTS_SORT_TYPES) - Specifies whether output should be sorted by name or rank in an ascending or descending manner
  • REST API documentation

Example

import { getLocationDump, LOCATION_TYPES, LOCATION_RESULTS_SORT_TYPES } from 'skypicker';

const locationDump = await getLocationDump({
  locationTypes: [LOCATION_TYPES.AIRPORT],
  limit: 10,
  sort: LOCATION_RESULTS_SORT_TYPES.DESCENDING_RANK,
})

getAirlines

  • Gets all airlines (both LC (legacy carrier) and LCC (low-cost carrier))
  • No parameters needed
  • REST API documentation

getAirlineIcon

searchFlights

  • departureIdentifier: (required; string, array[string]) - Any Skypicker location id(s), like airport codes, city IDs, two-letter country codes, etc.
  • departureDateTimeRange: (required; object) - Specifies the departure date and time-of-day ranges. The departure date values should be in ISO-8601 format (YYYY-MM-DD), while the time of day values should be in HH:mm format where the hour and minute values span 00-23 and 00-59, respectively.
{
  date: {
    start: '2018-01-01',
    end: '2018-01-15',
  },
  timeOfDay: {
    start: '02:30',
    end: '14:15',
  },
};
  • returnDepartureDateTimeRange: (required if round-trip flight; object) - Specifies the departure date and time-of-day ranges. Object should be in the same format as the departureDateTimeRange variable.
  • arrivalIdentifier: (optional; string, array[string]) - Any Skypicker location id(s). If this is not specified, you'll get results for all airports in the world
  • maximumHoursInFlight: (optional; non-negative integers) - Maximum flight duration, in hours
  • passengerCount: (optional; positive integers) - Number of passengers. Default value is 1.
  • directFlightsOnly: (optional; boolean) - When true, only direct flights are considered. By default, false.
  • currencyCode: (optional; string) - The currency in which prices and other relevant values are expressed. Follows ISO-4217 currency codes. By default, EUR.
  • priceRange: (optional; object) - Only tickets within the specified range are returned. Values should be represented as non-negative integers.
{
  start: 0,
  end: 100,
}
  • maximumStopOverCount: (optional; non-negative integer) - Maximum number of stopovers
  • airlinesFilter: (optional; object) - Either excludes or includes the specified airlines. The airlinesFilter object has two properties: airlines (an array of IATA codes) and type (an AIRLINES_FILTER_TYPE value).
  • partner: (optional; string) - The Skypicker Partner ID assigned to your account. Use picky for testing.
{
  airlines: [B6],
  type: AIRLINES_FILTER_TYPE.EXCLUDE,
}
  • locale: (optional; string) - The returned output matches the locale specified. The default value is en.
  • offset: (optional; non-negative integer) - Specified for paginating through requests
  • limit: (optional; positive integer) - This specifies the number of records returned by the API. The default value is 20.
  • sortType: (optional; FLIGHT_RESULTS_SORT_TYPES) - Specifies whether to sort results by date, duration, price, or quality
  • REST API documentation