diff --git a/doc/specs/examples/server-getServerVersion.json.yaml b/doc/specs/examples/server-getServerVersion.json.yaml new file mode 100644 index 00000000..b8064b59 --- /dev/null +++ b/doc/specs/examples/server-getServerVersion.json.yaml @@ -0,0 +1 @@ +value: { "server": { "date": "2026-10-28T07:25:58Z", "commit": "b551752d2a0e7a63459d9812825d95a633a98737" } } diff --git a/doc/specs/lichess-api.yaml b/doc/specs/lichess-api.yaml index 84a3082a..afc3bcc2 100644 --- a/doc/specs/lichess-api.yaml +++ b/doc/specs/lichess-api.yaml @@ -274,6 +274,9 @@ tags: - Each user blog exposes an atom (RSS) feed, like - User blogs mashup feed: https://lichess.org/blog/community.atom - User blogs mashup feed for a language: https://lichess.org/blog/community/fr.atom + - name: Server + description: | + Information about Lichess - name: OAuth description: | Obtaining and revoking OAuth tokens. @@ -388,6 +391,9 @@ paths: /bookmark/{gameId}: $ref: "./tags/games/bookmark-gameId.yaml" + /api/version: + $ref: "./tags/server/api-version.yaml" + /api/tv/channels: $ref: "./tags/tv/api-tv-channels.yaml" diff --git a/doc/specs/tags/server/api-version.yaml b/doc/specs/tags/server/api-version.yaml new file mode 100644 index 00000000..d43dc817 --- /dev/null +++ b/doc/specs/tags/server/api-version.yaml @@ -0,0 +1,40 @@ +get: + operationId: apiVersion + summary: Get server version + description: | + Get the date and git commit of the server code currently deployed. + Source code: [github.com/lichess-org/lila](https://github.com/lichess-org/lila). + tags: + - Server + security: [] + responses: + "200": + description: The server version. + headers: + Access-Control-Allow-Origin: + schema: + type: string + default: "'*'" + content: + application/json: + schema: + type: object + required: + - server + properties: + server: + type: object + required: + - date + - commit + properties: + date: + type: string + format: date-time + description: When the deployed server was built + commit: + type: string + description: Git commit hash of the deployed lila version + examples: + default: + $ref: "../../examples/server-getServerVersion.json.yaml" diff --git a/scripts/update-examples/README.md b/scripts/update-examples/README.md index 0869cbd6..57ca99ec 100644 --- a/scripts/update-examples/README.md +++ b/scripts/update-examples/README.md @@ -18,7 +18,7 @@ Or only some of them, by name: bun index.ts account tv ``` -Each script is a file in this directory: `account`, `analysis`, `arenas`, `board`, `bot`, `broadcasts`, `bulk-pairings`, `challenges`, `external-engine`, `fide`, `games`, `messaging`, `oauth`, `opening-explorer`, `puzzles`, `relations`, `simuls`, `studies`, `swiss`, `tablebase`, `teams`, `tv`, `users`. +Each script is a file in this directory: `account`, `analysis`, `arenas`, `board`, `bot`, `broadcasts`, `bulk-pairings`, `challenges`, `external-engine`, `fide`, `games`, `messaging`, `oauth`, `opening-explorer`, `puzzles`, `relations`, `server`, `simuls`, `studies`, `swiss`, `tablebase`, `teams`, `tv`, `users`. `board` and `bot` take about a minute: a victory or a draw can only be claimed once the opponent has been gone for that long. diff --git a/scripts/update-examples/index.ts b/scripts/update-examples/index.ts index fc5df9b8..d89cf558 100644 --- a/scripts/update-examples/index.ts +++ b/scripts/update-examples/index.ts @@ -14,6 +14,7 @@ import oauth from "./oauth"; import openingExplorer from "./opening-explorer"; import puzzles from "./puzzles"; import relations from "./relations"; +import server from "./server"; import simuls from "./simuls"; import studies from "./studies"; import swiss from "./swiss"; @@ -39,6 +40,7 @@ const scripts: Record Promise> = { "opening-explorer": openingExplorer, puzzles, relations, + server, simuls, studies, swiss, diff --git a/scripts/update-examples/server.ts b/scripts/update-examples/server.ts new file mode 100644 index 00000000..f4a50211 --- /dev/null +++ b/scripts/update-examples/server.ts @@ -0,0 +1,9 @@ +import { example, prodClient } from "./config"; + +export default async function server() { + await example( + "server", + "getServerVersion", + prodClient().GET("/api/version"), + ); +}