{"version":3,"sources":["src/sdk/BotFrameworkConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGxF;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAAuB;IAE3D;;OAEG;;IAKH;;;;;;;;;;OAUG;WACW,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,kBAAkB;IAkBxG;;;;;;;;;;;;;;;;;OAiBG;WACW,sBAAsB,CAChC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAC3D,kBAAkB;IAkBrB;;;;;;;;;;;;;;;;;;;OAmBG;WACW,QAAQ,CAClB,IAAI,EAAE,GAAG,GAAG,MAAM,EAClB,eAAe,CAAC,EAAE,MAAM,EACxB,KAAK,CAAC,EAAE,MAAM,GAAG,kBAAkB;IAoBvC;;;;;;;;;;;;;;;OAeG;WACW,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,kBAAkB;CAe1F","file":"BotFrameworkConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { Contracts } from \"./Contracts.js\";\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\nimport { PropertyId } from \"./Exports.js\";\n\n/**\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\n * @class BotFrameworkConfig\n */\nexport class BotFrameworkConfig extends DialogServiceConfigImpl {\n\n    /**\n     * Creates an instance of BotFrameworkConfig.\n     */\n    public constructor() {\n        super();\n    }\n\n    /**\n     * Creates a bot framework configuration instance with the provided subscription information.\n     * @member BotFrameworkConfig.fromSubscription\n     * @function\n     * @public\n     * @param subscription Subscription key associated with the bot\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n     * resource name.\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n     */\n    public static fromSubscription(subscription: string, region: string, botId?: string): BotFrameworkConfig {\n        Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n        botFrameworkConfig.setProperty(\n            PropertyId.Conversation_DialogType,\n            DialogServiceConfig.DialogTypes.BotFramework);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n\n        if (botId) {\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\n        }\n\n        return botFrameworkConfig;\n    }\n\n    /**\n     * Creates a bot framework configuration instance for the specified authorization token and region.\n     * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\n     * caller must refresh it by setting the authorizationToken property on the corresponding\n     * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\n     * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\n     * original configuration's authorization token. Create a new configuration instance or set the\n     * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\n     * further DialogServiceConnectors.\n     * @member BotFrameworkConfig.fromAuthorizationToken\n     * @function\n     * @public\n     * @param authorizationToken The authorization token associated with the bot\n     * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n     * resource name.\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n     */\n    public static fromAuthorizationToken(\n        authorizationToken: string, region: string, botId?: string\n    ): BotFrameworkConfig {\n        Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n        Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n        botFrameworkConfig.setProperty(\n            PropertyId.Conversation_DialogType,\n            DialogServiceConfig.DialogTypes.BotFramework);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n\n        if (botId) {\n            botFrameworkConfig.setProperty(PropertyId.Conversation_ApplicationId, botId);\n        }\n\n        return botFrameworkConfig;\n    }\n\n    /**\n     * Creates an instance of a BotFrameworkConfig.\n     * This method is intended only for users who use a non-default service host. The standard resource path will be\n     * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\n     * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\n     * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\n     * property on the created BotFrameworkConfig instance.\n     * Note: Added in version 1.15.0.\n     * @member BotFrameworkConfig.fromHost\n     * @function\n     * @public\n     * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\n     * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\n     * wss://{host}.convai.speech.azure.us.\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n     * token must be set.\n     * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n     * resource name.\n     * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n     */\n    public static fromHost(\n        host: URL | string,\n        subscriptionKey?: string,\n        botId?: string): BotFrameworkConfig {\n\n        void botId;\n        Contracts.throwIfNullOrUndefined(host, \"host\");\n        const resolvedHost: URL = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\n        Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\n\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n        botFrameworkConfig.setProperty(\n            PropertyId.Conversation_DialogType,\n            DialogServiceConfig.DialogTypes.BotFramework);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\n\n        if (undefined !== subscriptionKey) {\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n        }\n\n        return botFrameworkConfig;\n    }\n\n    /**\n     * Creates an instance of a BotFrameworkConfig.\n     * This method is intended only for users who use a non-standard service endpoint or parameters.\n     * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\n     * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\n     * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\n     * use the authorization token.\n     * Note: Added in version 1.15.0.\n     * @member BotFrameworkConfig.fromEndpoint\n     * @function\n     * @public\n     * @param {URL} endpoint - The service endpoint to connect to.\n     * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n     * token must be set.\n     * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\n     */\n    public static fromEndpoint(endpoint: URL, subscriptionKey?: string): BotFrameworkConfig {\n        Contracts.throwIfNull(endpoint, \"endpoint\");\n\n        const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n        botFrameworkConfig.setProperty(\n            PropertyId.Conversation_DialogType,\n            DialogServiceConfig.DialogTypes.BotFramework);\n        botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\n\n        if (undefined !== subscriptionKey) {\n            botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n        }\n\n        return botFrameworkConfig;\n    }\n}\n"]}