@headwindsimulations/api-client 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
# <img src="https://
|
|
2
|
-
#
|
|
1
|
+
# <img src="https://headwindsim.net/assets/images/headwind-logo-light.png" placeholder="HeadwindSimulations" width="400"/>
|
|
2
|
+
# Headwind Simulations API Client for FlyByWire API
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
This is a unofficial JavaScript client for the FlyByWire API and changed for Headwind Simulations needs.
|
|
5
5
|
The library supports both JavaScript and TypeScript.
|
|
6
|
+
If you want to use the FlyByWire API stick to the Official API-Client: https://github.com/flybywiresim/api-client
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
9
11
|
Install the client library using npm:
|
|
10
12
|
|
|
11
|
-
$ npm install --save @
|
|
13
|
+
$ npm install --save @headwindsimulations/api-client
|
|
12
14
|
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
15
17
|
### Initializing the client
|
|
16
18
|
```ts
|
|
17
|
-
import { NXApi } from '@
|
|
19
|
+
import { NXApi } from '@headwindsimulations/api-client';
|
|
18
20
|
|
|
19
21
|
NXApi.url = new URL('http://localhost:3000');
|
|
20
22
|
```
|
|
@@ -23,7 +25,7 @@ By default, the URL is set to `https://api.flybywiresim.com`. If this is the des
|
|
|
23
25
|
|
|
24
26
|
### METAR
|
|
25
27
|
```ts
|
|
26
|
-
import { Metar } from '@
|
|
28
|
+
import { Metar } from '@headwindsimulations/api-client';
|
|
27
29
|
|
|
28
30
|
Metar.get(icao, source)
|
|
29
31
|
.then(data => {
|
|
@@ -43,7 +45,7 @@ Metar.get(icao, source)
|
|
|
43
45
|
|
|
44
46
|
### TAF
|
|
45
47
|
```ts
|
|
46
|
-
import { Taf } from '@
|
|
48
|
+
import { Taf } from '@headwindsimulations/api-client';
|
|
47
49
|
|
|
48
50
|
Taf.get(icao, source)
|
|
49
51
|
.then(data => {
|
|
@@ -61,7 +63,7 @@ Taf.get(icao, source)
|
|
|
61
63
|
|
|
62
64
|
### ATIS
|
|
63
65
|
```ts
|
|
64
|
-
import { Atis } from '@
|
|
66
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
65
67
|
|
|
66
68
|
Atis.get(icao, source)
|
|
67
69
|
.then(data => {
|
|
@@ -81,7 +83,7 @@ Atis.get(icao, source)
|
|
|
81
83
|
|
|
82
84
|
### Airport
|
|
83
85
|
```ts
|
|
84
|
-
import { Airport } from '@
|
|
86
|
+
import { Airport } from '@headwindsimulations/api-client';
|
|
85
87
|
|
|
86
88
|
Airport.get(icao)
|
|
87
89
|
.then(data => {
|
|
@@ -96,7 +98,7 @@ Airport.get(icao)
|
|
|
96
98
|
|
|
97
99
|
### ATC
|
|
98
100
|
```ts
|
|
99
|
-
import { Atis } from '@
|
|
101
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
100
102
|
|
|
101
103
|
ATC.get(source)
|
|
102
104
|
.then(data => {
|
|
@@ -116,7 +118,7 @@ ATC.get(source)
|
|
|
116
118
|
|
|
117
119
|
#### Connect to TELEX system
|
|
118
120
|
```ts
|
|
119
|
-
import { Telex } from '@
|
|
121
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
120
122
|
|
|
121
123
|
Telex.connect(status)
|
|
122
124
|
.then(data => {
|
|
@@ -132,7 +134,7 @@ The backend might block certain flight numbers from being used for various reaso
|
|
|
132
134
|
|
|
133
135
|
#### Update the TELEX status
|
|
134
136
|
```ts
|
|
135
|
-
import { Telex } from '@
|
|
137
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
136
138
|
|
|
137
139
|
Telex.update(status)
|
|
138
140
|
.then(data => {
|
|
@@ -150,7 +152,7 @@ The status can only be updated once a connection has been established.
|
|
|
150
152
|
|
|
151
153
|
#### Disconnect from TELEX system
|
|
152
154
|
```ts
|
|
153
|
-
import { Telex } from '@
|
|
155
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
154
156
|
|
|
155
157
|
Telex.disconnect()
|
|
156
158
|
.then(data => {
|
|
@@ -167,7 +169,7 @@ This releases the flight number for reuse and removes the flight from the live m
|
|
|
167
169
|
|
|
168
170
|
#### Sending a message
|
|
169
171
|
```ts
|
|
170
|
-
import { Telex } from '@
|
|
172
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
171
173
|
|
|
172
174
|
Telex.sendMessage(recipient, message)
|
|
173
175
|
.then(data => {
|
|
@@ -184,7 +186,7 @@ Messages will be filtered for profanity in the backend.
|
|
|
184
186
|
|
|
185
187
|
#### Receiving messages
|
|
186
188
|
```ts
|
|
187
|
-
import { Telex } from '@
|
|
189
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
188
190
|
|
|
189
191
|
Telex.fetchMessages()
|
|
190
192
|
.then(data => {
|
|
@@ -200,7 +202,7 @@ Messages can only be received once and will be acknowledged by this transaction.
|
|
|
200
202
|
|
|
201
203
|
#### Fetch a single page of active connections
|
|
202
204
|
```ts
|
|
203
|
-
import { Telex } from '@
|
|
205
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
204
206
|
|
|
205
207
|
Telex.fetchConnections(skip, take, bounds)
|
|
206
208
|
.then(data => {
|
|
@@ -218,7 +220,7 @@ Telex.fetchConnections(skip, take, bounds)
|
|
|
218
220
|
|
|
219
221
|
#### Fetch all active connections
|
|
220
222
|
```ts
|
|
221
|
-
import { Telex } from '@
|
|
223
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
222
224
|
|
|
223
225
|
Telex.fetchAllConnections(bounds, callback)
|
|
224
226
|
.then(data => {
|
|
@@ -233,7 +235,7 @@ Telex.fetchAllConnections(bounds, callback)
|
|
|
233
235
|
|
|
234
236
|
#### Fetch a certain connection
|
|
235
237
|
```ts
|
|
236
|
-
import { Telex } from '@
|
|
238
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
237
239
|
|
|
238
240
|
Telex.fetchConnection(id)
|
|
239
241
|
.then(data => {
|
|
@@ -247,7 +249,7 @@ Telex.fetchConnection(id)
|
|
|
247
249
|
|
|
248
250
|
#### Find all active connections matching a flight number
|
|
249
251
|
```ts
|
|
250
|
-
import { Telex } from '@
|
|
252
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
251
253
|
|
|
252
254
|
Telex.findConnection(flight)
|
|
253
255
|
.then(data => {
|
|
@@ -261,7 +263,7 @@ Telex.findConnection(flight)
|
|
|
261
263
|
|
|
262
264
|
#### Count active connections
|
|
263
265
|
```ts
|
|
264
|
-
import { Telex } from '@
|
|
266
|
+
import { Telex } from '@headwindsimulations/api-client';
|
|
265
267
|
|
|
266
268
|
Telex.countConnections()
|
|
267
269
|
.then(data => {
|
|
@@ -275,7 +277,7 @@ Telex.countConnections()
|
|
|
275
277
|
|
|
276
278
|
#### Get the newest commit for a branch
|
|
277
279
|
```ts
|
|
278
|
-
import { GitVersions } from '@
|
|
280
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
279
281
|
|
|
280
282
|
GitVersions.getNewestCommit(user, repo, branch)
|
|
281
283
|
.then(data => {
|
|
@@ -291,7 +293,7 @@ GitVersions.getNewestCommit(user, repo, branch)
|
|
|
291
293
|
|
|
292
294
|
#### Get all releases for a repository
|
|
293
295
|
```ts
|
|
294
|
-
import { GitVersions } from '@
|
|
296
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
295
297
|
|
|
296
298
|
GitVersions.getReleases(user, repo)
|
|
297
299
|
.then(data => {
|
|
@@ -306,7 +308,7 @@ GitVersions.getReleases(user, repo)
|
|
|
306
308
|
|
|
307
309
|
#### Get open pull requests for a repository
|
|
308
310
|
```ts
|
|
309
|
-
import { GitVersions } from '@
|
|
311
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
310
312
|
|
|
311
313
|
GitVersions.getPulls(user, repo)
|
|
312
314
|
.then(data => {
|
|
@@ -321,7 +323,7 @@ GitVersions.getPulls(user, repo)
|
|
|
321
323
|
|
|
322
324
|
#### Get the artifact URL for a pull request
|
|
323
325
|
```ts
|
|
324
|
-
import { GitVersions } from '@
|
|
326
|
+
import { GitVersions } from '@headwindsimulations/api-client';
|
|
325
327
|
|
|
326
328
|
GitVersions.getArtifact(user, repo, pull)
|
|
327
329
|
.then(data => {
|
|
@@ -340,7 +342,7 @@ GitVersions.getArtifact(user, repo, pull)
|
|
|
340
342
|
|
|
341
343
|
#### Get the charts for an airport
|
|
342
344
|
```ts
|
|
343
|
-
import { Charts } from '@
|
|
345
|
+
import { Charts } from '@headwindsimulations/api-client';
|
|
344
346
|
|
|
345
347
|
Charts.get(icao, source)
|
|
346
348
|
.then(data => {
|
|
@@ -357,7 +359,7 @@ Charts.get(icao, source)
|
|
|
357
359
|
|
|
358
360
|
#### Fetch data for all GNSS satellites
|
|
359
361
|
```ts
|
|
360
|
-
import { Atis } from '@
|
|
362
|
+
import { Atis } from '@headwindsimulations/api-client';
|
|
361
363
|
|
|
362
364
|
GNSS.get()
|
|
363
365
|
.then(data => {
|
|
@@ -371,7 +373,7 @@ GNSS.get()
|
|
|
371
373
|
|
|
372
374
|
#### Send the request
|
|
373
375
|
```ts
|
|
374
|
-
import { Hoppie } from '@
|
|
376
|
+
import { Hoppie } from '@headwindsimulations/api-client';
|
|
375
377
|
|
|
376
378
|
const body {
|
|
377
379
|
logon: 'XXXXXXXXX',
|
|
@@ -390,4 +392,7 @@ Hoppie.post(body)
|
|
|
390
392
|
|
|
391
393
|
## License
|
|
392
394
|
|
|
393
|
-
This software is licensed under the [MIT license](https://github.com/
|
|
395
|
+
This software is licensed under the [MIT license](https://github.com/headwindsimulations/api-client/blob/main/LICENSE).
|
|
396
|
+
|
|
397
|
+
## Credits
|
|
398
|
+
Based on the Open-Source [FlyByWire Simulations API-Client](https://github.com/flybywiresim/api-client).
|