Skip to content

Commit ed2c59f

Browse files
svengczBenjozork
authored andcommitted
feat: Hoppie interface (#8)
* introduce the Hoppie API * update the documentation * increase the package version
1 parent edb2243 commit ed2c59f

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,25 @@ GNSS.get()
367367
});
368368
```
369369

370+
### Hoppie
371+
372+
#### Send the request
373+
```ts
374+
import { Hoppie } from '@flybywiresim/api-client';
375+
376+
const body {
377+
logon: 'XXXXXXXXX',
378+
from: 'TEST0',
379+
to: 'TEST0',
380+
type: 'poll'
381+
}
382+
Hoppie.post(body)
383+
.then(data => {
384+
console.log(data);
385+
}).catch(err => {
386+
console.error(err);
387+
});
388+
```
370389

371390

372391
## License

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flybywiresim/api-client",
3-
"version": "0.15.0",
3+
"version": "0.16.0",
44
"description": "Client library for the FlyByWire Simulations API",
55
"main": "dist/index.js",
66
"module": "dist/index.esm.js",

src/apis/Hoppie.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('Hoppie', () => {
2+
// API currently out of order
3+
test('API', () => {
4+
5+
});
6+
});

src/apis/Hoppie.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NXApi } from '../index';
2+
import { post } from '../utils';
3+
4+
export declare class HoppieResponse {
5+
response: string;
6+
}
7+
8+
export class Hoppie {
9+
public static sendRequest(body: any): Promise<HoppieResponse> {
10+
return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);
11+
}
12+
}

0 commit comments

Comments
 (0)