From ce59cc6003375213360fc7cd0dfe209368cef9fb Mon Sep 17 00:00:00 2001 From: Leon Machens Date: Wed, 14 Jul 2021 15:07:14 +0200 Subject: [PATCH 1/4] Add some InfoUpdate2 types Access `overwolf.games.events.onInfoUpdates2` results `info` property was always an empty object. `[key: string]: any;` is a temporary solution until all possibilities are added. I added only [live_client_data](https://overwolf.github.io/docs/api/overwolf-games-events-lol#live_client_data) and [game_info](https://overwolf.github.io/docs/api/overwolf-games-events-lol#matchstate). Can you check if this is correct? In addition, `extends InfoUpdate2[Feature]` gives you the correct type if you previously checked the `Feature` (see screenshots). --- overwolf.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/overwolf.d.ts b/overwolf.d.ts index b076db6..618b5c7 100644 --- a/overwolf.d.ts +++ b/overwolf.d.ts @@ -2735,10 +2735,23 @@ declare namespace overwolf.games.events { reason: string; } - interface InfoUpdate2 { } + interface InfoUpdate2 { + live_client_data?: { + active_player?: string; + all_players?: string; + events?: string; + game_data?: string; + port?: number; + }; + game_info?: { + matchStarted?: 'true' | 'false'; + matchId?: string; + }; + [key: string]: any; + } interface InfoUpdates2Event - { + { info: Info; feature: Feature; } From 229f960f2075a4fd646ca7712ba37571a2c628aa Mon Sep 17 00:00:00 2001 From: Leon Machens Date: Wed, 14 Jul 2021 15:20:10 +0200 Subject: [PATCH 2/4] Add status and reason to GetInfoResult Calling `overwolf.games.launchers.events.getInfo(10902, console.log)` (when League Launcher is running) returns and object with `success`, `status` and `res`. Calling the same method with an unknown ID like `overwolf.games.launchers.events.getInfo(999999, console.log)` returns an object with `success`, `status` and `reason`. There is not `error` property, even if TypeScript tells me so. Thus, I removed `extends Result` to remove `error` from the result and added `status` and `reason`. `res` is optional. --- overwolf.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/overwolf.d.ts b/overwolf.d.ts index 618b5c7..b2dfcc0 100644 --- a/overwolf.d.ts +++ b/overwolf.d.ts @@ -2637,8 +2637,10 @@ declare namespace overwolf.games.launchers { } declare namespace overwolf.games.launchers.events { - interface GetInfoResult extends Result { - res: T; + interface GetInfoResult { + status: 'error' | 'success'; + res?: T; + reason?: string; } interface SetRequiredFeaturesResult extends Result { From 5714db20f2c26052cd7cc8cb55ffabdf44a9b559 Mon Sep 17 00:00:00 2001 From: Leon Machens Date: Sun, 18 Jul 2021 12:39:20 +0200 Subject: [PATCH 3/4] Add missing type --- overwolf.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/overwolf.d.ts b/overwolf.d.ts index b2dfcc0..93c8ce4 100644 --- a/overwolf.d.ts +++ b/overwolf.d.ts @@ -2638,6 +2638,7 @@ declare namespace overwolf.games.launchers { declare namespace overwolf.games.launchers.events { interface GetInfoResult { + success: boolean; status: 'error' | 'success'; res?: T; reason?: string; From 684d1bd6e756472aaac0e64046316b5bf85dd4cc Mon Sep 17 00:00:00 2001 From: Leon Machens Date: Sun, 18 Jul 2021 12:50:26 +0200 Subject: [PATCH 4/4] Add all feature possibilities --- overwolf.d.ts | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/overwolf.d.ts b/overwolf.d.ts index 93c8ce4..e06ac5a 100644 --- a/overwolf.d.ts +++ b/overwolf.d.ts @@ -2738,26 +2738,30 @@ declare namespace overwolf.games.events { reason: string; } - interface InfoUpdate2 { - live_client_data?: { - active_player?: string; - all_players?: string; - events?: string; - game_data?: string; - port?: number; + type InfoUpdates2Event = { + feature: 'live_client_data'; + info: { + live_client_data: { + active_player?: string; + all_players?: string; + events?: string; + game_data?: string; + port?: number; + } }; - game_info?: { - matchStarted?: 'true' | 'false'; - matchId?: string; + } | { + feature: 'matchState'; + info: { + game_info: { + matchStarted?: 'true' | 'false'; + matchId?: string; + } }; - [key: string]: any; + } | { + feature: 'gep_internal' | 'match_info' | 'death' | 'respawn' | 'abilities' | 'kill' | 'assist' | 'gold' | 'minions' | 'summoner_info' | 'gameMode' | 'teams' | 'level' | 'announcer' | 'counters' | 'damage' | 'heal'; + info: any; } - interface InfoUpdates2Event - { - info: Info; - feature: Feature; - } /** * Sets the required features from the provider.