added entitysearch codegen

generated all available sdks, starting to write tests for text analytics

added generated code and tests for text-analytics

fixed up tests

added back removed files

unchanged suite-base from rebasing

renamed test

uncommented tests

cognitive

minor readme changes

added clarification account example is for text analytics

removed done() from readme

minor changes, doced env variable

fixed error

changed done() location

readme version

regenerated code for textanalytics

added codegen mappings and regenerated using vanilla

regenerated code with enum reference outside anonymous function scope
This commit is contained in:
Willie Xu 2017-11-06 18:41:43 -08:00 коммит произвёл williexu
Родитель 72f35e5433
Коммит e716b542f0
69 изменённых файлов: 2560 добавлений и 5475 удалений

Просмотреть файл

@ -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=<service-key>
```
* **OS X**, **Linux**
```
export AZURE_TEXT_ANALYTICS_KEY=<service-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.

Просмотреть файл

@ -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
}
}
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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');

Просмотреть файл

@ -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.

Просмотреть файл

@ -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)

Просмотреть файл

@ -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 };

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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[];
}

Просмотреть файл

@ -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');

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<KeyPhraseBatchResult>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
keyPhrasesWithHttpOperationResponse(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.KeyPhraseBatchResult>>;
/**
* @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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<models.KeyPhraseBatchResult>;
keyPhrases(input: models.MultiLanguageBatchInput, callback: ServiceCallback<models.KeyPhraseBatchResult>): void;
keyPhrases(input: models.MultiLanguageBatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.KeyPhraseBatchResult>): 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<LanguageBatchResult>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
detectLanguageWithHttpOperationResponse(input: models.BatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.LanguageBatchResult>>;
/**
* @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<models.LanguageBatchResult>;
detectLanguage(input: models.BatchInput, callback: ServiceCallback<models.LanguageBatchResult>): void;
detectLanguage(input: models.BatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.LanguageBatchResult>): 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<SentimentBatchResult>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
sentimentWithHttpOperationResponse(input: models.MultiLanguageBatchInput, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.SentimentBatchResult>>;
/**
* @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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<models.SentimentBatchResult>;
sentiment(input: models.MultiLanguageBatchInput, callback: ServiceCallback<models.SentimentBatchResult>): void;
sentiment(input: models.MultiLanguageBatchInput, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.SentimentBatchResult>): void;
}
export = TextAnalyticsAPIClient;

Просмотреть файл

@ -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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<KeyPhraseBatchResult>} - 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<LanguageBatchResult>} - 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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<SentimentBatchResult>} - 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 <a
* href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages">Text
* Analytics Documentation</a> 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;

Просмотреть файл

@ -0,0 +1,35 @@
{
"name": "azure-cognitiveservices-language",
"author": "Microsoft Corporation",
"contributors": [
"Xu, Willie <wilx@microsoft.com>"
],
"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"
}
}

Просмотреть файл

@ -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});
});

Просмотреть файл

@ -716,4 +716,4 @@ _.extend(SuiteBase.prototype, {
}
});
exports = module.exports = SuiteBase;
exports = module.exports = SuiteBase;

Просмотреть файл

@ -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; }]];

Просмотреть файл

@ -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; }]];

Просмотреть файл

@ -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 = [];

Просмотреть файл

@ -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();
});
});
});
});

Просмотреть файл

@ -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
services/mysqlManagement/mySQLManagementClient-tests.js
services/cognitiveServicesLanguage/textAnalyticsAPIClient-tests.js