diff --git a/types/twitch-ext/index.d.ts b/types/twitch-ext/index.d.ts index 4cac514539..fac7ccaad4 100644 --- a/types/twitch-ext/index.d.ts +++ b/types/twitch-ext/index.d.ts @@ -29,6 +29,11 @@ interface TwitchExt { */ actions: TwitchExtActions; + /** + * @see https://dev.twitch.tv/docs/extensions/reference/#helper-configuration + */ + configuration: TwitchExtConfiguration; + /** * @see https://dev.twitch.tv/docs/extensions/reference/#twitch-extension-feature-flags */ @@ -170,6 +175,46 @@ interface TwitchExtActions { requestIdShare(): void; } +/** + * @see TwitchExt.configuration + */ +interface TwitchExtConfiguration { + /** + * This property returns the record for the broadcaster segment if one is found; otherwise, undefined. + */ + broadcaster: { version: string; content: string } | undefined; + + /** + * This property returns the record for the developer segment if one is found; otherwise, undefined. + */ + developer: { version: string; content: string } | undefined; + + /** + * This property returns the record for the global segment if one is found; otherwise, undefined. + */ + global: { version: string; content: string } | undefined; + + /** + * This function registers a callback that is called whenever an extension configuration is received. + * The callback function takes no input and returns nothing. After this is called for the first time, + * the records for the global, developer and broadcaster segments will be set if the data is available. + * @param callback The callback that is fired. + */ + onChanged( + callback: () => void + ): void + + + /** + * This function can be called by the front end to set an extension configuration. + * @param segment The string-encoded configuration. + * @param version The configuration segment to set. + * @param content The version of configuration with which the segment is stored. + */ + set(segment: string, version: string, content: string): void; +} + + interface TwitchExtFeatureFlags { /** * If this flag is true, you can send a chat message to the current channel using Send Extension Chat Message