apilayer-aviationstack

1.0.1 • Public • Published

aviationstack-sdk

A simple SDK for the Aviationstack API, which provides real-time and historical aviation data, including flight status, routes, airports, airlines, aircraft types, and more.

Installation

You can install this SDK using npm:

npm install apilayer-aviationstack

Usage

This SDK supports both CommonJS (require) and ES Modules (import).

CommonJS (require)

const Aviationstack = require("apilayer-aviationstack");

const aviation = new Aviationstack("YOUR_API_KEY");

aviation
    .flights()
    .then((response) => console.log(response))
    .catch((error) => console.error(error));

ES Modules (import)

import Aviationstack from "apilayer-aviationstack";

const aviation = new Aviationstack("YOUR_API_KEY");

aviation
    .flights()
    .then((response) => console.log(response))
    .catch((error) => console.error(error));

API Endpoints

constructor(apiKey: string)

Initializes the Aviationstack client with your API key.

const aviation = new Aviationstack("YOUR_API_KEY");

flights(params?: object)

Retrieves real-time flight information.

aviation.flights({ airline_name: "Lufthansa" }).then((response) => console.log(response));

routes(params?: object)

Gets information about specific routes.

aviation.routes({ dep_iata: "JFK", arr_iata: "LAX" }).then((response) => console.log(response));

airports(params?: object)

Returns a list of airports.

aviation.airports({ country_name: "United States" }).then((response) => console.log(response));

airlines(params?: object)

Fetches airline details.

aviation.airlines({ airline_name: "Delta" }).then((response) => console.log(response));

aircraftTypes(params?: object)

Gets information about different aircraft types.

aviation.aircraftTypes().then((response) => console.log(response));

taxes(params?: object)

Returns information about applicable taxes.

aviation.taxes({ country_name: "Germany" }).then((response) => console.log(response));

cities(params?: object)

Gets information about cities.

aviation.cities({ country_name: "United Kingdom" }).then((response) => console.log(response));

countries(params?: object)

Returns a list of countries.

aviation.countries().then((response) => console.log(response));

flightsFuture(iataCode: string, type: string, date: string, params?: object)

Gets information about future flights. Required parameters: iataCode, type, and date.

aviation.flightsFuture("JFK", "departure", "2023-10-23").then((response) => console.log(response));

timetable(iataCode: string, date: string, params?: object)

Gets the flight timetable for a specific airport on a given date. Required parameters: iataCode and date.

aviation.timetable("LAX", "2023-10-23").then((response) => console.log(response));

Note

For more detailed information about Aviationstack API, make sure to check out our Developer Documentation.

License

This package is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i apilayer-aviationstack

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

5.6 kB

Total Files

3

Last publish

Collaborators

  • api-layer