@bluebottle_gg/league-broadcast-client 0.1.0 → 0.2.1

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.
package/dist/index.d.ts CHANGED
@@ -87,7 +87,7 @@ declare class itemWithAsset {
87
87
  * This is an auto-generated file.
88
88
  * Any changes made to this file can be lost when this file is regenerated.
89
89
  */
90
- declare class simpleChampionData {
90
+ declare class simpleChampionData$1 {
91
91
  id: number;
92
92
  alias: string;
93
93
  name: string;
@@ -104,7 +104,7 @@ declare class simpleChampionData {
104
104
  */
105
105
 
106
106
  declare class damageGraphEntry {
107
- champion?: simpleChampionData;
107
+ champion?: simpleChampionData$1;
108
108
  abilities?: ingameAbilityInfo[];
109
109
  activeItems?: itemWithAsset[];
110
110
  name: string;
@@ -172,7 +172,7 @@ declare class cDragonPerkInfo {
172
172
  */
173
173
 
174
174
  declare class ingameSingleRuneData {
175
- champion?: simpleChampionData;
175
+ champion?: simpleChampionData$1;
176
176
  perks: cDragonPerkInfo[];
177
177
  name: string;
178
178
  team: number;
@@ -193,7 +193,7 @@ declare class ingameRuneData {
193
193
  */
194
194
 
195
195
  declare class ingameScoreboardBottomPlayerData {
196
- champion?: simpleChampionData;
196
+ champion?: simpleChampionData$1;
197
197
  name: string;
198
198
  kills: number;
199
199
  deaths: number;
@@ -234,7 +234,7 @@ declare class ingameScoreboardBottomData {
234
234
  * This is an auto-generated file.
235
235
  * Any changes made to this file can be lost when this file is regenerated.
236
236
  */
237
- declare enum BestOfType {
237
+ declare enum BestOfType$1 {
238
238
  BestOf1 = 1,
239
239
  BestOf2 = 2,
240
240
  BestOf3 = 3,
@@ -293,7 +293,7 @@ declare class ingameScoreboardTeamData {
293
293
  declare class ingameScoreboardData {
294
294
  teams: ingameScoreboardTeamData[];
295
295
  gameTime: number;
296
- bestOf: BestOfType;
296
+ bestOf: BestOfType$1;
297
297
  }
298
298
 
299
299
  /**
@@ -314,7 +314,7 @@ declare class ingameSideInfoPageDisplayData {
314
314
  */
315
315
 
316
316
  declare class ingameSideInfoPageRow {
317
- champion?: simpleChampionData;
317
+ champion?: simpleChampionData$1;
318
318
  playerName?: string;
319
319
  team?: number;
320
320
  minValue?: number;
@@ -419,11 +419,13 @@ declare class perkInfoV2 {
419
419
  * Any changes made to this file can be lost when this file is regenerated.
420
420
  */
421
421
 
422
- declare class tabPlayer {
422
+ declare class tabPlayer$1 {
423
423
  id: string;
424
424
  playerName: string;
425
425
  playerHashtag: string;
426
- championAssets?: simpleChampionData;
426
+ givenName: string;
427
+ familyName: string;
428
+ championAssets?: simpleChampionData$1;
427
429
  abilities: ingameAbilityInfo[];
428
430
  perks: perkInfoV2[];
429
431
  health: ingameHealthData;
@@ -443,7 +445,7 @@ declare class tabPlayer {
443
445
 
444
446
  declare class tabTeam {
445
447
  id: number;
446
- players: tabPlayer[];
448
+ players: tabPlayer$1[];
447
449
  }
448
450
 
449
451
  /**
@@ -520,7 +522,7 @@ declare enum TeamMemberRole {
520
522
  * Any changes made to this file can be lost when this file is regenerated.
521
523
  */
522
524
 
523
- declare class teamMember {
525
+ declare class teamMember$1 {
524
526
  memberId: number;
525
527
  teamId: number;
526
528
  alias: string;
@@ -538,8 +540,8 @@ declare class teamMember {
538
540
  * Any changes made to this file can be lost when this file is regenerated.
539
541
  */
540
542
 
541
- declare class teamWithMembers {
542
- members: teamMember[];
543
+ declare class teamWithMembers$1 {
544
+ members: teamMember$1[];
543
545
  teamId: number;
544
546
  name: string;
545
547
  tag: string;
@@ -563,7 +565,7 @@ declare class ingameFrontendData {
563
565
  isTestingEnvironment?: boolean;
564
566
  gameVersion: string;
565
567
  patch?: string;
566
- teams?: teamWithMembers[];
568
+ teams?: teamWithMembers$1[];
567
569
  gameStatus: GameState$1;
568
570
  scoreboard?: ingameScoreboardData;
569
571
  tabs?: {
@@ -573,6 +575,9 @@ declare class ingameFrontendData {
573
575
  baronPitTimer?: iObjectiveRespawnData;
574
576
  dragonPitTimer?: iObjectiveRespawnData;
575
577
  inhibitors?: teamInhibitorData[];
578
+ showTwitchPrediction: boolean;
579
+ showTwitchPoll: boolean;
580
+ showTwitchChatVote: boolean;
576
581
  sideInfoPage?: ingameSideInfoPage;
577
582
  goldGraph?: ingameGoldGraphData;
578
583
  runes?: ingameRuneData;
@@ -718,6 +723,269 @@ interface GameStateSnapshot {
718
723
  */
719
724
  declare function shallowEqual<T>(a: T, b: T): boolean;
720
725
 
726
+ /**
727
+ * This is an auto-generated file.
728
+ * Any changes made to this file can be lost when this file is regenerated.
729
+ */
730
+
731
+ declare class championData {
732
+ id: number;
733
+ alias: string;
734
+ name: string;
735
+ attackSpeed: number;
736
+ splashCenteredImg: string;
737
+ splashImg: string;
738
+ loadingImg: string;
739
+ squareImg: string;
740
+ tileImg: string;
741
+ spells: championAbilityData[];
742
+ }
743
+
744
+ /**
745
+ * This is an auto-generated file.
746
+ * Any changes made to this file can be lost when this file is regenerated.
747
+ */
748
+
749
+ declare class banSlot$1 {
750
+ isActive: boolean;
751
+ champion?: championData;
752
+ }
753
+
754
+ /**
755
+ * This is an auto-generated file.
756
+ * Any changes made to this file can be lost when this file is regenerated.
757
+ */
758
+ declare class championStatistics {
759
+ winRate: number;
760
+ pickRate: number;
761
+ banRate: number;
762
+ }
763
+
764
+ /**
765
+ * This is an auto-generated file.
766
+ * Any changes made to this file can be lost when this file is regenerated.
767
+ */
768
+ declare class summonerSpellData {
769
+ id?: number;
770
+ name: string;
771
+ spellIcon: string;
772
+ localAsset: string;
773
+ }
774
+
775
+ /**
776
+ * This is an auto-generated file.
777
+ * Any changes made to this file can be lost when this file is regenerated.
778
+ */
779
+
780
+ declare class pickSlot$1 {
781
+ id: number;
782
+ isActive: boolean;
783
+ player: string;
784
+ summonerSpells: summonerSpellData[];
785
+ champion?: championData;
786
+ championStatistics?: championStatistics;
787
+ }
788
+
789
+ /**
790
+ * This is an auto-generated file.
791
+ * Any changes made to this file can be lost when this file is regenerated.
792
+ */
793
+ declare enum PickBanPhase$1 {
794
+ BEGIN = 0,
795
+ BAN1 = 1,
796
+ BAN2 = 2,
797
+ PICK1 = 3,
798
+ PICK2 = 4,
799
+ END = 5,
800
+ WAIT = 6
801
+ }
802
+
803
+ /**
804
+ * This is an auto-generated file.
805
+ * Any changes made to this file can be lost when this file is regenerated.
806
+ */
807
+
808
+ declare class pickBanTimer$1 {
809
+ phaseName: PickBanPhase$1;
810
+ phaseDuration: number;
811
+ timeRemaining: number;
812
+ }
813
+
814
+ /**
815
+ * This is an auto-generated file.
816
+ * Any changes made to this file can be lost when this file is regenerated.
817
+ */
818
+ declare enum TimeLineActionType$1 {
819
+ HoverPick = 0,
820
+ Pick = 1,
821
+ Ban = 2
822
+ }
823
+
824
+ /**
825
+ * This is an auto-generated file.
826
+ * Any changes made to this file can be lost when this file is regenerated.
827
+ */
828
+
829
+ declare class timelineEntry$1 {
830
+ type: TimeLineActionType$1;
831
+ champion: championData;
832
+ timer: pickBanTimer$1;
833
+ }
834
+
835
+ /**
836
+ * This is an auto-generated file.
837
+ * Any changes made to this file can be lost when this file is regenerated.
838
+ */
839
+
840
+ declare class championSelectTeam$1 {
841
+ metaData?: teamWithMembers$1;
842
+ bans: banSlot$1[];
843
+ slots: pickSlot$1[];
844
+ timeline: timelineEntry$1[];
845
+ index: number;
846
+ scoreMatch: teamScore;
847
+ scoreSeason: teamScore;
848
+ fearlessBans?: {
849
+ [key: number]: simpleChampionData$1[];
850
+ };
851
+ }
852
+
853
+ /**
854
+ * This is an auto-generated file.
855
+ * Any changes made to this file can be lost when this file is regenerated.
856
+ */
857
+ declare class champSelectStatePerformanceData {
858
+ updateDuration: number;
859
+ }
860
+
861
+ /**
862
+ * This is an auto-generated file.
863
+ * Any changes made to this file can be lost when this file is regenerated.
864
+ */
865
+ declare enum MatchRuleSet$1 {
866
+ Standard = 0,
867
+ PartialFearless = 1,
868
+ Fearless = 2
869
+ }
870
+
871
+ /**
872
+ * This is an auto-generated file.
873
+ * Any changes made to this file can be lost when this file is regenerated.
874
+ */
875
+
876
+ declare class matchData$1 {
877
+ matchId: number;
878
+ seasonId: number;
879
+ winnerId?: number;
880
+ isActive: boolean;
881
+ type: BestOfType$1;
882
+ nextMatchId?: number;
883
+ winnerNextMatchId?: number;
884
+ loserNextMatchId?: number;
885
+ name?: string;
886
+ date?: Date;
887
+ ruleSet: MatchRuleSet$1;
888
+ onStage: boolean;
889
+ }
890
+
891
+ /**
892
+ * This is an auto-generated file.
893
+ * Any changes made to this file can be lost when this file is regenerated.
894
+ */
895
+
896
+ declare class champSelectStateMetaData$1 {
897
+ bestOfType: BestOfType$1;
898
+ patch: string;
899
+ performanceData: champSelectStatePerformanceData;
900
+ matchData?: matchData$1;
901
+ }
902
+
903
+ /**
904
+ * This is an auto-generated file.
905
+ * Any changes made to this file can be lost when this file is regenerated.
906
+ */
907
+
908
+ declare class champSelectStateData {
909
+ isActive: boolean;
910
+ isConnected: boolean;
911
+ isTestingEnvironment: boolean;
912
+ blueTeam: championSelectTeam$1;
913
+ redTeam: championSelectTeam$1;
914
+ metaData: champSelectStateMetaData$1;
915
+ timer: pickBanTimer$1;
916
+ }
917
+
918
+ /**
919
+ * Reactive store for League Broadcast champion-select (pre-game) state.
920
+ *
921
+ * Follows the same selector-based model as {@link GameStateStore} but holds
922
+ * `champSelectStateData` instead of ingame data.
923
+ *
924
+ * @example Vanilla JS
925
+ * ```ts
926
+ * const timer = store.select(s => s.champSelectData.timer);
927
+ * timer.subscribe(() => {
928
+ * console.log('Timer changed:', timer.getSnapshot());
929
+ * });
930
+ * ```
931
+ *
932
+ * @example React 18+
933
+ * ```tsx
934
+ * function Timer() {
935
+ * const timer = useSyncExternalStore(
936
+ * store.select(s => s.champSelectData.timer).subscribe,
937
+ * store.select(s => s.champSelectData.timer).getSnapshot,
938
+ * );
939
+ * return <div>{timer?.timeRemaining}</div>;
940
+ * }
941
+ * ```
942
+ */
943
+ declare class ChampSelectStateStore {
944
+ /** Current immutable snapshot. Replaced (never mutated) on every update. */
945
+ private snapshot;
946
+ /** Global listeners — called on every state change regardless of selector. */
947
+ private listeners;
948
+ /** Monotonically increasing version — used for cheap stale checks. */
949
+ private version;
950
+ constructor(initialState: champSelectStateData);
951
+ /** Return the current full snapshot. */
952
+ getSnapshot(): ChampSelectSnapshot;
953
+ /** Return the current version number. */
954
+ getVersion(): number;
955
+ /**
956
+ * Subscribe to **all** state changes (unfiltered).
957
+ * Returns an unsubscribe function.
958
+ */
959
+ subscribe(listener: () => void): () => void;
960
+ /**
961
+ * Create a **subscribable slice** that only triggers when the selected
962
+ * value changes according to `equalityFn` (defaults to `===`).
963
+ */
964
+ select<S>(selector: (snapshot: ChampSelectSnapshot) => S, equalityFn?: EqualityFn<S>): Subscribable<S>;
965
+ /**
966
+ * Watch a derived value and invoke `callback` whenever it changes.
967
+ * Returns an unsubscribe function.
968
+ */
969
+ watch<S>(selector: (snapshot: ChampSelectSnapshot) => S, callback: (value: S, prev: S) => void, equalityFn?: EqualityFn<S>): () => void;
970
+ /**
971
+ * Watch a derived value and invoke `callback` whenever it changes,
972
+ * **and** invoke it immediately with the current value.
973
+ */
974
+ watchImmediate<S>(selector: (snapshot: ChampSelectSnapshot) => S, callback: (value: S, prev: S | undefined) => void, equalityFn?: EqualityFn<S>): () => void;
975
+ /** @internal Replace champ-select data snapshot and notify listeners. */
976
+ _setChampSelectData(data: champSelectStateData): void;
977
+ /** @internal Replace entire snapshot (used on champ select end / reset). */
978
+ _reset(data: champSelectStateData): void;
979
+ private emit;
980
+ }
981
+ interface ChampSelectSnapshot {
982
+ readonly champSelectData: champSelectStateData;
983
+ /** Whether champ select is currently active. */
984
+ readonly isActive: boolean;
985
+ /** Monotonic version counter — useful for cheap stale checks. */
986
+ readonly version: number;
987
+ }
988
+
721
989
  /**
722
990
  * This is an auto-generated file.
723
991
  * Any changes made to this file can be lost when this file is regenerated.
@@ -763,8 +1031,8 @@ declare class ingameObjectiveEvent {
763
1031
  */
764
1032
 
765
1033
  declare class announcementParameter {
766
- champion?: simpleChampionData;
767
- member?: teamMember;
1034
+ champion?: simpleChampionData$1;
1035
+ member?: teamMember$1;
768
1036
  asset?: string;
769
1037
  team: number;
770
1038
  }
@@ -827,156 +1095,870 @@ declare class announcerEvent {
827
1095
 
828
1096
  declare class killFeedEvent {
829
1097
  ingameTeamId: number;
830
- killer?: simpleChampionData;
831
- victim: simpleChampionData;
832
- assisters?: simpleChampionData[];
1098
+ killer?: simpleChampionData$1;
1099
+ victim: simpleChampionData$1;
1100
+ assisters?: simpleChampionData$1[];
833
1101
  }
834
1102
 
835
1103
  /**
836
1104
  * This is an auto-generated file.
837
1105
  * Any changes made to this file can be lost when this file is regenerated.
838
1106
  */
839
- declare enum Team {
1107
+ declare enum Team$1 {
840
1108
  None = 0,
841
1109
  Order = 1,
842
1110
  Chaos = 2,
843
1111
  Neutral = 3
844
1112
  }
845
1113
 
846
- interface LeagueBroadcastClientConfig {
847
- host: string;
848
- port?: number;
849
- wsRoute?: string;
850
- apiRoute?: string;
851
- cacheRoute?: string;
852
- useHttps?: boolean;
853
- autoConnect?: boolean;
854
- }
855
- interface GameDataEventHandlers {
856
- onPlayerEvent?: (event: playerUpdateEvent) => void;
857
- onTeamEvent?: (event: teamUpdateResults) => void;
858
- onObjectiveEvent?: (event: ingameObjectiveEvent) => void;
859
- onFirstTowerEvent?: (teamId: Team) => void;
860
- onAnnouncementEvent?: (event: announcerEvent) => void;
861
- onKillFeedEvent?: (event: killFeedEvent) => void;
1114
+ /**
1115
+ * This is an auto-generated file.
1116
+ * Any changes made to this file can be lost when this file is regenerated.
1117
+ */
1118
+
1119
+ declare class pickBanActionEventArgs {
1120
+ type: string;
1121
+ subType: string;
1122
+ actorId: number;
1123
+ id: number;
1124
+ gameTeamId: number;
1125
+ champion?: championData;
1126
+ puuid?: string;
862
1127
  }
1128
+
863
1129
  /**
864
- * Main client for connecting to League Broadcast backend and receiving game data
1130
+ * Base HTTP client for League Broadcast REST API calls.
1131
+ *
1132
+ * Provides typed `get`, `post`, `put`, `patch`, and `delete` helpers that
1133
+ * handle JSON serialization, error responses, and empty bodies.
1134
+ *
1135
+ * Used internally by the generated API modules — you normally access this
1136
+ * through `LeagueBroadcastClient.api.*` rather than constructing it directly.
865
1137
  */
866
- declare class LeagueBroadcastClient {
867
- private ws;
868
- private config;
869
- private gameData;
870
- private gameState;
871
- private isTestingEnvironment;
872
- /** Reactive store — subscribe to fine-grained state slices. */
873
- readonly store: GameStateStore;
874
- private stateUpdateHandlers;
875
- private gameStatusHandlers;
876
- private eventHandlers;
877
- constructor(config: LeagueBroadcastClientConfig);
878
- /**
879
- * Connect to the League Broadcast backend
880
- */
881
- connect(): Promise<void>;
882
- /**
883
- * Disconnect from the League Broadcast backend
884
- */
885
- disconnect(): void;
886
- /**
887
- * Check if connected to the backend
888
- */
889
- isConnected(): boolean;
890
- /**
891
- * Get the current game data
892
- */
893
- getGameData(): ingameFrontendData;
894
- /**
895
- * Get the current game state
896
- */
897
- getGameState(): GameState$1;
898
- /**
899
- * Check if in testing environment
900
- */
901
- isInTestingEnvironment(): boolean;
902
- /**
903
- * Register a handler for state updates
904
- */
905
- onStateUpdate(handler: (state: ingameFrontendData) => void): () => void;
906
- /**
907
- * Register a handler for game status changes
908
- */
909
- onGameStatusChange(handler: (status: GameState$1, isTestingEnv: boolean) => void): () => void;
910
- /**
911
- * Register handlers for game events
912
- */
913
- onGameEvents(handlers: GameDataEventHandlers): void;
914
- /**
915
- * Register a handler for connection events
916
- */
917
- onConnect(handler: () => void): () => void;
918
- /**
919
- * Register a handler for disconnection events
920
- */
921
- onDisconnect(handler: () => void): () => void;
922
- /**
923
- * Register a handler for error events
924
- */
925
- onError(handler: (error: Event) => void): () => void;
926
- /**
927
- * Create a subscribable slice of game state.
928
- * The slice only notifies listeners when the selected value actually changes.
929
- *
930
- * Works directly with React 18+ `useSyncExternalStore`:
931
- * ```tsx
932
- * const kills = client.select(s => s.gameData.scoreboard?.teams[0]?.kills);
933
- * function Kills() {
934
- * const value = useSyncExternalStore(kills.subscribe, kills.getSnapshot);
935
- * return <span>{value}</span>;
936
- * }
937
- * ```
938
- */
939
- select<S>(selector: (snapshot: GameStateSnapshot) => S, equalityFn?: EqualityFn<S>): Subscribable<S>;
1138
+ declare class ApiClient {
1139
+ private baseUrl;
1140
+ constructor(baseUrl: string);
1141
+ /** Update the base URL (e.g. after reconnecting to a different host/port). */
1142
+ updateBaseUrl(baseUrl: string): void;
1143
+ /** Current base URL. */
1144
+ getBaseUrl(): string;
1145
+ get<T>(path: string): Promise<T>;
1146
+ post<T = void>(path: string, body?: unknown): Promise<T>;
1147
+ put<T = void>(path: string, body?: unknown): Promise<T>;
1148
+ patch<T = void>(path: string, body?: unknown): Promise<T>;
1149
+ delete<T = void>(path: string): Promise<T>;
940
1150
  /**
941
- * Watch a derived value and invoke `callback` whenever it changes.
942
- * Returns an unsubscribe function.
943
- *
944
- * ```ts
945
- * client.watch(
946
- * s => s.gameData.scoreboard?.teams[0]?.kills,
947
- * (kills, prev) => console.log(`Kills: ${prev} → ${kills}`),
948
- * );
949
- * ```
1151
+ * POST with a raw string body (e.g. base64 image data).
1152
+ * Sets Content-Type to text/plain instead of application/json.
950
1153
  */
951
- watch<S>(selector: (snapshot: GameStateSnapshot) => S, callback: (value: S, prev: S) => void, equalityFn?: EqualityFn<S>): () => void;
952
- /**
953
- * Get the base HTTP URL for API requests
954
- */
955
- getApiUrl(): string;
1154
+ postRaw<T = void>(path: string, rawBody: string): Promise<T>;
956
1155
  /**
957
- * Get the base URL for cache requests
1156
+ * PUT with a raw string body (e.g. base64 image data).
1157
+ * Sets Content-Type to text/plain instead of application/json.
958
1158
  */
959
- getCacheUrl(path?: string): string;
960
- /**
961
- * Setup message handler for WebSocket messages
962
- */
963
- private setupMessageHandler;
964
- /**
965
- * Handle state update from backend
1159
+ putRaw<T = void>(path: string, rawBody: string): Promise<T>;
1160
+ private buildUrl;
1161
+ private request;
1162
+ private parseResponse;
1163
+ }
1164
+ /**
1165
+ * Error thrown when a REST API call returns a non-2xx status.
1166
+ */
1167
+ declare class ApiError extends Error {
1168
+ readonly status: number;
1169
+ readonly statusText: string;
1170
+ readonly body: string;
1171
+ readonly url: string;
1172
+ constructor(status: number, statusText: string, body: string, url: string);
1173
+ }
1174
+
1175
+ /**
1176
+ * This is an auto-generated file.
1177
+ * Any changes made to this file can be lost when this file is regenerated.
1178
+ */
1179
+ declare class simpleChampionData {
1180
+ id: number;
1181
+ alias: string;
1182
+ name: string;
1183
+ splashCenteredImg: string;
1184
+ splashImg: string;
1185
+ loadingImg: string;
1186
+ squareImg: string;
1187
+ tileImg: string;
1188
+ }
1189
+
1190
+ /**
1191
+ * Auto-generated REST API client for Champion select (pre-game) endpoints.
1192
+ * Do not edit manually. Changes will be lost.
1193
+ *
1194
+ * @generated 2026-03-11
1195
+ */
1196
+
1197
+ declare class PreGameApi {
1198
+ private readonly client;
1199
+ constructor(client: ApiClient);
1200
+ /** `POST championselect/mock/{doMocking}` */
1201
+ mockChampionSelect(doMocking: boolean, randomizationinterval?: number): Promise<boolean>;
1202
+ /** `GET championselect/mock` */
1203
+ getMockingStatus(): Promise<boolean>;
1204
+ /** `GET championselect/bans` */
1205
+ getBans(): Promise<Record<number, Record<number, simpleChampionData[]>>>;
1206
+ /** `GET championselect/frontend` */
1207
+ getFrontendUrl(): Promise<string>;
1208
+ /** `GET championselect/stage/{stageSide}/teamid` */
1209
+ getTeamIdOnSide(stageSide: number): Promise<number>;
1210
+ /** `POST championselect/frontend` */
1211
+ changeRouting(uri: string): Promise<void>;
1212
+ /** `GET championselect/stage/{stageside}/{slotid}` */
1213
+ getPlayerPUUIDInSlot(stageside: number, slotid: number): Promise<string>;
1214
+ }
1215
+
1216
+ /**
1217
+ * This is an auto-generated file.
1218
+ * Any changes made to this file can be lost when this file is regenerated.
1219
+ */
1220
+
1221
+ declare class gameWithTeams$1 {
1222
+ teams: teamWithMembers$1[];
1223
+ gameId: number;
1224
+ matchId: number;
1225
+ gameNumber: number;
1226
+ gameWinnerId?: number;
1227
+ isActive: boolean;
1228
+ isComplete: boolean;
1229
+ gameTime?: number;
1230
+ gameDate?: Date;
1231
+ ruleSet: MatchRuleSet$1;
1232
+ patch: string;
1233
+ gameVersion: string;
1234
+ assetPatch: string;
1235
+ }
1236
+
1237
+ /**
1238
+ * This is an auto-generated file.
1239
+ * Any changes made to this file can be lost when this file is regenerated.
1240
+ */
1241
+ declare enum Team {
1242
+ None = 0,
1243
+ Order = 1,
1244
+ Chaos = 2,
1245
+ Neutral = 3
1246
+ }
1247
+
1248
+ /**
1249
+ * This is an auto-generated file.
1250
+ * Any changes made to this file can be lost when this file is regenerated.
1251
+ */
1252
+
1253
+ declare class teamMember {
1254
+ memberId: number;
1255
+ teamId: number;
1256
+ alias: string;
1257
+ puuid: string;
1258
+ isActive: boolean;
1259
+ tag: string;
1260
+ iconUri?: string;
1261
+ role: TeamMemberRole;
1262
+ familyName: string;
1263
+ givenName: string;
1264
+ }
1265
+
1266
+ /**
1267
+ * This is an auto-generated file.
1268
+ * Any changes made to this file can be lost when this file is regenerated.
1269
+ */
1270
+
1271
+ declare class teamWithMembers {
1272
+ members: teamMember$1[];
1273
+ teamId: number;
1274
+ name: string;
1275
+ tag: string;
1276
+ description?: string;
1277
+ iconUri?: string;
1278
+ isActive: boolean;
1279
+ primaryColor?: number;
1280
+ secondaryColor?: number;
1281
+ tertiaryColor?: number;
1282
+ backgroundColor?: number;
1283
+ }
1284
+
1285
+ /**
1286
+ * Auto-generated REST API client for Game CRUD and draft (picks/bans) endpoints.
1287
+ * Do not edit manually. Changes will be lost.
1288
+ *
1289
+ * @generated 2026-03-11
1290
+ */
1291
+
1292
+ declare class GameApi {
1293
+ private readonly client;
1294
+ constructor(client: ApiClient);
1295
+ /** `GET game/current` */
1296
+ getCurrentGame(): Promise<gameWithTeams$1>;
1297
+ /** `GET game/previous` */
1298
+ getPreviousGame(): Promise<number>;
1299
+ /** `GET game/{gameid}` */
1300
+ getGame(gameid: number): Promise<gameWithTeams$1>;
1301
+ /** `PATCH game/{gameid}` */
1302
+ updateGame(gameid: number, game: unknown): Promise<void>;
1303
+ /** `PUT game/{gameid}/teams` */
1304
+ setSideSelection(gameid: number, teams: number[]): Promise<void>;
1305
+ /** `GET game/{gameid}/teams` */
1306
+ getTeamsInGame(gameid: number): Promise<teamWithMembers[]>;
1307
+ /** `DELETE game/{gameid}/winner` */
1308
+ removeGameWinner(gameid: number): Promise<void>;
1309
+ /** `PUT game/{gameid}/winner/{teamid}` */
1310
+ setGameWinner(gameid: number, teamid: number): Promise<void>;
1311
+ /** `GET game/{gameid}/bans` */
1312
+ getBans(gameid: number): Promise<simpleChampionData[]>;
1313
+ /** `GET game/{gameid}/bans/{teamid}` */
1314
+ getBansForTeam(gameid: number, teamid: number): Promise<simpleChampionData[]>;
1315
+ /** `PUT game/{gameid}/bans` */
1316
+ setBans(gameid: number, bans: Record<number, (string | null)[]>): Promise<void>;
1317
+ /** `PUT game/{gameid}/bans/{teamid}` */
1318
+ setBansForTeam(gameid: number, teamid: number, bans: (string | null)[]): Promise<void>;
1319
+ /** `GET game/{gameid}/picks` */
1320
+ getPicks(gameid: number): Promise<Record<number, simpleChampionData[]>>;
1321
+ /** `GET game/{gameid}/picks/{teamid}` */
1322
+ getPicksForTeam(gameid: number, teamid: number): Promise<simpleChampionData[]>;
1323
+ /** `PUT game/{gameid}/picks` */
1324
+ setPicks(gameid: number, picks: Record<number, (string | null)[]>): Promise<void>;
1325
+ /** `PUT game/{gameid}/picks/{teamid}` */
1326
+ setPicksForTeam(gameid: number, teamid: number, picks: (string | null)[]): Promise<void>;
1327
+ /** `GET game/{gameid}/teams/players` */
1328
+ getPlayersInGame(gameid: number): Promise<Record<Team, teamMember[]>>;
1329
+ }
1330
+
1331
+ /**
1332
+ * This is an auto-generated file.
1333
+ * Any changes made to this file can be lost when this file is regenerated.
1334
+ */
1335
+
1336
+ declare class tabPlayer {
1337
+ id: string;
1338
+ playerName: string;
1339
+ playerHashtag: string;
1340
+ givenName: string;
1341
+ familyName: string;
1342
+ championAssets?: simpleChampionData$1;
1343
+ abilities: ingameAbilityInfo[];
1344
+ perks: perkInfoV2[];
1345
+ health: ingameHealthData;
1346
+ resource: ingameResourceData;
1347
+ stacksData?: number;
1348
+ hasBaron: boolean;
1349
+ hasElder: boolean;
1350
+ level: number;
1351
+ experience: ingameExperienceData;
1352
+ timeToRespawn?: number;
1353
+ }
1354
+
1355
+ /**
1356
+ * Auto-generated REST API client for Live game state endpoints (requires active game).
1357
+ * Do not edit manually. Changes will be lost.
1358
+ *
1359
+ * @generated 2026-03-11
1360
+ */
1361
+
1362
+ declare class GameStateApi {
1363
+ private readonly client;
1364
+ constructor(client: ApiClient);
1365
+ /** `GET game/state/time` */
1366
+ getGameTime(): Promise<number>;
1367
+ /** `GET game/state/team/{teamId}/dragons` */
1368
+ getTeamDragons(teamId: number): Promise<string[]>;
1369
+ /** `PATCH game/state/team/{teamId}/dragons` */
1370
+ updateTeamDragons(teamId: number, dragons: string[]): Promise<void>;
1371
+ /** `GET game/state/team/all/index` */
1372
+ getActiveTeams(): Promise<number[]>;
1373
+ /** `GET game/state/team/all/participant` */
1374
+ getAllTeamParticipants(): Promise<Record<number, tabPlayer[]>>;
1375
+ /** `GET game/state/team/{teamId}/participant` */
1376
+ getTeamParticipants(teamId: number): Promise<tabPlayer[]>;
1377
+ /** `GET game/state/team/all/participant/order` */
1378
+ getTeamParticipantOrder(): Promise<string[]>;
1379
+ /** `PUT game/state/team/all/participant/order` */
1380
+ updateTeamParticipantOrder(orderedNames: string[]): Promise<void>;
1381
+ }
1382
+
1383
+ /**
1384
+ * This is an auto-generated file.
1385
+ * Any changes made to this file can be lost when this file is regenerated.
1386
+ */
1387
+
1388
+ declare class matchData {
1389
+ matchId: number;
1390
+ seasonId: number;
1391
+ winnerId?: number;
1392
+ isActive: boolean;
1393
+ type: BestOfType$1;
1394
+ nextMatchId?: number;
1395
+ winnerNextMatchId?: number;
1396
+ loserNextMatchId?: number;
1397
+ name?: string;
1398
+ date?: Date;
1399
+ ruleSet: MatchRuleSet$1;
1400
+ onStage: boolean;
1401
+ }
1402
+
1403
+ /**
1404
+ * This is an auto-generated file.
1405
+ * Any changes made to this file can be lost when this file is regenerated.
1406
+ */
1407
+
1408
+ declare class addMatchRequestArgs {
1409
+ name?: string;
1410
+ type: BestOfType$1;
1411
+ teams: number[];
1412
+ isCurrent: boolean;
1413
+ onStage?: boolean;
1414
+ seasonId?: number;
1415
+ nextMatchId?: number;
1416
+ winnerNextMatchId?: number;
1417
+ loserNextMatchId?: number;
1418
+ matchDate?: string;
1419
+ timePerGame?: number;
1420
+ ruleSet: string;
1421
+ }
1422
+
1423
+ /**
1424
+ * This is an auto-generated file.
1425
+ * Any changes made to this file can be lost when this file is regenerated.
1426
+ */
1427
+
1428
+ declare class optionalMatchData {
1429
+ date?: Date;
1430
+ ruleSet?: MatchRuleSet$1;
1431
+ onStage?: boolean;
1432
+ }
1433
+
1434
+ /**
1435
+ * This is an auto-generated file.
1436
+ * Any changes made to this file can be lost when this file is regenerated.
1437
+ */
1438
+ declare enum BestOfType {
1439
+ BestOf1 = 1,
1440
+ BestOf2 = 2,
1441
+ BestOf3 = 3,
1442
+ BestOf5 = 5,
1443
+ BestOf7 = 7
1444
+ }
1445
+
1446
+ /**
1447
+ * This is an auto-generated file.
1448
+ * Any changes made to this file can be lost when this file is regenerated.
1449
+ */
1450
+ declare enum MatchRuleSet {
1451
+ Standard = 0,
1452
+ PartialFearless = 1,
1453
+ Fearless = 2
1454
+ }
1455
+
1456
+ /**
1457
+ * This is an auto-generated file.
1458
+ * Any changes made to this file can be lost when this file is regenerated.
1459
+ */
1460
+
1461
+ declare class gameWithTeams {
1462
+ teams: teamWithMembers$1[];
1463
+ gameId: number;
1464
+ matchId: number;
1465
+ gameNumber: number;
1466
+ gameWinnerId?: number;
1467
+ isActive: boolean;
1468
+ isComplete: boolean;
1469
+ gameTime?: number;
1470
+ gameDate?: Date;
1471
+ ruleSet: MatchRuleSet$1;
1472
+ patch: string;
1473
+ gameVersion: string;
1474
+ assetPatch: string;
1475
+ }
1476
+
1477
+ /**
1478
+ * This is an auto-generated file.
1479
+ * Any changes made to this file can be lost when this file is regenerated.
1480
+ */
1481
+
1482
+ declare class matchWithGamesAndTeams {
1483
+ games: gameWithTeams[];
1484
+ teams: teamWithMembers$1[];
1485
+ matchId: number;
1486
+ seasonId: number;
1487
+ winnerId?: number;
1488
+ isActive: boolean;
1489
+ type: BestOfType$1;
1490
+ nextMatchId?: number;
1491
+ winnerNextMatchId?: number;
1492
+ loserNextMatchId?: number;
1493
+ name?: string;
1494
+ date?: Date;
1495
+ ruleSet: MatchRuleSet$1;
1496
+ onStage: boolean;
1497
+ }
1498
+
1499
+ /**
1500
+ * Auto-generated REST API client for Match (series) management endpoints.
1501
+ * Do not edit manually. Changes will be lost.
1502
+ *
1503
+ * @generated 2026-03-11
1504
+ */
1505
+
1506
+ declare class MatchApi {
1507
+ private readonly client;
1508
+ constructor(client: ApiClient);
1509
+ /** `GET match/season/{seasonId}/simple` */
1510
+ getSimpleMatches(seasonId: number): Promise<matchData[]>;
1511
+ /** `GET match/season/{seasonId}` */
1512
+ getMatches(seasonId: number): Promise<matchWithGamesAndTeams[]>;
1513
+ /** `GET match/simple` */
1514
+ getAllSimpleMatches(): Promise<matchData[]>;
1515
+ /** `GET match` */
1516
+ getAllMatches(): Promise<matchWithGamesAndTeams[]>;
1517
+ /** `GET match/current` */
1518
+ getCurrentMatch(): Promise<matchWithGamesAndTeams>;
1519
+ /** `POST match/current` */
1520
+ completeCurrentMatch(): Promise<void>;
1521
+ /** `GET match/current/id` */
1522
+ getCurrentMatchId(): Promise<number>;
1523
+ /** `GET match/previous/id` */
1524
+ getPreviousMatchId(): Promise<number>;
1525
+ /** `POST match/current/{seriesid}` */
1526
+ setCurrentMatch(seriesid: number): Promise<void>;
1527
+ /** `GET match/current/bestof` */
1528
+ getCurrentMatchBestOf(): Promise<BestOfType>;
1529
+ /** `PUT match/current/bestof` */
1530
+ setCurrentMatchBestOf(type: BestOfType): Promise<void>;
1531
+ /** `GET match/current/teams` */
1532
+ getCurrentMatchTeams(): Promise<teamWithMembers[]>;
1533
+ /** `PUT match/current/teams` */
1534
+ setCurrentMatchTeams(teamIds: number[]): Promise<void>;
1535
+ /** `GET match/current/game` */
1536
+ getCurrentGame(): Promise<gameWithTeams$1>;
1537
+ /** `GET match/current/ruleset` */
1538
+ getCurrentMatchRuleset(): Promise<MatchRuleSet>;
1539
+ /** `PUT match/current/ruleset/{ruleset}` */
1540
+ setCurrentMatchRuleset(ruleset: MatchRuleSet): Promise<void>;
1541
+ /** `GET match/current/fearless/bans` */
1542
+ getBans(): Promise<Record<number, Record<number, simpleChampionData[]>>>;
1543
+ /** `GET match/current/onstage` */
1544
+ getCurrentMatchOnStage(): Promise<boolean>;
1545
+ /** `GET match/{matchid}` */
1546
+ getMatch(matchid: number): Promise<matchWithGamesAndTeams>;
1547
+ /** `DELETE match/{matchid}` */
1548
+ deleteMatch(matchid: number): Promise<boolean>;
1549
+ /** `GET match/{matchid}/teams` */
1550
+ getMatchTeams(matchid: number): Promise<teamWithMembers[]>;
1551
+ /** `PUT match/{matchid}/teams` */
1552
+ setMatchTeams(matchid: number, teamIds: number[]): Promise<void>;
1553
+ /** `GET match/{matchid}/games` */
1554
+ getMatchGames(matchid: number): Promise<gameWithTeams$1[]>;
1555
+ /** `GET match/{matchid}/winner` */
1556
+ getMatchWinner(matchid: number): Promise<teamWithMembers>;
1557
+ /** `PUT match/{matchid}/winner/{teamid}` */
1558
+ setMatchWinner(matchid: number, teamid: number): Promise<void>;
1559
+ /** `DELETE match/{matchid}/winner` */
1560
+ removeMatchWinner(matchid: number): Promise<void>;
1561
+ /** `GET match/{matchid}/bestof` */
1562
+ getMatchBestOf(matchid: number): Promise<BestOfType>;
1563
+ /** `PUT match/{matchid}/bestof/{type}` */
1564
+ setMatchBestOf(matchid: number, type: BestOfType): Promise<void>;
1565
+ /** `GET match/{matchid}/ruleset` */
1566
+ getMatchRuleset(matchid: number): Promise<MatchRuleSet>;
1567
+ /** `PUT match/{matchid}/ruleset/{ruleset}` */
1568
+ setMatchRuleset(matchid: number, ruleset: MatchRuleSet): Promise<void>;
1569
+ /** `GET match/{matchid}/name` */
1570
+ getMatchName(matchid: number): Promise<string>;
1571
+ /** `PATCH match/{matchid}/name/{matchName}` */
1572
+ setMatchName(matchid: number, matchName: string): Promise<void>;
1573
+ /** `PATCH match/{matchid}` */
1574
+ updateMatch(matchid: number, matchUpdate: optionalMatchData): Promise<void>;
1575
+ /** `GET match/{matchid}/fearless/bans` */
1576
+ getMatchBans(matchid: number): Promise<Record<number, Record<number, simpleChampionData[]>>>;
1577
+ /** `GET match/{seriesid}/onstage` */
1578
+ getMatchOnStage(seriesid: number): Promise<boolean>;
1579
+ /** `PUT match` */
1580
+ addMatch(match: addMatchRequestArgs): Promise<number>;
1581
+ /** `GET match/{matchId}/stage/team/{stageSide}` */
1582
+ getTeamOnStageSide(matchId: number, stageSide: number): Promise<teamWithMembers>;
1583
+ /** `GET match/current/stage/team/{stageSide}` */
1584
+ getTeamOnStageSideCurrent(stageSide: number): Promise<teamWithMembers>;
1585
+ }
1586
+
1587
+ /**
1588
+ * This is an auto-generated file.
1589
+ * Any changes made to this file can be lost when this file is regenerated.
1590
+ */
1591
+ declare class seasonData {
1592
+ seasonId: number;
1593
+ seasonName: string;
1594
+ isActive: boolean;
1595
+ startDate?: Date;
1596
+ endDate?: Date;
1597
+ iconUri?: string;
1598
+ }
1599
+
1600
+ /**
1601
+ * This is an auto-generated file.
1602
+ * Any changes made to this file can be lost when this file is regenerated.
1603
+ */
1604
+ declare class teamData {
1605
+ teamId: number;
1606
+ name: string;
1607
+ tag: string;
1608
+ description?: string;
1609
+ iconUri?: string;
1610
+ isActive: boolean;
1611
+ primaryColor?: number;
1612
+ secondaryColor?: number;
1613
+ tertiaryColor?: number;
1614
+ backgroundColor?: number;
1615
+ }
1616
+
1617
+ /**
1618
+ * Auto-generated REST API client for Season management endpoints.
1619
+ * Do not edit manually. Changes will be lost.
1620
+ *
1621
+ * @generated 2026-03-11
1622
+ */
1623
+
1624
+ declare class SeasonApi {
1625
+ private readonly client;
1626
+ constructor(client: ApiClient);
1627
+ /** `GET season/current` */
1628
+ getCurrentSeason(): Promise<seasonData>;
1629
+ /** `GET season/current/match` */
1630
+ getCurrentSeasonScheduledMatch(): Promise<matchWithGamesAndTeams>;
1631
+ /** `GET season/current/id` */
1632
+ getCurrentSeasonId(): Promise<number>;
1633
+ /** `POST season/current` */
1634
+ setCurrentSeason(newCurrentSeasonId: number): Promise<void>;
1635
+ /** `GET season/current/teams` */
1636
+ getCurrentSeasonTeams(): Promise<teamData[]>;
1637
+ /** `GET season/current/teamswithmembers` */
1638
+ getCurrentSeasonTeamsWithMembers(): Promise<teamWithMembers[]>;
1639
+ /** `GET season/current/icon` */
1640
+ getCurrentSeasonIcon(): Promise<string>;
1641
+ /** `PUT season/current/icon` */
1642
+ setCurrentSeasonIcon(): Promise<string>;
1643
+ /** `GET season` */
1644
+ getAllSeasons(): Promise<seasonData[]>;
1645
+ /** `GET season/{seasonId}` */
1646
+ getSeasonById(seasonId: number): Promise<seasonData>;
1647
+ /** `GET season/{seasonId}/matches` */
1648
+ getMatchesInSeason(seasonId: number): Promise<matchWithGamesAndTeams[]>;
1649
+ /** `GET season/{seasonId}/matches/count` */
1650
+ getMatchesInSeasonCount(seasonId: number): Promise<number>;
1651
+ /** `GET season/{seasonId}/matches/day/{day}` */
1652
+ getMatchesInSeasonOnDay(seasonId: number, day: string): Promise<matchWithGamesAndTeams[]>;
1653
+ /** `GET season/{seasonId}/teams` */
1654
+ getTeamsInSeason(seasonId: number): Promise<teamData[]>;
1655
+ /** `GET season/{seasonId}/teamswithmembers` */
1656
+ getTeamsWithMembersInSeason(seasonId: number): Promise<teamWithMembers[]>;
1657
+ /** `POST season` */
1658
+ createOrUpdateSeason(seasonData: seasonData): Promise<number>;
1659
+ /** `GET season/{seasonId}/icon` */
1660
+ getSeasonIcon(seasonId: number): Promise<string>;
1661
+ /** `PUT season/{seasonId}/icon` */
1662
+ setSeasonIcon(seasonId: number): Promise<string>;
1663
+ /** `DELETE season/{seasonId}` */
1664
+ deleteSeason(seasonId: number): Promise<void>;
1665
+ }
1666
+
1667
+ /**
1668
+ * Auto-generated REST API client for In-game overlay and serialization endpoints.
1669
+ * Do not edit manually. Changes will be lost.
1670
+ *
1671
+ * @generated 2026-03-11
1672
+ */
1673
+
1674
+ declare class IngameApi {
1675
+ private readonly client;
1676
+ constructor(client: ApiClient);
1677
+ /** `GET ingame/status` */
1678
+ getGameState(): Promise<number>;
1679
+ /** `POST ingame/enable` */
1680
+ enableComponent(): Promise<void>;
1681
+ /** `POST ingame/disable` */
1682
+ disableComponent(): Promise<void>;
1683
+ /** `POST ingame/mock/{doMocking}` */
1684
+ mockIngame(doMocking: boolean): Promise<void>;
1685
+ /** `GET ingame/mock` */
1686
+ getMockingStatus(): Promise<boolean>;
1687
+ /** `GET ingame/frontend` */
1688
+ getFrontendUrl(): Promise<string>;
1689
+ /** `GET ingame/showing` */
1690
+ getCurrentCommonSerializationOptions(): Promise<Record<string, unknown>>;
1691
+ /** `POST ingame/showing` */
1692
+ setCurrentCommonSerializationOptions(data: Record<string, unknown>): Promise<void>;
1693
+ /** `GET ingame/showing/{socketid}` */
1694
+ getCurrentFrontendSerializationOptions(socketid: string): Promise<Record<string, unknown>>;
1695
+ /** `POST ingame/showing/{socketid}` */
1696
+ setCurrentFrontendSerializationOptions(socketid: string, data: Record<string, unknown>): Promise<void>;
1697
+ /** `GET ingame/stage/{stageSide}/{playerSlot}/networkId` */
1698
+ getPlayerPUUIDInSlot(stageSide: number, playerSlot: number): Promise<number>;
1699
+ /** `GET ingame/stage/{stageSide}/ingameteamid` */
1700
+ getIngameTeamOnStageSide(stageSide: number): Promise<number>;
1701
+ /** `GET ingame/state/activeOverlays` */
1702
+ getActiveOverlays(): Promise<string[]>;
1703
+ }
1704
+
1705
+ /**
1706
+ * Composite REST API client that aggregates all generated API modules.
1707
+ *
1708
+ * Access individual API groups via the named properties:
1709
+ *
1710
+ * ```ts
1711
+ * const client = new LeagueBroadcastClient({ host: "localhost" });
1712
+ *
1713
+ * // Games
1714
+ * const game = await client.api.game.getCurrent();
1715
+ *
1716
+ * // Matches
1717
+ * const match = await client.api.match.getCurrent();
1718
+ * await client.api.match.setCurrentBestOf(BestOfType.BestOf3);
1719
+ *
1720
+ * // Seasons
1721
+ * const seasons = await client.api.season.getAll();
1722
+ *
1723
+ * // In-game overlay control
1724
+ * await client.api.ingame.enable();
1725
+ * const overlays = await client.api.ingame.getActiveOverlays();
1726
+ *
1727
+ * // Live game state (requires active game)
1728
+ * const time = await client.api.gameState.getGameTime();
1729
+ * const players = await client.api.gameState.getAllParticipants();
1730
+ *
1731
+ * // Pre-game / champion select
1732
+ * const frontendUrl = await client.api.preGame.getFrontendUrl();
1733
+ * ```
1734
+ */
1735
+
1736
+ declare class RestApi {
1737
+ private readonly client;
1738
+ /** In-game overlay and serialization endpoints. */
1739
+ readonly ingame: IngameApi;
1740
+ /** Game CRUD, picks/bans, and winner endpoints. */
1741
+ readonly game: GameApi;
1742
+ /** Match (series) management — current match, teams, fearless bans, etc. */
1743
+ readonly match: MatchApi;
1744
+ /** Season management — CRUD, teams, icons, match listings. */
1745
+ readonly season: SeasonApi;
1746
+ /** Champion select (pre-game) mocking, bans, frontend routing. */
1747
+ readonly preGame: PreGameApi;
1748
+ /** Live game state — participants, dragons, ordering. Requires active game. */
1749
+ readonly gameState: GameStateApi;
1750
+ constructor(baseUrl: string);
1751
+ /**
1752
+ * Update the base URL for all API modules (e.g. after changing host/port).
966
1753
  */
967
- private handleStateUpdate;
1754
+ updateBaseUrl(baseUrl: string): void;
968
1755
  /**
969
- * Handle game status update
1756
+ * Get direct access to the underlying HTTP client for custom requests.
970
1757
  */
971
- private handleGameStatusUpdate;
1758
+ getHttpClient(): ApiClient;
1759
+ }
1760
+
1761
+ interface LeagueBroadcastClientConfig {
1762
+ host: string;
1763
+ port?: number;
1764
+ /** In-game WebSocket route. @default "/ws/in" */
1765
+ ingameWsRoute?: string;
1766
+ /** Pre-game (champion select) WebSocket route. @default "/ws/pre" */
1767
+ preGameWsRoute?: string;
1768
+ apiRoute?: string;
1769
+ cacheRoute?: string;
1770
+ useHttps?: boolean;
1771
+ autoConnect?: boolean;
1772
+ }
1773
+ interface IngameEventHandlers {
1774
+ onPlayerEvent?: (event: playerUpdateEvent) => void;
1775
+ onTeamEvent?: (event: teamUpdateResults) => void;
1776
+ onObjectiveEvent?: (event: ingameObjectiveEvent) => void;
1777
+ onFirstTowerEvent?: (teamId: Team$1) => void;
1778
+ onAnnouncementEvent?: (event: announcerEvent) => void;
1779
+ onKillFeedEvent?: (event: killFeedEvent) => void;
1780
+ }
1781
+ interface ChampSelectEventHandlers {
1782
+ /** Fired for every pick/ban action (hover, lock, ban reveal, phase transition). */
1783
+ onAction?: (action: pickBanActionEventArgs) => void;
1784
+ /** Fired when champ select becomes active (first state update with `isActive === true`). */
1785
+ onChampSelectStart?: () => void;
1786
+ /** Fired when champ select ends (backend sends `isActive === false`). */
1787
+ onChampSelectEnd?: () => void;
1788
+ /** Fired when the frontend route changes (e.g. navigating between pre-game views). */
1789
+ onRouteUpdate?: (uri: string) => void;
1790
+ }
1791
+ /**
1792
+ * Main client for connecting to the League Broadcast backend.
1793
+ *
1794
+ * Internally manages **two** WebSocket connections:
1795
+ * - `/ws/in` — real-time in-game data
1796
+ * - `/ws/pre` — champion-select (pre-game) data
1797
+ *
1798
+ * Both connections are opened on {@link connect} (or automatically if
1799
+ * `autoConnect` is `true`) and share the same host / port.
1800
+ *
1801
+ * @example
1802
+ * ```ts
1803
+ * const client = new LeagueBroadcastClient({ host: "localhost" });
1804
+ *
1805
+ * // In-game
1806
+ * client.onIngameStateUpdate(data => console.log("Game time:", data.gameTime));
1807
+ * client.watchIngame(s => s.gameData.scoreboard?.teams[0]?.kills, kills => { });
1808
+ *
1809
+ * // Pre-game
1810
+ * client.onChampSelectUpdate(data => console.log("Phase:", data.timer.phaseName));
1811
+ * client.onChampSelectEvents({ onAction: a => console.log(a) });
1812
+ * client.selectChampSelect(s => s.champSelectData.timer);
1813
+ * ```
1814
+ */
1815
+ declare class LeagueBroadcastClient {
1816
+ private ingameWs;
1817
+ private preGameWs;
1818
+ private config;
1819
+ private gameData;
1820
+ private gameState;
1821
+ private _isTestingEnvironment;
1822
+ private champSelectData;
1823
+ private champSelectWasActive;
1824
+ /** Reactive store for **in-game** state. */
1825
+ readonly ingameStore: GameStateStore;
1826
+ /** Reactive store for **pre-game** (champion select) state. */
1827
+ readonly preGameStore: ChampSelectStateStore;
972
1828
  /**
973
- * Handle game events
1829
+ * Typed REST API client for all backend HTTP endpoints.
1830
+ *
1831
+ * Provides access to game, match, season, in-game, pre-game, and
1832
+ * game-state API groups:
1833
+ *
1834
+ * ```ts
1835
+ * const game = await client.api.game.getCurrent();
1836
+ * const match = await client.api.match.getCurrent();
1837
+ * await client.api.ingame.enable();
1838
+ * ```
974
1839
  */
975
- private handleGameEvents;
1840
+ readonly api: RestApi;
1841
+ private stateUpdateHandlers;
1842
+ private gameStatusHandlers;
1843
+ private ingameEventHandlers;
1844
+ private champSelectUpdateHandlers;
1845
+ private champSelectEventHandlers;
1846
+ constructor(config: LeagueBroadcastClientConfig);
1847
+ /**
1848
+ * Connect to both in-game and pre-game WebSocket endpoints.
1849
+ *
1850
+ * Both connections are attempted in parallel. If either fails the returned
1851
+ * promise rejects, but the other connection may still succeed.
1852
+ */
1853
+ connect(): Promise<void>;
1854
+ /**
1855
+ * Disconnect from both WebSocket endpoints.
1856
+ */
1857
+ disconnect(): void;
1858
+ /**
1859
+ * Whether the in-game WebSocket is connected.
1860
+ */
1861
+ isIngameConnected(): boolean;
1862
+ /**
1863
+ * Whether the pre-game WebSocket is connected.
1864
+ */
1865
+ isPreGameConnected(): boolean;
1866
+ /** Get the current in-game data. */
1867
+ getIngameData(): ingameFrontendData;
1868
+ /** Get the current game state. */
1869
+ getIngameState(): GameState$1;
1870
+ /** Whether the backend is in a testing / replay environment. */
1871
+ isInTestingEnvironment(): boolean;
1872
+ /** Get the current champion-select state. */
1873
+ getChampSelectData(): champSelectStateData;
1874
+ /** Whether champion select is currently active. */
1875
+ isChampSelectActive(): boolean;
1876
+ /** Register a handler for in-game state updates. */
1877
+ onIngameStateUpdate(handler: (state: ingameFrontendData) => void): () => void;
1878
+ /** Register a handler for in-game status changes (running, paused, out of game). */
1879
+ onIngameStatusChange(handler: (status: GameState$1, isTestingEnv: boolean) => void): () => void;
1880
+ /** Register handlers for in-game events (kills, objectives, etc.). */
1881
+ onIngameEvents(handlers: IngameEventHandlers): void;
1882
+ /** Register a handler for champ-select state updates. */
1883
+ onChampSelectUpdate(handler: (state: champSelectStateData) => void): () => void;
1884
+ /** Register handlers for champ-select lifecycle and action events. */
1885
+ onChampSelectEvents(handlers: ChampSelectEventHandlers): void;
1886
+ /** Register a handler for in-game connection. */
1887
+ onIngameConnect(handler: () => void): () => void;
1888
+ /** Register a handler for in-game disconnection. */
1889
+ onIngameDisconnect(handler: () => void): () => void;
1890
+ /** Register a handler for in-game connection errors. */
1891
+ onIngameError(handler: (error: Event) => void): () => void;
1892
+ /** Register a handler for pre-game connection. */
1893
+ onPreGameConnect(handler: () => void): () => void;
1894
+ /** Register a handler for pre-game disconnection. */
1895
+ onPreGameDisconnect(handler: () => void): () => void;
1896
+ /** Register a handler for pre-game connection errors. */
1897
+ onPreGameError(handler: (error: Event) => void): () => void;
1898
+ /**
1899
+ * Create a subscribable slice of **in-game** state.
1900
+ * The slice only notifies listeners when the selected value actually changes.
1901
+ *
1902
+ * Works directly with React 18+ `useSyncExternalStore`:
1903
+ * ```tsx
1904
+ * const kills = client.selectIngame(s => s.gameData.scoreboard?.teams[0]?.kills);
1905
+ * function Kills() {
1906
+ * const value = useSyncExternalStore(kills.subscribe, kills.getSnapshot);
1907
+ * return <span>{value}</span>;
1908
+ * }
1909
+ * ```
1910
+ */
1911
+ selectIngame<S>(selector: (snapshot: GameStateSnapshot) => S, equalityFn?: EqualityFn<S>): Subscribable<S>;
976
1912
  /**
977
- * End the game and reset state
1913
+ * Watch a derived **in-game** value and invoke `callback` whenever it changes.
1914
+ * Returns an unsubscribe function.
1915
+ *
1916
+ * ```ts
1917
+ * client.watchIngame(
1918
+ * s => s.gameData.scoreboard?.teams[0]?.kills,
1919
+ * (kills, prev) => console.log(`Kills: ${prev} → ${kills}`),
1920
+ * );
1921
+ * ```
978
1922
  */
1923
+ watchIngame<S>(selector: (snapshot: GameStateSnapshot) => S, callback: (value: S, prev: S) => void, equalityFn?: EqualityFn<S>): () => void;
1924
+ /**
1925
+ * Create a subscribable slice of **pre-game** (champion select) state.
1926
+ *
1927
+ * ```tsx
1928
+ * const timer = client.selectChampSelect(s => s.champSelectData.timer);
1929
+ * function DraftTimer() {
1930
+ * const value = useSyncExternalStore(timer.subscribe, timer.getSnapshot);
1931
+ * return <span>{value?.timeRemaining}</span>;
1932
+ * }
1933
+ * ```
1934
+ */
1935
+ selectChampSelect<S>(selector: (snapshot: ChampSelectSnapshot) => S, equalityFn?: EqualityFn<S>): Subscribable<S>;
1936
+ /**
1937
+ * Watch a derived **pre-game** value and invoke `callback` whenever it
1938
+ * changes. Returns an unsubscribe function.
1939
+ *
1940
+ * ```ts
1941
+ * client.watchChampSelect(
1942
+ * s => s.champSelectData.timer.timeRemaining,
1943
+ * (remaining, prev) => console.log(`Time: ${prev} → ${remaining}`),
1944
+ * );
1945
+ * ```
1946
+ */
1947
+ watchChampSelect<S>(selector: (snapshot: ChampSelectSnapshot) => S, callback: (value: S, prev: S) => void, equalityFn?: EqualityFn<S>): () => void;
1948
+ /** Get the base HTTP URL for API requests. */
1949
+ getApiUrl(): string;
1950
+ /** Get the base URL for cache requests (optionally resolve a path). */
1951
+ getCacheUrl(path?: string): string;
1952
+ private setupIngameMessageHandler;
1953
+ private handleStateUpdate;
1954
+ private handleGameStatusUpdate;
1955
+ private handleGameEvents;
979
1956
  private endGame;
1957
+ private setupPreGameMessageHandler;
1958
+ private handleChampSelectStateUpdate;
1959
+ private handleChampSelectAction;
1960
+ private handleRouteUpdate;
1961
+ private endChampSelect;
980
1962
  }
981
1963
 
982
1964
  /**
@@ -1044,9 +2026,134 @@ declare class transitionEvents {
1044
2026
  player?: playerUpdateEvent[];
1045
2027
  team?: teamUpdateResults[];
1046
2028
  objective?: ingameObjectiveEvent[];
1047
- firstTower?: Team;
2029
+ firstTower?: number;
1048
2030
  announcements?: announcerEvent[];
1049
2031
  killFeed?: killFeedEvent[];
1050
2032
  }
1051
2033
 
1052
- export { type EqualityFn, type GameDataEventHandlers, GameState$1 as GameState, type GameStateSnapshot, GameStateStore, LeagueBroadcastClient, type LeagueBroadcastClientConfig, type Subscribable, WebSocketManager, announcerEvent, ingameFrontendData, ingameObjectiveEvent, killFeedEvent, playerUpdateEvent, shallowEqual, teamUpdateResults, transitionEvents };
2034
+ /**
2035
+ * This is an auto-generated file.
2036
+ * Any changes made to this file can be lost when this file is regenerated.
2037
+ */
2038
+
2039
+ declare class championSelectTeam {
2040
+ metaData?: teamWithMembers$1;
2041
+ bans: banSlot$1[];
2042
+ slots: pickSlot$1[];
2043
+ timeline: timelineEntry$1[];
2044
+ index: number;
2045
+ scoreMatch: teamScore;
2046
+ scoreSeason: teamScore;
2047
+ fearlessBans?: {
2048
+ [key: number]: simpleChampionData$1[];
2049
+ };
2050
+ }
2051
+
2052
+ /**
2053
+ * This is an auto-generated file.
2054
+ * Any changes made to this file can be lost when this file is regenerated.
2055
+ */
2056
+
2057
+ declare class pickBanTimer {
2058
+ phaseName: PickBanPhase$1;
2059
+ phaseDuration: number;
2060
+ timeRemaining: number;
2061
+ }
2062
+
2063
+ /**
2064
+ * This is an auto-generated file.
2065
+ * Any changes made to this file can be lost when this file is regenerated.
2066
+ */
2067
+ declare enum PickBanPhase {
2068
+ BEGIN = 0,
2069
+ BAN1 = 1,
2070
+ BAN2 = 2,
2071
+ PICK1 = 3,
2072
+ PICK2 = 4,
2073
+ END = 5,
2074
+ WAIT = 6
2075
+ }
2076
+
2077
+ /**
2078
+ * This is an auto-generated file.
2079
+ * Any changes made to this file can be lost when this file is regenerated.
2080
+ */
2081
+
2082
+ declare class banSlot {
2083
+ isActive: boolean;
2084
+ champion?: championData;
2085
+ }
2086
+
2087
+ /**
2088
+ * This is an auto-generated file.
2089
+ * Any changes made to this file can be lost when this file is regenerated.
2090
+ */
2091
+
2092
+ declare class pickSlot {
2093
+ id: number;
2094
+ isActive: boolean;
2095
+ player: string;
2096
+ summonerSpells: summonerSpellData[];
2097
+ champion?: championData;
2098
+ championStatistics?: championStatistics;
2099
+ }
2100
+
2101
+ /**
2102
+ * This is an auto-generated file.
2103
+ * Any changes made to this file can be lost when this file is regenerated.
2104
+ */
2105
+
2106
+ declare class champSelectStateMetaData {
2107
+ bestOfType: BestOfType$1;
2108
+ patch: string;
2109
+ performanceData: champSelectStatePerformanceData;
2110
+ matchData?: matchData$1;
2111
+ }
2112
+
2113
+ /**
2114
+ * This is an auto-generated file.
2115
+ * Any changes made to this file can be lost when this file is regenerated.
2116
+ */
2117
+ declare enum ActionType {
2118
+ TEN_BANS_REVEAL = 0,
2119
+ PHASE_TRANSITION = 1,
2120
+ PICK = 2,
2121
+ BAN = 3
2122
+ }
2123
+
2124
+ /**
2125
+ * This is an auto-generated file.
2126
+ * Any changes made to this file can be lost when this file is regenerated.
2127
+ */
2128
+ declare enum ActionSubType {
2129
+ START = 0,
2130
+ HOVER = 1,
2131
+ LOCK = 2
2132
+ }
2133
+
2134
+ /**
2135
+ * This is an auto-generated file.
2136
+ * Any changes made to this file can be lost when this file is regenerated.
2137
+ */
2138
+
2139
+ declare class timelineEntry {
2140
+ type: TimeLineActionType$1;
2141
+ champion: championData;
2142
+ timer: pickBanTimer$1;
2143
+ }
2144
+
2145
+ /**
2146
+ * This is an auto-generated file.
2147
+ * Any changes made to this file can be lost when this file is regenerated.
2148
+ */
2149
+ declare enum TimeLineActionType {
2150
+ HoverPick = 0,
2151
+ Pick = 1,
2152
+ Ban = 2
2153
+ }
2154
+
2155
+ declare function getSortedInventory(playerData: ingameScoreboardBottomPlayerData): (itemWithAsset | undefined)[];
2156
+ declare function getTrinket(playerData: ingameScoreboardBottomPlayerData): itemWithAsset | undefined;
2157
+ declare function getRoleQuest(playerData: ingameScoreboardBottomPlayerData): itemWithAsset | undefined;
2158
+
2159
+ export { ActionSubType, ActionType, ApiClient, ApiError, BestOfType, type ChampSelectEventHandlers, type ChampSelectSnapshot, ChampSelectStateStore, type EqualityFn, GameApi, GameState$1 as GameState, GameStateApi, type GameStateSnapshot, GameStateStore, IngameApi, type IngameEventHandlers, LeagueBroadcastClient, type LeagueBroadcastClientConfig, MatchApi, MatchRuleSet, PickBanPhase, PreGameApi, RestApi, SeasonApi, type Subscribable, TimeLineActionType, WebSocketManager, announcerEvent, banSlot, champSelectStateData, champSelectStateMetaData, championSelectTeam, gameWithTeams$1 as gameWithTeams, getRoleQuest, getSortedInventory, getTrinket, ingameFrontendData, ingameObjectiveEvent, killFeedEvent, matchData, matchWithGamesAndTeams, pickBanActionEventArgs, pickBanTimer, pickSlot, playerUpdateEvent, seasonData, shallowEqual, simpleChampionData, tabPlayer, teamData, teamUpdateResults, teamWithMembers, timelineEntry, transitionEvents };