microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 5.72 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/CustomCommandsConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGxF;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,uBAAuB;IAE7D;;OAEG;;IAKH;;;;;;;;;OASG;WACW,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB;IAajH;;;;;;;;;;;;;;OAcG;WACW,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB;IAa7H;;;;;;OAMG;IACH,IAAW,aAAa,CAAC,KAAK,EAAE,MAAM,EAGrC;IAED;;;;;;OAMG;IACH,IAAW,aAAa,IAAI,MAAM,CAEjC;CACJ","file":"CustomCommandsConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport { DialogServiceConfig, DialogServiceConfigImpl } from \"./DialogServiceConfig.js\";\r\nimport { PropertyId } from \"./Exports.js\";\r\n\r\n/**\r\n * Class that defines configurations for the dialog service connector object for using a CustomCommands backend.\r\n * @class CustomCommandsConfig\r\n */\r\nexport class CustomCommandsConfig extends DialogServiceConfigImpl {\r\n\r\n /**\r\n * Creates an instance of CustomCommandsConfig.\r\n */\r\n public constructor() {\r\n super();\r\n }\r\n\r\n /**\r\n * Creates an instance of the bot framework config with the specified subscription and region.\r\n * @member CustomCommandsConfig.fromSubscription\r\n * @function\r\n * @public\r\n * @param applicationId Speech Commands application id.\r\n * @param subscription Subscription key associated with the bot\r\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n * @returns {CustomCommandsConfig} A new bot framework config.\r\n */\r\n public static fromSubscription(applicationId: string, subscription: string, region: string): CustomCommandsConfig {\r\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\r\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return customCommandsConfig;\r\n }\r\n\r\n /**\r\n * Creates an instance of the bot framework config with the specified Speech Commands application id, authorization token and region.\r\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\r\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\r\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.\r\n * For recognizers that have been created before, you need to set authorization token of the corresponding recognizer\r\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\r\n * @member CustomCommandsConfig.fromAuthorizationToken\r\n * @function\r\n * @public\r\n * @param applicationId Speech Commands application id.\r\n * @param authorizationToken The authorization token associated with the application.\r\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\r\n * @returns {CustomCommandsConfig} A new speech commands config.\r\n */\r\n public static fromAuthorizationToken(applicationId: string, authorizationToken: string, region: string): CustomCommandsConfig {\r\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\r\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\r\n Contracts.throwIfNullOrWhitespace(region, \"region\");\r\n\r\n const customCommandsConfig: CustomCommandsConfig = new DialogServiceConfigImpl();\r\n customCommandsConfig.setProperty(PropertyId.Conversation_DialogType, DialogServiceConfig.DialogTypes.CustomCommands);\r\n customCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\r\n customCommandsConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\r\n customCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\r\n return customCommandsConfig;\r\n }\r\n\r\n /**\r\n * Sets the corresponding backend application identifier.\r\n * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n * @function\r\n * @public\r\n * @param {string} value - The application identifier to set.\r\n */\r\n public set applicationId(value: string) {\r\n Contracts.throwIfNullOrWhitespace(value, \"value\");\r\n this.setProperty(PropertyId.Conversation_ApplicationId, value);\r\n }\r\n\r\n /**\r\n * Gets the corresponding backend application identifier.\r\n * @member CustomCommandsConfig.prototype.Conversation_ApplicationId\r\n * @function\r\n * @public\r\n * @param {string} value - The application identifier to get.\r\n */\r\n public get applicationId(): string {\r\n return this.getProperty(PropertyId.Conversation_ApplicationId);\r\n }\r\n}\r\n"]}