tachyon-protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +97 -0
  2. package/dist/account/getToken/request.json +73 -0
  3. package/dist/account/getToken/response.json +91 -0
  4. package/dist/account/login/request.json +32 -0
  5. package/dist/account/login/response.json +300 -0
  6. package/dist/account/recover/request.json +15 -0
  7. package/dist/account/recover/response.json +58 -0
  8. package/dist/account/register/request.json +52 -0
  9. package/dist/account/register/response.json +78 -0
  10. package/dist/account/rename/request.json +33 -0
  11. package/dist/account/rename/response.json +66 -0
  12. package/dist/bot/slave/request.json +29 -0
  13. package/dist/bot/slave/response.json +58 -0
  14. package/dist/bot/unslave/request.json +15 -0
  15. package/dist/bot/unslave/response.json +58 -0
  16. package/dist/game/launch/response.json +70 -0
  17. package/dist/index.d.ts +923 -0
  18. package/dist/lobby/close/request.json +15 -0
  19. package/dist/lobby/close/response.json +58 -0
  20. package/dist/lobby/create/request.json +52 -0
  21. package/dist/lobby/create/response.json +66 -0
  22. package/dist/lobby/join/request.json +36 -0
  23. package/dist/lobby/join/response.json +86 -0
  24. package/dist/lobby/joined/response.json +256 -0
  25. package/dist/lobby/leave/request.json +15 -0
  26. package/dist/lobby/leave/response.json +62 -0
  27. package/dist/lobby/left/response.json +58 -0
  28. package/dist/lobby/list/request.json +15 -0
  29. package/dist/lobby/list/response.json +267 -0
  30. package/dist/lobby/receiveMessage/response.json +80 -0
  31. package/dist/lobby/sendMessage/request.json +33 -0
  32. package/dist/lobby/sendMessage/response.json +66 -0
  33. package/dist/lobby/updated/response.json +212 -0
  34. package/dist/matchmaking/cancel/request.json +15 -0
  35. package/dist/matchmaking/cancel/response.json +62 -0
  36. package/dist/matchmaking/found/response.json +70 -0
  37. package/dist/matchmaking/list/request.json +15 -0
  38. package/dist/matchmaking/list/response.json +105 -0
  39. package/dist/matchmaking/lost/response.json +58 -0
  40. package/dist/matchmaking/queue/request.json +31 -0
  41. package/dist/matchmaking/queue/response.json +66 -0
  42. package/dist/matchmaking/queueUpdate/response.json +70 -0
  43. package/dist/matchmaking/ready/request.json +15 -0
  44. package/dist/matchmaking/ready/response.json +62 -0
  45. package/dist/matchmaking/readyUpdate/response.json +74 -0
  46. package/dist/system/disconnect/request.json +15 -0
  47. package/dist/system/disconnected/response.json +58 -0
  48. package/dist/system/version/response.json +71 -0
  49. package/license.md +19 -0
  50. package/package.json +52 -0
