ivao-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

IVAO-SDK

GitHub Workflow Status GitHub Workflow Status


Introduction

The IVAO-SDK is a wrapper for interacting with the IVAO API and pulling data from IVAO for use in any web app.

Installation

$ npm i ivao-sdk -D

Usage

To use the IVAO-SDK, import it into your project and instantiate a new instance of the IVAO class:

const ivaoSdk = require('ivao-sdk');

// instantiate new instance of IvaoClient
const ivaoClient = new ivaoSdk.IvaoClient(); // default data refresh rate of 15 seconds

// Listen for connected event to know when the client is ready to use.
ivaoClient.on('connected', () => {
  console.log('Connected to IVAO API');
  
  // The SDK also emits an event for when data is refreshed if you wish to perform logic on data refresh
    ivaoClient.on('dataRefreshed', () => {
        console.log('Data refreshed');
    });
});

When instantiating a new instance, you can optionally pass in an options object to specify the data refresh rate:

const ivaoClient = new ivaoSdk.IvaoClient({
  refreshRate: 30 // refresh data every 30 seconds
});

Quickstart Example

const ivaoSdk = require('ivao-sdk');
const ivaoClient = new ivaoSdk.IvaoClient();

ivaoClient.on('connected', () => {
  console.log('Connected to IVAO API');

  const pilots = ivaoClient.getIvaoPilotsFiltered({
    flightPlan: {
      aircraft: {
        icaoCode: 'B738',
      },
    },
  });

  console.log(pilots);
  console.log('Result count:', pilots.length);
});

Documentation

See the IVAO SDK documentation for more information and usage examples of the client methods.

Package Sidebar

Install

npm i ivao-sdk

Weekly Downloads

0

Version

1.0.9

License

GNU General Public License v3.0

Unpacked Size

938 kB

Total Files

30

Last publish

Collaborators

  • b_brown