UNPKG

@euirim/microsoft-cognitiveservices-speech-sdk

Version:
1 lines 3.86 kB
{"version":3,"sources":["src/sdk/BotFrameworkConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAAuB;IAE3D;;OAEG;;IAKH;;;;;;;;OAQG;WACW,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB;IAWxF;;;;;;;;;;;;;OAaG;WACW,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB;CAUvG","file":"BotFrameworkConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { Contracts } from \"./Contracts\";\nimport { DialogServiceConfigImpl } from \"./DialogServiceConfig\";\nimport { PropertyId } from \"./Exports\";\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 an instance of the bot framework config with the specified subscription and region.\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 * @returns {BotFrameworkConfig} A new bot framework config.\n */\n public static fromSubscription(subscription: string, region: string): BotFrameworkConfig {\n Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, \"bot_framework\");\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return botFrameworkConfig;\n }\n\n /**\n * Creates an instance of the bot framework config with the specified authorization token and region.\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\n * As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created.\n * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\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 * @returns {BotFrameworkConfig} A new bot framework config.\n */\n public static fromAuthorizationToken(authorizationToken: string, region: string): BotFrameworkConfig {\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const botFrameworkConfig: BotFrameworkConfig = new DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(PropertyId.Conversation_DialogType, \"bot_framework\");\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n botFrameworkConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return botFrameworkConfig;\n }\n}\n"]}