microsoft / immersive-reader-sdk

SDK for using the Immersive Reader through Cognitive Services
MIT License
95 stars 52 forks source link

Provide types for `onPreferencesChanged` string #485

Closed benvillalobos closed 2 months ago

benvillalobos commented 8 months ago

In the handler for onPreferencesChanged, it would be great to be able to parse the string using known types provided by the SDK. Today, the VSCode for Education Extension uses manually created types based on the preferences string we received at the time. If they change at any point, the current method of fixing it would be to once again manually take a look at the string rather than updating a package to obtain the new types.

At minimum, the documentation, could define what's expected in the onPreferencesChanged string.

Some of the types returned in the prefs string were documented, but not all. Below is an example.

export type TranslationLanguageData = {
    tlc: string;
    slc: string;
};

export type TranslationLanguage = {
    key: string;
    text: string;
    data: TranslationLanguageData;
};

See https://github.com/microsoft/vscode-edu-extension/pull/1532/files for context. If you need access to the repository, please comment or message offline.

cristobal-buenrostro commented 3 months ago

Hi @benvillalobos , we are updating docs to reflect the types returned for preferences

benvillalobos commented 3 months ago

Thanks for the update @cristobal-buenrostro !

cristobal-buenrostro commented 2 months ago

@benvillalobos

doc updated: https://learn.microsoft.com/en-us/azure/ai-services/immersive-reader/how-to-store-user-preferences#example-preferences-json-structure