@@ -0,0 +1,923 @@
1
+ /**
2
+ * This file was automatically generated, do not edit it manually.
3
+ * Instead modify the .ts files in src/schema and do npm run build
4
+ */
5
+
6
+ export type AccountGetTokenResponse =
7
+ | {
8
+ command: "account/getToken/response";
9
+ status: "success";
10
+ data: {
11
+ token: string;
12
+ };
13
+ }
14
+ | {
15
+ command: "account/getToken/response";
16
+ status: "failed";
17
+ reason:
18
+ | "no_user_found"
19
+ | "unverified"
20
+ | "invalid_password"
21
+ | "max_attempts"
22
+ | "internal_error"
23
+ | "unauthorized"
24
+ | "invalid_command";
25
+ };
26
+ export type AccountLoginResponse =
27
+ | {
28
+ command: "account/login/response";
29
+ status: "success";
30
+ data: {
31
+ user: {
32
+ userId: number;
33
+ username: string;
34
+ clanId: number | null;
35
+ icons: {
36
+ /**
37
+ * This interface was referenced by `undefined`'s JSON-Schema definition
38
+ * via the `patternProperty` "^(.*)$".
39
+ */
40
+ [k: string]: string;
41
+ };
42
+ roles: ("admin" | "moderator" | "autohost" | "mentor" | "caster" | "tourney")[];
43
+ battleStatus: {
44
+ lobbyId: number | null;
45
+ inGame: boolean;
46
+ away: boolean;
47
+ ready: boolean;
48
+ playerNumber: number | null;
49
+ teamColour: string | null;
50
+ isPlayer: boolean;
51
+ bonus: number;
52
+ sync: {
53
+ engine: number;
54
+ game: number;
55
+ map: number;
56
+ };
57
+ partyId: number | null;
58
+ muted: boolean;
59
+ } | null;
60
+ email: string;
61
+ friends: number[];
62
+ friendRequests: number[];
63
+ ignores: number[];
64
+ };
65
+ };
66
+ }
67
+ | {
68
+ command: "account/login/response";
69
+ status: "failed";
70
+ reason: "invalid_token" | "expired_token" | "banned" | "internal_error" | "unauthorized" | "invalid_command";
71
+ };
72
+ export type AccountRecoverResponse =
73
+ | {
74
+ command: "account/recover/response";
75
+ status: "success";
76
+ }
77
+ | {
78
+ command: "account/recover/response";
79
+ status: "failed";
80
+ reason: "internal_error" | "unauthorized" | "invalid_command";
81
+ };
82
+ export type AccountRegisterResponse =
83
+ | {
84
+ command: "account/register/response";
85
+ status: "success";
86
+ }
87
+ | {
88
+ command: "account/register/response";
89
+ status: "failed";
90
+ reason:
91
+ | "email_taken"
92
+ | "username_taken"
93
+ | "invalid_email"
94
+ | "weak_password"
95
+ | "username_profanity"
96
+ | "internal_error"
97
+ | "unauthorized"
98
+ | "invalid_command";
99
+ };
100
+ export type AccountRenameResponse =
101
+ | {
102
+ command: "account/rename/response";
103
+ status: "success";
104
+ }
105
+ | {
106
+ command: "account/rename/response";
107
+ status: "failed";
108
+ reason: "username_taken" | "username_profanity" | "internal_error" | "unauthorized" | "invalid_command";
109
+ };
110
+ export type BotSlaveResponse =
111
+ | {
112
+ command: "bot/slave/response";
113
+ status: "success";
114
+ }
115
+ | {
116
+ command: "bot/slave/response";
117
+ status: "failed";
118
+ reason: "internal_error" | "unauthorized" | "invalid_command";
119
+ };
120
+ export type BotUnslaveResponse =
121
+ | {
122
+ command: "bot/unslave/response";
123
+ status: "success";
124
+ }
125
+ | {
126
+ command: "bot/unslave/response";
127
+ status: "failed";
128
+ reason: "internal_error" | "unauthorized" | "invalid_command";
129
+ };
130
+ export type GameLaunchResponse =
131
+ | {
132
+ command: "game/launch/response";
133
+ status: "success";
134
+ data: {
135
+ script: string;
136
+ };
137
+ }
138
+ | {
139
+ command: "game/launch/response";
140
+ status: "failed";
141
+ reason: "internal_error" | "unauthorized" | "invalid_command";
142
+ };
143
+ export type LobbyCloseResponse =
144
+ | {
145
+ command: "lobby/close/response";
146
+ status: "success";
147
+ }
148
+ | {
149
+ command: "lobby/close/response";
150
+ status: "failed";
151
+ reason: "internal_error" | "unauthorized" | "invalid_command";
152
+ };
153
+ export type LobbyCreateResponse =
154
+ | {
155
+ command: "lobby/create/response";
156
+ status: "success";
157
+ }
158
+ | {
159
+ command: "lobby/create/response";
160
+ status: "failed";
161
+ reason: "no_hosts_available" | "invalid_region" | "internal_error" | "unauthorized" | "invalid_command";
162
+ };
163
+ export type LobbyJoinResponse =
164
+ | {
165
+ command: "lobby/join/response";
166
+ status: "success";
167
+ }
168
+ | {
169
+ command: "lobby/join/response";
170
+ status: "failed";
171
+ reason:
172
+ | "locked"
173
+ | "requires_password"
174
+ | "invalid_password"
175
+ | "max_participants_reached"
176
+ | "rank_too_low"
177
+ | "rank_too_high"
178
+ | "banned"
179
+ | "internal_error"
180
+ | "unauthorized"
181
+ | "invalid_command";
182
+ };
183
+ export type LobbyJoinedResponse =
184
+ | {
185
+ command: "lobby/joined/response";
186
+ status: "success";
187
+ data: {
188
+ id: number;
189
+ name: string;
190
+ founderId: number;
191
+ locked: boolean;
192
+ passworded: boolean;
193
+ playerIds: number[];
194
+ spectatorIds: number[];
195
+ engine: string;
196
+ game: string;
197
+ map: string;
198
+ startAreas: {
199
+ /**
200
+ * This interface was referenced by `undefined`'s JSON-Schema definition
201
+ * via the `patternProperty` "^(0|[1-9][0-9]*)$".
202
+ */
203
+ [k: string]: {
204
+ x: number;
205
+ y: number;
206
+ width: number;
207
+ height: number;
208
+ };
209
+ };
210
+ limits: {
211
+ minTeamsize: number | null;
212
+ maxTeamsize: number | null;
213
+ minRating: number | null;
214
+ maxRating: number | null;
215
+ };
216
+ };
217
+ }
218
+ | {
219
+ command: "lobby/joined/response";
220
+ status: "failed";
221
+ reason: "internal_error" | "unauthorized" | "invalid_command";
222
+ };
223
+ export type LobbyLeaveResponse =
224
+ | {
225
+ command: "lobby/leave/response";
226
+ status: "success";
227
+ }
228
+ | {
229
+ command: "lobby/leave/response";
230
+ status: "failed";
231
+ reason: "no_lobby" | "internal_error" | "unauthorized" | "invalid_command";
232
+ };
233
+ export type LobbyLeftResponse =
234
+ | {
235
+ command: "lobby/left/response";
236
+ status: "success";
237
+ }
238
+ | {
239
+ command: "lobby/left/response";
240
+ status: "failed";
241
+ reason: "internal_error" | "unauthorized" | "invalid_command";
242
+ };
243
+ export type LobbyListResponse =
244
+ | {
245
+ command: "lobby/list/response";
246
+ status: "success";
247
+ data: {
248
+ lobbies: {
249
+ id: number;
250
+ name: string;
251
+ founderId: number;
252
+ locked: boolean;
253
+ passworded: boolean;
254
+ playerIds: number[];
255
+ spectatorIds: number[];
256
+ engine: string;
257
+ game: string;
258
+ map: string;
259
+ startAreas: {
260
+ /**
261
+ * This interface was referenced by `undefined`'s JSON-Schema definition
262
+ * via the `patternProperty` "^(0|[1-9][0-9]*)$".
263
+ */
264
+ [k: string]: {
265
+ x: number;
266
+ y: number;
267
+ width: number;
268
+ height: number;
269
+ };
270
+ };
271
+ limits: {
272
+ minTeamsize: number | null;
273
+ maxTeamsize: number | null;
274
+ minRating: number | null;
275
+ maxRating: number | null;
276
+ };
277
+ }[];
278
+ };
279
+ }
280
+ | {
281
+ command: "lobby/list/response";
282
+ status: "failed";
283
+ reason: "internal_error" | "unauthorized" | "invalid_command";
284
+ };
285
+ export type LobbyReceiveMessageResponse =
286
+ | {
287
+ command: "lobby/receiveMessage/response";
288
+ status: "success";
289
+ data: {
290
+ userId: number;
291
+ message: string;
292
+ };
293
+ }
294
+ | {
295
+ command: "lobby/receiveMessage/response";
296
+ status: "failed";
297
+ reason: "internal_error" | "unauthorized" | "invalid_command";
298
+ };
299
+ export type LobbySendMessageResponse =
300
+ | {
301
+ command: "lobby/sendMessage/response";
302
+ status: "success";
303
+ }
304
+ | {
305
+ command: "lobby/sendMessage/response";
306
+ status: "failed";
307
+ reason: "not_in_lobby" | "muted" | "internal_error" | "unauthorized" | "invalid_command";
308
+ };
309
+ export type LobbyUpdatedResponse =
310
+ | {
311
+ command: "lobby/updated/response";
312
+ status: "success";
313
+ data: {
314
+ id?: number;
315
+ name?: string;
316
+ founderId?: number;
317
+ locked?: boolean;
318
+ passworded?: boolean;
319
+ playerIds?: number[];
320
+ spectatorIds?: number[];
321
+ engine?: string;
322
+ game?: string;
323
+ map?: string;
324
+ startAreas?: {
325
+ /**
326
+ * This interface was referenced by `undefined`'s JSON-Schema definition
327
+ * via the `patternProperty` "^(0|[1-9][0-9]*)$".
328
+ */
329
+ [k: string]: {
330
+ x: number;
331
+ y: number;
332
+ width: number;
333
+ height: number;
334
+ };
335
+ };
336
+ limits?: {
337
+ minTeamsize: number | null;
338
+ maxTeamsize: number | null;
339
+ minRating: number | null;
340
+ maxRating: number | null;
341
+ };
342
+ };
343
+ }
344
+ | {
345
+ command: "lobby/updated/response";
346
+ status: "failed";
347
+ reason: "internal_error" | "unauthorized" | "invalid_command";
348
+ };
349
+ export type MatchmakingCancelResponse =
350
+ | {
351
+ command: "matchmaking/cancel/response";
352
+ status: "success";
353
+ }
354
+ | {
355
+ command: "matchmaking/cancel/response";
356
+ status: "failed";
357
+ reason: "not_queued" | "internal_error" | "unauthorized" | "invalid_command";
358
+ };
359
+ export type MatchmakingFoundResponse =
360
+ | {
361
+ command: "matchmaking/found/response";
362
+ status: "success";
363
+ data: {
364
+ queueId: string;
365
+ };
366
+ }
367
+ | {
368
+ command: "matchmaking/found/response";
369
+ status: "failed";
370
+ reason: "internal_error" | "unauthorized" | "invalid_command";
371
+ };
372
+ export type MatchmakingListResponse =
373
+ | {
374
+ command: "matchmaking/list/response";
375
+ status: "success";
376
+ data: {
377
+ queues: {
378
+ id: string;
379
+ name: string;
380
+ ranked: boolean;
381
+ }[];
382
+ };
383
+ }
384
+ | {
385
+ command: "matchmaking/list/response";
386
+ status: "failed";
387
+ reason: "internal_error" | "unauthorized" | "invalid_command";
388
+ };
389
+ export type MatchmakingLostResponse =
390
+ | {
391
+ command: "matchmaking/lost/response";
392
+ status: "success";
393
+ }
394
+ | {
395
+ command: "matchmaking/lost/response";
396
+ status: "failed";
397
+ reason: "internal_error" | "unauthorized" | "invalid_command";
398
+ };
399
+ export type MatchmakingQueueResponse =
400
+ | {
401
+ command: "matchmaking/queue/response";
402
+ status: "success";
403
+ }
404
+ | {
405
+ command: "matchmaking/queue/response";
406
+ status: "failed";
407
+ reason: "invalid_queue_specified" | "already_ingame" | "internal_error" | "unauthorized" | "invalid_command";
408
+ };
409
+ export type MatchmakingQueueUpdateResponse =
410
+ | {
411
+ command: "matchmaking/queueUpdate/response";
412
+ status: "success";
413
+ data: {
414
+ playersQueued: number;
415
+ };
416
+ }
417
+ | {
418
+ command: "matchmaking/queueUpdate/response";
419
+ status: "failed";
420
+ reason: "internal_error" | "unauthorized" | "invalid_command";
421
+ };
422
+ export type MatchmakingReadyResponse =
423
+ | {
424
+ command: "matchmaking/ready/response";
425
+ status: "success";
426
+ }
427
+ | {
428
+ command: "matchmaking/ready/response";
429
+ status: "failed";
430
+ reason: "no_match" | "internal_error" | "unauthorized" | "invalid_command";
431
+ };
432
+ export type MatchmakingReadyUpdateResponse =
433
+ | {
434
+ command: "matchmaking/readyUpdate/response";
435
+ status: "success";
436
+ data: {
437
+ readyMax: number;
438
+ readyCurrent: number;
439
+ };
440
+ }
441
+ | {
442
+ command: "matchmaking/readyUpdate/response";
443
+ status: "failed";
444
+ reason: "internal_error" | "unauthorized" | "invalid_command";
445
+ };
446
+ export type SystemDisconnectedResponse =
447
+ | {
448
+ command: "system/disconnected/response";
449
+ status: "success";
450
+ }
451
+ | {
452
+ command: "system/disconnected/response";
453
+ status: "failed";
454
+ reason: "internal_error" | "unauthorized" | "invalid_command";
455
+ };
456
+ export type SystemVersionResponse =
457
+ | {
458
+ command: "system/version/response";
459
+ status: "success";
460
+ data: {
461
+ tachyonVersion: "0.1.0";
462
+ };
463
+ }
464
+ | {
465
+ command: "system/version/response";
466
+ status: "failed";
467
+ reason: "internal_error" | "unauthorized" | "invalid_command";
468
+ };
469
+
470
+ export interface Tachyon {
471
+ account: {
472
+ /**
473
+ * Get an authentication token used for [login](#login).
474
+ */
475
+ getToken: {
476
+ request: AccountGetTokenRequest;
477
+ response: AccountGetTokenResponse;
478
+ };
479
+ /**
480
+ * Login using an authentication token from [getToken](#gettoken).
481
+ */
482
+ login: {
483
+ request: AccountLoginRequest;
484
+ response: AccountLoginResponse;
485
+ };
486
+ /**
487
+ * Should reset the password for the connected user and send it to the associated email address
488
+ */
489
+ recover: {
490
+ request: AccountRecoverRequest;
491
+ response: AccountRecoverResponse;
492
+ };
493
+ /**
494
+ * Registers a new account. The user's password should be hashed twice, once on the client (md5), then again on the server (something stronger) before being stored.
495
+ *
496
+ * The server implementation may wish to verify the account by sending a verification link to the email address. `hashedPassword` implies that the user's password should be hashed twice, once on the client-side, and then again on the server. Doing this ensures even the server can never know the user's plaintext password.
497
+ */
498
+ register: {
499
+ request: AccountRegisterRequest;
500
+ response: AccountRegisterResponse;
501
+ };
502
+ /**
503
+ * Change username for the current user.
504
+ */
505
+ rename: {
506
+ request: AccountRenameRequest;
507
+ response: AccountRenameResponse;
508
+ };
509
+ };
510
+ bot: {
511
+ /**
512
+ * Registers the client as slavable by the master server to be used for hosting dedicated lobbies or matchmaking.
513
+ */
514
+ slave: {
515
+ request: BotSlaveRequest;
516
+ response: BotSlaveResponse;
517
+ };
518
+ /**
519
+ * Unregisters the client as slavable.
520
+ */
521
+ unslave: {
522
+ request: BotUnslaveRequest;
523
+ response: BotUnslaveResponse;
524
+ };
525
+ };
526
+ game: {
527
+ /**
528
+ * When a client receives this response it should launch the game with the start script.
529
+ */
530
+ launch: {
531
+ response: GameLaunchResponse;
532
+ };
533
+ };
534
+ lobby: {
535
+ /**
536
+ * Close an existing lobby.
537
+ */
538
+ close: {
539
+ request: LobbyCloseRequest;
540
+ response: LobbyCloseResponse;
541
+ };
542
+ /**
543
+ * Create a new lobby - intended for player clients to summon a dedicated host.
544
+ */
545
+ create: {
546
+ request: LobbyCreateRequest;
547
+ response: LobbyCreateResponse;
548
+ };
549
+ /**
550
+ * Join a custom lobby. Server will send a [joined](#joined) response containing the joined lobby's data.
551
+ */
552
+ join: {
553
+ request: LobbyJoinRequest;
554
+ response: LobbyJoinResponse;
555
+ };
556
+ /**
557
+ * Sent when the client successfully joins a lobby. Can also be sent at any time by the server to forcibly make the client join a lobby.
558
+ */
559
+ joined: {
560
+ response: LobbyJoinedResponse;
561
+ };
562
+ /**
563
+ * Leave the current lobby.
564
+ */
565
+ leave: {
566
+ request: LobbyLeaveRequest;
567
+ response: LobbyLeaveResponse;
568
+ };
569
+ /**
570
+ * Sent when the server removes the client from a lobby.
571
+ */
572
+ left: {
573
+ response: LobbyLeftResponse;
574
+ };
575
+ /**
576
+ * Returns all custom lobbies.
577
+ */
578
+ list: {
579
+ request: LobbyListRequest;
580
+ response: LobbyListResponse;
581
+ };
582
+ /**
583
+ * Receive a lobby message. See [sendMessage](#sendmessage) for outgoing messages.
584
+ */
585
+ receiveMessage: {
586
+ response: LobbyReceiveMessageResponse;
587
+ };
588
+ /**
589
+ * Send a lobby message. See [receiveMessage](#receivemessage) for incoming messages.
590
+ */
591
+ sendMessage: {
592
+ request: LobbySendMessageRequest;
593
+ response: LobbySendMessageResponse;
594
+ };
595
+ /**
596
+ * Server sends this partial object whenever a lobby relevant to the client changes in some way.
597
+ */
598
+ updated: {
599
+ response: LobbyUpdatedResponse;
600
+ };
601
+ };
602
+ matchmaking: {
603
+ /**
604
+ * Cancel queueing for matchmaking. Can also be sent during the ready phase to effectively decline the match.
605
+ */
606
+ cancel: {
607
+ request: MatchmakingCancelRequest;
608
+ response: MatchmakingCancelResponse;
609
+ };
610
+ /**
611
+ * Server should send this when there are enough queued players to form a valid game that meets their criteria. Clients should respond with [ready](#ready).
612
+ */
613
+ found: {
614
+ response: MatchmakingFoundResponse;
615
+ };
616
+ /**
617
+ * Returns all available matchmaking queues.
618
+ */
619
+ list: {
620
+ request: MatchmakingListRequest;
621
+ response: MatchmakingListResponse;
622
+ };
623
+ /**
624
+ * Sent when a found match gets disbanded because a client failed to ready up.
625
+ */
626
+ lost: {
627
+ response: MatchmakingLostResponse;
628
+ };
629
+ /**
630
+ * Queue up for matchmaking. Should cancel the previous queue if already in one.
631
+ */
632
+ queue: {
633
+ request: MatchmakingQueueRequest;
634
+ response: MatchmakingQueueResponse;
635
+ };
636
+ /**
637
+ * Contains some info about the state of the current queue.
638
+ */
639
+ queueUpdate: {
640
+ response: MatchmakingQueueUpdateResponse;
641
+ };
642
+ /**
643
+ * Clients should send this when they are ready to proceed with the found match. If not sent within 10s of the [found](#found) response then queue should be cancelled.
644
+ */
645
+ ready: {
646
+ request: MatchmakingReadyRequest;
647
+ response: MatchmakingReadyResponse;
648
+ };
649
+ /**
650
+ * Sent when a client in a found match readies up.
651
+ */
652
+ readyUpdate: {
653
+ response: MatchmakingReadyUpdateResponse;
654
+ };
655
+ };
656
+ system: {
657
+ /**
658
+ * Ask the server to terminate the connection. The server will send a [disconnected](#disconnected) response.
659
+ */
660
+ disconnect: {
661
+ request: SystemDisconnectRequest;
662
+ };
663
+ /**
664
+ * Sent when the server terminates the WebSocket connection with the client for any reason. The only time the `success` response should be sent is if the client asked to be disconnected using a [disconnect](#disconnect) request.
665
+ */
666
+ disconnected: {
667
+ response: SystemDisconnectedResponse;
668
+ };
669
+ /**
670
+ * Sends the current version of the protocol to new Websocket clients as soon as they connect.
671
+ */
672
+ version: {
673
+ response: SystemVersionResponse;
674
+ };
675
+ };
676
+ }
677
+ export interface AccountGetTokenRequest {
678
+ command: "account/getToken/request";
679
+ data: (
680
+ | {
681
+ email: string;
682
+ }
683
+ | {
684
+ username: string;
685
+ }
686
+ ) & {
687
+ hashedPassword: string;
688
+ };
689
+ }
690
+ export interface AccountLoginRequest {
691
+ command: "account/login/request";
692
+ data: {
693
+ token: string;
694
+ };
695
+ }
696
+ export interface AccountRecoverRequest {
697
+ command: "account/recover/request";
698
+ }
699
+ export interface AccountRegisterRequest {
700
+ command: "account/register/request";
701
+ data: {
702
+ email: string;
703
+ username: string;
704
+ hashedPassword: string;
705
+ };
706
+ }
707
+ export interface AccountRenameRequest {
708
+ command: "account/rename/request";
709
+ data: {
710
+ newUsername: string;
711
+ };
712
+ }
713
+ export interface BotSlaveRequest {
714
+ command: "bot/slave/request";
715
+ data: {
716
+ maxBattles: number;
717
+ };
718
+ }
719
+ export interface BotUnslaveRequest {
720
+ command: "bot/unslave/request";
721
+ }
722
+ export interface LobbyCloseRequest {
723
+ command: "lobby/close/request";
724
+ }
725
+ export interface LobbyCreateRequest {
726
+ command: "lobby/create/request";
727
+ data: {
728
+ title: string;
729
+ private: boolean;
730
+ region: string;
731
+ maxPlayers: number;
732
+ };
733
+ }
734
+ export interface LobbyJoinRequest {
735
+ command: "lobby/join/request";
736
+ data: {
737
+ lobbyId: number;
738
+ password?: string;
739
+ };
740
+ }
741
+ export interface LobbyLeaveRequest {
742
+ command: "lobby/leave/request";
743
+ }
744
+ export interface LobbyListRequest {
745
+ command: "lobby/list/request";
746
+ }
747
+ export interface LobbySendMessageRequest {
748
+ command: "lobby/sendMessage/request";
749
+ data: {
750
+ message: string;
751
+ };
752
+ }
753
+ export interface MatchmakingCancelRequest {
754
+ command: "matchmaking/cancel/request";
755
+ }
756
+ export interface MatchmakingListRequest {
757
+ command: "matchmaking/list/request";
758
+ }
759
+ export interface MatchmakingQueueRequest {
760
+ command: "matchmaking/queue/request";
761
+ data: {
762
+ /**
763
+ * @minItems 1
764
+ */
765
+ queues: [string, ...string[]];
766
+ };
767
+ }
768
+ export interface MatchmakingReadyRequest {
769
+ command: "matchmaking/ready/request";
770
+ }
771
+ export interface SystemDisconnectRequest {
772
+ command: "system/disconnect/request";
773
+ }
774
+ export type Username = string;
775
+
776
+ export type Email = string;
777
+
778
+ export interface BattleStatus {
779
+ lobbyId: number | null;
780
+ inGame: boolean;
781
+ away: boolean;
782
+ ready: boolean;
783
+ playerNumber: number | null;
784
+ teamColour: string | null;
785
+ isPlayer: boolean;
786
+ bonus: number;
787
+ sync: {
788
+ engine: number;
789
+ game: number;
790
+ map: number;
791
+ };
792
+ partyId: number | null;
793
+ muted: boolean;
794
+ }
795
+
796
+ export interface UserClient {
797
+ userId: number;
798
+ username: string;
799
+ clanId: number | null;
800
+ icons: {
801
+ /**
802
+ * This interface was referenced by `undefined`'s JSON-Schema definition
803
+ * via the `patternProperty` "^(.*)$".
804
+ */
805
+ [k: string]: string;
806
+ };
807
+ roles: ("admin" | "moderator" | "autohost" | "mentor" | "caster" | "tourney")[];
808
+ battleStatus: {
809
+ lobbyId: number | null;
810
+ inGame: boolean;
811
+ away: boolean;
812
+ ready: boolean;
813
+ playerNumber: number | null;
814
+ teamColour: string | null;
815
+ isPlayer: boolean;
816
+ bonus: number;
817
+ sync: {
818
+ engine: number;
819
+ game: number;
820
+ map: number;
821
+ };
822
+ partyId: number | null;
823
+ muted: boolean;
824
+ } | null;
825
+ }
826
+
827
+ export interface PrivateUserClient {
828
+ userId: number;
829
+ username: string;
830
+ clanId: number | null;
831
+ icons: {
832
+ /**
833
+ * This interface was referenced by `undefined`'s JSON-Schema definition
834
+ * via the `patternProperty` "^(.*)$".
835
+ */
836
+ [k: string]: string;
837
+ };
838
+ roles: ("admin" | "moderator" | "autohost" | "mentor" | "caster" | "tourney")[];
839
+ battleStatus: {
840
+ lobbyId: number | null;
841
+ inGame: boolean;
842
+ away: boolean;
843
+ ready: boolean;
844
+ playerNumber: number | null;
845
+ teamColour: string | null;
846
+ isPlayer: boolean;
847
+ bonus: number;
848
+ sync: {
849
+ engine: number;
850
+ game: number;
851
+ map: number;
852
+ };
853
+ partyId: number | null;
854
+ muted: boolean;
855
+ } | null;
856
+ email: string;
857
+ friends: number[];
858
+ friendRequests: number[];
859
+ ignores: number[];
860
+ }
861
+
862
+ export interface Rect {
863
+ x: number;
864
+ y: number;
865
+ width: number;
866
+ height: number;
867
+ }
868
+
869
+ export interface Lobby {
870
+ id: number;
871
+ name: string;
872
+ founderId: number;
873
+ locked: boolean;
874
+ passworded: boolean;
875
+ playerIds: number[];
876
+ spectatorIds: number[];
877
+ engine: string;
878
+ game: string;
879
+ map: string;
880
+ startAreas: {
881
+ /**
882
+ * This interface was referenced by `undefined`'s JSON-Schema definition
883
+ * via the `patternProperty` "^(0|[1-9][0-9]*)$".
884
+ */
885
+ [k: string]: {
886
+ x: number;
887
+ y: number;
888
+ width: number;
889
+ height: number;
890
+ };
891
+ };
892
+ limits: {
893
+ minTeamsize: number | null;
894
+ maxTeamsize: number | null;
895
+ minRating: number | null;
896
+ maxRating: number | null;
897
+ };
898
+ }
899
+
900
+
901
+ export type ServiceId = keyof Tachyon;
902
+
903
+ export type EndpointId = keyof Tachyon[ServiceId];
904
+
905
+ export type RequestEndpointId<S extends ServiceId> = keyof {
906
+ [key in keyof Tachyon[S] as Tachyon[S][key] extends { request: any } ? key : never]: Tachyon[S][key];
907
+ };
908
+
909
+ export type ResponseEndpointId<S extends ServiceId> = keyof {
910
+ [key in keyof Tachyon[S] as Tachyon[S][key] extends { response: any } ? key : never]: Tachyon[S][key];
911
+ };
912
+
913
+ export type RequestType<S extends ServiceId, E extends RequestEndpointId<S>> = Tachyon[S][E] extends { request: infer Req } ? Req : object;
914
+
915
+ export type ResponseType<S extends ServiceId, E extends ResponseEndpointId<S>> = Tachyon[S][E] extends { response: infer Res } ? Res : object;
916
+
917
+ export type RequestData<S extends ServiceId, E extends RequestEndpointId<S>> = Tachyon[S][E] extends { request: { data: infer Data } } ? Data : never;
918
+
919
+ export type ResponseData<S extends ServiceId, E extends ResponseEndpointId<S>> = Tachyon[S][E] extends { response: { data: infer Data } } ? Data : never;
920
+
921
+ export type RemoveField<T, K extends string> = T extends { [P in K]: any } ? Omit<T, K> : never;
922
+
923
+ export type GetCommands<S extends ServiceId, E extends keyof Tachyon[S]> = Tachyon[S][E];