added cognitive services entity search sdk

This commit is contained in:
Tony Jin 2017-10-26 16:35:09 -07:00
Родитель d64018781e
Коммит c33d65046d
44 изменённых файлов: 5732 добавлений и 1 удалений

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

@ -25,5 +25,6 @@
"trailing": true,
"undef": true,
"unused": false,
"shadow": true
"shadow": true,
"loopfunc": true
}

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

@ -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,40 @@
# Microsoft Azure SDK for Node.js - Cognitive Services Entity Search API
This project provides a Node.js package that makes it easy to work with Microsoft Azure Cognitive Services Entity Search API. Right now it supports:
- **Node.js version: 7.10.0 or higher**
## How to Install
```bash
npm install azure-cognitiveservices-search
```
## How to use
### Create credentials
```javascript
var msRestAzure = require('ms-rest-azure');
var credentials = msRestAzure.ApiSubscriptionKeyCredentials('<YourSubscriptionKey>');
```
### Query the Entity Search API
```javascript
var search = require('azure-cognitiveservices-search');
var entitySearchApi = new search.EntitySearchAPI(credentials);
var query = 'seahawks';
var options = {'market': 'en-us'};
var response = entitySearchApi.entitiesOperations.search(query, options, function(err, result, request, response){
console.log(err);
console.log(result);
console.log(request);
console.log(response);
});
```
## More Detailed Information
https://azure.microsoft.com/en-us/try/cognitive-services/ under "Search"

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

@ -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 EntitySearchAPI = require('./entitySearch/entitySearchAPI');
import * as EntitySearchModels from './entitySearch/models';
export { EntitySearchAPI, EntitySearchModels };

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

@ -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.EntitySearchAPI = require('./entitySearch/entitySearchAPI');
exports = module.exports;

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

