src/mcpHelpers.js
async function setPreferredMcpSettings(accessToken, languageCode, languageTag, timezone) {
    let preferredLanguage = getValidLanguageOrThrow(languageCode);
    let preferredRegionalSettings = getValidLanguageTagOrThrow(languageTag);
    let preferredTimezone = getValidTimezoneOrThrow(timezone);

    const mcpSettings = await getMcpSettings(accessToken);

    return await mcpCustomizr.putSettings(accessToken, {
        language: updatePreferredLanguage(preferredLanguage, mcpSettings.language),
        regionalSettings: preferredRegionalSettings,
        timezone: preferredTimezone,
    });
}
async function setPreferredMcpSettings(accessToken, languageCode, languageTag, timezone) {
    let preferredLanguage = getValidLanguageOrThrow(languageCode);
    let preferredRegionalSettings = getValidLanguageTagOrThrow(languageTag);
    let preferredTimezone = getValidTimezoneOrThrow(timezone);

    const mcpSettings = await getMcpSettings(accessToken);

    return await mcpCustomizr.putSettings(accessToken, {
        language: updatePreferredLanguage(preferredLanguage, mcpSettings.language),
        regionalSettings: preferredRegionalSettings,
        timezone: preferredTimezone,
    });
}
async function setPreferredMcpSettings ( accessToken , languageCode , languageTag , timezone ) { let preferredLanguage = getValidLanguageOrThrow ( languageCode ) ; let preferredRegionalSettings = getValidLanguageTagOrThrow ( languageTag ) ; let preferredTimezone = getValidTimezoneOrThrow ( timezone ) ; const mcpSettings = await getMcpSettings ( accessToken ) ; return await mcpCustomizr . putSettings ( accessToken , { language : updatePreferredLanguage ( preferredLanguage , mcpSettings . language ) , regionalSettings : preferredRegionalSettings , timezone : preferredTimezone , } ) ; }
Validate and update the preferred user settings at once
@param {string} accessToken - Access token to use to call Customizr
@param {string} languageCode - ISO-639 language code (eg. bul, en, eng, de)
@param {string} languageTag - RFC 4656 compliant language code (eg. en, en-US)
@param {string} timezone - IANA timezone (eg. Europe/Amsterdam)
@return {Promise<void>}
Validate and update the preferred user settings at once