Skip to content

Commit

Permalink
update lichess api types
Browse files Browse the repository at this point in the history
  • Loading branch information
fitztrev committed Feb 16, 2025
1 parent 743d38f commit cbda5e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

12 changes: 4 additions & 8 deletions sample-data/generate/add-broadcasts.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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),
Expand All @@ -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]),
};

Expand Down

0 comments on commit cbda5e3

Please sign in to comment.