@ -0,0 +1,42 @@
/*
* 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, ServiceClientCredentials } from 'ms-rest';
import * as operations from "./operations";
declare class EntitySearchAPI extends ServiceClient {
/**
* @class
* Initializes a new instance of the EntitySearchAPI class.
* @constructor
*
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
*
* @param {string} [baseUri] - The base URI of the service.
*
* @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(credentials: ServiceClientCredentials, baseUri?: string, options?: ServiceClientOptions);
credentials: ServiceClientCredentials;
// Operation groups
entitiesOperations: operations.EntitiesOperations;
}
export = EntitySearchAPI;

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

@ -0,0 +1,60 @@
/*
* 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 models = require('./models');
const operations = require('./operations');
/** Class representing a EntitySearchAPI. */
class EntitySearchAPI extends ServiceClient {
/**
* Create a EntitySearchAPI.
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
* @param {string} [baseUri] - The base URI of the service.
* @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(credentials, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (!options) options = {};
super(credentials, options);
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://api.cognitive.microsoft.com/bing/v7.0';
}
this.credentials = credentials;
let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
this.entitiesOperations = new operations.EntitiesOperations(this);
this.models = models;
msRest.addSerializationMixin(this);
}
}
module.exports = EntitySearchAPI;

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

@ -0,0 +1,91 @@
/*
* 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;

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

@ -0,0 +1,75 @@
/*
* 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;

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

@ -0,0 +1,66 @@
/*
* 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;

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

@ -0,0 +1,92 @@
/*
* 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;

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

@ -0,0 +1,98 @@
/*
* 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;

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

@ -0,0 +1,82 @@
/*
* 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;

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

@ -0,0 +1,93 @@
/*
* 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;

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

@ -0,0 +1,176 @@
/*
* 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;

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

@ -0,0 +1,138 @@
/*
* 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: 'Enum',
allowedValues: [ 'DominantEntity', 'DominantEntityWithDisambiguation', 'Disambiguation', 'List', 'ListWithPivot' ]
}
},
value: {
required: true,
serializedName: 'value',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'ThingElementType',
type: {
name: 'Composite',
className: 'Thing'
}
}
}
}
}
}
};
}
}
module.exports = Entities;

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

@ -0,0 +1,87 @@
/*
* 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: 'Enum',
allowedValues: [ 'DominantEntity', 'DisambiguationItem', 'ListItem' ]
}
},
entityTypeHints: {
required: false,
readOnly: true,
serializedName: 'entityTypeHints',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'EntityTypeElementType',
type: {
name: 'Enum',
allowedValues: [ 'Generic', 'Person', 'Place', 'Media', 'Organization', 'LocalBusiness', 'Restaurant', 'Hotel', 'TouristAttraction', 'Travel', 'City', 'Country', 'Attraction', 'House', 'State', 'RadioStation', 'StreetAddress', 'Neighborhood', 'Locality', 'PostalCode', 'Region', 'SubRegion', 'MinorRegion', 'Continent', 'PointOfInterest', 'Other', 'Movie', 'Book', 'TelevisionShow', 'TelevisionSeason', 'VideoGame', 'MusicAlbum', 'MusicRecording', 'MusicGroup', 'Composition', 'TheaterPlay', 'Event', 'Actor', 'Artist', 'Attorney', 'Speciality', 'CollegeOrUniversity', 'School', 'Food', 'Drug', 'Animal', 'SportsTeam', 'Product', 'Car' ]
}
}
}
},
entityTypeDisplayHint: {
required: false,
readOnly: true,
serializedName: 'entityTypeDisplayHint',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = EntitiesEntityPresentationInfo;

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

@ -0,0 +1,109 @@
/*
* 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: 'Enum',
allowedValues: [ 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization' ]
}
},
subCode: {
required: false,
readOnly: true,
serializedName: 'subCode',
type: {
name: 'Enum',
allowedValues: [ 'UnexpectedError', 'ResourceError', 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired' ]
}
},
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;

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

@ -0,0 +1,109 @@
/*
* 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;

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

@ -0,0 +1,63 @@
/*
* 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 Identifiable.
* @extends models['ResponseBase']
*/
class Identifiable extends models['ResponseBase'] {
/**
* Create a Identifiable.
* @member {string} [id]
*/
constructor() {
super();
}
/**
* Defines the metadata of Identifiable
*
* @returns {object} metadata of Identifiable
*
*/
mapper() {
return {
required: false,
serializedName: 'Identifiable',
type: {
name: 'Composite',
className: 'Identifiable',
modelProperties: {
_type: {
required: true,
serializedName: '_type',
type: {
name: 'String'
}
},
id: {
required: false,
readOnly: true,
serializedName: 'id',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = Identifiable;

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

@ -0,0 +1,216 @@
/*
* 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;

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

@ -0,0 +1,579 @@
/*
* 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 QueryContext class.
* @constructor
* Defines the query context that Bing used for the request.
*
* @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".
*/
export interface QueryContext {
originalQuery: string;
readonly alteredQuery?: string;
readonly alterationOverrideQuery?: string;
readonly adultIntent?: boolean;
readonly askUserForLocation?: boolean;
}
/**
* @class
* Initializes a new instance of the ResponseBase class.
* @constructor
* @member {string} _type Polymorphic Discriminator
*/
export interface ResponseBase {
_type: string;
}
/**
* @class
* Initializes a new instance of the Identifiable class.
* @constructor
* @member {string} [id]
*/
export interface Identifiable extends ResponseBase {
readonly id?: string;
}
/**
* @class
* Initializes a new instance of the Response class.
* @constructor
* @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.
*/
export interface Response extends Identifiable {
readonly contractualRules?: ContractualRulesContractualRule[];
readonly webSearchUrl?: string;
}
/**
* @class
* Initializes a new instance of the Thing class.
* @constructor
* @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.
*/
export interface Thing extends Response {
readonly name?: string;
readonly url?: string;
readonly image?: ImageObject;
readonly description?: string;
readonly entityPresentationInfo?: EntitiesEntityPresentationInfo;
readonly bingId?: string;
}
/**
* @class
* Initializes a new instance of the CreativeWork class.
* @constructor
* @member {string} [thumbnailUrl] The URL to a thumbnail of the item.
* @member {array} [provider] The source of the creative work.
* @member {string} [text]
*/
export interface CreativeWork extends Thing {
readonly thumbnailUrl?: string;
readonly provider?: Thing[];
readonly text?: string;
}
/**
* @class
* Initializes a new instance of the MediaObject class.
* @constructor
* @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.
*/
export interface MediaObject extends CreativeWork {
readonly contentUrl?: string;
readonly hostPageUrl?: string;
readonly width?: number;
readonly height?: number;
}
/**
* @class
* Initializes a new instance of the ImageObject class.
* @constructor
* Defines an image
*
* @member {object} [thumbnail] The URL to a thumbnail of the image
*/
export interface ImageObject extends MediaObject {
readonly thumbnail?: ImageObject;
}
/**
* @class
* Initializes a new instance of the EntitiesEntityPresentationInfo class.
* @constructor
* Defines additional information about an entity such as type hints.
*
* @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.
*/
export interface EntitiesEntityPresentationInfo {
entityScenario: string;
readonly entityTypeHints?: string[];
readonly entityTypeDisplayHint?: string;
}
/**
* @class
* Initializes a new instance of the Answer class.
* @constructor
*/
export interface Answer extends Response {
}
/**
* @class
* Initializes a new instance of the SearchResultsAnswer class.
* @constructor
* @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".
*/
export interface SearchResultsAnswer extends Answer {
readonly queryContext?: QueryContext;
}
/**
* @class
* Initializes a new instance of the Entities class.
* @constructor
* Defines an entity answer.
*
* @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.
*/
export interface Entities extends SearchResultsAnswer {
readonly queryScenario?: string;
value: Thing[];
}
/**
* @class
* Initializes a new instance of the Places class.
* @constructor
* Defines a local entity answer.
*
* @member {array} value A list of local entities, such as restaurants or
* hotels.
*/
export interface Places extends SearchResultsAnswer {
value: Thing[];
}
/**
* @class
* Initializes a new instance of the SearchResponse class.
* @constructor
* Defines the top-level object that the response includes when the request
* succeeds.
*
* @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.
*/
export interface SearchResponse extends Response {
readonly queryContext?: QueryContext;
readonly entities?: Entities;
readonly places?: Places;
}
/**
* @class
* Initializes a new instance of the ContractualRulesContractualRule class.
* @constructor
* @member {string} [targetPropertyName] The name of the field that the rule
* applies to.
* @member {string} _type Polymorphic Discriminator
*/
export interface ContractualRulesContractualRule {
readonly targetPropertyName?: string;
_type: string;
}
/**
* @class
* Initializes a new instance of the ErrorModel class.
* @constructor
* Defines the error that occurred.
*
* @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.
*/
export interface ErrorModel {
code: string;
readonly subCode?: string;
message: string;
readonly moreDetails?: string;
readonly parameter?: string;
readonly value?: string;
}
/**
* @class
* Initializes a new instance of the ErrorResponse class.
* @constructor
* The top-level response that represents a failed request.
*
* @member {array} errors A list of errors that describe the reasons why the
* request failed.
*/
export interface ErrorResponse extends Response {
errors: ErrorModel[];
}
/**
* @class
* Initializes a new instance of the Intangible class.
* @constructor
*/
export interface Intangible extends Thing {
}
/**
* @class
* Initializes a new instance of the StructuredValue class.
* @constructor
*/
export interface StructuredValue extends Intangible {
}
/**
* @class
* Initializes a new instance of the PostalAddress class.
* @constructor
* Defines a postal address.
*
* @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.
*/
export interface PostalAddress extends StructuredValue {
readonly streetAddress?: string;
readonly addressLocality?: string;
readonly addressSubregion?: string;
readonly addressRegion?: string;
readonly postalCode?: string;
readonly postOfficeBoxNumber?: string;
readonly addressCountry?: string;
readonly countryIso?: string;
readonly neighborhood?: string;
readonly addressRegionAbbreviation?: string;
readonly text?: string;
}
/**
* @class
* Initializes a new instance of the Place class.
* @constructor
* Defines information about a local entity, such as a restaurant or hotel.
*
* @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
*/
export interface Place extends Thing {
readonly address?: PostalAddress;
readonly telephone?: string;
}
/**
* @class
* Initializes a new instance of the Organization class.
* @constructor
* Defines an organization.
*
*/
export interface Organization extends Thing {
}
/**
* @class
* Initializes a new instance of the ContractualRulesAttribution class.
* @constructor
* @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.
*/
export interface ContractualRulesAttribution extends ContractualRulesContractualRule {
readonly mustBeCloseToContent?: boolean;
}
/**
* @class
* Initializes a new instance of the License class.
* @constructor
* Defines the license under which the text or photo may be used.
*
*/
export interface License extends CreativeWork {
}
/**
* @class
* Initializes a new instance of the ContractualRulesLicenseAttribution class.
* @constructor
* Defines a contractual rule for license attribution.
*
* @member {object} [license] The license under which the content may be used.
* @member {string} [licenseNotice] The license to display next to the targeted
* field.
*/
export interface ContractualRulesLicenseAttribution extends ContractualRulesAttribution {
readonly license?: License;
readonly licenseNotice?: string;
}
/**
* @class
* Initializes a new instance of the ContractualRulesLinkAttribution class.
* @constructor
* Defines a contractual rule for link attribution.
*
* @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.
*/
export interface ContractualRulesLinkAttribution extends ContractualRulesAttribution {
text: string;
url: string;
readonly optionalForListDisplay?: boolean;
}
/**
* @class
* Initializes a new instance of the ContractualRulesMediaAttribution class.
* @constructor
* Defines a contractual rule for media attribution.
*
* @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.
*/
export interface ContractualRulesMediaAttribution extends ContractualRulesAttribution {
readonly url?: string;
}
/**
* @class
* Initializes a new instance of the ContractualRulesTextAttribution class.
* @constructor
* Defines a contractual rule for text attribution.
*
* @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.
*/
export interface ContractualRulesTextAttribution extends ContractualRulesAttribution {
text: string;
readonly optionalForListDisplay?: boolean;
}

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

@ -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.
*/
/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */
'use strict';
exports.QueryContext = require('./queryContext');
exports.ResponseBase = require('./responseBase');
exports.Identifiable = require('./identifiable');
exports.Response = require('./response');
exports.Thing = require('./thing');
exports.CreativeWork = require('./creativeWork');
exports.MediaObject = require('./mediaObject');
exports.ImageObject = require('./imageObject');
exports.EntitiesEntityPresentationInfo = require('./entitiesEntityPresentationInfo');
exports.Answer = require('./answer');
exports.SearchResultsAnswer = require('./searchResultsAnswer');
exports.Entities = require('./entities');
exports.Places = require('./places');
exports.SearchResponse = require('./searchResponse');
exports.ContractualRulesContractualRule = require('./contractualRulesContractualRule');
exports.ErrorModel = require('./errorModel');
exports.ErrorResponse = require('./errorResponse');
exports.Intangible = require('./intangible');
exports.StructuredValue = require('./structuredValue');
exports.PostalAddress = require('./postalAddress');
exports.Place = require('./place');
exports.Organization = require('./organization');
exports.ContractualRulesAttribution = require('./contractualRulesAttribution');
exports.License = require('./license');
exports.ContractualRulesLicenseAttribution = require('./contractualRulesLicenseAttribution');
exports.ContractualRulesLinkAttribution = require('./contractualRulesLinkAttribution');
exports.ContractualRulesMediaAttribution = require('./contractualRulesMediaAttribution');
exports.ContractualRulesTextAttribution = require('./contractualRulesTextAttribution');
exports.discriminators = {
'ResponseBase.ImageObject' : exports.ImageObject,
'ResponseBase.Thing' : exports.Thing,
'ResponseBase.Entities' : exports.Entities,
'ResponseBase.Places' : exports.Places,
'ResponseBase.SearchResponse' : exports.SearchResponse,
'ContractualRules/ContractualRule' : exports.ContractualRulesContractualRule,
'ResponseBase.Response' : exports.Response,
'ResponseBase.SearchResultsAnswer' : exports.SearchResultsAnswer,
'ResponseBase.Identifiable' : exports.Identifiable,
'ResponseBase.Answer' : exports.Answer,
'ResponseBase.ErrorResponse' : exports.ErrorResponse,
'ResponseBase.PostalAddress' : exports.PostalAddress,
'ResponseBase.Place' : exports.Place,
'ResponseBase.Organization' : exports.Organization,
'ResponseBase' : exports.ResponseBase,
'ResponseBase.CreativeWork' : exports.CreativeWork,
'ResponseBase.Intangible' : exports.Intangible,
'ContractualRulesContractualRule.ContractualRules/Attribution' : exports.ContractualRulesAttribution,
'ResponseBase.MediaObject' : exports.MediaObject,
'ResponseBase.License' : exports.License,
'ResponseBase.StructuredValue' : exports.StructuredValue,
'ContractualRulesContractualRule.ContractualRules/LicenseAttribution' : exports.ContractualRulesLicenseAttribution,
'ContractualRulesContractualRule.ContractualRules/LinkAttribution' : exports.ContractualRulesLinkAttribution,
'ContractualRulesContractualRule.ContractualRules/MediaAttribution' : exports.ContractualRulesMediaAttribution,
'ContractualRulesContractualRule.ContractualRules/TextAttribution' : exports.ContractualRulesTextAttribution
};

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

@ -0,0 +1,141 @@
/*
* 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;

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

@ -0,0 +1,174 @@
/*
* 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;

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

@ -0,0 +1,212 @@
/*
* 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;

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

@ -0,0 +1,142 @@
/*
* 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;

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

@ -0,0 +1,183 @@
/*
* 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;

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

@ -0,0 +1,118 @@
/*
* 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;

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

@ -0,0 +1,251 @@
/*
* 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;

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

@ -0,0 +1,108 @@
/*
* 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;

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

@ -0,0 +1,95 @@
/*
* 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 Response.
* @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;

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

@ -0,0 +1,56 @@
/*
* 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 ResponseBase.
*/
class ResponseBase {
/**
* Create a ResponseBase.
* @member {string} _type Polymorphic Discriminator
*/
constructor() {
}
/**
* Defines the metadata of ResponseBase
*
* @returns {object} metadata of ResponseBase
*
*/
mapper() {
return {
required: false,
serializedName: 'ResponseBase',
type: {
name: 'Composite',
polymorphicDiscriminator: {
serializedName: '_type',
clientName: '_type'
},
uberParent: 'ResponseBase',
className: 'ResponseBase',
modelProperties: {
_type: {
required: true,
serializedName: '_type',
type: {
name: 'String'
}
}
}
}
};
}
}
module.exports = ResponseBase;

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

@ -0,0 +1,169 @@
/*
* 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;

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

@ -0,0 +1,128 @@
/*
* 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;

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

@ -0,0 +1,141 @@
/*
* 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;

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

@ -0,0 +1,162 @@
/*
* 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;

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

@ -0,0 +1,827 @@
/*
* 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 msRest = require('ms-rest');
const WebResource = msRest.WebResource;
/**
* @summary The Entity Search API lets you send a search query to Bing and get
* back search results that include entities and places. Place results include
* restaurants, hotel, or other local businesses. For places, the query can
* specify the name of the local business or it can ask for a list (for
* example, restaurants near me). Entity results include persons, places, or
* things. Place in this context is tourist attractions, states, countries,
* etc.
*
* @param {string} query The user's search term.
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.acceptLanguage] A comma-delimited list of one or
* more languages to use for user interface strings. The list is in decreasing
* order of preference. For additional information, including expected format,
* see [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
* header and the setLang query parameter are mutually exclusive; do not
* specify both. If you set this header, you must also specify the cc query
* parameter. Bing will use the first supported language it finds from the
* list, and combine that language with the cc parameter value to determine the
* market to return results for. If the list does not include a supported
* language, Bing will find the closest language and market that supports the
* request, and may use an aggregated or default market for the results instead
* of a specified one. You should use this header and the cc query parameter
* only if you specify multiple languages; otherwise, you should use the mkt
* and setLang query parameters. A user interface string is a string that's
* used as a label in a user interface. There are very few user interface
* strings in the JSON response objects. Any links in the response objects to
* Bing.com properties will apply the specified language.
*
* @param {string} [options.pragma] By default, Bing returns cached content, if
* available. To prevent Bing from returning cached content, set the Pragma
* header to no-cache (for example, Pragma: no-cache).
*
* @param {string} [options.userAgent] The user agent originating the request.
* Bing uses the user agent to provide mobile users with an optimized
* experience. Although optional, you are strongly encouraged to always specify
* this header. The user-agent should be the same string that any commonly used
* browser would send. For information about user agents, see [RFC
* 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
*
* @param {string} [options.clientId] Bing uses this header to provide users
* with consistent behavior across Bing API calls. Bing often flights new
* features and improvements, and it uses the client ID as a key for assigning
* traffic on different flights. If you do not use the same client ID for a
* user across multiple requests, then Bing may assign the user to multiple
* conflicting flights. Being assigned to multiple conflicting flights can lead
* to an inconsistent user experience. For example, if the second request has a
* different flight assignment than the first, the experience may be
* unexpected. Also, Bing can use the client ID to tailor web results to that
* client IDs search history, providing a richer experience for the user. Bing
* also uses this header to help improve result rankings by analyzing the
* activity generated by a client ID. The relevance improvements help with
* better quality of results delivered by Bing APIs and in turn enables higher
* click-through rates for the API consumer. IMPORTANT: Although optional, you
* should consider this header required. Persisting the client ID across
* multiple requests for the same end user and device combination enables 1)
* the API consumer to receive a consistent user experience, and 2) higher
* click-through rates via better quality of results from the Bing APIs. Each
* user that uses your application on the device must have a unique, Bing
* generated client ID. If you do not include this header in the request, Bing
* generates an ID and returns it in the X-MSEdge-ClientID response header. The
* only time that you should NOT include this header in a request is the first
* time the user uses your app on that device. Use the client ID for each Bing
* API request that your app makes for this user on the device. Persist the
* client ID. To persist the ID in a browser app, use a persistent HTTP cookie
* to ensure the ID is used across all sessions. Do not use a session cookie.
* For other apps such as mobile apps, use the device's persistent storage to
* persist the ID. The next time the user uses your app on that device, get the
* client ID that you persisted. Bing responses may or may not include this
* header. If the response includes this header, capture the client ID and use
* it for all subsequent Bing requests for the user on that device. If you
* include the X-MSEdge-ClientID, you must not include cookies in the request.
*
* @param {string} [options.clientIp] The IPv4 or IPv6 address of the client
* device. The IP address is used to discover the user's location. Bing uses
* the location information to determine safe search behavior. Although
* optional, you are encouraged to always specify this header and the
* X-Search-Location header. Do not obfuscate the address (for example, by
* changing the last octet to 0). Obfuscating the address results in the
* location not being anywhere near the device's actual location, which may
* result in Bing serving erroneous results.
*
* @param {string} [options.location] A semicolon-delimited list of key/value
* pairs that describe the client's geographical location. Bing uses the
* location information to determine safe search behavior and to return
* relevant local content. Specify the key/value pair as <key>:<value>. The
* following are the keys that you use to specify the user's location. lat
* (required): The latitude of the client's location, in degrees. The latitude
* must be greater than or equal to -90.0 and less than or equal to +90.0.
* Negative values indicate southern latitudes and positive values indicate
* northern latitudes. long (required): The longitude of the client's location,
* in degrees. The longitude must be greater than or equal to -180.0 and less
* than or equal to +180.0. Negative values indicate western longitudes and
* positive values indicate eastern longitudes. re (required): The radius, in
* meters, which specifies the horizontal accuracy of the coordinates. Pass the
* value returned by the device's location service. Typical values might be 22m
* for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP
* lookup. ts (optional): The UTC UNIX timestamp of when the client was at the
* location. (The UNIX timestamp is the number of seconds since January 1,
* 1970.) head (optional): The client's relative heading or direction of
* travel. Specify the direction of travel as degrees from 0 through 360,
* counting clockwise relative to true north. Specify this key only if the sp
* key is nonzero. sp (optional): The horizontal velocity (speed), in meters
* per second, that the client device is traveling. alt (optional): The
* altitude of the client device, in meters. are (optional): The radius, in
* meters, that specifies the vertical accuracy of the coordinates. Specify
* this key only if you specify the alt key. Although many of the keys are
* optional, the more information that you provide, the more accurate the
* location results are. Although optional, you are encouraged to always
* specify the user's geographical location. Providing the location is
* especially important if the client's IP address does not accurately reflect
* the user's physical location (for example, if the client uses VPN). For
* optimal results, you should include this header and the X-MSEdge-ClientIP
* header, but at a minimum, you should include this header.
*
* @param {string} [options.countryCode] A 2-character country code of the
* country where the results come from. This API supports only the United
* States market. If you specify this query parameter, it must be set to us. If
* you set this parameter, you must also specify the Accept-Language header.
* Bing uses the first supported language it finds from the languages list, and
* combine that language with the country code that you specify to determine
* the market to return results for. If the languages list does not include a
* supported language, Bing finds the closest language and market that supports
* the request, or it may use an aggregated or default market for the results
* instead of a specified one. You should use this query parameter and the
* Accept-Language query parameter only if you specify multiple languages;
* otherwise, you should use the mkt and setLang query parameters. This
* parameter and the mkt query parameter are mutually exclusivedo not specify
* both.
*
* @param {string} [options.market] The market where the results come from. You
* are strongly encouraged to always specify the market, if known. Specifying
* the market helps Bing route the request and return an appropriate and
* optimal response. This parameter and the cc query parameter are mutually
* exclusivedo not specify both.
*
* @param {array} [options.responseFilter] A comma-delimited list of answers to
* include in the response. If you do not specify this parameter, the response
* includes all search answers for which there's relevant data.
*
* @param {array} [options.responseFormat] The media type to use for the
* response. The following are the possible case-insensitive values: JSON,
* JSONLD. The default is JSON. If you specify JSONLD, the response body
* includes JSON-LD objects that contain the search results.
*
* @param {string} [options.safeSearch] A filter used to filter adult content.
* Off: Return webpages with adult text, images, or videos. Moderate: Return
* webpages with adult text, but not adult images or videos. Strict: Do not
* return webpages with adult text, images, or videos. The default is Moderate.
* If the request comes from a market that Bing's adult policy requires that
* safeSearch is set to Strict, Bing ignores the safeSearch value and uses
* Strict. If you use the site: query operator, there is the chance that the
* response may contain adult content regardless of what the safeSearch query
* parameter is set to. Use site: only if you are aware of the content on the
* site and your scenario supports the possibility of adult content. Possible
* values include: 'Off', 'Moderate', 'Strict'
*
* @param {string} [options.setLang] The language to use for user interface
* strings. Specify the language using the ISO 639-1 2-letter language code.
* For example, the language code for English is EN. The default is EN
* (English). Although optional, you should always specify the language.
* Typically, you set setLang to the same language specified by mkt unless the
* user wants the user interface strings displayed in a different language.
* This parameter and the Accept-Language header are mutually exclusive; do not
* specify both. A user interface string is a string that's used as a label in
* a user interface. There are few user interface strings in the JSON response
* objects. Also, any links to Bing.com properties in the response objects
* apply the specified language.
*
* @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 SearchResponse} 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 _search(query, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
callback = options;
options = null;
}
if (!callback) {
throw new Error('callback cannot be null.');
}
let acceptLanguage = (options && options.acceptLanguage !== undefined) ? options.acceptLanguage : undefined;
let pragma = (options && options.pragma !== undefined) ? options.pragma : undefined;
let userAgent = (options && options.userAgent !== undefined) ? options.userAgent : undefined;
let clientId = (options && options.clientId !== undefined) ? options.clientId : undefined;
let clientIp = (options && options.clientIp !== undefined) ? options.clientIp : undefined;
let location = (options && options.location !== undefined) ? options.location : undefined;
let countryCode = (options && options.countryCode !== undefined) ? options.countryCode : undefined;
let market = (options && options.market !== undefined) ? options.market : undefined;
let responseFilter = (options && options.responseFilter !== undefined) ? options.responseFilter : undefined;
let responseFormat = (options && options.responseFormat !== undefined) ? options.responseFormat : undefined;
let safeSearch = (options && options.safeSearch !== undefined) ? options.safeSearch : undefined;
let setLang = (options && options.setLang !== undefined) ? options.setLang : undefined;
// Validate
try {
if (acceptLanguage !== null && acceptLanguage !== undefined && typeof acceptLanguage.valueOf() !== 'string') {
throw new Error('acceptLanguage must be of type string.');
}
if (pragma !== null && pragma !== undefined && typeof pragma.valueOf() !== 'string') {
throw new Error('pragma must be of type string.');
}
if (userAgent !== null && userAgent !== undefined && typeof userAgent.valueOf() !== 'string') {
throw new Error('userAgent must be of type string.');
}
if (clientId !== null && clientId !== undefined && typeof clientId.valueOf() !== 'string') {
throw new Error('clientId must be of type string.');
}
if (clientIp !== null && clientIp !== undefined && typeof clientIp.valueOf() !== 'string') {
throw new Error('clientIp must be of type string.');
}
if (location !== null && location !== undefined && typeof location.valueOf() !== 'string') {
throw new Error('location must be of type string.');
}
if (countryCode !== null && countryCode !== undefined && typeof countryCode.valueOf() !== 'string') {
throw new Error('countryCode must be of type string.');
}
if (market !== null && market !== undefined && typeof market.valueOf() !== 'string') {
throw new Error('market must be of type string.');
}
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
throw new Error('query cannot be null or undefined and it must be of type string.');
}
if (Array.isArray(responseFilter)) {
for (let i = 0; i < responseFilter.length; i++) {
if (responseFilter[i]) {
let allowedValues = [ 'Entities', 'Places' ];
if (!allowedValues.some( function(item) { return item === responseFilter[i]; })) {
throw new Error(responseFilter[i] + ' is not a valid value. The valid values are: ' + allowedValues);
}
}
}
}
if (Array.isArray(responseFormat)) {
for (let i1 = 0; i1 < responseFormat.length; i1++) {
if (responseFormat[i1]) {
let allowedValues1 = [ 'Json', 'JsonLd' ];
if (!allowedValues1.some( function(item) { return item === responseFormat[i1]; })) {
throw new Error(responseFormat[i1] + ' is not a valid value. The valid values are: ' + allowedValues1);
}
}
}
}
if (safeSearch) {
let allowedValues2 = [ 'Off', 'Moderate', 'Strict' ];
if (!allowedValues2.some( function(item) { return item === safeSearch; })) {
throw new Error(safeSearch + ' is not a valid value. The valid values are: ' + allowedValues2);
}
}
if (setLang !== null && setLang !== undefined && typeof setLang.valueOf() !== 'string') {
throw new Error('setLang must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
let baseUrl = this.client.baseUri;
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'entities';
let queryParameters = [];
if (countryCode !== null && countryCode !== undefined) {
queryParameters.push('cc=' + encodeURIComponent(countryCode));
}
if (market !== null && market !== undefined) {
queryParameters.push('mkt=' + encodeURIComponent(market));
}
queryParameters.push('q=' + encodeURIComponent(query));
if (responseFilter !== null && responseFilter !== undefined) {
queryParameters.push('ResponseFilter=' + encodeURIComponent(responseFilter.join(',')));
}
if (responseFormat !== null && responseFormat !== undefined) {
queryParameters.push('ResponseFormat=' + encodeURIComponent(responseFormat.join(',')));
}
if (safeSearch !== null && safeSearch !== undefined) {
queryParameters.push('SafeSearch=' + encodeURIComponent(safeSearch));
}
if (setLang !== null && setLang !== undefined) {
queryParameters.push('SetLang=' + encodeURIComponent(setLang));
}
if (queryParameters.length > 0) {
requestUrl += '?' + queryParameters.join('&');
}
// Create HTTP transport objects
let httpRequest = new WebResource();
httpRequest.method = 'GET';
httpRequest.url = requestUrl;
httpRequest.headers = {};
// Set Headers
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
if (acceptLanguage !== undefined && acceptLanguage !== null) {
httpRequest.headers['Accept-Language'] = acceptLanguage;
}
if (pragma !== undefined && pragma !== null) {
httpRequest.headers['Pragma'] = pragma;
}
if (userAgent !== undefined && userAgent !== null) {
httpRequest.headers['User-Agent'] = userAgent;
}
if (clientId !== undefined && clientId !== null) {
httpRequest.headers['X-MSEdge-ClientID'] = clientId;
}
if (clientIp !== undefined && clientIp !== null) {
httpRequest.headers['X-MSEdge-ClientIP'] = clientIp;
}
if (location !== undefined && location !== null) {
httpRequest.headers['X-Search-Location'] = location;
}
if(options) {
for(let headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
httpRequest.headers[headerName] = options['customHeaders'][headerName];
}
}
}
httpRequest.body = null;
// 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['SearchResponse']().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 EntitiesOperations. */
class EntitiesOperations {
/**
* Create a EntitiesOperations.
* @param {EntitySearchAPI} client Reference to the service client.
*/
constructor(client) {
this.client = client;
this._search = _search;
}
/**
* @summary The Entity Search API lets you send a search query to Bing and get
* back search results that include entities and places. Place results include
* restaurants, hotel, or other local businesses. For places, the query can
* specify the name of the local business or it can ask for a list (for
* example, restaurants near me). Entity results include persons, places, or
* things. Place in this context is tourist attractions, states, countries,
* etc.
*
* @param {string} query The user's search term.
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.acceptLanguage] A comma-delimited list of one or
* more languages to use for user interface strings. The list is in decreasing
* order of preference. For additional information, including expected format,
* see [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
* header and the setLang query parameter are mutually exclusive; do not
* specify both. If you set this header, you must also specify the cc query
* parameter. Bing will use the first supported language it finds from the
* list, and combine that language with the cc parameter value to determine the
* market to return results for. If the list does not include a supported
* language, Bing will find the closest language and market that supports the
* request, and may use an aggregated or default market for the results instead
* of a specified one. You should use this header and the cc query parameter
* only if you specify multiple languages; otherwise, you should use the mkt
* and setLang query parameters. A user interface string is a string that's
* used as a label in a user interface. There are very few user interface
* strings in the JSON response objects. Any links in the response objects to
* Bing.com properties will apply the specified language.
*
* @param {string} [options.pragma] By default, Bing returns cached content, if
* available. To prevent Bing from returning cached content, set the Pragma
* header to no-cache (for example, Pragma: no-cache).
*
* @param {string} [options.userAgent] The user agent originating the request.
* Bing uses the user agent to provide mobile users with an optimized
* experience. Although optional, you are strongly encouraged to always specify
* this header. The user-agent should be the same string that any commonly used
* browser would send. For information about user agents, see [RFC
* 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
*
* @param {string} [options.clientId] Bing uses this header to provide users
* with consistent behavior across Bing API calls. Bing often flights new
* features and improvements, and it uses the client ID as a key for assigning
* traffic on different flights. If you do not use the same client ID for a
* user across multiple requests, then Bing may assign the user to multiple
* conflicting flights. Being assigned to multiple conflicting flights can lead
* to an inconsistent user experience. For example, if the second request has a
* different flight assignment than the first, the experience may be
* unexpected. Also, Bing can use the client ID to tailor web results to that
* client IDs search history, providing a richer experience for the user. Bing
* also uses this header to help improve result rankings by analyzing the
* activity generated by a client ID. The relevance improvements help with
* better quality of results delivered by Bing APIs and in turn enables higher
* click-through rates for the API consumer. IMPORTANT: Although optional, you
* should consider this header required. Persisting the client ID across
* multiple requests for the same end user and device combination enables 1)
* the API consumer to receive a consistent user experience, and 2) higher
* click-through rates via better quality of results from the Bing APIs. Each
* user that uses your application on the device must have a unique, Bing
* generated client ID. If you do not include this header in the request, Bing
* generates an ID and returns it in the X-MSEdge-ClientID response header. The
* only time that you should NOT include this header in a request is the first
* time the user uses your app on that device. Use the client ID for each Bing
* API request that your app makes for this user on the device. Persist the
* client ID. To persist the ID in a browser app, use a persistent HTTP cookie
* to ensure the ID is used across all sessions. Do not use a session cookie.
* For other apps such as mobile apps, use the device's persistent storage to
* persist the ID. The next time the user uses your app on that device, get the
* client ID that you persisted. Bing responses may or may not include this
* header. If the response includes this header, capture the client ID and use
* it for all subsequent Bing requests for the user on that device. If you
* include the X-MSEdge-ClientID, you must not include cookies in the request.
*
* @param {string} [options.clientIp] The IPv4 or IPv6 address of the client
* device. The IP address is used to discover the user's location. Bing uses
* the location information to determine safe search behavior. Although
* optional, you are encouraged to always specify this header and the
* X-Search-Location header. Do not obfuscate the address (for example, by
* changing the last octet to 0). Obfuscating the address results in the
* location not being anywhere near the device's actual location, which may
* result in Bing serving erroneous results.
*
* @param {string} [options.location] A semicolon-delimited list of key/value
* pairs that describe the client's geographical location. Bing uses the
* location information to determine safe search behavior and to return
* relevant local content. Specify the key/value pair as <key>:<value>. The
* following are the keys that you use to specify the user's location. lat
* (required): The latitude of the client's location, in degrees. The latitude
* must be greater than or equal to -90.0 and less than or equal to +90.0.
* Negative values indicate southern latitudes and positive values indicate
* northern latitudes. long (required): The longitude of the client's location,
* in degrees. The longitude must be greater than or equal to -180.0 and less
* than or equal to +180.0. Negative values indicate western longitudes and
* positive values indicate eastern longitudes. re (required): The radius, in
* meters, which specifies the horizontal accuracy of the coordinates. Pass the
* value returned by the device's location service. Typical values might be 22m
* for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP
* lookup. ts (optional): The UTC UNIX timestamp of when the client was at the
* location. (The UNIX timestamp is the number of seconds since January 1,
* 1970.) head (optional): The client's relative heading or direction of
* travel. Specify the direction of travel as degrees from 0 through 360,
* counting clockwise relative to true north. Specify this key only if the sp
* key is nonzero. sp (optional): The horizontal velocity (speed), in meters
* per second, that the client device is traveling. alt (optional): The
* altitude of the client device, in meters. are (optional): The radius, in
* meters, that specifies the vertical accuracy of the coordinates. Specify
* this key only if you specify the alt key. Although many of the keys are
* optional, the more information that you provide, the more accurate the
* location results are. Although optional, you are encouraged to always
* specify the user's geographical location. Providing the location is
* especially important if the client's IP address does not accurately reflect
* the user's physical location (for example, if the client uses VPN). For
* optimal results, you should include this header and the X-MSEdge-ClientIP
* header, but at a minimum, you should include this header.
*
* @param {string} [options.countryCode] A 2-character country code of the
* country where the results come from. This API supports only the United
* States market. If you specify this query parameter, it must be set to us. If
* you set this parameter, you must also specify the Accept-Language header.
* Bing uses the first supported language it finds from the languages list, and
* combine that language with the country code that you specify to determine
* the market to return results for. If the languages list does not include a
* supported language, Bing finds the closest language and market that supports
* the request, or it may use an aggregated or default market for the results
* instead of a specified one. You should use this query parameter and the
* Accept-Language query parameter only if you specify multiple languages;
* otherwise, you should use the mkt and setLang query parameters. This
* parameter and the mkt query parameter are mutually exclusivedo not specify
* both.
*
* @param {string} [options.market] The market where the results come from. You
* are strongly encouraged to always specify the market, if known. Specifying
* the market helps Bing route the request and return an appropriate and
* optimal response. This parameter and the cc query parameter are mutually
* exclusivedo not specify both.
*
* @param {array} [options.responseFilter] A comma-delimited list of answers to
* include in the response. If you do not specify this parameter, the response
* includes all search answers for which there's relevant data.
*
* @param {array} [options.responseFormat] The media type to use for the
* response. The following are the possible case-insensitive values: JSON,
* JSONLD. The default is JSON. If you specify JSONLD, the response body
* includes JSON-LD objects that contain the search results.
*
* @param {string} [options.safeSearch] A filter used to filter adult content.
* Off: Return webpages with adult text, images, or videos. Moderate: Return
* webpages with adult text, but not adult images or videos. Strict: Do not
* return webpages with adult text, images, or videos. The default is Moderate.
* If the request comes from a market that Bing's adult policy requires that
* safeSearch is set to Strict, Bing ignores the safeSearch value and uses
* Strict. If you use the site: query operator, there is the chance that the
* response may contain adult content regardless of what the safeSearch query
* parameter is set to. Use site: only if you are aware of the content on the
* site and your scenario supports the possibility of adult content. Possible
* values include: 'Off', 'Moderate', 'Strict'
*
* @param {string} [options.setLang] The language to use for user interface
* strings. Specify the language using the ISO 639-1 2-letter language code.
* For example, the language code for English is EN. The default is EN
* (English). Although optional, you should always specify the language.
* Typically, you set setLang to the same language specified by mkt unless the
* user wants the user interface strings displayed in a different language.
* This parameter and the Accept-Language header are mutually exclusive; do not
* specify both. A user interface string is a string that's used as a label in
* a user interface. There are few user interface strings in the JSON response
* objects. Also, any links to Bing.com properties in the response objects
* apply the specified language.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<SearchResponse>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
searchWithHttpOperationResponse(query, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._search(query, 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 Entity Search API lets you send a search query to Bing and get
* back search results that include entities and places. Place results include
* restaurants, hotel, or other local businesses. For places, the query can
* specify the name of the local business or it can ask for a list (for
* example, restaurants near me). Entity results include persons, places, or
* things. Place in this context is tourist attractions, states, countries,
* etc.
*
* @param {string} query The user's search term.
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.acceptLanguage] A comma-delimited list of one or
* more languages to use for user interface strings. The list is in decreasing
* order of preference. For additional information, including expected format,
* see [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
* header and the setLang query parameter are mutually exclusive; do not
* specify both. If you set this header, you must also specify the cc query
* parameter. Bing will use the first supported language it finds from the
* list, and combine that language with the cc parameter value to determine the
* market to return results for. If the list does not include a supported
* language, Bing will find the closest language and market that supports the
* request, and may use an aggregated or default market for the results instead
* of a specified one. You should use this header and the cc query parameter
* only if you specify multiple languages; otherwise, you should use the mkt
* and setLang query parameters. A user interface string is a string that's
* used as a label in a user interface. There are very few user interface
* strings in the JSON response objects. Any links in the response objects to
* Bing.com properties will apply the specified language.
*
* @param {string} [options.pragma] By default, Bing returns cached content, if
* available. To prevent Bing from returning cached content, set the Pragma
* header to no-cache (for example, Pragma: no-cache).
*
* @param {string} [options.userAgent] The user agent originating the request.
* Bing uses the user agent to provide mobile users with an optimized
* experience. Although optional, you are strongly encouraged to always specify
* this header. The user-agent should be the same string that any commonly used
* browser would send. For information about user agents, see [RFC
* 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
*
* @param {string} [options.clientId] Bing uses this header to provide users
* with consistent behavior across Bing API calls. Bing often flights new
* features and improvements, and it uses the client ID as a key for assigning
* traffic on different flights. If you do not use the same client ID for a
* user across multiple requests, then Bing may assign the user to multiple
* conflicting flights. Being assigned to multiple conflicting flights can lead
* to an inconsistent user experience. For example, if the second request has a
* different flight assignment than the first, the experience may be
* unexpected. Also, Bing can use the client ID to tailor web results to that
* client IDs search history, providing a richer experience for the user. Bing
* also uses this header to help improve result rankings by analyzing the
* activity generated by a client ID. The relevance improvements help with
* better quality of results delivered by Bing APIs and in turn enables higher
* click-through rates for the API consumer. IMPORTANT: Although optional, you
* should consider this header required. Persisting the client ID across
* multiple requests for the same end user and device combination enables 1)
* the API consumer to receive a consistent user experience, and 2) higher
* click-through rates via better quality of results from the Bing APIs. Each
* user that uses your application on the device must have a unique, Bing
* generated client ID. If you do not include this header in the request, Bing
* generates an ID and returns it in the X-MSEdge-ClientID response header. The
* only time that you should NOT include this header in a request is the first
* time the user uses your app on that device. Use the client ID for each Bing
* API request that your app makes for this user on the device. Persist the
* client ID. To persist the ID in a browser app, use a persistent HTTP cookie
* to ensure the ID is used across all sessions. Do not use a session cookie.
* For other apps such as mobile apps, use the device's persistent storage to
* persist the ID. The next time the user uses your app on that device, get the
* client ID that you persisted. Bing responses may or may not include this
* header. If the response includes this header, capture the client ID and use
* it for all subsequent Bing requests for the user on that device. If you
* include the X-MSEdge-ClientID, you must not include cookies in the request.
*
* @param {string} [options.clientIp] The IPv4 or IPv6 address of the client
* device. The IP address is used to discover the user's location. Bing uses
* the location information to determine safe search behavior. Although
* optional, you are encouraged to always specify this header and the
* X-Search-Location header. Do not obfuscate the address (for example, by
* changing the last octet to 0). Obfuscating the address results in the
* location not being anywhere near the device's actual location, which may
* result in Bing serving erroneous results.
*
* @param {string} [options.location] A semicolon-delimited list of key/value
* pairs that describe the client's geographical location. Bing uses the
* location information to determine safe search behavior and to return
* relevant local content. Specify the key/value pair as <key>:<value>. The
* following are the keys that you use to specify the user's location. lat
* (required): The latitude of the client's location, in degrees. The latitude
* must be greater than or equal to -90.0 and less than or equal to +90.0.
* Negative values indicate southern latitudes and positive values indicate
* northern latitudes. long (required): The longitude of the client's location,
* in degrees. The longitude must be greater than or equal to -180.0 and less
* than or equal to +180.0. Negative values indicate western longitudes and
* positive values indicate eastern longitudes. re (required): The radius, in
* meters, which specifies the horizontal accuracy of the coordinates. Pass the
* value returned by the device's location service. Typical values might be 22m
* for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP
* lookup. ts (optional): The UTC UNIX timestamp of when the client was at the
* location. (The UNIX timestamp is the number of seconds since January 1,
* 1970.) head (optional): The client's relative heading or direction of
* travel. Specify the direction of travel as degrees from 0 through 360,
* counting clockwise relative to true north. Specify this key only if the sp
* key is nonzero. sp (optional): The horizontal velocity (speed), in meters
* per second, that the client device is traveling. alt (optional): The
* altitude of the client device, in meters. are (optional): The radius, in
* meters, that specifies the vertical accuracy of the coordinates. Specify
* this key only if you specify the alt key. Although many of the keys are
* optional, the more information that you provide, the more accurate the
* location results are. Although optional, you are encouraged to always
* specify the user's geographical location. Providing the location is
* especially important if the client's IP address does not accurately reflect
* the user's physical location (for example, if the client uses VPN). For
* optimal results, you should include this header and the X-MSEdge-ClientIP
* header, but at a minimum, you should include this header.
*
* @param {string} [options.countryCode] A 2-character country code of the
* country where the results come from. This API supports only the United
* States market. If you specify this query parameter, it must be set to us. If
* you set this parameter, you must also specify the Accept-Language header.
* Bing uses the first supported language it finds from the languages list, and
* combine that language with the country code that you specify to determine
* the market to return results for. If the languages list does not include a
* supported language, Bing finds the closest language and market that supports
* the request, or it may use an aggregated or default market for the results
* instead of a specified one. You should use this query parameter and the
* Accept-Language query parameter only if you specify multiple languages;
* otherwise, you should use the mkt and setLang query parameters. This
* parameter and the mkt query parameter are mutually exclusivedo not specify
* both.
*
* @param {string} [options.market] The market where the results come from. You
* are strongly encouraged to always specify the market, if known. Specifying
* the market helps Bing route the request and return an appropriate and
* optimal response. This parameter and the cc query parameter are mutually
* exclusivedo not specify both.
*
* @param {array} [options.responseFilter] A comma-delimited list of answers to
* include in the response. If you do not specify this parameter, the response
* includes all search answers for which there's relevant data.
*
* @param {array} [options.responseFormat] The media type to use for the
* response. The following are the possible case-insensitive values: JSON,
* JSONLD. The default is JSON. If you specify JSONLD, the response body
* includes JSON-LD objects that contain the search results.
*
* @param {string} [options.safeSearch] A filter used to filter adult content.
* Off: Return webpages with adult text, images, or videos. Moderate: Return
* webpages with adult text, but not adult images or videos. Strict: Do not
* return webpages with adult text, images, or videos. The default is Moderate.
* If the request comes from a market that Bing's adult policy requires that
* safeSearch is set to Strict, Bing ignores the safeSearch value and uses
* Strict. If you use the site: query operator, there is the chance that the
* response may contain adult content regardless of what the safeSearch query
* parameter is set to. Use site: only if you are aware of the content on the
* site and your scenario supports the possibility of adult content. Possible
* values include: 'Off', 'Moderate', 'Strict'
*
* @param {string} [options.setLang] The language to use for user interface
* strings. Specify the language using the ISO 639-1 2-letter language code.
* For example, the language code for English is EN. The default is EN
* (English). Although optional, you should always specify the language.
* Typically, you set setLang to the same language specified by mkt unless the
* user wants the user interface strings displayed in a different language.
* This parameter and the Accept-Language header are mutually exclusive; do not
* specify both. A user interface string is a string that's used as a label in
* a user interface. There are few user interface strings in the JSON response
* objects. Also, any links to Bing.com properties in the response objects
* apply the specified language.
*
* @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 {SearchResponse} - 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 SearchResponse} 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.
*/
search(query, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
optionalCallback = options;
options = null;
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._search(query, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._search(query, options, optionalCallback);
}
}
}
module.exports = EntitiesOperations;

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

@ -0,0 +1,405 @@
/*
* 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 { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest';
import * as models from '../models';
/**
* @class
* EntitiesOperations
* __NOTE__: An instance of this class is automatically created for an
* instance of the EntitySearchAPI.
*/
export interface EntitiesOperations {
/**
* @summary The Entity Search API lets you send a search query to Bing and get
* back search results that include entities and places. Place results include
* restaurants, hotel, or other local businesses. For places, the query can
* specify the name of the local business or it can ask for a list (for
* example, restaurants near me). Entity results include persons, places, or
* things. Place in this context is tourist attractions, states, countries,
* etc.
*
* @param {string} query The user's search term.
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.acceptLanguage] A comma-delimited list of one or
* more languages to use for user interface strings. The list is in decreasing
* order of preference. For additional information, including expected format,
* see [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
* header and the setLang query parameter are mutually exclusive; do not
* specify both. If you set this header, you must also specify the cc query
* parameter. Bing will use the first supported language it finds from the
* list, and combine that language with the cc parameter value to determine the
* market to return results for. If the list does not include a supported
* language, Bing will find the closest language and market that supports the
* request, and may use an aggregated or default market for the results instead
* of a specified one. You should use this header and the cc query parameter
* only if you specify multiple languages; otherwise, you should use the mkt
* and setLang query parameters. A user interface string is a string that's
* used as a label in a user interface. There are very few user interface
* strings in the JSON response objects. Any links in the response objects to
* Bing.com properties will apply the specified language.
*
* @param {string} [options.pragma] By default, Bing returns cached content, if
* available. To prevent Bing from returning cached content, set the Pragma
* header to no-cache (for example, Pragma: no-cache).
*
* @param {string} [options.userAgent] The user agent originating the request.
* Bing uses the user agent to provide mobile users with an optimized
* experience. Although optional, you are strongly encouraged to always specify
* this header. The user-agent should be the same string that any commonly used
* browser would send. For information about user agents, see [RFC
* 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
*
* @param {string} [options.clientId] Bing uses this header to provide users
* with consistent behavior across Bing API calls. Bing often flights new
* features and improvements, and it uses the client ID as a key for assigning
* traffic on different flights. If you do not use the same client ID for a
* user across multiple requests, then Bing may assign the user to multiple
* conflicting flights. Being assigned to multiple conflicting flights can lead
* to an inconsistent user experience. For example, if the second request has a
* different flight assignment than the first, the experience may be
* unexpected. Also, Bing can use the client ID to tailor web results to that
* client IDs search history, providing a richer experience for the user. Bing
* also uses this header to help improve result rankings by analyzing the
* activity generated by a client ID. The relevance improvements help with
* better quality of results delivered by Bing APIs and in turn enables higher
* click-through rates for the API consumer. IMPORTANT: Although optional, you
* should consider this header required. Persisting the client ID across
* multiple requests for the same end user and device combination enables 1)
* the API consumer to receive a consistent user experience, and 2) higher
* click-through rates via better quality of results from the Bing APIs. Each
* user that uses your application on the device must have a unique, Bing
* generated client ID. If you do not include this header in the request, Bing
* generates an ID and returns it in the X-MSEdge-ClientID response header. The
* only time that you should NOT include this header in a request is the first
* time the user uses your app on that device. Use the client ID for each Bing
* API request that your app makes for this user on the device. Persist the
* client ID. To persist the ID in a browser app, use a persistent HTTP cookie
* to ensure the ID is used across all sessions. Do not use a session cookie.
* For other apps such as mobile apps, use the device's persistent storage to
* persist the ID. The next time the user uses your app on that device, get the
* client ID that you persisted. Bing responses may or may not include this
* header. If the response includes this header, capture the client ID and use
* it for all subsequent Bing requests for the user on that device. If you
* include the X-MSEdge-ClientID, you must not include cookies in the request.
*
* @param {string} [options.clientIp] The IPv4 or IPv6 address of the client
* device. The IP address is used to discover the user's location. Bing uses
* the location information to determine safe search behavior. Although
* optional, you are encouraged to always specify this header and the
* X-Search-Location header. Do not obfuscate the address (for example, by
* changing the last octet to 0). Obfuscating the address results in the
* location not being anywhere near the device's actual location, which may
* result in Bing serving erroneous results.
*
* @param {string} [options.location] A semicolon-delimited list of key/value
* pairs that describe the client's geographical location. Bing uses the
* location information to determine safe search behavior and to return
* relevant local content. Specify the key/value pair as <key>:<value>. The
* following are the keys that you use to specify the user's location. lat
* (required): The latitude of the client's location, in degrees. The latitude
* must be greater than or equal to -90.0 and less than or equal to +90.0.
* Negative values indicate southern latitudes and positive values indicate
* northern latitudes. long (required): The longitude of the client's location,
* in degrees. The longitude must be greater than or equal to -180.0 and less
* than or equal to +180.0. Negative values indicate western longitudes and
* positive values indicate eastern longitudes. re (required): The radius, in
* meters, which specifies the horizontal accuracy of the coordinates. Pass the
* value returned by the device's location service. Typical values might be 22m
* for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP
* lookup. ts (optional): The UTC UNIX timestamp of when the client was at the
* location. (The UNIX timestamp is the number of seconds since January 1,
* 1970.) head (optional): The client's relative heading or direction of
* travel. Specify the direction of travel as degrees from 0 through 360,
* counting clockwise relative to true north. Specify this key only if the sp
* key is nonzero. sp (optional): The horizontal velocity (speed), in meters
* per second, that the client device is traveling. alt (optional): The
* altitude of the client device, in meters. are (optional): The radius, in
* meters, that specifies the vertical accuracy of the coordinates. Specify
* this key only if you specify the alt key. Although many of the keys are
* optional, the more information that you provide, the more accurate the
* location results are. Although optional, you are encouraged to always
* specify the user's geographical location. Providing the location is
* especially important if the client's IP address does not accurately reflect
* the user's physical location (for example, if the client uses VPN). For
* optimal results, you should include this header and the X-MSEdge-ClientIP
* header, but at a minimum, you should include this header.
*
* @param {string} [options.countryCode] A 2-character country code of the
* country where the results come from. This API supports only the United
* States market. If you specify this query parameter, it must be set to us. If
* you set this parameter, you must also specify the Accept-Language header.
* Bing uses the first supported language it finds from the languages list, and
* combine that language with the country code that you specify to determine
* the market to return results for. If the languages list does not include a
* supported language, Bing finds the closest language and market that supports
* the request, or it may use an aggregated or default market for the results
* instead of a specified one. You should use this query parameter and the
* Accept-Language query parameter only if you specify multiple languages;
* otherwise, you should use the mkt and setLang query parameters. This
* parameter and the mkt query parameter are mutually exclusivedo not specify
* both.
*
* @param {string} [options.market] The market where the results come from. You
* are strongly encouraged to always specify the market, if known. Specifying
* the market helps Bing route the request and return an appropriate and
* optimal response. This parameter and the cc query parameter are mutually
* exclusivedo not specify both.
*
* @param {array} [options.responseFilter] A comma-delimited list of answers to
* include in the response. If you do not specify this parameter, the response
* includes all search answers for which there's relevant data.
*
* @param {array} [options.responseFormat] The media type to use for the
* response. The following are the possible case-insensitive values: JSON,
* JSONLD. The default is JSON. If you specify JSONLD, the response body
* includes JSON-LD objects that contain the search results.
*
* @param {string} [options.safeSearch] A filter used to filter adult content.
* Off: Return webpages with adult text, images, or videos. Moderate: Return
* webpages with adult text, but not adult images or videos. Strict: Do not
* return webpages with adult text, images, or videos. The default is Moderate.
* If the request comes from a market that Bing's adult policy requires that
* safeSearch is set to Strict, Bing ignores the safeSearch value and uses
* Strict. If you use the site: query operator, there is the chance that the
* response may contain adult content regardless of what the safeSearch query
* parameter is set to. Use site: only if you are aware of the content on the
* site and your scenario supports the possibility of adult content. Possible
* values include: 'Off', 'Moderate', 'Strict'
*
* @param {string} [options.setLang] The language to use for user interface
* strings. Specify the language using the ISO 639-1 2-letter language code.
* For example, the language code for English is EN. The default is EN
* (English). Although optional, you should always specify the language.
* Typically, you set setLang to the same language specified by mkt unless the
* user wants the user interface strings displayed in a different language.
* This parameter and the Accept-Language header are mutually exclusive; do not
* specify both. A user interface string is a string that's used as a label in
* a user interface. There are few user interface strings in the JSON response
* objects. Also, any links to Bing.com properties in the response objects
* apply the specified language.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<SearchResponse>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
searchWithHttpOperationResponse(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, responseFilter? : string[], responseFormat? : string[], safeSearch? : string, setLang? : string, customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.SearchResponse>>;
/**
* @summary The Entity Search API lets you send a search query to Bing and get
* back search results that include entities and places. Place results include
* restaurants, hotel, or other local businesses. For places, the query can
* specify the name of the local business or it can ask for a list (for
* example, restaurants near me). Entity results include persons, places, or
* things. Place in this context is tourist attractions, states, countries,
* etc.
*
* @param {string} query The user's search term.
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.acceptLanguage] A comma-delimited list of one or
* more languages to use for user interface strings. The list is in decreasing
* order of preference. For additional information, including expected format,
* see [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
* header and the setLang query parameter are mutually exclusive; do not
* specify both. If you set this header, you must also specify the cc query
* parameter. Bing will use the first supported language it finds from the
* list, and combine that language with the cc parameter value to determine the
* market to return results for. If the list does not include a supported
* language, Bing will find the closest language and market that supports the
* request, and may use an aggregated or default market for the results instead
* of a specified one. You should use this header and the cc query parameter
* only if you specify multiple languages; otherwise, you should use the mkt
* and setLang query parameters. A user interface string is a string that's
* used as a label in a user interface. There are very few user interface
* strings in the JSON response objects. Any links in the response objects to
* Bing.com properties will apply the specified language.
*
* @param {string} [options.pragma] By default, Bing returns cached content, if
* available. To prevent Bing from returning cached content, set the Pragma
* header to no-cache (for example, Pragma: no-cache).
*
* @param {string} [options.userAgent] The user agent originating the request.
* Bing uses the user agent to provide mobile users with an optimized
* experience. Although optional, you are strongly encouraged to always specify
* this header. The user-agent should be the same string that any commonly used
* browser would send. For information about user agents, see [RFC
* 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
*
* @param {string} [options.clientId] Bing uses this header to provide users
* with consistent behavior across Bing API calls. Bing often flights new
* features and improvements, and it uses the client ID as a key for assigning
* traffic on different flights. If you do not use the same client ID for a
* user across multiple requests, then Bing may assign the user to multiple
* conflicting flights. Being assigned to multiple conflicting flights can lead
* to an inconsistent user experience. For example, if the second request has a
* different flight assignment than the first, the experience may be
* unexpected. Also, Bing can use the client ID to tailor web results to that
* client IDs search history, providing a richer experience for the user. Bing
* also uses this header to help improve result rankings by analyzing the
* activity generated by a client ID. The relevance improvements help with
* better quality of results delivered by Bing APIs and in turn enables higher
* click-through rates for the API consumer. IMPORTANT: Although optional, you
* should consider this header required. Persisting the client ID across
* multiple requests for the same end user and device combination enables 1)
* the API consumer to receive a consistent user experience, and 2) higher
* click-through rates via better quality of results from the Bing APIs. Each
* user that uses your application on the device must have a unique, Bing
* generated client ID. If you do not include this header in the request, Bing
* generates an ID and returns it in the X-MSEdge-ClientID response header. The
* only time that you should NOT include this header in a request is the first
* time the user uses your app on that device. Use the client ID for each Bing
* API request that your app makes for this user on the device. Persist the
* client ID. To persist the ID in a browser app, use a persistent HTTP cookie
* to ensure the ID is used across all sessions. Do not use a session cookie.
* For other apps such as mobile apps, use the device's persistent storage to
* persist the ID. The next time the user uses your app on that device, get the
* client ID that you persisted. Bing responses may or may not include this
* header. If the response includes this header, capture the client ID and use
* it for all subsequent Bing requests for the user on that device. If you
* include the X-MSEdge-ClientID, you must not include cookies in the request.
*
* @param {string} [options.clientIp] The IPv4 or IPv6 address of the client
* device. The IP address is used to discover the user's location. Bing uses
* the location information to determine safe search behavior. Although
* optional, you are encouraged to always specify this header and the
* X-Search-Location header. Do not obfuscate the address (for example, by
* changing the last octet to 0). Obfuscating the address results in the
* location not being anywhere near the device's actual location, which may
* result in Bing serving erroneous results.
*
* @param {string} [options.location] A semicolon-delimited list of key/value
* pairs that describe the client's geographical location. Bing uses the
* location information to determine safe search behavior and to return
* relevant local content. Specify the key/value pair as <key>:<value>. The
* following are the keys that you use to specify the user's location. lat
* (required): The latitude of the client's location, in degrees. The latitude
* must be greater than or equal to -90.0 and less than or equal to +90.0.
* Negative values indicate southern latitudes and positive values indicate
* northern latitudes. long (required): The longitude of the client's location,
* in degrees. The longitude must be greater than or equal to -180.0 and less
* than or equal to +180.0. Negative values indicate western longitudes and
* positive values indicate eastern longitudes. re (required): The radius, in
* meters, which specifies the horizontal accuracy of the coordinates. Pass the
* value returned by the device's location service. Typical values might be 22m
* for GPS/Wi-Fi, 380m for cell tower triangulation, and 18,000m for reverse IP
* lookup. ts (optional): The UTC UNIX timestamp of when the client was at the
* location. (The UNIX timestamp is the number of seconds since January 1,
* 1970.) head (optional): The client's relative heading or direction of
* travel. Specify the direction of travel as degrees from 0 through 360,
* counting clockwise relative to true north. Specify this key only if the sp
* key is nonzero. sp (optional): The horizontal velocity (speed), in meters
* per second, that the client device is traveling. alt (optional): The
* altitude of the client device, in meters. are (optional): The radius, in
* meters, that specifies the vertical accuracy of the coordinates. Specify
* this key only if you specify the alt key. Although many of the keys are
* optional, the more information that you provide, the more accurate the
* location results are. Although optional, you are encouraged to always
* specify the user's geographical location. Providing the location is
* especially important if the client's IP address does not accurately reflect
* the user's physical location (for example, if the client uses VPN). For
* optimal results, you should include this header and the X-MSEdge-ClientIP
* header, but at a minimum, you should include this header.
*
* @param {string} [options.countryCode] A 2-character country code of the
* country where the results come from. This API supports only the United
* States market. If you specify this query parameter, it must be set to us. If
* you set this parameter, you must also specify the Accept-Language header.
* Bing uses the first supported language it finds from the languages list, and
* combine that language with the country code that you specify to determine
* the market to return results for. If the languages list does not include a
* supported language, Bing finds the closest language and market that supports
* the request, or it may use an aggregated or default market for the results
* instead of a specified one. You should use this query parameter and the
* Accept-Language query parameter only if you specify multiple languages;
* otherwise, you should use the mkt and setLang query parameters. This
* parameter and the mkt query parameter are mutually exclusivedo not specify
* both.
*
* @param {string} [options.market] The market where the results come from. You
* are strongly encouraged to always specify the market, if known. Specifying
* the market helps Bing route the request and return an appropriate and
* optimal response. This parameter and the cc query parameter are mutually
* exclusivedo not specify both.
*
* @param {array} [options.responseFilter] A comma-delimited list of answers to
* include in the response. If you do not specify this parameter, the response
* includes all search answers for which there's relevant data.
*
* @param {array} [options.responseFormat] The media type to use for the
* response. The following are the possible case-insensitive values: JSON,
* JSONLD. The default is JSON. If you specify JSONLD, the response body
* includes JSON-LD objects that contain the search results.
*
* @param {string} [options.safeSearch] A filter used to filter adult content.
* Off: Return webpages with adult text, images, or videos. Moderate: Return
* webpages with adult text, but not adult images or videos. Strict: Do not
* return webpages with adult text, images, or videos. The default is Moderate.
* If the request comes from a market that Bing's adult policy requires that
* safeSearch is set to Strict, Bing ignores the safeSearch value and uses
* Strict. If you use the site: query operator, there is the chance that the
* response may contain adult content regardless of what the safeSearch query
* parameter is set to. Use site: only if you are aware of the content on the
* site and your scenario supports the possibility of adult content. Possible
* values include: 'Off', 'Moderate', 'Strict'
*
* @param {string} [options.setLang] The language to use for user interface
* strings. Specify the language using the ISO 639-1 2-letter language code.
* For example, the language code for English is EN. The default is EN
* (English). Although optional, you should always specify the language.
* Typically, you set setLang to the same language specified by mkt unless the
* user wants the user interface strings displayed in a different language.
* This parameter and the Accept-Language header are mutually exclusive; do not
* specify both. A user interface string is a string that's used as a label in
* a user interface. There are few user interface strings in the JSON response
* objects. Also, any links to Bing.com properties in the response objects
* apply the specified language.
*
* @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 {SearchResponse} - 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.
*
* {SearchResponse} [result] - The deserialized result object if an error did not occur.
* See {@link SearchResponse} 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.
*/
search(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, responseFilter? : string[], responseFormat? : string[], safeSearch? : string, setLang? : string, customHeaders? : { [headerName: string]: string; } }): Promise<models.SearchResponse>;
search(query: string, callback: ServiceCallback<models.SearchResponse>): void;
search(query: string, options: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, responseFilter? : string[], responseFormat? : string[], safeSearch? : string, setLang? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.SearchResponse>): void;
}

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

@ -0,0 +1,17 @@
/*
* 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,35 @@
{
"name": "azure-cognitiveservices-search",
"author": "Microsoft Corporation",
"contributors": [
"Jin, Tony <toji@microsoft.com>"
],
"version": "1.0.0",
"description": "Microsoft Azure Cognitive Services Search API Client Library for Node.js",
"tags": [
"azure",
"sdk"
],
"keywords": [
"node",
"azure"
],
"main": "./lib/cognitiveServicesSearch.js",
"types": "./lib/cognitiveServicesSearch.d.ts",
"license": "MIT",
"dependencies": {
"mocha": "^4.0.1",
"ms-rest": "^2.2.3"
},
"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"
}
}

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

@ -0,0 +1,33 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
const Search = require('../../../lib/services/cognitiveServices.Search/lib/cognitiveServicesSearch');
const ApiSubscriptionKeyServiceCredentials = require('../../../runtime/ms-rest-azure/lib/credentials/apiSubscriptionKeyServiceCredentials');
var assert = require('assert');
describe('Cognitive Services Search', function() {
describe('EntitySearchAPI', function() {
it('should return a valid response', function(done) {
var subscriptionKey = process.env['API_SUBSCRIPTION_KEY']
var credentials = new ApiSubscriptionKeyServiceCredentials(subscriptionKey);
var api = new Search.EntitySearchAPI(credentials);
api.entitiesOperations.search('seahawks', {'market': 'en-us'}, function(err, result, request, response){
if (err) done(err);
assert.notEqual(result, null);
assert.notEqual(result.queryContext, null);
assert.equal(result.queryContext.originalQuery, 'seahawks');
assert.notEqual(result.entities, null);
assert.notEqual(result.entities.value, null);
assert.equal(result.entities.value.length, 1);
assert.notEqual(result.entities.value[0].contractualRules, null);
done();
});
});
});
});

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

@ -0,0 +1,5 @@
Test Configuration Instructions
================================
In order to test against a specific API Key, set the following variables:
API_SUBSCIPTION_KEY

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

@ -20,6 +20,7 @@ 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