GIOS_API

GIOS_API

GIOS API Class.

Constructor

new GIOS_API()

Source:

Methods

(async) findAll() → {Promise.<Array.<Station>>}

Find all stations

Source:
Throws:

Connection error

Type
TypeError
Example
const giosApi = new GIOS_API();
const data = await giosApi.findAll();

(async) findById(id) → {Promise.<Array.<Station>>}

Find stations by one ore multiple ids.

Parameters:
Name Type Description
id number | Array.<number>

One or multiple stations id.

Source:
Throws:

Connection error

Type
TypeError
Example
const giosApi = new GIOS_API();

const data = await giosApi.findById(45);

//or

const data = await giosApi.findById([488, 145, 732]);

(async) findInRange(lat, lat, options) → {Promise.<Array.<Station>>}

Find stations in range by coordinates.

Parameters:
Name Type Description
lat number

Latitude.

lat number

Longitude.

options object

Options.

Properties
Name Type Description
distance number

Distance to find in meters.

limit number

Result limit to return.

showNearest boolean

Return the nearest station if not found in range.

Source:
Throws:

Connection error

Type
TypeError
Example
const giosApi = new GIOS_API();

const data = await giosApi.findInRange(52.406376, 16.925167);

//or

const settings = {
 distance: 10000,
 limit: 5,
 showNearest: true
};

const data = await giosApi.findInRange(52.406376, 16.925167, settings);

(async) fetchStationSensors(id, prefetchopt) → {Promise.<StationsList>}

Fetch station sensors by station id.

Parameters:
Name Type Attributes Default Description
id number

The station id.

prefetch boolean <optional>
false

Flag to prefecth all sensors data.

Source:
Throws:

Connection error

Type
TypeError
Example
const giosApi = new GIOS_API();
const sensors = await giosApi.fetchStationSensors(944);

//or

const sensors = await giosApi.fetchStationSensors(944, true);

(async) fetchAirQuality(id) → {Promise.<AirQuality>}

Fetch station air quality by station id.

Parameters:
Name Type Description
id number

The station id.

Source:
Throws:

Connection error

Type
TypeError
Example
const giosApi = new GIOS_API();
const airQuality = await giosApi.fetchAirQuality(944);