Skip to content

Commit

Permalink
add batch airport endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nistei committed Jan 4, 2021
1 parent 776b2f1 commit 62a2598
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flybywiresim/api-client",
"version": "0.6.0",
"version": "0.7.0",
"description": "Client library for the FlyByWire Simulations API",
"main": "lib/index.js",
"scripts": {
Expand Down
25 changes: 25 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,31 @@ export class Airport {
return response.json();
});
}

public static getBatch(icaos: string[]): Promise<AirportResponse[]> {
if (!icaos) {
throw new Error("No ICAOs provided");
}

const body = {
icaos
};
const headers = {
"Content-Type": "application/json"
};


let url = new URL(`/api/v1/airport/_batch`, NXApi.url);

return fetch(url.href, {method: "POST", body: JSON.stringify(body), headers})
.then((response) => {
if (!response.ok) {
throw new HttpError(response.status);
}

return response.json();
});
}
}

export class GitVersions {
Expand Down

0 comments on commit 62a2598

Please sign in to comment.