@flybywiresim/api-client
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -77,2 +77,8 @@ export declare class MetarResponse { | ||
} | ||
export declare class Bounds { | ||
north: number; | ||
east: number; | ||
south: number; | ||
west: number; | ||
} | ||
export declare class HttpError extends Error { | ||
@@ -105,3 +111,3 @@ readonly status: number; | ||
static fetchMessages(): Promise<TelexMessage[]>; | ||
static fetchConnections(skip?: number, take?: number): Promise<Paginated<TelexConnection>>; | ||
static fetchConnections(skip?: number, take?: number, bounds?: Bounds): Promise<Paginated<TelexConnection>>; | ||
static fetchConnection(id: string): Promise<TelexConnection>; | ||
@@ -108,0 +114,0 @@ static findConnection(flightNumber: string): Promise<TelexConnection>; |
@@ -192,3 +192,3 @@ "use strict"; | ||
}; | ||
Telex.fetchConnections = function (skip, take) { | ||
Telex.fetchConnections = function (skip, take, bounds) { | ||
var url = new URL("/txcxn", NXApi.url); | ||
@@ -201,2 +201,8 @@ if (skip) { | ||
} | ||
if (bounds) { | ||
url.searchParams.append("north", bounds.north.toString()); | ||
url.searchParams.append("east", bounds.east.toString()); | ||
url.searchParams.append("south", bounds.south.toString()); | ||
url.searchParams.append("west", bounds.west.toString()); | ||
} | ||
return fetch(url.href, { method: "GET" }) | ||
@@ -203,0 +209,0 @@ .then(function (response) { |
{ | ||
"name": "@flybywiresim/api-client", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Client library for the FlyByWire Simulations API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
![FlyByWireLogo](https://raw.githubusercontent.com/flybywiresim/fbw-branding/master/svg/FBW-Logo.svg) | ||
# <img src="https://raw.githubusercontent.com/flybywiresim/fbw-branding/master/svg/FBW-Logo.svg" placeholder="FlyByWire" width="400"/> | ||
# FlyByWire Simulations API Client | ||
@@ -186,3 +186,3 @@ | ||
Telex.fetchConnections(skip, take) | ||
Telex.fetchConnections(skip, take, bounds) | ||
.then(data => { | ||
@@ -197,2 +197,3 @@ console.log(data); | ||
- `take` is a number and tells the backend how many connections to send. | ||
- `bounds` is an optional bounding box. Query only connections within this area. | ||
@@ -199,0 +200,0 @@ `take` and `skip` are used to control the pagination. A maximum of 100 entries can be fetched at a time. |
20282
410
245