@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 5.39 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/SpeechCommandsConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE;;;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;;;;;;;;IACQ,aAAa,EAAQ,MAAM;CAezC","file":"SpeechCommandsConfig.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 SpeechCommands backend.\n * @class SpeechCommandsConfig\n */\nexport class SpeechCommandsConfig extends DialogServiceConfigImpl {\n\n /**\n * Creates an instance of SpeechCommandsConfig.\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 SpeechCommandsConfig.fromSubscription\n * @function\n * @public\n * @param applicationId Speech Commands application id.\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 {SpeechCommandsConfig} A new bot framework config.\n */\n public static fromSubscription(applicationId: string, subscription: string, region: string): SpeechCommandsConfig {\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\n Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const speechCommandsConfig: SpeechCommandsConfig = new DialogServiceConfigImpl();\n speechCommandsConfig.setProperty(PropertyId.Conversation_DialogType, \"custom_commands\");\n speechCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\n speechCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Key, subscription);\n speechCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return speechCommandsConfig;\n }\n\n /**\n * Creates an instance of the bot framework config with the specified Speech Commands application id, 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 SpeechCommandsConfig.fromAuthorizationToken\n * @function\n * @public\n * @param applicationId Speech Commands application id.\n * @param authorizationToken The authorization token associated with the application.\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @returns {SpeechCommandsConfig} A new speech commands config.\n */\n public static fromAuthorizationToken(applicationId: string, authorizationToken: string, region: string): SpeechCommandsConfig {\n Contracts.throwIfNullOrWhitespace(applicationId, \"applicationId\");\n Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const speechCommandsConfig: SpeechCommandsConfig = new DialogServiceConfigImpl();\n speechCommandsConfig.setProperty(PropertyId.Conversation_DialogType, \"custom_commands\");\n speechCommandsConfig.setProperty(PropertyId.Conversation_ApplicationId, applicationId);\n speechCommandsConfig.setProperty(PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n speechCommandsConfig.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n return speechCommandsConfig;\n }\n\n /**\n * Sets the corresponding backend application identifier.\n * @member SpeechCommandsConfig.prototype.Conversation_ApplicationId\n * @function\n * @public\n * @param {string} value - The application identifier to set.\n */\n public set applicationId(value: string) {\n Contracts.throwIfNullOrWhitespace(value, \"value\");\n this.setProperty(PropertyId.Conversation_ApplicationId, value);\n }\n\n /**\n * Gets the corresponding backend application identifier.\n * @member SpeechCommandsConfig.prototype.Conversation_ApplicationId\n * @function\n * @public\n * @param {string} value - The application identifier to get.\n */\n public get applicationId(): string {\n return this.getProperty(PropertyId.Conversation_ApplicationId);\n }\n}\n"]}