Skip to content

Commit

Permalink
feat(docs): rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
krystxf committed Jun 18, 2024
1 parent 708eead commit 7365986
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
device: [14, 15]
iOS: [17.0, 17.5]
iOS: [17.5, 18]
name: App CI 🚀 (iPhone ${{ matrix.device }}, iOS ${{ matrix.iOS }} )

steps:
Expand Down
2 changes: 1 addition & 1 deletion backend-nest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"build": "nest build",
"start": "nest start",
"start:dev": "nest start --watch",
"dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
Expand Down
130 changes: 120 additions & 10 deletions docs/src/pages/docs/rest-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,132 @@ Backend gets data from [Golemio API](https://api.golemio.cz/pid/docs/openapi/) c

## Metro departures

[Golemio departures API](https://api.golemio.cz/pid/docs/openapi/#/%F0%9F%9A%8F%20PID%20Departure%20Boards/get_pid_departureboards)
<br />

<a href="https://api.metronow.dev/metro?station=andel" target="_blank">
```http
GET https://api.metronow.dev/v1/metro/v1/metro/departures
GET https://api.metronow.dev/metro
```
</a>
<details>
<summary>Request</summary>
```http
## ONE STATION
### Example requests
GET https://api.metronow.dev/metro?station=Anděl
**Departures for one platform:**
# Can be also written as:
```http
GET https://api.metronow.dev/v1/metro/departures?gtfsID=U1040Z101P
```
GET https://api.metronow.dev/metro?station=andel
**Departures from multiple platforms (max. 10):**
## MULTIPLE STATIONS
```http
GET https://api.metronow.dev/v1/metro/departures?gtfsID=U1040Z101P&gtfsID=U1040Z102P
# As multiple query parameters:
GET https://api.metronow.dev/metro?station=Anděl&station=Dejvická
# As a comma-separated list:
GET https://api.metronow.dev/metro?station=[Anděl,Dejvická]
# As a JSON array:
GET https://api.metronow.dev/metro?station=["Anděl","Dejvická"]
````
</details>
<details>
<summary>Response</summary>
**Response schema:**
```json
{
[platform id]: [
{
"delay": "number", // seconds
"departure": "string", // ISO 8601
"heading": "string", // station
"line": "A" | "B" | "C"
}
]
}
````
**Example response:**
```json
{
"U458Z102P": [
{
"delay": 10,
"departure": "2024-06-18T04:45:25+02:00",
"heading": "Černý Most",
"line": "B"
}
]
}
```

</details>

<details>
<summary>List of all stations</summary>
<li>Anděl</li>
<li>Bořislavka</li>
<li>Budějovická</li>
<li>Černý Most</li>
<li>Českomoravská</li>
<li>Dejvická</li>
<li>Depo Hostivař</li>
<li>Flora</li>
<li>Florenc</li>
<li>Háje</li>
<li>Hlavní nádraží</li>
<li>Hloubětí</li>
<li>Hradčanská</li>
<li>Hůrka</li>
<li>Chodov</li>
<li>I. P. Pavlova</li>
<li>Invalidovna</li>
<li>Jinonice</li>
<li>Jiřího z Poděbrad</li>
<li>Kačerov</li>
<li>Karlovo náměstí</li>
<li>Kobylisy</li>
<li>Kolbenova</li>
<li>Křižíkova</li>
<li>Ládví</li>
<li>Letňany</li>
<li>Luka</li>
<li>Lužiny</li>
<li>Malostranská</li>
<li>Můstek</li>
<li>Muzeum</li>
<li>Nádraží Holešovice</li>
<li>Nádraží Veleslaví</li>
<li>Náměstí Míru</li>
<li>Náměstí Republiky</li>
<li>Národní třída</li>
<li>Nemocnice Motol</li>
<li>Nové Butovice</li>
<li>Opatov</li>
<li>Palmovka</li>
<li>Pankrác</li>
<li>Petřiny</li>
<li>Pražského povstání</li>
<li>Prosek</li>
<li>Radlická</li>
<li>Rajská zahrada</li>
<li>Roztyly</li>
<li>Skalka</li>
<li>Smíchovské nádraží</li>
<li>Staroměstská</li>
<li>Stodůlky</li>
<li>Strašnická</li>
<li>Střížkov</li>
<li>Vltavská</li>
<li>Vysočanská</li>
<li>Vyšehrad</li>
<li>Zličí</li>
<li>Želivského</li>
</details>
2 changes: 0 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7365986

Please sign in to comment.