flightplandb
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -73,24 +73,31 @@ const axios = require('axios') | ||
// Generate a flight plan | ||
generateFlightPlan(fromIcao, toIcao, callback, | ||
useNat = true, usePacot = true, useAwylo = true, useAwyhi = true, | ||
cruiseAlt = 35000, cruiseSpeed = 420, | ||
ascentRate = 2500, ascentSpeed = 250, | ||
descentRate = 1500, descentSpeed = 250) { | ||
const options = { | ||
generateFlightPlan(fromIcao, toIcao, callback, options = { | ||
useNat: true, | ||
usePacot: true, | ||
useAwylo: true, | ||
useAwyhi: true, | ||
cruiseAlt: 35000, | ||
cruiseSpeed: 420, | ||
ascentRate: 2500, | ||
ascentSpeed: 250, | ||
descentRate: 1500, | ||
descentSpeed: 250 | ||
}) { | ||
const parameters = { | ||
fromICAO: fromIcao, | ||
toICAO: toIcao, | ||
useNAT: useNat, | ||
usePACOT: usePacot, | ||
useAWYLO: useAwylo, | ||
useAWYHI: useAwyhi, | ||
cruiseAlt: cruiseAlt, | ||
cruiseSpeed: cruiseSpeed, | ||
ascentRate: ascentRate, | ||
ascentSpeed: ascentSpeed, | ||
descentRate: descentRate, | ||
descentSpeed: descentSpeed | ||
useNAT: options.useNat, | ||
usePACOT: options.usePacot, | ||
useAWYLO: options.useAwylo, | ||
useAWYHI: options.useAwyhi, | ||
cruiseAlt: options.cruiseAlt, | ||
cruiseSpeed: options.cruiseSpeed, | ||
ascentRate: options.ascentRate, | ||
ascentSpeed: options.ascentSpeed, | ||
descentRate: options.descentRate, | ||
descentSpeed: options.descentSpeed | ||
} | ||
const uri = `${baseUri}/auto/generate` | ||
axios.post(uri, options, { | ||
axios.post(uri, parameters, { | ||
headers: { | ||
@@ -97,0 +104,0 @@ Authorization: this.apiKey |
{ | ||
"name": "flightplandb", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "An API wrapper for the website FlightPlanDatabase's API", | ||
@@ -5,0 +5,0 @@ "main": "flightplandb.js", |
@@ -10,5 +10,19 @@ # FlightPlanDB.js | ||
``getFlightPlan(id, callback)``-- Gets the flight plan from the database with the corresponding ID<br> | ||
``getAirport(icao, callback)``-- Gets the airport information for a given ICAO code<br> | ||
``getWeather(icao, callback)``-- Gets the METAR and TAF (if available) for the given ICAO airport<br> | ||
``flightPlanQuery(query, callback)``-- Retrieves a search of all flightplans matching a query, including ICAOs, airport names, username, tags, or flight number<br> | ||
``flightPlanFromTo(from, to, callback)``-- Retrieves a search of all flightplans from a location, to another<br> | ||
``flightPlanIcaoFromTo(fromIcao, toIcao, callback)``-- Retrieves a search of all flightplans from a specific ICAO airport, to another<br> | ||
``flightPlanFlightNumber(flightNumber, callback)``-- Retrieves a search of all flightplans with a given flight number<br> | ||
``flightPlanFlightNumber(flightNumber, callback)``-- Retrieves a search of all flightplans with a given flight number<br> | ||
``generateFlightPlan(fromIcao, toIcao, callback, { | ||
useNat: true, | ||
usePacot: true, | ||
useAwylo: true, | ||
useAwyhi: true, | ||
cruiseAlt: 35000, | ||
cruiseSpeed: 420, | ||
ascentRate: 2500, | ||
ascentSpeed: 250, | ||
descentRate: 1500, | ||
descentSpeed: 250 | ||
})``-- Generates a flight plan with the given parameters. All parameters in the object are optional, and defaults are shown above. |
5589
115
27