@flybywiresim/api-client
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -86,2 +86,12 @@ export declare class MetarResponse { | ||
} | ||
export declare class PullInfo { | ||
number: number; | ||
title: string; | ||
author: string; | ||
labels: string[]; | ||
isDraft: boolean; | ||
} | ||
export declare class ArtifactInfo { | ||
artifactUrl: string; | ||
} | ||
export declare class Paginated<T> { | ||
@@ -144,2 +154,4 @@ results: T[]; | ||
static getReleases(user: string, repo: string): Promise<ReleaseInfo[]>; | ||
static getPulls(user: string, repo: string): Promise<PullInfo[]>; | ||
static getArtifact(user: string, repo: string, pull: string): Promise<ArtifactInfo>; | ||
} |
@@ -363,4 +363,16 @@ "use strict"; | ||
}; | ||
GitVersions.getPulls = function (user, repo) { | ||
if (!user || !repo) { | ||
throw new Error("Missing argument"); | ||
} | ||
return _get(new URL("/api/v1/git-versions/" + user + "/" + repo + "/pulls", NXApi.url)); | ||
}; | ||
GitVersions.getArtifact = function (user, repo, pull) { | ||
if (!user || !repo || !pull) { | ||
throw new Error("Missing argument"); | ||
} | ||
return _get(new URL("/api/v1/git-versions/" + user + "/" + repo + "/pulls/" + pull + "/artifact", NXApi.url)); | ||
}; | ||
return GitVersions; | ||
}()); | ||
exports.GitVersions = GitVersions; |
{ | ||
"name": "@flybywiresim/api-client", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Client library for the FlyByWire Simulations API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -229,3 +229,3 @@ # <img src="https://raw.githubusercontent.com/flybywiresim/fbw-branding/master/svg/FBW-Logo.svg" placeholder="FlyByWire" width="400"/> | ||
#### Find a connection by a flight number | ||
#### Find all active connections matching a flight number | ||
```ts | ||
@@ -244,4 +244,2 @@ import { Telex } from '@flybywiresim/api-client'; | ||
This will only return an active flight since flight numbers can be reused. | ||
#### Count active connections | ||
@@ -259,4 +257,69 @@ ```ts | ||
### Github | ||
#### Get the newest commit for a branch | ||
```ts | ||
import { GitVersions } from '@flybywiresim/api-client'; | ||
GitVersions.getNewestCommit(user, repo, branch) | ||
.then(data => { | ||
console.log(data); | ||
}).catch(err => { | ||
console.error(err); | ||
}); | ||
``` | ||
- `user` the owner of the repository. | ||
- `repo` the repository. | ||
- `branch` the requested branch. | ||
#### Get all releases for a repository | ||
```ts | ||
import { GitVersions } from '@flybywiresim/api-client'; | ||
GitVersions.getReleases(user, repo) | ||
.then(data => { | ||
console.log(data); | ||
}).catch(err => { | ||
console.error(err); | ||
}); | ||
``` | ||
- `user` the owner of the repository. | ||
- `repo` the repository. | ||
#### Get open pull requests for a repository | ||
```ts | ||
import { GitVersions } from '@flybywiresim/api-client'; | ||
GitVersions.getPulls(user, repo) | ||
.then(data => { | ||
console.log(data); | ||
}).catch(err => { | ||
console.error(err); | ||
}); | ||
``` | ||
- `user` the owner of the repository. | ||
- `repo` the repository. | ||
#### Get the artifact URL for a pull request | ||
```ts | ||
import { GitVersions } from '@flybywiresim/api-client'; | ||
GitVersions.getArtifact(user, repo, pull) | ||
.then(data => { | ||
console.log(data); | ||
}).catch(err => { | ||
console.error(err); | ||
}); | ||
``` | ||
- `user` the owner of the repository. | ||
- `repo` the repository. | ||
- `pull` the number of the pull request. | ||
## License | ||
This software is licensed under the [MIT license](https://github.com/flybywiresim/api-client/blob/main/LICENSE). |
27944
532
323