Skip to content

Commit

Permalink
feat: Hoppie interface (#8)
Browse files Browse the repository at this point in the history
* introduce the Hoppie API

* update the documentation

* increase the package version
  • Loading branch information
svengcz authored and Benjozork committed Jan 28, 2022
1 parent edb2243 commit ed2c59f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,25 @@ GNSS.get()
});
```

### Hoppie

#### Send the request
```ts
import { Hoppie } from '@flybywiresim/api-client';

const body {
logon: 'XXXXXXXXX',
from: 'TEST0',
to: 'TEST0',
type: 'poll'
}
Hoppie.post(body)
.then(data => {
console.log(data);
}).catch(err => {
console.error(err);
});
```


## License
Expand Down
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.15.0",
"version": "0.16.0",
"description": "Client library for the FlyByWire Simulations API",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down
6 changes: 6 additions & 0 deletions src/apis/Hoppie.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('Hoppie', () => {
// API currently out of order
test('API', () => {

});
});
12 changes: 12 additions & 0 deletions src/apis/Hoppie.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NXApi } from '../index';
import { post } from '../utils';

export declare class HoppieResponse {
response: string;
}

export class Hoppie {
public static sendRequest(body: any): Promise<HoppieResponse> {
return post<HoppieResponse>(new URL('/api/v1/hoppie', NXApi.url), body);
}
}

0 comments on commit ed2c59f

Please sign in to comment.