From cbda5e390c02d0620b43d4c4b600cd5ee2270215 Mon Sep 17 00:00:00 2001 From: Trevor Fitzgerald Date: Sun, 16 Feb 2025 18:51:50 -0500 Subject: [PATCH] update lichess api types --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- sample-data/generate/add-broadcasts.ts | 12 ++++-------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 51948dc..5c8f318 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@faker-js/faker": "^9.4.0", - "@lichess-org/types": "^2.0.24", + "@lichess-org/types": "^2.0.27", "@tailwindcss/postcss": "^4.0.6", "@tauri-apps/cli": "^2.2.7", "@types/node": "^22.13.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca4c448..ae6d472 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ importers: specifier: ^9.4.0 version: 9.4.0 '@lichess-org/types': - specifier: ^2.0.24 - version: 2.0.24 + specifier: ^2.0.27 + version: 2.0.27 '@tailwindcss/postcss': specifier: ^4.0.6 version: 4.0.6 @@ -391,8 +391,8 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@lichess-org/types@2.0.24': - resolution: {integrity: sha512-2yRd54jTiYlfKxMeRijJ5kX7faB4wXxPdhC486ylR8FNe7eyE9AYhmaK/xNGNoCW3mZqacXs9MX0UfdIAIK4WA==} + '@lichess-org/types@2.0.27': + resolution: {integrity: sha512-SHm3qEY/H0PXwb2ncTsksjrDSD0E3BCzp082bSUplFn9Ug4BQ0tw404p8ADgFVD1ee+MIzWfNLlAw43RvfMYNg==} '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -1860,7 +1860,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@lichess-org/types@2.0.24': {} + '@lichess-org/types@2.0.27': {} '@nodelib/fs.scandir@2.1.5': dependencies: diff --git a/sample-data/generate/add-broadcasts.ts b/sample-data/generate/add-broadcasts.ts index 23394c8..cbdda39 100644 --- a/sample-data/generate/add-broadcasts.ts +++ b/sample-data/generate/add-broadcasts.ts @@ -1,10 +1,6 @@ import createClient from 'openapi-fetch'; import { faker } from '@faker-js/faker'; -import type { paths } from '@lichess-org/types'; - -type NewBroadcast = paths['/broadcast/new']['post']['requestBody']['content']['application/x-www-form-urlencoded']; -type NewBroadcastRound = - paths['/broadcast/{broadcastTournamentId}/new']['post']['requestBody']['content']['application/x-www-form-urlencoded']; +import type { components, paths } from '@lichess-org/types'; const lichess = 'http://localhost:8080'; const token = 'lip_admin'; @@ -22,7 +18,7 @@ for (let i = 1; i <= 100; i++) { faker.helpers.arrayElement(['Cup', 'Championship', 'Open', 'Festival', 'Invitational', 'Classic', 'Rapid']), ].join(' '); - const broadcast: NewBroadcast = { + const broadcast: components['schemas']['BroadcastForm'] = { name, showScores: faker.datatype.boolean(0.2), showRatingDiffs: faker.datatype.boolean(0.2), @@ -45,10 +41,10 @@ for (let i = 1; i <= 100; i++) { console.log(broadcastResponse.data); for (let j = 1; j <= faker.number.int({ min: 0, max: 10 }); j++) { - const round: NewBroadcastRound = { + const round: components['schemas']['BroadcastRoundForm'] = { name: `Round ${j}`, startsAt: faker.date.future().getTime(), - finished: faker.datatype.boolean(0.2), + status: faker.helpers.arrayElement(['new', 'started', 'finished']), delay: 60 * faker.helpers.arrayElement([0, 1, 5, 10, 15]), };