microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 3.42 kB
Source Map (JSON)
{"version":3,"sources":["src/sdk/VoiceProfileResult.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,uBAAuB,EAGvB,kBAAkB,EAClB,YAAY,EACf,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,gBAAgB,CAAS;gBAEd,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;IAU3D,IAAW,MAAM,IAAI,YAAY,CAEhC;IAED,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;CACJ;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,uBAAuB;IAExE,OAAO;IAIP;;;;;;;OAOG;WACW,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,+BAA+B;CAUxF","file":"VoiceProfileResult.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\n/* eslint-disable max-classes-per-file */\r\nimport { CancellationErrorCodePropertyName } from \"../common.speech/Exports.js\";\r\nimport { Contracts } from \"./Contracts.js\";\r\nimport {\r\n CancellationDetailsBase,\r\n CancellationErrorCode,\r\n CancellationReason,\r\n PropertyCollection,\r\n ResultReason\r\n} from \"./Exports.js\";\r\n\r\n/**\r\n * Output format\r\n * @class VoiceProfileResult\r\n */\r\nexport class VoiceProfileResult {\r\n private privReason: ResultReason;\r\n private privProperties: PropertyCollection;\r\n private privErrorDetails: string;\r\n\r\n public constructor(reason: ResultReason, statusText: string) {\r\n this.privReason = reason;\r\n this.privProperties = new PropertyCollection();\r\n if (reason === ResultReason.Canceled) {\r\n Contracts.throwIfNullOrUndefined(statusText, \"statusText\");\r\n this.privErrorDetails = statusText;\r\n this.privProperties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.ServiceError]);\r\n }\r\n }\r\n\r\n public get reason(): ResultReason {\r\n return this.privReason;\r\n }\r\n\r\n public get properties(): PropertyCollection {\r\n return this.privProperties;\r\n }\r\n\r\n public get errorDetails(): string {\r\n return this.privErrorDetails;\r\n }\r\n}\r\n\r\n/**\r\n * @class VoiceProfileCancellationDetails\r\n */\r\nexport class VoiceProfileCancellationDetails extends CancellationDetailsBase {\r\n\r\n private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\r\n super(reason, errorDetails, errorCode);\r\n }\r\n\r\n /**\r\n * Creates an instance of VoiceProfileCancellationDetails object for the canceled VoiceProfileResult.\r\n * @member VoiceProfileCancellationDetails.fromResult\r\n * @function\r\n * @public\r\n * @param {VoiceProfileResult} result - The result that was canceled.\r\n * @returns {VoiceProfileCancellationDetails} The cancellation details object being created.\r\n */\r\n public static fromResult(result: VoiceProfileResult): VoiceProfileCancellationDetails {\r\n const reason = CancellationReason.Error;\r\n let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\r\n\r\n if (!!result.properties) {\r\n errorCode = (CancellationErrorCode as any)[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])]; //eslint-disable-line\r\n }\r\n\r\n return new VoiceProfileCancellationDetails(reason, result.errorDetails, errorCode);\r\n }\r\n}\r\n"]}