diff --git a/doc/specs/examples/bot-getOnlineBots.json b/doc/specs/examples/bot-getOnlineBots.json new file mode 100644 index 00000000..7b8ef6e1 --- /dev/null +++ b/doc/specs/examples/bot-getOnlineBots.json @@ -0,0 +1,51 @@ +{ + "id": "halcyonbot", + "username": "halcyonbot", + "perfs": { + "bullet": { + "games": 24255, + "rating": 2313, + "rd": 45, + "prog": 10 + }, + "blitz": { + "games": 33330, + "rating": 2227, + "rd": 45, + "prog": -5 + }, + "rapid": { + "games": 21219, + "rating": 2310, + "rd": 45, + "prog": -3 + }, + "classical": { + "games": 0, + "rating": 2000, + "rd": 500, + "prog": 0, + "prov": true + }, + "correspondence": { + "games": 0, + "rating": 2000, + "rd": 500, + "prog": 0, + "prov": true + } + }, + "title": "BOT", + "patron": true, + "createdAt": 1674374156963, + "profile": { + "bio": "I'm a chess engine written from scratch. Challenge me to a rated or casual game of bullet, blitz, or rapid! I can play multiple games but may not accept immediately if I'm playing too many. Created by @thinic.", + "realName": "Halcyon 1", + "links": "https://lishogi.org/@/kawasemi\r\nhttps://github.com/nhamil/halcyon" + }, + "seenAt": 1747683622797, + "playTime": { + "total": 57161455, + "tv": 772338 + } +} diff --git a/doc/specs/tags/bot/api-bot-online.yaml b/doc/specs/tags/bot/api-bot-online.yaml index f6ecf07c..9696a218 100644 --- a/doc/specs/tags/bot/api-bot-online.yaml +++ b/doc/specs/tags/bot/api-bot-online.yaml @@ -26,4 +26,4 @@ get: schema: $ref: "../../schemas/User.yaml" example: - $ref: "../../examples/user-georges-bot.json" + $ref: "../../examples/bot-getOnlineBots.json" diff --git a/scripts/update-examples/bot.ts b/scripts/update-examples/bot.ts new file mode 100644 index 00000000..4d9b5612 --- /dev/null +++ b/scripts/update-examples/bot.ts @@ -0,0 +1,19 @@ +import { example, prodClient, readNdJson } from "./config"; + +const abortController = new AbortController(); +const signal = abortController.signal; + +await prodClient() + .GET("/api/bot/online", { + headers: { + Accept: "application/x-ndjson", + }, + signal, + parseAs: "stream", + }) + .then((response) => + readNdJson(response.response, (line: any) => { + example("bot", "getOnlineBots", line); + abortController.abort(); + }), + );