diff --git a/Documentation/EnvironmentVariables.md b/Documentation/EnvironmentVariables.md index 4785c13a8..73aa22d7b 100644 --- a/Documentation/EnvironmentVariables.md +++ b/Documentation/EnvironmentVariables.md @@ -98,4 +98,16 @@ export AZURE_GCM_KEY=[your-GCMKey] export NOCK_OFF=true ``` +### For clients targeting any of the Cognitive Services sdks, please make sure to set the corresponding environment variables. Each key is associated with the service that the account was created for. +From an admin cmd console/terminal, at the root directory of your cloned repo, run the following for environment setup: +* **Windows** +``` +set AZURE_TEXT_ANALYTICS_KEY= +``` + +* **OS X**, **Linux** +``` +export AZURE_TEXT_ANALYTICS_KEY= +``` + #### Note: Not all tests require all these environment variables, and if a required one is not set the test will fail and tell you which ones need to be set. diff --git a/codegen_mappings.json b/codegen_mappings.json index 45f9d9579..4bdd4fd17 100644 --- a/codegen_mappings.json +++ b/codegen_mappings.json @@ -83,13 +83,45 @@ "cognitiveservices": { "resource-manager": { "packageName": "azure-arm-cognitiveservices", - "dir": "cognitiveservicesManagement/lib", + "dir": "cognitiveServicesManagement/lib", "source": "cognitiveservices/resource-manager/readme.md" }, "data-plane": { - "packageName": "azure-cognitiveservices", - "dir": "cognitiveservices/lib", - "source": "cognitiveservices/data-plane/readme.md" + "entitySearch": { + "packageName": "azure-cognitiveservices-entitysearch", + "dir": "cognitiveServicesSearch/lib/entitySearch", + "source": "cognitiveservices/data-plane/EntitySearch/readme.md", + "language": "NodeJS", + "clientName": "EntitySearchAPIClient" + }, + "webSearch": { + "packageName": "azure-cognitiveservices-websearch", + "dir": "cognitiveServicesSearch/lib/webSearch", + "source": "cognitiveservices/data-plane/WebSearch/readme.md", + "language": "NodeJS", + "clientName": "WebSearchAPIClient" + }, + "face": { + "packageName": "azure-cognitiveservices-face", + "dir": "cognitiveServicesVision/lib/face", + "source": "cognitiveservices/data-plane/Face/readme.md", + "language": "NodeJS", + "clientName": "FaceAPIClient" + }, + "textAnalytics": { + "packageName": "azure-cognitiveservices-textanalytics", + "dir": "cognitiveServicesLanguage/lib/textAnalytics", + "source": "cognitiveservices/data-plane/TextAnalytics/readme.md", + "language": "NodeJS", + "clientName": "TextAnalyticsAPIClient" + }, + "computerVision": { + "packageName": "azure-cognitiveservices-computervision", + "dir": "cognitiveServicesVision/lib/computerVision", + "source": "cognitiveservices/data-plane/ComputerVision/readme.md", + "language": "NodeJS", + "clientName": "ComputerVisionAPIClient" + } } }, "commerce": { @@ -575,4 +607,4 @@ "ft": 1 } } -} +} \ No newline at end of file diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/airport.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/airport.js deleted file mode 100644 index 637e134ea..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/airport.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Airport. - * @extends models['CivicStructure'] - */ -class Airport extends models['CivicStructure'] { - /** - * Create a Airport. - * @member {string} [iataCode] - * @member {string} [icaoCode] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Airport - * - * @returns {object} metadata of Airport - * - */ - mapper() { - return { - required: false, - serializedName: 'Airport', - type: { - name: 'Composite', - className: 'Airport', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - iataCode: { - required: false, - readOnly: true, - serializedName: 'iataCode', - type: { - name: 'String' - } - }, - icaoCode: { - required: false, - readOnly: true, - serializedName: 'icaoCode', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Airport; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/answer.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/answer.js deleted file mode 100644 index 61833afd2..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/answer.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Answer. - * @extends models['Response'] - */ -class Answer extends models['Response'] { - /** - * Create a Answer. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Answer - * - * @returns {object} metadata of Answer - * - */ - mapper() { - return { - required: false, - serializedName: 'Answer', - type: { - name: 'Composite', - className: 'Answer', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Answer; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/civicStructure.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/civicStructure.js deleted file mode 100644 index b2e81fa0d..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/civicStructure.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a CivicStructure. - * @extends models['Place'] - */ -class CivicStructure extends models['Place'] { - /** - * Create a CivicStructure. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of CivicStructure - * - * @returns {object} metadata of CivicStructure - * - */ - mapper() { - return { - required: false, - serializedName: 'CivicStructure', - type: { - name: 'Composite', - className: 'CivicStructure', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CivicStructure; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesAttribution.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesAttribution.js deleted file mode 100644 index 47aec2f89..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesAttribution.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a ContractualRulesAttribution. - * @extends models['ContractualRulesContractualRule'] - */ -class ContractualRulesAttribution extends models['ContractualRulesContractualRule'] { - /** - * Create a ContractualRulesAttribution. - * @member {boolean} [mustBeCloseToContent] A Boolean value that determines - * whether the contents of the rule must be placed in close proximity to the - * field that the rule applies to. If true, the contents must be placed in - * close proximity. If false, or this field does not exist, the contents may - * be placed at the caller's discretion. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ContractualRulesAttribution - * - * @returns {object} metadata of ContractualRulesAttribution - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/Attribution', - type: { - name: 'Composite', - className: 'ContractualRulesAttribution', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - mustBeCloseToContent: { - required: false, - readOnly: true, - serializedName: 'mustBeCloseToContent', - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesAttribution; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesContractualRule.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesContractualRule.js deleted file mode 100644 index d8ff6f1ff..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesContractualRule.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Class representing a ContractualRulesContractualRule. - */ -class ContractualRulesContractualRule { - /** - * Create a ContractualRulesContractualRule. - * @member {string} [targetPropertyName] The name of the field that the rule - * applies to. - * @member {string} _type Polymorphic Discriminator - */ - constructor() { - } - - /** - * Defines the metadata of ContractualRulesContractualRule - * - * @returns {object} metadata of ContractualRulesContractualRule - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/ContractualRule', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesContractualRule; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLicenseAttribution.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLicenseAttribution.js deleted file mode 100644 index 212e9a7a3..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLicenseAttribution.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a contractual rule for license attribution. - * - * @extends models['ContractualRulesAttribution'] - */ -class ContractualRulesLicenseAttribution extends models['ContractualRulesAttribution'] { - /** - * Create a ContractualRulesLicenseAttribution. - * @member {object} [license] The license under which the content may be - * used. - * @member {string} [licenseNotice] The license to display next to the - * targeted field. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ContractualRulesLicenseAttribution - * - * @returns {object} metadata of ContractualRulesLicenseAttribution - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/LicenseAttribution', - type: { - name: 'Composite', - className: 'ContractualRulesLicenseAttribution', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - mustBeCloseToContent: { - required: false, - readOnly: true, - serializedName: 'mustBeCloseToContent', - type: { - name: 'Boolean' - } - }, - license: { - required: false, - readOnly: true, - serializedName: 'license', - type: { - name: 'Composite', - className: 'License' - } - }, - licenseNotice: { - required: false, - readOnly: true, - serializedName: 'licenseNotice', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesLicenseAttribution; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLinkAttribution.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLinkAttribution.js deleted file mode 100644 index f703b1a79..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesLinkAttribution.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a contractual rule for link attribution. - * - * @extends models['ContractualRulesAttribution'] - */ -class ContractualRulesLinkAttribution extends models['ContractualRulesAttribution'] { - /** - * Create a ContractualRulesLinkAttribution. - * @member {string} text The attribution text. - * @member {string} url The URL to the provider's website. Use text and URL - * to create the hyperlink. - * @member {boolean} [optionalForListDisplay] Indicates whether this - * provider's attribution is optional. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ContractualRulesLinkAttribution - * - * @returns {object} metadata of ContractualRulesLinkAttribution - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/LinkAttribution', - type: { - name: 'Composite', - className: 'ContractualRulesLinkAttribution', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - mustBeCloseToContent: { - required: false, - readOnly: true, - serializedName: 'mustBeCloseToContent', - type: { - name: 'Boolean' - } - }, - text: { - required: true, - serializedName: 'text', - type: { - name: 'String' - } - }, - url: { - required: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - optionalForListDisplay: { - required: false, - readOnly: true, - serializedName: 'optionalForListDisplay', - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesLinkAttribution; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesMediaAttribution.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesMediaAttribution.js deleted file mode 100644 index 2ca280011..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesMediaAttribution.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a contractual rule for media attribution. - * - * @extends models['ContractualRulesAttribution'] - */ -class ContractualRulesMediaAttribution extends models['ContractualRulesAttribution'] { - /** - * Create a ContractualRulesMediaAttribution. - * @member {string} [url] The URL that you use to create of hyperlink of the - * media content. For example, if the target is an image, you would use the - * URL to make the image clickable. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ContractualRulesMediaAttribution - * - * @returns {object} metadata of ContractualRulesMediaAttribution - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/MediaAttribution', - type: { - name: 'Composite', - className: 'ContractualRulesMediaAttribution', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - mustBeCloseToContent: { - required: false, - readOnly: true, - serializedName: 'mustBeCloseToContent', - type: { - name: 'Boolean' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesMediaAttribution; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesTextAttribution.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesTextAttribution.js deleted file mode 100644 index bee5025a2..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/contractualRulesTextAttribution.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a contractual rule for text attribution. - * - * @extends models['ContractualRulesAttribution'] - */ -class ContractualRulesTextAttribution extends models['ContractualRulesAttribution'] { - /** - * Create a ContractualRulesTextAttribution. - * @member {string} text The attribution text. Text attribution applies to - * the entity as a whole and should be displayed immediately following the - * entity presentation. If there are multiple text or link attribution rules - * that do not specify a target, you should concatenate them and display them - * using a "Data from:" label. - * @member {boolean} [optionalForListDisplay] Indicates whether this - * provider's attribution is optional. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ContractualRulesTextAttribution - * - * @returns {object} metadata of ContractualRulesTextAttribution - * - */ - mapper() { - return { - required: false, - serializedName: 'ContractualRules/TextAttribution', - type: { - name: 'Composite', - className: 'ContractualRulesTextAttribution', - modelProperties: { - targetPropertyName: { - required: false, - readOnly: true, - serializedName: 'targetPropertyName', - type: { - name: 'String' - } - }, - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - mustBeCloseToContent: { - required: false, - readOnly: true, - serializedName: 'mustBeCloseToContent', - type: { - name: 'Boolean' - } - }, - text: { - required: true, - serializedName: 'text', - type: { - name: 'String' - } - }, - optionalForListDisplay: { - required: false, - readOnly: true, - serializedName: 'optionalForListDisplay', - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = ContractualRulesTextAttribution; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/creativeWork.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/creativeWork.js deleted file mode 100644 index 4d004fdea..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/creativeWork.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a CreativeWork. - * @extends models['Thing'] - */ -class CreativeWork extends models['Thing'] { - /** - * Create a CreativeWork. - * @member {string} [thumbnailUrl] The URL to a thumbnail of the item. - * @member {array} [provider] The source of the creative work. - * @member {string} [text] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of CreativeWork - * - * @returns {object} metadata of CreativeWork - * - */ - mapper() { - return { - required: false, - serializedName: 'CreativeWork', - type: { - name: 'Composite', - className: 'CreativeWork', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - thumbnailUrl: { - required: false, - readOnly: true, - serializedName: 'thumbnailUrl', - type: { - name: 'String' - } - }, - provider: { - required: false, - readOnly: true, - serializedName: 'provider', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CreativeWork; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entertainmentBusiness.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/entertainmentBusiness.js deleted file mode 100644 index 538bfd8f5..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entertainmentBusiness.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a EntertainmentBusiness. - * @extends models['LocalBusiness'] - */ -class EntertainmentBusiness extends models['LocalBusiness'] { - /** - * Create a EntertainmentBusiness. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of EntertainmentBusiness - * - * @returns {object} metadata of EntertainmentBusiness - * - */ - mapper() { - return { - required: false, - serializedName: 'EntertainmentBusiness', - type: { - name: 'Composite', - className: 'EntertainmentBusiness', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EntertainmentBusiness; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entities.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/entities.js deleted file mode 100644 index 7f7d348f9..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entities.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines an entity answer. - * - * @extends models['SearchResultsAnswer'] - */ -class Entities extends models['SearchResultsAnswer'] { - /** - * Create a Entities. - * @member {string} [queryScenario] The supported query scenario. This field - * is set to DominantEntity or DisambiguationItem. The field is set to - * DominantEntity if Bing determines that only a single entity satisfies the - * request. For example, a book, movie, person, or attraction. If multiple - * entities could satisfy the request, the field is set to - * DisambiguationItem. For example, if the request uses the generic title of - * a movie franchise, the entity's type would likely be DisambiguationItem. - * But, if the request specifies a specific title from the franchise, the - * entity's type would likely be DominantEntity. Possible values include: - * 'DominantEntity', 'DominantEntityWithDisambiguation', 'Disambiguation', - * 'List', 'ListWithPivot'. Default value: 'DominantEntity' . - * @member {array} value A list of entities. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Entities - * - * @returns {object} metadata of Entities - * - */ - mapper() { - return { - required: false, - serializedName: 'Entities', - type: { - name: 'Composite', - className: 'Entities', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - queryContext: { - required: false, - readOnly: true, - serializedName: 'queryContext', - type: { - name: 'Composite', - className: 'QueryContext' - } - }, - queryScenario: { - required: false, - readOnly: true, - serializedName: 'queryScenario', - defaultValue: 'DominantEntity', - type: { - name: 'String' - } - }, - value: { - required: true, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - } - } - } - }; - } -} - -module.exports = Entities; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entitiesEntityPresentationInfo.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/entitiesEntityPresentationInfo.js deleted file mode 100644 index de6ba6111..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/entitiesEntityPresentationInfo.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Defines additional information about an entity such as type hints. - * - */ -class EntitiesEntityPresentationInfo { - /** - * Create a EntitiesEntityPresentationInfo. - * @member {string} entityScenario The supported scenario. Possible values - * include: 'DominantEntity', 'DisambiguationItem', 'ListItem'. Default - * value: 'DominantEntity' . - * @member {array} [entityTypeHints] A list of hints that indicate the - * entity's type. The list could contain a single hint such as Movie or a - * list of hints such as Place, LocalBusiness, Restaurant. Each successive - * hint in the array narrows the entity's type. - * @member {string} [entityTypeDisplayHint] A display version of the entity - * hint. For example, if entityTypeHints is Artist, this field may be set to - * American Singer. - */ - constructor() { - } - - /** - * Defines the metadata of EntitiesEntityPresentationInfo - * - * @returns {object} metadata of EntitiesEntityPresentationInfo - * - */ - mapper() { - return { - required: false, - serializedName: 'Entities/EntityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo', - modelProperties: { - entityScenario: { - required: true, - serializedName: 'entityScenario', - defaultValue: 'DominantEntity', - type: { - name: 'String' - } - }, - entityTypeHints: { - required: false, - readOnly: true, - serializedName: 'entityTypeHints', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - entityTypeDisplayHint: { - required: false, - readOnly: true, - serializedName: 'entityTypeDisplayHint', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = EntitiesEntityPresentationInfo; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorModel.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorModel.js deleted file mode 100644 index 29a10321d..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorModel.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Defines the error that occurred. - * - */ -class ErrorModel { - /** - * Create a ErrorModel. - * @member {string} code The error code that identifies the category of - * error. Possible values include: 'None', 'ServerError', 'InvalidRequest', - * 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'. - * Default value: 'None' . - * @member {string} [subCode] The error code that further helps to identify - * the error. Possible values include: 'UnexpectedError', 'ResourceError', - * 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', - * 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', - * 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' - * @member {string} message A description of the error. - * @member {string} [moreDetails] A description that provides additional - * information about the error. - * @member {string} [parameter] The parameter in the request that caused the - * error. - * @member {string} [value] The parameter's value in the request that was not - * valid. - */ - constructor() { - } - - /** - * Defines the metadata of ErrorModel - * - * @returns {object} metadata of ErrorModel - * - */ - mapper() { - return { - required: false, - serializedName: 'Error', - type: { - name: 'Composite', - className: 'ErrorModel', - modelProperties: { - code: { - required: true, - serializedName: 'code', - defaultValue: 'None', - type: { - name: 'String' - } - }, - subCode: { - required: false, - readOnly: true, - serializedName: 'subCode', - type: { - name: 'String' - } - }, - message: { - required: true, - serializedName: 'message', - type: { - name: 'String' - } - }, - moreDetails: { - required: false, - readOnly: true, - serializedName: 'moreDetails', - type: { - name: 'String' - } - }, - parameter: { - required: false, - readOnly: true, - serializedName: 'parameter', - type: { - name: 'String' - } - }, - value: { - required: false, - readOnly: true, - serializedName: 'value', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = ErrorModel; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorResponse.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorResponse.js deleted file mode 100644 index 3dfd928c2..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/errorResponse.js +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * The top-level response that represents a failed request. - * - * @extends models['Response'] - */ -class ErrorResponse extends models['Response'] { - /** - * Create a ErrorResponse. - * @member {array} errors A list of errors that describe the reasons why the - * request failed. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ErrorResponse - * - * @returns {object} metadata of ErrorResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'ErrorResponse', - type: { - name: 'Composite', - className: 'ErrorResponse', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - errors: { - required: true, - serializedName: 'errors', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ErrorModelElementType', - type: { - name: 'Composite', - className: 'ErrorModel' - } - } - } - } - } - } - }; - } -} - -module.exports = ErrorResponse; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/foodEstablishment.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/foodEstablishment.js deleted file mode 100644 index fbed8d1c6..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/foodEstablishment.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a FoodEstablishment. - * @extends models['LocalBusiness'] - */ -class FoodEstablishment extends models['LocalBusiness'] { - /** - * Create a FoodEstablishment. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of FoodEstablishment - * - * @returns {object} metadata of FoodEstablishment - * - */ - mapper() { - return { - required: false, - serializedName: 'FoodEstablishment', - type: { - name: 'Composite', - className: 'FoodEstablishment', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = FoodEstablishment; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/hotel.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/hotel.js deleted file mode 100644 index 2f7701c73..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/hotel.js +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Hotel. - * @extends models['LodgingBusiness'] - */ -class Hotel extends models['LodgingBusiness'] { - /** - * Create a Hotel. - * @member {string} [hotelClass] - * @member {array} [amenities] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Hotel - * - * @returns {object} metadata of Hotel - * - */ - mapper() { - return { - required: false, - serializedName: 'Hotel', - type: { - name: 'Composite', - className: 'Hotel', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - }, - hotelClass: { - required: false, - readOnly: true, - serializedName: 'hotelClass', - type: { - name: 'String' - } - }, - amenities: { - required: false, - readOnly: true, - serializedName: 'amenities', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - } - } - } - }; - } -} - -module.exports = Hotel; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/imageObject.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/imageObject.js deleted file mode 100644 index 8b676bce3..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/imageObject.js +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines an image - * - * @extends models['MediaObject'] - */ -class ImageObject extends models['MediaObject'] { - /** - * Create a ImageObject. - * @member {object} [thumbnail] The URL to a thumbnail of the image - */ - constructor() { - super(); - } - - /** - * Defines the metadata of ImageObject - * - * @returns {object} metadata of ImageObject - * - */ - mapper() { - return { - required: false, - serializedName: 'ImageObject', - type: { - name: 'Composite', - className: 'ImageObject', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - thumbnailUrl: { - required: false, - readOnly: true, - serializedName: 'thumbnailUrl', - type: { - name: 'String' - } - }, - provider: { - required: false, - readOnly: true, - serializedName: 'provider', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - }, - contentUrl: { - required: false, - readOnly: true, - serializedName: 'contentUrl', - type: { - name: 'String' - } - }, - hostPageUrl: { - required: false, - readOnly: true, - serializedName: 'hostPageUrl', - type: { - name: 'String' - } - }, - width: { - required: false, - readOnly: true, - serializedName: 'width', - type: { - name: 'Number' - } - }, - height: { - required: false, - readOnly: true, - serializedName: 'height', - type: { - name: 'Number' - } - }, - thumbnail: { - required: false, - readOnly: true, - serializedName: 'thumbnail', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - } - }; - } -} - -module.exports = ImageObject; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/intangible.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/intangible.js deleted file mode 100644 index 1749af586..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/intangible.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Intangible. - * @extends models['Thing'] - */ -class Intangible extends models['Thing'] { - /** - * Create a Intangible. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Intangible - * - * @returns {object} metadata of Intangible - * - */ - mapper() { - return { - required: false, - serializedName: 'Intangible', - type: { - name: 'Composite', - className: 'Intangible', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Intangible; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/license.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/license.js deleted file mode 100644 index 57649cc7a..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/license.js +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines the license under which the text or photo may be used. - * - * @extends models['CreativeWork'] - */ -class License extends models['CreativeWork'] { - /** - * Create a License. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of License - * - * @returns {object} metadata of License - * - */ - mapper() { - return { - required: false, - serializedName: 'License', - type: { - name: 'Composite', - className: 'License', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - thumbnailUrl: { - required: false, - readOnly: true, - serializedName: 'thumbnailUrl', - type: { - name: 'String' - } - }, - provider: { - required: false, - readOnly: true, - serializedName: 'provider', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = License; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/localBusiness.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/localBusiness.js deleted file mode 100644 index f9caa9140..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/localBusiness.js +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a LocalBusiness. - * @extends models['Place'] - */ -class LocalBusiness extends models['Place'] { - /** - * Create a LocalBusiness. - * @member {string} [priceRange] $$. - * @member {array} [panoramas] - * @member {boolean} [isPermanentlyClosed] - * @member {string} [tagLine] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LocalBusiness - * - * @returns {object} metadata of LocalBusiness - * - */ - mapper() { - return { - required: false, - serializedName: 'LocalBusiness', - type: { - name: 'Composite', - className: 'LocalBusiness', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = LocalBusiness; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/lodgingBusiness.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/lodgingBusiness.js deleted file mode 100644 index c3eeeeb7b..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/lodgingBusiness.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a LodgingBusiness. - * @extends models['LocalBusiness'] - */ -class LodgingBusiness extends models['LocalBusiness'] { - /** - * Create a LodgingBusiness. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of LodgingBusiness - * - * @returns {object} metadata of LodgingBusiness - * - */ - mapper() { - return { - required: false, - serializedName: 'LodgingBusiness', - type: { - name: 'Composite', - className: 'LodgingBusiness', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = LodgingBusiness; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/mediaObject.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/mediaObject.js deleted file mode 100644 index a7d6ef2fc..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/mediaObject.js +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a MediaObject. - * @extends models['CreativeWork'] - */ -class MediaObject extends models['CreativeWork'] { - /** - * Create a MediaObject. - * @member {string} [contentUrl] Original URL to retrieve the source (file) - * for the media object (e.g the source URL for the image). - * @member {string} [hostPageUrl] URL of the page that hosts the media - * object. - * @member {number} [width] The width of the source media object, in pixels. - * @member {number} [height] The height of the source media object, in - * pixels. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MediaObject - * - * @returns {object} metadata of MediaObject - * - */ - mapper() { - return { - required: false, - serializedName: 'MediaObject', - type: { - name: 'Composite', - className: 'MediaObject', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - thumbnailUrl: { - required: false, - readOnly: true, - serializedName: 'thumbnailUrl', - type: { - name: 'String' - } - }, - provider: { - required: false, - readOnly: true, - serializedName: 'provider', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - }, - contentUrl: { - required: false, - readOnly: true, - serializedName: 'contentUrl', - type: { - name: 'String' - } - }, - hostPageUrl: { - required: false, - readOnly: true, - serializedName: 'hostPageUrl', - type: { - name: 'String' - } - }, - width: { - required: false, - readOnly: true, - serializedName: 'width', - type: { - name: 'Number' - } - }, - height: { - required: false, - readOnly: true, - serializedName: 'height', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MediaObject; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/movieTheater.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/movieTheater.js deleted file mode 100644 index e148f7a20..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/movieTheater.js +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a MovieTheater. - * @extends models['EntertainmentBusiness'] - */ -class MovieTheater extends models['EntertainmentBusiness'] { - /** - * Create a MovieTheater. - * @member {number} [screenCount] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of MovieTheater - * - * @returns {object} metadata of MovieTheater - * - */ - mapper() { - return { - required: false, - serializedName: 'MovieTheater', - type: { - name: 'Composite', - className: 'MovieTheater', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - }, - screenCount: { - required: false, - readOnly: true, - serializedName: 'screenCount', - type: { - name: 'Number' - } - } - } - } - }; - } -} - -module.exports = MovieTheater; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/organization.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/organization.js deleted file mode 100644 index af1447b91..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/organization.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines an organization. - * - * @extends models['Thing'] - */ -class Organization extends models['Thing'] { - /** - * Create a Organization. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Organization - * - * @returns {object} metadata of Organization - * - */ - mapper() { - return { - required: false, - serializedName: 'Organization', - type: { - name: 'Composite', - className: 'Organization', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Organization; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/place.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/place.js deleted file mode 100644 index 1642f6cea..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/place.js +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines information about a local entity, such as a restaurant or hotel. - * - * @extends models['Thing'] - */ -class Place extends models['Thing'] { - /** - * Create a Place. - * @member {object} [address] The postal address of where the entity is - * located - * @member {string} [address.streetAddress] - * @member {string} [address.addressLocality] The city where the street - * address is located. For example, Seattle. - * @member {string} [address.addressSubregion] - * @member {string} [address.addressRegion] The state or province code where - * the street address is located. This could be the two-letter code. For - * example, WA, or the full name , Washington. - * @member {string} [address.postalCode] The zip code or postal code where - * the street address is located. For example, 98052. - * @member {string} [address.postOfficeBoxNumber] - * @member {string} [address.addressCountry] The country/region where the - * street address is located. This could be the two-letter ISO code. For - * example, US, or the full name, United States. - * @member {string} [address.countryIso] The two letter ISO code of this - * countr. For example, US. - * @member {string} [address.neighborhood] The neighborhood where the street - * address is located. For example, Westlake. - * @member {string} [address.addressRegionAbbreviation] Region Abbreviation. - * For example, WA. - * @member {string} [address.text] The complete address. For example, 2100 - * Westlake Ave N, Bellevue, WA 98052. - * @member {string} [telephone] The entity's telephone number - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Place - * - * @returns {object} metadata of Place - * - */ - mapper() { - return { - required: false, - serializedName: 'Place', - type: { - name: 'Composite', - className: 'Place', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Place; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/places.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/places.js deleted file mode 100644 index 5cd33e1a2..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/places.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a local entity answer. - * - * @extends models['SearchResultsAnswer'] - */ -class Places extends models['SearchResultsAnswer'] { - /** - * Create a Places. - * @member {array} value A list of local entities, such as restaurants or - * hotels. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Places - * - * @returns {object} metadata of Places - * - */ - mapper() { - return { - required: false, - serializedName: 'Places', - type: { - name: 'Composite', - className: 'Places', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - queryContext: { - required: false, - readOnly: true, - serializedName: 'queryContext', - type: { - name: 'Composite', - className: 'QueryContext' - } - }, - value: { - required: true, - serializedName: 'value', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - className: 'Thing' - } - } - } - } - } - } - }; - } -} - -module.exports = Places; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/postalAddress.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/postalAddress.js deleted file mode 100644 index efd1482e9..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/postalAddress.js +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a postal address. - * - * @extends models['StructuredValue'] - */ -class PostalAddress extends models['StructuredValue'] { - /** - * Create a PostalAddress. - * @member {string} [streetAddress] - * @member {string} [addressLocality] The city where the street address is - * located. For example, Seattle. - * @member {string} [addressSubregion] - * @member {string} [addressRegion] The state or province code where the - * street address is located. This could be the two-letter code. For example, - * WA, or the full name , Washington. - * @member {string} [postalCode] The zip code or postal code where the street - * address is located. For example, 98052. - * @member {string} [postOfficeBoxNumber] - * @member {string} [addressCountry] The country/region where the street - * address is located. This could be the two-letter ISO code. For example, - * US, or the full name, United States. - * @member {string} [countryIso] The two letter ISO code of this countr. For - * example, US. - * @member {string} [neighborhood] The neighborhood where the street address - * is located. For example, Westlake. - * @member {string} [addressRegionAbbreviation] Region Abbreviation. For - * example, WA. - * @member {string} [text] The complete address. For example, 2100 Westlake - * Ave N, Bellevue, WA 98052. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of PostalAddress - * - * @returns {object} metadata of PostalAddress - * - */ - mapper() { - return { - required: false, - serializedName: 'PostalAddress', - type: { - name: 'Composite', - className: 'PostalAddress', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - streetAddress: { - required: false, - readOnly: true, - serializedName: 'streetAddress', - type: { - name: 'String' - } - }, - addressLocality: { - required: false, - readOnly: true, - serializedName: 'addressLocality', - type: { - name: 'String' - } - }, - addressSubregion: { - required: false, - readOnly: true, - serializedName: 'addressSubregion', - type: { - name: 'String' - } - }, - addressRegion: { - required: false, - readOnly: true, - serializedName: 'addressRegion', - type: { - name: 'String' - } - }, - postalCode: { - required: false, - readOnly: true, - serializedName: 'postalCode', - type: { - name: 'String' - } - }, - postOfficeBoxNumber: { - required: false, - readOnly: true, - serializedName: 'postOfficeBoxNumber', - type: { - name: 'String' - } - }, - addressCountry: { - required: false, - readOnly: true, - serializedName: 'addressCountry', - type: { - name: 'String' - } - }, - countryIso: { - required: false, - readOnly: true, - serializedName: 'countryIso', - type: { - name: 'String' - } - }, - neighborhood: { - required: false, - readOnly: true, - serializedName: 'neighborhood', - type: { - name: 'String' - } - }, - addressRegionAbbreviation: { - required: false, - readOnly: true, - serializedName: 'addressRegionAbbreviation', - type: { - name: 'String' - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = PostalAddress; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/queryContext.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/queryContext.js deleted file mode 100644 index fd7a4ba07..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/queryContext.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Defines the query context that Bing used for the request. - * - */ -class QueryContext { - /** - * Create a QueryContext. - * @member {string} originalQuery The query string as specified in the - * request. - * @member {string} [alteredQuery] The query string used by Bing to perform - * the query. Bing uses the altered query string if the original query string - * contained spelling mistakes. For example, if the query string is "saling - * downwind", the altered query string will be "sailing downwind". This field - * is included only if the original query string contains a spelling mistake. - * @member {string} [alterationOverrideQuery] The query string to use to - * force Bing to use the original string. For example, if the query string is - * "saling downwind", the override query string will be "+saling downwind". - * Remember to encode the query string which results in "%2Bsaling+downwind". - * This field is included only if the original query string contains a - * spelling mistake. - * @member {boolean} [adultIntent] A Boolean value that indicates whether the - * specified query has adult intent. The value is true if the query has adult - * intent; otherwise, false. - * @member {boolean} [askUserForLocation] A Boolean value that indicates - * whether Bing requires the user's location to provide accurate results. If - * you specified the user's location by using the X-MSEdge-ClientIP and - * X-Search-Location headers, you can ignore this field. For location aware - * queries, such as "today's weather" or "restaurants near me" that need the - * user's location to provide accurate results, this field is set to true. - * For location aware queries that include the location (for example, - * "Seattle weather"), this field is set to false. This field is also set to - * false for queries that are not location aware, such as "best sellers". - */ - constructor() { - } - - /** - * Defines the metadata of QueryContext - * - * @returns {object} metadata of QueryContext - * - */ - mapper() { - return { - required: false, - serializedName: 'QueryContext', - type: { - name: 'Composite', - className: 'QueryContext', - modelProperties: { - originalQuery: { - required: true, - serializedName: 'originalQuery', - type: { - name: 'String' - } - }, - alteredQuery: { - required: false, - readOnly: true, - serializedName: 'alteredQuery', - type: { - name: 'String' - } - }, - alterationOverrideQuery: { - required: false, - readOnly: true, - serializedName: 'alterationOverrideQuery', - type: { - name: 'String' - } - }, - adultIntent: { - required: false, - readOnly: true, - serializedName: 'adultIntent', - type: { - name: 'Boolean' - } - }, - askUserForLocation: { - required: false, - readOnly: true, - serializedName: 'askUserForLocation', - type: { - name: 'Boolean' - } - } - } - } - }; - } -} - -module.exports = QueryContext; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/response.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/response.js deleted file mode 100644 index 1f677acf6..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/response.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines a response. All schemas that could be returned at the root of a - * response should inherit from this - * - * @extends models['Identifiable'] - */ -class Response extends models['Identifiable'] { - /** - * Create a Response. - * @member {array} [contractualRules] A list of rules that you must adhere to - * if you display the item. - * @member {string} [webSearchUrl] The URL To Bing's search result for this - * item. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Response - * - * @returns {object} metadata of Response - * - */ - mapper() { - return { - required: false, - serializedName: 'Response', - type: { - name: 'Composite', - className: 'Response', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Response; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/restaurant.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/restaurant.js deleted file mode 100644 index 358472413..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/restaurant.js +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Restaurant. - * @extends models['FoodEstablishment'] - */ -class Restaurant extends models['FoodEstablishment'] { - /** - * Create a Restaurant. - * @member {boolean} [acceptsReservations] - * @member {string} [reservationUrl] - * @member {array} [servesCuisine] - * @member {string} [menuUrl] - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Restaurant - * - * @returns {object} metadata of Restaurant - * - */ - mapper() { - return { - required: false, - serializedName: 'Restaurant', - type: { - name: 'Composite', - className: 'Restaurant', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - }, - priceRange: { - required: false, - readOnly: true, - serializedName: 'priceRange', - type: { - name: 'String' - } - }, - panoramas: { - required: false, - readOnly: true, - serializedName: 'panoramas', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ImageObjectElementType', - type: { - name: 'Composite', - className: 'ImageObject' - } - } - } - }, - isPermanentlyClosed: { - required: false, - readOnly: true, - serializedName: 'isPermanentlyClosed', - type: { - name: 'Boolean' - } - }, - tagLine: { - required: false, - readOnly: true, - serializedName: 'tagLine', - type: { - name: 'String' - } - }, - acceptsReservations: { - required: false, - readOnly: true, - serializedName: 'acceptsReservations', - type: { - name: 'Boolean' - } - }, - reservationUrl: { - required: false, - readOnly: true, - serializedName: 'reservationUrl', - type: { - name: 'String' - } - }, - servesCuisine: { - required: false, - readOnly: true, - serializedName: 'servesCuisine', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - menuUrl: { - required: false, - readOnly: true, - serializedName: 'menuUrl', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Restaurant; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResponse.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResponse.js deleted file mode 100644 index c8728a42c..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResponse.js +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Defines the top-level object that the response includes when the request - * succeeds. - * - * @extends models['Response'] - */ -class SearchResponse extends models['Response'] { - /** - * Create a SearchResponse. - * @member {object} [queryContext] An object that contains the query string - * that Bing used for the request. This object contains the query string as - * entered by the user. It may also contain an altered query string that Bing - * used for the query if the query string contained a spelling mistake. - * @member {string} [queryContext.originalQuery] The query string as - * specified in the request. - * @member {string} [queryContext.alteredQuery] The query string used by Bing - * to perform the query. Bing uses the altered query string if the original - * query string contained spelling mistakes. For example, if the query string - * is "saling downwind", the altered query string will be "sailing downwind". - * This field is included only if the original query string contains a - * spelling mistake. - * @member {string} [queryContext.alterationOverrideQuery] The query string - * to use to force Bing to use the original string. For example, if the query - * string is "saling downwind", the override query string will be "+saling - * downwind". Remember to encode the query string which results in - * "%2Bsaling+downwind". This field is included only if the original query - * string contains a spelling mistake. - * @member {boolean} [queryContext.adultIntent] A Boolean value that - * indicates whether the specified query has adult intent. The value is true - * if the query has adult intent; otherwise, false. - * @member {boolean} [queryContext.askUserForLocation] A Boolean value that - * indicates whether Bing requires the user's location to provide accurate - * results. If you specified the user's location by using the - * X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this - * field. For location aware queries, such as "today's weather" or - * "restaurants near me" that need the user's location to provide accurate - * results, this field is set to true. For location aware queries that - * include the location (for example, "Seattle weather"), this field is set - * to false. This field is also set to false for queries that are not - * location aware, such as "best sellers". - * @member {object} [entities] A list of entities that are relevant to the - * search query. - * @member {string} [entities.queryScenario] The supported query scenario. - * This field is set to DominantEntity or DisambiguationItem. The field is - * set to DominantEntity if Bing determines that only a single entity - * satisfies the request. For example, a book, movie, person, or attraction. - * If multiple entities could satisfy the request, the field is set to - * DisambiguationItem. For example, if the request uses the generic title of - * a movie franchise, the entity's type would likely be DisambiguationItem. - * But, if the request specifies a specific title from the franchise, the - * entity's type would likely be DominantEntity. Possible values include: - * 'DominantEntity', 'DominantEntityWithDisambiguation', 'Disambiguation', - * 'List', 'ListWithPivot' - * @member {array} [entities.value] A list of entities. - * @member {object} [places] A list of local entities such as restaurants or - * hotels that are relevant to the query. - * @member {array} [places.value] A list of local entities, such as - * restaurants or hotels. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of SearchResponse - * - * @returns {object} metadata of SearchResponse - * - */ - mapper() { - return { - required: false, - serializedName: 'SearchResponse', - type: { - name: 'Composite', - className: 'SearchResponse', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - queryContext: { - required: false, - readOnly: true, - serializedName: 'queryContext', - type: { - name: 'Composite', - className: 'QueryContext' - } - }, - entities: { - required: false, - readOnly: true, - serializedName: 'entities', - type: { - name: 'Composite', - className: 'Entities' - } - }, - places: { - required: false, - readOnly: true, - serializedName: 'places', - type: { - name: 'Composite', - className: 'Places' - } - } - } - } - }; - } -} - -module.exports = SearchResponse; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResultsAnswer.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResultsAnswer.js deleted file mode 100644 index b322b05ca..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/searchResultsAnswer.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a SearchResultsAnswer. - * @extends models['Answer'] - */ -class SearchResultsAnswer extends models['Answer'] { - /** - * Create a SearchResultsAnswer. - * @member {object} [queryContext] - * @member {string} [queryContext.originalQuery] The query string as - * specified in the request. - * @member {string} [queryContext.alteredQuery] The query string used by Bing - * to perform the query. Bing uses the altered query string if the original - * query string contained spelling mistakes. For example, if the query string - * is "saling downwind", the altered query string will be "sailing downwind". - * This field is included only if the original query string contains a - * spelling mistake. - * @member {string} [queryContext.alterationOverrideQuery] The query string - * to use to force Bing to use the original string. For example, if the query - * string is "saling downwind", the override query string will be "+saling - * downwind". Remember to encode the query string which results in - * "%2Bsaling+downwind". This field is included only if the original query - * string contains a spelling mistake. - * @member {boolean} [queryContext.adultIntent] A Boolean value that - * indicates whether the specified query has adult intent. The value is true - * if the query has adult intent; otherwise, false. - * @member {boolean} [queryContext.askUserForLocation] A Boolean value that - * indicates whether Bing requires the user's location to provide accurate - * results. If you specified the user's location by using the - * X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this - * field. For location aware queries, such as "today's weather" or - * "restaurants near me" that need the user's location to provide accurate - * results, this field is set to true. For location aware queries that - * include the location (for example, "Seattle weather"), this field is set - * to false. This field is also set to false for queries that are not - * location aware, such as "best sellers". - */ - constructor() { - super(); - } - - /** - * Defines the metadata of SearchResultsAnswer - * - * @returns {object} metadata of SearchResultsAnswer - * - */ - mapper() { - return { - required: false, - serializedName: 'SearchResultsAnswer', - type: { - name: 'Composite', - className: 'SearchResultsAnswer', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - queryContext: { - required: false, - readOnly: true, - serializedName: 'queryContext', - type: { - name: 'Composite', - className: 'QueryContext' - } - } - } - } - }; - } -} - -module.exports = SearchResultsAnswer; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/structuredValue.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/structuredValue.js deleted file mode 100644 index 5922eb727..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/structuredValue.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a StructuredValue. - * @extends models['Intangible'] - */ -class StructuredValue extends models['Intangible'] { - /** - * Create a StructuredValue. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of StructuredValue - * - * @returns {object} metadata of StructuredValue - * - */ - mapper() { - return { - required: false, - serializedName: 'StructuredValue', - type: { - name: 'Composite', - className: 'StructuredValue', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = StructuredValue; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/thing.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/thing.js deleted file mode 100644 index cc752d65b..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/thing.js +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a Thing. - * @extends models['Response'] - */ -class Thing extends models['Response'] { - /** - * Create a Thing. - * @member {string} [name] The name of the thing represented by this object. - * @member {string} [url] The URL to get more information about the thing - * represented by this object. - * @member {object} [image] - * @member {object} [image.thumbnail] The URL to a thumbnail of the image - * @member {string} [description] A short description of the item. - * @member {object} [entityPresentationInfo] Additional information about the - * entity such as hints that you can use to determine the entity's type. To - * determine the entity's type, use the entityScenario and entityTypeHint - * fields. - * @member {string} [entityPresentationInfo.entityScenario] The supported - * scenario. Possible values include: 'DominantEntity', 'DisambiguationItem', - * 'ListItem' - * @member {array} [entityPresentationInfo.entityTypeHints] A list of hints - * that indicate the entity's type. The list could contain a single hint such - * as Movie or a list of hints such as Place, LocalBusiness, Restaurant. Each - * successive hint in the array narrows the entity's type. - * @member {string} [entityPresentationInfo.entityTypeDisplayHint] A display - * version of the entity hint. For example, if entityTypeHints is Artist, - * this field may be set to American Singer. - * @member {string} [bingId] An ID that uniquely identifies this item. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of Thing - * - * @returns {object} metadata of Thing - * - */ - mapper() { - return { - required: false, - serializedName: 'Thing', - type: { - name: 'Composite', - className: 'Thing', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = Thing; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/touristAttraction.js b/lib/services/cognitiveServices.Search/lib/entitySearch/models/touristAttraction.js deleted file mode 100644 index 22bf86710..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/touristAttraction.js +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const models = require('./index'); - -/** - * Class representing a TouristAttraction. - * @extends models['Place'] - */ -class TouristAttraction extends models['Place'] { - /** - * Create a TouristAttraction. - */ - constructor() { - super(); - } - - /** - * Defines the metadata of TouristAttraction - * - * @returns {object} metadata of TouristAttraction - * - */ - mapper() { - return { - required: false, - serializedName: 'TouristAttraction', - type: { - name: 'Composite', - className: 'TouristAttraction', - modelProperties: { - _type: { - required: true, - serializedName: '_type', - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - contractualRules: { - required: false, - readOnly: true, - serializedName: 'contractualRules', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ContractualRulesContractualRuleElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ContractualRulesContractualRule', - className: 'ContractualRulesContractualRule' - } - } - } - }, - webSearchUrl: { - required: false, - readOnly: true, - serializedName: 'webSearchUrl', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - url: { - required: false, - readOnly: true, - serializedName: 'url', - type: { - name: 'String' - } - }, - image: { - required: false, - readOnly: true, - serializedName: 'image', - type: { - name: 'Composite', - className: 'ImageObject' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - entityPresentationInfo: { - required: false, - readOnly: true, - serializedName: 'entityPresentationInfo', - type: { - name: 'Composite', - className: 'EntitiesEntityPresentationInfo' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - address: { - required: false, - readOnly: true, - serializedName: 'address', - type: { - name: 'Composite', - className: 'PostalAddress' - } - }, - telephone: { - required: false, - readOnly: true, - serializedName: 'telephone', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = TouristAttraction; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/operations/index.js b/lib/services/cognitiveServices.Search/lib/entitySearch/operations/index.js deleted file mode 100644 index 8c5af2bb6..000000000 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/operations/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -exports.EntitiesOperations = require('./entitiesOperations'); diff --git a/lib/services/cognitiveServicesLanguage/LICENSE.txt b/lib/services/cognitiveServicesLanguage/LICENSE.txt new file mode 100644 index 000000000..0313a903d --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/lib/services/cognitiveServicesLanguage/README.md b/lib/services/cognitiveServicesLanguage/README.md new file mode 100644 index 000000000..516d2c9bb --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/README.md @@ -0,0 +1,92 @@ +# Microsoft Azure SDK for Node.js - Cognitive Services Language + +This project provides a Node.js package that makes it easy to work with the Microsoft Azure Cognitive Services Language APIs. Right now it supports: +- **Node.js version: 6.x or higher** + + +## How to Install + +```bash +npm install azure-cognitiveservices-language +``` + +## How to use + +### Create a Cognitive Services Account(ex. Text Analytics) + +```javascript + const msRestAzure = require('ms-rest-azure'); + const CognitiveServicesManagement = require("azure-arm-cognitiveservices"); + let client; + let createAccount = msRestAzure.interactiveLogin().then((credentials) => { + client = new CognitiveServicesManagement(credentials, suite.subscriptionId); + return client.accounts.create('groupname', 'accountname', { + sku: { + name: "F0" + }, + kind: "TextAnalytics", + location: "westus", + properties: {} + }); + }).catch((err) => { + console.log('An error ocurred'); + console.dir(err, {depth: null, colors: true}); + }); +``` + +### List the keys from the created account + +```javascript + let serviceKey; + createAccount.then((result) => { + return client.accounts.listKeys('groupname', 'accountname'); + }).then((result) => { + serviceKey = result.key1; + console.log(result.key2); + }).catch((err) => { + console.log('An error ocurred'); + console.dir(err, {depth: null, colors: true}); + }); +``` + +### Create credentials + + ```javascript + const CognitiveServicesCredentials = require('ms-rest-azure').CognitiveServicesCredentials; + + // Creating the Cognitive Services credentials + // This requires a key corresponding to the service being used (i.e. text-analytics, etc) + let credentials = new CognitiveServicesCredentials(serviceKey); + ``` + +### Text Analytics API + + ```javascript + const language = require('azure-cognitiveservices-language'); + + let client = new language.TextAnalyticsAPIClient(credentials); + let input = { + documents: [ + { + 'id': "1", + 'text': "I had a wonderful experience! The rooms were wonderful and the staff was helpful." + } + ] + } + let operation = client.detectLanguage(input) + operation.then(function (result){ + console.log(result.documents[0].detectedLanguages[0].name); + console.log(result.documents[0].detectedLanguages[0].score); + }).catch(function (err){ + throw err; + }); + ``` + +## More Detailed Information + +https://azure.microsoft.com/en-us/try/cognitive-services/ under "Language" + +## Related Projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) +- [AutoRest](https://github.com/Azure/autorest) diff --git a/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.d.ts b/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.d.ts new file mode 100644 index 000000000..0cec94389 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.d.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ + +import TextAnalyticsAPIClient = require('./textAnalytics/textAnalyticsAPIClient'); +import * as TextAnalyticsModels from './textAnalytics/models'; + +export { TextAnalyticsAPIClient, TextAnalyticsModels }; \ No newline at end of file diff --git a/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.js b/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.js new file mode 100644 index 000000000..4a8419321 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/cognitiveServicesLanguage.js @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + */ +'use strict'; + +exports.TextAnalyticsAPIClient = require('./textAnalytics/textAnalyticsAPIClient'); +exports = module.exports; \ No newline at end of file diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/batchInput.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/batchInput.js new file mode 100644 index 000000000..e9a85e100 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/batchInput.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a BatchInput. + */ +class BatchInput { + /** + * Create a BatchInput. + * @member {array} [documents] + */ + constructor() { + } + + /** + * Defines the metadata of BatchInput + * + * @returns {object} metadata of BatchInput + * + */ + mapper() { + return { + required: false, + serializedName: 'BatchInput', + type: { + name: 'Composite', + className: 'BatchInput', + modelProperties: { + documents: { + required: false, + serializedName: 'documents', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InputElementType', + type: { + name: 'Composite', + className: 'Input' + } + } + } + } + } + } + }; + } +} + +module.exports = BatchInput; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/detectedLanguage.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/detectedLanguage.js new file mode 100644 index 000000000..df9ce1f96 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/detectedLanguage.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a DetectedLanguage. + */ +class DetectedLanguage { + /** + * Create a DetectedLanguage. + * @member {string} [name] Long name of a detected language (e.g. English, + * French). + * @member {string} [iso6391Name] A two letter representation of the detected + * language according to the ISO 639-1 standard (e.g. en, fr). + * @member {number} [score] A confidence score between 0 and 1. Scores close + * to 1 indicate 100% certainty that the identified language is true. + */ + constructor() { + } + + /** + * Defines the metadata of DetectedLanguage + * + * @returns {object} metadata of DetectedLanguage + * + */ + mapper() { + return { + required: false, + serializedName: 'DetectedLanguage', + type: { + name: 'Composite', + className: 'DetectedLanguage', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + iso6391Name: { + required: false, + serializedName: 'iso6391Name', + type: { + name: 'String' + } + }, + score: { + required: false, + serializedName: 'score', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = DetectedLanguage; diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/identifiable.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorRecord.js similarity index 58% rename from lib/services/cognitiveServices.Search/lib/entitySearch/models/identifiable.js rename to lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorRecord.js index f3b4fe336..76ce40e43 100644 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/identifiable.js +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorRecord.js @@ -10,47 +10,43 @@ 'use strict'; -const models = require('./index'); - /** - * Defines the identity of a resource. - * - * @extends models['ResponseBase'] + * Class representing a ErrorRecord. */ -class Identifiable extends models['ResponseBase'] { +class ErrorRecord { /** - * Create a Identifiable. - * @member {string} [id] A String identifier. + * Create a ErrorRecord. + * @member {string} [id] Input document unique identifier the error refers + * to. + * @member {string} [message] Error message. */ constructor() { - super(); } /** - * Defines the metadata of Identifiable + * Defines the metadata of ErrorRecord * - * @returns {object} metadata of Identifiable + * @returns {object} metadata of ErrorRecord * */ mapper() { return { required: false, - serializedName: 'Identifiable', + serializedName: 'ErrorRecord', type: { name: 'Composite', - className: 'Identifiable', + className: 'ErrorRecord', modelProperties: { - _type: { - required: true, - serializedName: '_type', + id: { + required: false, + serializedName: 'id', type: { name: 'String' } }, - id: { + message: { required: false, - readOnly: true, - serializedName: 'id', + serializedName: 'message', type: { name: 'String' } @@ -61,4 +57,4 @@ class Identifiable extends models['ResponseBase'] { } } -module.exports = Identifiable; +module.exports = ErrorRecord; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorResponse.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorResponse.js new file mode 100644 index 000000000..5c6a2e3f8 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/errorResponse.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a ErrorResponse. + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {object} [innerError] + * @member {string} [innerError.code] + * @member {string} [innerError.message] + * @member {object} [innerError.innerError] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + innerError: { + required: false, + serializedName: 'innerError', + type: { + name: 'Composite', + className: 'InternalError' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.d.ts b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.d.ts new file mode 100644 index 000000000..e457c7de0 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.d.ts @@ -0,0 +1,198 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as moment from "moment"; + + +/** + * @class + * Initializes a new instance of the MultiLanguageInput class. + * @constructor + * @member {string} [language] This is the 2 letter ISO 639-1 representation of + * a language. For example, use "en" for English; "es" for Spanish etc., + * @member {string} [id] Unique, non-empty document identifier. + * @member {string} [text] + */ +export interface MultiLanguageInput { + language?: string; + id?: string; + text?: string; +} + +/** + * @class + * Initializes a new instance of the MultiLanguageBatchInput class. + * @constructor + * @member {array} [documents] + */ +export interface MultiLanguageBatchInput { + documents?: MultiLanguageInput[]; +} + +/** + * @class + * Initializes a new instance of the KeyPhraseBatchResultItem class. + * @constructor + * @member {array} [keyPhrases] A list of representative words or phrases. The + * number of key phrases returned is proportional to the number of words in the + * input document. + * @member {string} [id] Unique document identifier. + */ +export interface KeyPhraseBatchResultItem { + readonly keyPhrases?: string[]; + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorRecord class. + * @constructor + * @member {string} [id] Input document unique identifier the error refers to. + * @member {string} [message] Error message. + */ +export interface ErrorRecord { + id?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the KeyPhraseBatchResult class. + * @constructor + * @member {array} [documents] + * @member {array} [errors] + */ +export interface KeyPhraseBatchResult { + readonly documents?: KeyPhraseBatchResultItem[]; + readonly errors?: ErrorRecord[]; +} + +/** + * @class + * Initializes a new instance of the InternalError class. + * @constructor + * @member {string} [code] + * @member {string} [message] + * @member {object} [innerError] + */ +export interface InternalError { + code?: string; + message?: string; + innerError?: InternalError; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {object} [innerError] + * @member {string} [innerError.code] + * @member {string} [innerError.message] + * @member {object} [innerError.innerError] + */ +export interface ErrorResponse { + code?: string; + message?: string; + target?: string; + innerError?: InternalError; +} + +/** + * @class + * Initializes a new instance of the Input class. + * @constructor + * @member {string} [id] Unique, non-empty document identifier. + * @member {string} [text] + */ +export interface Input { + id?: string; + text?: string; +} + +/** + * @class + * Initializes a new instance of the BatchInput class. + * @constructor + * @member {array} [documents] + */ +export interface BatchInput { + documents?: Input[]; +} + +/** + * @class + * Initializes a new instance of the DetectedLanguage class. + * @constructor + * @member {string} [name] Long name of a detected language (e.g. English, + * French). + * @member {string} [iso6391Name] A two letter representation of the detected + * language according to the ISO 639-1 standard (e.g. en, fr). + * @member {number} [score] A confidence score between 0 and 1. Scores close to + * 1 indicate 100% certainty that the identified language is true. + */ +export interface DetectedLanguage { + name?: string; + iso6391Name?: string; + score?: number; +} + +/** + * @class + * Initializes a new instance of the LanguageBatchResultItem class. + * @constructor + * @member {string} [id] Unique document identifier. + * @member {array} [detectedLanguages] A list of extracted languages. + */ +export interface LanguageBatchResultItem { + readonly id?: string; + readonly detectedLanguages?: DetectedLanguage[]; +} + +/** + * @class + * Initializes a new instance of the LanguageBatchResult class. + * @constructor + * @member {array} [documents] + * @member {array} [errors] + */ +export interface LanguageBatchResult { + readonly documents?: LanguageBatchResultItem[]; + readonly errors?: ErrorRecord[]; +} + +/** + * @class + * Initializes a new instance of the SentimentBatchResultItem class. + * @constructor + * @member {number} [score] A decimal number between 0 and 1 denoting the + * sentiment of the document. A score above 0.7 usually refers to a positive + * document while a score below 0.3 normally has a negative connotation. Mid + * values refer to neutral text. + * @member {string} [id] Unique document identifier. + */ +export interface SentimentBatchResultItem { + readonly score?: number; + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the SentimentBatchResult class. + * @constructor + * @member {array} [documents] + * @member {array} [errors] + */ +export interface SentimentBatchResult { + readonly documents?: SentimentBatchResultItem[]; + readonly errors?: ErrorRecord[]; +} diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.js new file mode 100644 index 000000000..bdb6fbd22 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/index.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.MultiLanguageInput = require('./multiLanguageInput'); +exports.MultiLanguageBatchInput = require('./multiLanguageBatchInput'); +exports.KeyPhraseBatchResultItem = require('./keyPhraseBatchResultItem'); +exports.ErrorRecord = require('./errorRecord'); +exports.KeyPhraseBatchResult = require('./keyPhraseBatchResult'); +exports.InternalError = require('./internalError'); +exports.ErrorResponse = require('./errorResponse'); +exports.Input = require('./input'); +exports.BatchInput = require('./batchInput'); +exports.DetectedLanguage = require('./detectedLanguage'); +exports.LanguageBatchResultItem = require('./languageBatchResultItem'); +exports.LanguageBatchResult = require('./languageBatchResult'); +exports.SentimentBatchResultItem = require('./sentimentBatchResultItem'); +exports.SentimentBatchResult = require('./sentimentBatchResult'); diff --git a/lib/services/cognitiveServices.Search/lib/entitySearch/models/responseBase.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/input.js similarity index 52% rename from lib/services/cognitiveServices.Search/lib/entitySearch/models/responseBase.js rename to lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/input.js index 7e113e0a4..605ddd3a9 100644 --- a/lib/services/cognitiveServices.Search/lib/entitySearch/models/responseBase.js +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/input.js @@ -11,38 +11,41 @@ 'use strict'; /** - * Class representing a ResponseBase. + * Class representing a Input. */ -class ResponseBase { +class Input { /** - * Create a ResponseBase. - * @member {string} _type Polymorphic Discriminator + * Create a Input. + * @member {string} [id] Unique, non-empty document identifier. + * @member {string} [text] */ constructor() { } /** - * Defines the metadata of ResponseBase + * Defines the metadata of Input * - * @returns {object} metadata of ResponseBase + * @returns {object} metadata of Input * */ mapper() { return { required: false, - serializedName: 'ResponseBase', + serializedName: 'Input', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'ResponseBase', + className: 'Input', modelProperties: { - _type: { - required: true, - serializedName: '_type', + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + text: { + required: false, + serializedName: 'text', type: { name: 'String' } @@ -53,4 +56,4 @@ class ResponseBase { } } -module.exports = ResponseBase; +module.exports = Input; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/internalError.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/internalError.js new file mode 100644 index 000000000..661c82dfe --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/internalError.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a InternalError. + */ +class InternalError { + /** + * Create a InternalError. + * @member {string} [code] + * @member {string} [message] + * @member {object} [innerError] + */ + constructor() { + } + + /** + * Defines the metadata of InternalError + * + * @returns {object} metadata of InternalError + * + */ + mapper() { + return { + required: false, + serializedName: 'InternalError', + type: { + name: 'Composite', + className: 'InternalError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + innerError: { + required: false, + serializedName: 'innerError', + type: { + name: 'Composite', + className: 'InternalError' + } + } + } + } + }; + } +} + +module.exports = InternalError; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResult.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResult.js new file mode 100644 index 000000000..d61484568 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResult.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a KeyPhraseBatchResult. + */ +class KeyPhraseBatchResult { + /** + * Create a KeyPhraseBatchResult. + * @member {array} [documents] + * @member {array} [errors] + */ + constructor() { + } + + /** + * Defines the metadata of KeyPhraseBatchResult + * + * @returns {object} metadata of KeyPhraseBatchResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyPhraseBatchResult', + type: { + name: 'Composite', + className: 'KeyPhraseBatchResult', + modelProperties: { + documents: { + required: false, + readOnly: true, + serializedName: 'documents', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'KeyPhraseBatchResultItemElementType', + type: { + name: 'Composite', + className: 'KeyPhraseBatchResultItem' + } + } + } + }, + errors: { + required: false, + readOnly: true, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorRecordElementType', + type: { + name: 'Composite', + className: 'ErrorRecord' + } + } + } + } + } + } + }; + } +} + +module.exports = KeyPhraseBatchResult; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResultItem.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResultItem.js new file mode 100644 index 000000000..b00a41288 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/keyPhraseBatchResultItem.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a KeyPhraseBatchResultItem. + */ +class KeyPhraseBatchResultItem { + /** + * Create a KeyPhraseBatchResultItem. + * @member {array} [keyPhrases] A list of representative words or phrases. + * The number of key phrases returned is proportional to the number of words + * in the input document. + * @member {string} [id] Unique document identifier. + */ + constructor() { + } + + /** + * Defines the metadata of KeyPhraseBatchResultItem + * + * @returns {object} metadata of KeyPhraseBatchResultItem + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyPhraseBatchResultItem', + type: { + name: 'Composite', + className: 'KeyPhraseBatchResultItem', + modelProperties: { + keyPhrases: { + required: false, + readOnly: true, + serializedName: 'keyPhrases', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = KeyPhraseBatchResultItem; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResult.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResult.js new file mode 100644 index 000000000..ce27da8a0 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResult.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a LanguageBatchResult. + */ +class LanguageBatchResult { + /** + * Create a LanguageBatchResult. + * @member {array} [documents] + * @member {array} [errors] + */ + constructor() { + } + + /** + * Defines the metadata of LanguageBatchResult + * + * @returns {object} metadata of LanguageBatchResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LanguageBatchResult', + type: { + name: 'Composite', + className: 'LanguageBatchResult', + modelProperties: { + documents: { + required: false, + readOnly: true, + serializedName: 'documents', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LanguageBatchResultItemElementType', + type: { + name: 'Composite', + className: 'LanguageBatchResultItem' + } + } + } + }, + errors: { + required: false, + readOnly: true, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorRecordElementType', + type: { + name: 'Composite', + className: 'ErrorRecord' + } + } + } + } + } + } + }; + } +} + +module.exports = LanguageBatchResult; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResultItem.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResultItem.js new file mode 100644 index 000000000..04e9fe436 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/languageBatchResultItem.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a LanguageBatchResultItem. + */ +class LanguageBatchResultItem { + /** + * Create a LanguageBatchResultItem. + * @member {string} [id] Unique document identifier. + * @member {array} [detectedLanguages] A list of extracted languages. + */ + constructor() { + } + + /** + * Defines the metadata of LanguageBatchResultItem + * + * @returns {object} metadata of LanguageBatchResultItem + * + */ + mapper() { + return { + required: false, + serializedName: 'LanguageBatchResultItem', + type: { + name: 'Composite', + className: 'LanguageBatchResultItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + detectedLanguages: { + required: false, + readOnly: true, + serializedName: 'detectedLanguages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DetectedLanguageElementType', + type: { + name: 'Composite', + className: 'DetectedLanguage' + } + } + } + } + } + } + }; + } +} + +module.exports = LanguageBatchResultItem; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageBatchInput.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageBatchInput.js new file mode 100644 index 000000000..d4acc34b8 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageBatchInput.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a MultiLanguageBatchInput. + */ +class MultiLanguageBatchInput { + /** + * Create a MultiLanguageBatchInput. + * @member {array} [documents] + */ + constructor() { + } + + /** + * Defines the metadata of MultiLanguageBatchInput + * + * @returns {object} metadata of MultiLanguageBatchInput + * + */ + mapper() { + return { + required: false, + serializedName: 'MultiLanguageBatchInput', + type: { + name: 'Composite', + className: 'MultiLanguageBatchInput', + modelProperties: { + documents: { + required: false, + serializedName: 'documents', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MultiLanguageInputElementType', + type: { + name: 'Composite', + className: 'MultiLanguageInput' + } + } + } + } + } + } + }; + } +} + +module.exports = MultiLanguageBatchInput; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageInput.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageInput.js new file mode 100644 index 000000000..5501b9713 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/multiLanguageInput.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a MultiLanguageInput. + */ +class MultiLanguageInput { + /** + * Create a MultiLanguageInput. + * @member {string} [language] This is the 2 letter ISO 639-1 representation + * of a language. For example, use "en" for English; "es" for Spanish etc., + * @member {string} [id] Unique, non-empty document identifier. + * @member {string} [text] + */ + constructor() { + } + + /** + * Defines the metadata of MultiLanguageInput + * + * @returns {object} metadata of MultiLanguageInput + * + */ + mapper() { + return { + required: false, + serializedName: 'MultiLanguageInput', + type: { + name: 'Composite', + className: 'MultiLanguageInput', + modelProperties: { + language: { + required: false, + serializedName: 'language', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + text: { + required: false, + serializedName: 'text', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MultiLanguageInput; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResult.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResult.js new file mode 100644 index 000000000..42dd278d6 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResult.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Class representing a SentimentBatchResult. + */ +class SentimentBatchResult { + /** + * Create a SentimentBatchResult. + * @member {array} [documents] + * @member {array} [errors] + */ + constructor() { + } + + /** + * Defines the metadata of SentimentBatchResult + * + * @returns {object} metadata of SentimentBatchResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SentimentBatchResult', + type: { + name: 'Composite', + className: 'SentimentBatchResult', + modelProperties: { + documents: { + required: false, + readOnly: true, + serializedName: 'documents', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SentimentBatchResultItemElementType', + type: { + name: 'Composite', + className: 'SentimentBatchResultItem' + } + } + } + }, + errors: { + required: false, + readOnly: true, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorRecordElementType', + type: { + name: 'Composite', + className: 'ErrorRecord' + } + } + } + } + } + } + }; + } +} + +module.exports = SentimentBatchResult; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResultItem.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResultItem.js new file mode 100644 index 000000000..d1c68dff8 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/models/sentimentBatchResultItem.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Class representing a SentimentBatchResultItem. + */ +class SentimentBatchResultItem { + /** + * Create a SentimentBatchResultItem. + * @member {number} [score] A decimal number between 0 and 1 denoting the + * sentiment of the document. A score above 0.7 usually refers to a positive + * document while a score below 0.3 normally has a negative connotation. Mid + * values refer to neutral text. + * @member {string} [id] Unique document identifier. + */ + constructor() { + } + + /** + * Defines the metadata of SentimentBatchResultItem + * + * @returns {object} metadata of SentimentBatchResultItem + * + */ + mapper() { + return { + required: false, + serializedName: 'SentimentBatchResultItem', + type: { + name: 'Composite', + className: 'SentimentBatchResultItem', + modelProperties: { + score: { + required: false, + readOnly: true, + serializedName: 'score', + type: { + name: 'Number' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SentimentBatchResultItem; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.d.ts b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.d.ts new file mode 100644 index 000000000..0b7e5c6e6 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.d.ts @@ -0,0 +1,260 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import * as models from "./models"; + +declare class TextAnalyticsAPIClient extends ServiceClient { + /** + * @class + * Initializes a new instance of the TextAnalyticsAPIClient class. + * @constructor + * + * @param {azureRegions} azureRegion - Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' + * + * @param {credentials} credentials - Subscription credentials which uniquely identify client subscription. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + */ + constructor(azureRegion: string, credentials: ServiceClientCredentials, options?: ServiceClientOptions); + + azureRegion: string; + + credentials: ServiceClientCredentials; + + + /** + * @summary The API returns a list of strings denoting the key talking points + * in the input text. + * + * We employ techniques from Microsoft Office's sophisticated Natural Language + * Processing toolkit. See the Text + * Analytics Documentation for details about the languages that are + * supported by key phrase extraction. + * + * @param {object} input Collection of documents to analyze. Documents can now + * contain a language field to indicate the text language + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + keyPhrasesWithHttpOperationResponse(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary The API returns a list of strings denoting the key talking points + * in the input text. + * + * We employ techniques from Microsoft Office's sophisticated Natural Language + * Processing toolkit. See the Text + * Analytics Documentation for details about the languages that are + * supported by key phrase extraction. + * + * @param {object} input Collection of documents to analyze. Documents can now + * contain a language field to indicate the text language + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {KeyPhraseBatchResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {KeyPhraseBatchResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyPhraseBatchResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + keyPhrases(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + keyPhrases(input: models.MultiLanguageBatchInput, callback: ServiceCallback): void; + keyPhrases(input: models.MultiLanguageBatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary The API returns the detected language and a numeric score between 0 + * and 1. + * + * Scores close to 1 indicate 100% certainty that the identified language is + * true. A total of 120 languages are supported. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + detectLanguageWithHttpOperationResponse(input: models.BatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary The API returns the detected language and a numeric score between 0 + * and 1. + * + * Scores close to 1 indicate 100% certainty that the identified language is + * true. A total of 120 languages are supported. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LanguageBatchResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LanguageBatchResult} [result] - The deserialized result object if an error did not occur. + * See {@link LanguageBatchResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + detectLanguage(input: models.BatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + detectLanguage(input: models.BatchInput, callback: ServiceCallback): void; + detectLanguage(input: models.BatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary The API returns a numeric score between 0 and 1. + * + * Scores close to 1 indicate positive sentiment, while scores close to 0 + * indicate negative sentiment. Sentiment score is generated using + * classification techniques. The input features to the classifier include + * n-grams, features generated from part-of-speech tags, and word embeddings. + * See the Text + * Analytics Documentation for details about the languages that are + * supported by sentiment analysis. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + sentimentWithHttpOperationResponse(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary The API returns a numeric score between 0 and 1. + * + * Scores close to 1 indicate positive sentiment, while scores close to 0 + * indicate negative sentiment. Sentiment score is generated using + * classification techniques. The input features to the classifier include + * n-grams, features generated from part-of-speech tags, and word embeddings. + * See the Text + * Analytics Documentation for details about the languages that are + * supported by sentiment analysis. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SentimentBatchResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SentimentBatchResult} [result] - The deserialized result object if an error did not occur. + * See {@link SentimentBatchResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + sentiment(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + sentiment(input: models.MultiLanguageBatchInput, callback: ServiceCallback): void; + sentiment(input: models.MultiLanguageBatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +export = TextAnalyticsAPIClient; diff --git a/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.js b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.js new file mode 100644 index 000000000..3c9be2418 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient.js @@ -0,0 +1,816 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const ServiceClient = msRest.ServiceClient; +const WebResource = msRest.WebResource; + +const models = require('./models'); + + +/** + * @summary The API returns a list of strings denoting the key talking points + * in the input text. + * + * We employ techniques from Microsoft Office's sophisticated Natural Language + * Processing toolkit. See the Text + * Analytics Documentation for details about the languages that are + * supported by key phrase extraction. + * + * @param {object} input Collection of documents to analyze. Documents can now + * contain a language field to indicate the text language + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link KeyPhraseBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _keyPhrases(input, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.azureRegion) { + let allowedValues = [ 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' ]; + let enumValue = this.azureRegion; + if (!allowedValues.some( function(item) { return item === enumValue; })) { + throw new Error(enumValue + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('this.azureRegion cannot be null or undefined.'); + } + if (input === null || input === undefined) { + throw new Error('input cannot be null or undefined.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v2.0/keyPhrases'; + requestUrl = requestUrl.replace('{AzureRegion}', this.azureRegion); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (input !== null && input !== undefined) { + let requestModelMapper = new client.models['MultiLanguageBatchInput']().mapper(); + requestModel = client.serialize(requestModelMapper, input, 'input'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(input, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['KeyPhraseBatchResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary The API returns the detected language and a numeric score between 0 + * and 1. + * + * Scores close to 1 indicate 100% certainty that the identified language is + * true. A total of 120 languages are supported. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LanguageBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _detectLanguage(input, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.azureRegion) { + let allowedValues = [ 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' ]; + let enumValue = this.azureRegion; + if (!allowedValues.some( function(item) { return item === enumValue; })) { + throw new Error(enumValue + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('this.azureRegion cannot be null or undefined.'); + } + if (input === null || input === undefined) { + throw new Error('input cannot be null or undefined.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v2.0/languages'; + requestUrl = requestUrl.replace('{AzureRegion}', this.azureRegion); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (input !== null && input !== undefined) { + let requestModelMapper = new client.models['BatchInput']().mapper(); + requestModel = client.serialize(requestModelMapper, input, 'input'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(input, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LanguageBatchResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * @summary The API returns a numeric score between 0 and 1. + * + * Scores close to 1 indicate positive sentiment, while scores close to 0 + * indicate negative sentiment. Sentiment score is generated using + * classification techniques. The input features to the classifier include + * n-grams, features generated from part-of-speech tags, and word embeddings. + * See the Text + * Analytics Documentation for details about the languages that are + * supported by sentiment analysis. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SentimentBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _sentiment(input, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.azureRegion) { + let allowedValues = [ 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' ]; + let enumValue = this.azureRegion; + if (!allowedValues.some( function(item) { return item === enumValue; })) { + throw new Error(enumValue + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('this.azureRegion cannot be null or undefined.'); + } + if (input === null || input === undefined) { + throw new Error('input cannot be null or undefined.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v2.0/sentiment'; + requestUrl = requestUrl.replace('{AzureRegion}', this.azureRegion); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (input !== null && input !== undefined) { + let requestModelMapper = new client.models['MultiLanguageBatchInput']().mapper(); + requestModel = client.serialize(requestModelMapper, input, 'input'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(input, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SentimentBatchResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a TextAnalyticsAPIClient. */ +class TextAnalyticsAPIClient extends ServiceClient { + /** + * Create a TextAnalyticsAPIClient. + * @param {azureRegions} azureRegion - Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth' + * @param {credentials} credentials - Subscription credentials which uniquely identify client subscription. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + */ + constructor(azureRegion, credentials, options) { + if (azureRegion === null || azureRegion === undefined) { + throw new Error('\'azureRegion\' cannot be null.'); + } + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.baseUri = 'https://{AzureRegion}.api.cognitive.microsoft.com/text/analytics'; + this.azureRegion = azureRegion; + this.credentials = credentials; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + this.models = models; + this._keyPhrases = _keyPhrases; + this._detectLanguage = _detectLanguage; + this._sentiment = _sentiment; + msRest.addSerializationMixin(this); + } + + /** + * @summary The API returns a list of strings denoting the key talking points + * in the input text. + * + * We employ techniques from Microsoft Office's sophisticated Natural Language + * Processing toolkit. See the Text + * Analytics Documentation for details about the languages that are + * supported by key phrase extraction. + * + * @param {object} input Collection of documents to analyze. Documents can now + * contain a language field to indicate the text language + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + keyPhrasesWithHttpOperationResponse(input, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._keyPhrases(input, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary The API returns a list of strings denoting the key talking points + * in the input text. + * + * We employ techniques from Microsoft Office's sophisticated Natural Language + * Processing toolkit. See the Text + * Analytics Documentation for details about the languages that are + * supported by key phrase extraction. + * + * @param {object} input Collection of documents to analyze. Documents can now + * contain a language field to indicate the text language + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {KeyPhraseBatchResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link KeyPhraseBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + keyPhrases(input, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._keyPhrases(input, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._keyPhrases(input, options, optionalCallback); + } + } + + /** + * @summary The API returns the detected language and a numeric score between 0 + * and 1. + * + * Scores close to 1 indicate 100% certainty that the identified language is + * true. A total of 120 languages are supported. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + detectLanguageWithHttpOperationResponse(input, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._detectLanguage(input, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary The API returns the detected language and a numeric score between 0 + * and 1. + * + * Scores close to 1 indicate 100% certainty that the identified language is + * true. A total of 120 languages are supported. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LanguageBatchResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LanguageBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + detectLanguage(input, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._detectLanguage(input, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._detectLanguage(input, options, optionalCallback); + } + } + + /** + * @summary The API returns a numeric score between 0 and 1. + * + * Scores close to 1 indicate positive sentiment, while scores close to 0 + * indicate negative sentiment. Sentiment score is generated using + * classification techniques. The input features to the classifier include + * n-grams, features generated from part-of-speech tags, and word embeddings. + * See the Text + * Analytics Documentation for details about the languages that are + * supported by sentiment analysis. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + sentimentWithHttpOperationResponse(input, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._sentiment(input, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary The API returns a numeric score between 0 and 1. + * + * Scores close to 1 indicate positive sentiment, while scores close to 0 + * indicate negative sentiment. Sentiment score is generated using + * classification techniques. The input features to the classifier include + * n-grams, features generated from part-of-speech tags, and word embeddings. + * See the Text + * Analytics Documentation for details about the languages that are + * supported by sentiment analysis. + * + * @param {object} input Collection of documents to analyze. + * + * @param {array} [input.documents] + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SentimentBatchResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SentimentBatchResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + sentiment(input, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._sentiment(input, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._sentiment(input, options, optionalCallback); + } + } + +} + +module.exports = TextAnalyticsAPIClient; diff --git a/lib/services/cognitiveServicesLanguage/package.json b/lib/services/cognitiveServicesLanguage/package.json new file mode 100644 index 000000000..6a5588fc7 --- /dev/null +++ b/lib/services/cognitiveServicesLanguage/package.json @@ -0,0 +1,35 @@ +{ + "name": "azure-cognitiveservices-language", + "author": "Microsoft Corporation", + "contributors": [ + "Xu, Willie " + ], + "version": "1.0.0-preview", + "description": "Microsoft Azure Cognitive Services Language API Client Library for Node.js", + "tags": [ + "azure", + "sdk" + ], + "keywords": [ + "node", + "azure" + ], + "main": "./lib/cognitiveServicesLanguage.js", + "types": "./lib/cognitiveServicesLanguage.d.ts", + "license": "MIT", + "dependencies": { + "ms-rest": "^2.2.5", + "ms-rest-azure": "^2.4.4" + }, + "homepage": "http://github.com/Azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "git@github.com:Azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + }, + "scripts": { + "test": "npm -s run-script jshint" + } +} \ No newline at end of file diff --git a/lib/services/cognitiveServicesManagement/README.md b/lib/services/cognitiveServicesManagement/README.md index 18bc7fd83..8b4ac3236 100644 --- a/lib/services/cognitiveServicesManagement/README.md +++ b/lib/services/cognitiveServicesManagement/README.md @@ -25,7 +25,7 @@ npm install azure-arm-cognitiveservices // the user will get a DeviceTokenCredentials object. msRestAzure.interactiveLogin().then((credentials) => { let client = new CognitiveServicesManagement(credentials, 'your-subscription-id'); - client.cognitiveServicesAccounts.list().then((cognitiveServicesAccounts) => { + client.accounts.list().then((cognitiveServicesAccounts) => { console.log('List of cognitiveServicesAccounts:'); console.dir(cognitiveServicesAccounts, {depth: null, colors: true}); }); diff --git a/test/framework/suite-base.js b/test/framework/suite-base.js index 816725690..a8643c0f1 100644 --- a/test/framework/suite-base.js +++ b/test/framework/suite-base.js @@ -716,4 +716,4 @@ _.extend(SuiteBase.prototype, { } }); -exports = module.exports = SuiteBase; +exports = module.exports = SuiteBase; \ No newline at end of file diff --git a/test/recordings/textanalytics-tests/Text_Analytics_Analyze_language._should_detect_that_text_is_english.nock.js b/test/recordings/textanalytics-tests/Text_Analytics_Analyze_language._should_detect_that_text_is_english.nock.js new file mode 100644 index 000000000..451949161 --- /dev/null +++ b/test/recordings/textanalytics-tests/Text_Analytics_Analyze_language._should_detect_that_text_is_english.nock.js @@ -0,0 +1,22 @@ +// This file has been autogenerated. + +exports.setEnvironment = function() { + process.env['AZURE_TEXT_ANALYTICS_KEY'] = 'dummy'; + process.env['AZURE_SUBSCRIPTION_ID'] = '0b1f6471-1bf0-4dda-aec3-cb9272f09590'; +}; + +exports.scopes = [[function (nock) { +var result = +nock('https://westus.api.cognitive.microsoft.com:443') + .filteringRequestBody(function (path) { return '*';}) +.post('/text/analytics/v2.0/languages', '*') + .reply(200, "{\"documents\":[{\"id\":\"1\",\"detectedLanguages\":[{\"name\":\"English\",\"iso6391Name\":\"en\",\"score\":1.0}]}],\"errors\":[]}", { 'transfer-encoding': 'chunked', + 'content-type': 'application/json; charset=utf-8', + 'x-ms-transaction-count': '1', + 'x-aml-ta-request-id': '3dc4c61d-a7c5-4723-ad47-12bf19fcf3f9', + 'x-content-type-options': 'nosniff', + 'apim-request-id': '3b9d3f38-f20b-473b-946b-324ca8dc7f41', + 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', + date: 'Fri, 10 Nov 2017 01:17:55 GMT', + connection: 'close' }); + return result; }]]; \ No newline at end of file diff --git a/test/recordings/textanalytics-tests/Text_Analytics_Analyze_sentiment._should_detect_happiness_and_unhappiness_successfully.nock.js b/test/recordings/textanalytics-tests/Text_Analytics_Analyze_sentiment._should_detect_happiness_and_unhappiness_successfully.nock.js new file mode 100644 index 000000000..56dde7d98 --- /dev/null +++ b/test/recordings/textanalytics-tests/Text_Analytics_Analyze_sentiment._should_detect_happiness_and_unhappiness_successfully.nock.js @@ -0,0 +1,22 @@ +// This file has been autogenerated. + +exports.setEnvironment = function() { + process.env['AZURE_TEXT_ANALYTICS_KEY'] = 'dummy'; + process.env['AZURE_SUBSCRIPTION_ID'] = '0b1f6471-1bf0-4dda-aec3-cb9272f09590'; +}; + +exports.scopes = [[function (nock) { +var result = +nock('https://westus.api.cognitive.microsoft.com:443') + .filteringRequestBody(function (path) { return '*';}) +.post('/text/analytics/v2.0/sentiment', '*') + .reply(200, "{\"documents\":[{\"score\":0.99979335069656372,\"id\":\"1\"},{\"score\":8.5532665252685547E-06,\"id\":\"2\"}],\"errors\":[]}", { 'transfer-encoding': 'chunked', + 'content-type': 'application/json; charset=utf-8', + 'x-ms-transaction-count': '2', + 'x-aml-ta-request-id': '34594f7d-7bc9-4442-9aa4-55c44edc0f8b', + 'x-content-type-options': 'nosniff', + 'apim-request-id': '3f2c70df-9f51-4519-b7ea-4ba0840fa8da', + 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', + date: 'Fri, 10 Nov 2017 01:17:56 GMT', + connection: 'close' }); + return result; }]]; \ No newline at end of file diff --git a/test/recordings/textanalytics-tests/suite.textanalytics-tests.nock.js b/test/recordings/textanalytics-tests/suite.textanalytics-tests.nock.js new file mode 100644 index 000000000..35c2935ff --- /dev/null +++ b/test/recordings/textanalytics-tests/suite.textanalytics-tests.nock.js @@ -0,0 +1,8 @@ +// This file has been autogenerated. + +exports.setEnvironment = function() { + process.env['AZURE_TEXT_ANALYTICS_KEY'] = 'dummy'; + process.env['AZURE_SUBSCRIPTION_ID'] = '0b1f6471-1bf0-4dda-aec3-cb9272f09590'; +}; + +exports.scopes = []; diff --git a/test/services/cognitiveServicesLanguage/textAnalyticsAPIClient-tests.js b/test/services/cognitiveServicesLanguage/textAnalyticsAPIClient-tests.js new file mode 100644 index 000000000..c476920b6 --- /dev/null +++ b/test/services/cognitiveServicesLanguage/textAnalyticsAPIClient-tests.js @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + + +var should = require('should'); +var CognitiveServicesCredentials = require('ms-rest-azure').CognitiveServicesCredentials; + +var SuiteBase = require('../../framework/suite-base'); +var TextAnalyticsAPIClient = require('../../../lib/services/cognitiveServicesLanguage/lib/textAnalytics/textAnalyticsAPIClient'); + +var requiredEnvironment = [ + { name: 'AZURE_TEXT_ANALYTICS_KEY', secure: true } +]; + +var testPrefix = 'textanalytics-tests'; +var suite; +var client; +var credentials; + +describe('Text Analytics', () => { + before(function (done) { + suite = new SuiteBase(this, testPrefix, requiredEnvironment); + suite.setupSuite(() => { + credentials = new CognitiveServicesCredentials(process.env["AZURE_TEXT_ANALYTICS_KEY"]); + client = new TextAnalyticsAPIClient(credentials, "westus"); + done(); + }); + }); + + after(function (done) { + suite.teardownSuite(done); + }); + + beforeEach(function (done) { + suite.setupTest(done); + }); + + afterEach(function (done) { + suite.baseTeardownTest(done); + }); + + describe('Analyze language.', () => { + it('should detect that text is english', (done) => { + var input = { + documents: [ + { + 'id': "1", + 'text': "I had a wonderful experience! The rooms were wonderful and the staff was helpful." + } + ] + } + client.detectLanguage(input, (err, result, request, response) => { + if (err) done(err); + result.documents[0].detectedLanguages[0].name.should.equal("English"); + result.documents[0].detectedLanguages[0].score.should.equal(1); + done(); + }); + }); + }); + describe('Analyze sentiment.', () => { + it('should detect happiness and unhappiness successfully', (done) => { + var input = { + documents: [ + { + 'id': "1", + 'text': "I had a wonderful experience! The rooms were wonderful and the staff was helpful." + }, + { + 'id': "2", + 'text': "I had a terrible day. I hate life." + } + ] + } + client.sentiment(input, (err, result, request, response) => { + if (err) done(err); + result.documents[0].score.should.greaterThan(.8); + result.documents[1].score.should.lessThan(.2); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/test/testlistarm.txt b/test/testlistarm.txt index 2db441900..afe97f015 100644 --- a/test/testlistarm.txt +++ b/test/testlistarm.txt @@ -21,7 +21,6 @@ services/cdnManagement/cdnCheckResourceUsage-tests.js services/cdnManagement/cdnEdgeNode-tests.js services/cdnManagement/cdnCheckNameAvailability-tests.js services/cdnManagement/cdnOperation-tests.js -services/cognitiveServicesSearch/entitySearch-tests.js services/batchManagement/batchManagementClient-tests.js services/batch/batchClient-tests.js services/servermanagement/servermanagement-tests.js @@ -33,4 +32,5 @@ services/keyVault/keyVault-key-tests.js services/keyVault/keyVault-secret-tests.js services/keyVault/keyVault-certificate-tests.js services/postgresqlManagement/postgreSQLManagementClient-tests.js -services/mysqlManagement/mySQLManagementClient-tests.js \ No newline at end of file +services/mysqlManagement/mySQLManagementClient-tests.js +services/cognitiveServicesLanguage/textAnalyticsAPIClient-tests.js