From b8a5d0faeb85d62b3178ca714ce87c8a18e3dfd8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 4 Jun 2018 18:07:14 +0000 Subject: [PATCH 1/5] Generated from 3c97f2f096db0a70f33aefeea74399963aecf84b update spec --- lib/services/autosuggest/LICENSE.txt | 21 + .../autosuggest/lib/autoSuggestAPIClient.d.ts | 436 +++++++++ .../autosuggest/lib/autoSuggestAPIClient.js | 866 ++++++++++++++++++ lib/services/autosuggest/lib/models/action.js | 398 ++++++++ lib/services/autosuggest/lib/models/answer.js | 119 +++ .../autosuggest/lib/models/autoSuggest.js | 144 +++ .../autosuggest/lib/models/creativeWork.js | 405 ++++++++ .../autosuggest/lib/models/errorModel.js | 94 ++ .../autosuggest/lib/models/errorResponse.js | 136 +++ .../autosuggest/lib/models/identifiable.js | 70 ++ .../autosuggest/lib/models/index.d.ts | 328 +++++++ lib/services/autosuggest/lib/models/index.js | 43 + .../autosuggest/lib/models/queryContext.js | 117 +++ .../autosuggest/lib/models/response.js | 123 +++ .../autosuggest/lib/models/responseBase.js | 58 ++ .../autosuggest/lib/models/searchAction.js | 425 +++++++++ .../lib/models/searchResultsAnswer.js | 157 ++++ .../lib/models/suggestionsSuggestionGroup.js | 66 ++ lib/services/autosuggest/lib/models/thing.js | 191 ++++ lib/services/autosuggest/package.json | 24 + 20 files changed, 4221 insertions(+) create mode 100644 lib/services/autosuggest/LICENSE.txt create mode 100644 lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts create mode 100644 lib/services/autosuggest/lib/autoSuggestAPIClient.js create mode 100644 lib/services/autosuggest/lib/models/action.js create mode 100644 lib/services/autosuggest/lib/models/answer.js create mode 100644 lib/services/autosuggest/lib/models/autoSuggest.js create mode 100644 lib/services/autosuggest/lib/models/creativeWork.js create mode 100644 lib/services/autosuggest/lib/models/errorModel.js create mode 100644 lib/services/autosuggest/lib/models/errorResponse.js create mode 100644 lib/services/autosuggest/lib/models/identifiable.js create mode 100644 lib/services/autosuggest/lib/models/index.d.ts create mode 100644 lib/services/autosuggest/lib/models/index.js create mode 100644 lib/services/autosuggest/lib/models/queryContext.js create mode 100644 lib/services/autosuggest/lib/models/response.js create mode 100644 lib/services/autosuggest/lib/models/responseBase.js create mode 100644 lib/services/autosuggest/lib/models/searchAction.js create mode 100644 lib/services/autosuggest/lib/models/searchResultsAnswer.js create mode 100644 lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js create mode 100644 lib/services/autosuggest/lib/models/thing.js create mode 100644 lib/services/autosuggest/package.json diff --git a/lib/services/autosuggest/LICENSE.txt b/lib/services/autosuggest/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/autosuggest/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 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. diff --git a/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts b/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts new file mode 100644 index 0000000000..c8958bb799 --- /dev/null +++ b/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts @@ -0,0 +1,436 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import * as models from "./models"; + +export default class AutoSuggestAPIClient extends ServiceClient { + /** + * @class + * Initializes a new instance of the AutoSuggestAPIClient 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; + + + /** + * @summary The AutoSuggest API lets you send a search query to Bing and get + * back a list of suggestions. This section provides technical details about + * the query parameters and headers that you use to request suggestions and the + * JSON response objects that contain them. + * + * @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](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#cc) + * query parameter. To determine the market to return results for, Bing uses + * the first supported language it finds from the list and combines it with the + * cc parameter value. If the list does not include a supported language, Bing + * finds the closest language and market that supports the request or it uses + * an aggregated or default market for the results. To determine the market + * that Bing used, see the BingAPIs-Market header. Use this header and the cc + * query parameter only if you specify multiple languages. Otherwise, use the + * [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#mkt) + * and + * [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#setlang) + * query parameters. 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. Any links to Bing.com properties in the response objects + * 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 encouraged to always specify this + * header. The user-agent should be the same string that any commonly used + * browser sends. For information about user agents, see [RFC + * 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following + * are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible; + * MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; + * Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH - + * I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version / + * 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 + * like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 + * iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + * WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad; + * CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version + * / 7.0 Mobile / 11A465 Safari / 9537.53 + * + * @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 ID’s 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 :. 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 exclusive—do 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 + * exclusive—do not specify both. + * + * @param {string} [options.safeSearch] Filter suggestions for adult content. + * The following are the possible filter values. Off: Return suggestions with + * adult text, images, or videos. Moderate: Return suggestion with adult text + * but not adult images or videos. Strict: Do not return news articles with + * adult text, images, or videos. 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 {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 {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + autoSuggestMethodWithHttpOperationResponse(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary The AutoSuggest API lets you send a search query to Bing and get + * back a list of suggestions. This section provides technical details about + * the query parameters and headers that you use to request suggestions and the + * JSON response objects that contain them. + * + * @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](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#cc) + * query parameter. To determine the market to return results for, Bing uses + * the first supported language it finds from the list and combines it with the + * cc parameter value. If the list does not include a supported language, Bing + * finds the closest language and market that supports the request or it uses + * an aggregated or default market for the results. To determine the market + * that Bing used, see the BingAPIs-Market header. Use this header and the cc + * query parameter only if you specify multiple languages. Otherwise, use the + * [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#mkt) + * and + * [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#setlang) + * query parameters. 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. Any links to Bing.com properties in the response objects + * 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 encouraged to always specify this + * header. The user-agent should be the same string that any commonly used + * browser sends. For information about user agents, see [RFC + * 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following + * are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible; + * MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; + * Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH - + * I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version / + * 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 + * like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 + * iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + * WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad; + * CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version + * / 7.0 Mobile / 11A465 Safari / 9537.53 + * + * @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 ID’s 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 :. 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 exclusive—do 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 + * exclusive—do not specify both. + * + * @param {string} [options.safeSearch] Filter suggestions for adult content. + * The following are the possible filter values. Off: Return suggestions with + * adult text, images, or videos. Moderate: Return suggestion with adult text + * but not adult images or videos. Strict: Do not return news articles with + * adult text, images, or videos. 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 {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 {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 {AutoSuggest} - 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. + * + * {AutoSuggest} [result] - The deserialized result object if an error did not occur. + * See {@link AutoSuggest} 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. + */ + autoSuggestMethod(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise; + autoSuggestMethod(query: string, callback: ServiceCallback): void; + autoSuggestMethod(query: string, options: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +export { AutoSuggestAPIClient, models as AutoSuggestAPIModels }; diff --git a/lib/services/autosuggest/lib/autoSuggestAPIClient.js b/lib/services/autosuggest/lib/autoSuggestAPIClient.js new file mode 100644 index 0000000000..e068f8ee4d --- /dev/null +++ b/lib/services/autosuggest/lib/autoSuggestAPIClient.js @@ -0,0 +1,866 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const ServiceClient = msRest.ServiceClient; +const WebResource = msRest.WebResource; + +const models = require('./models'); + + +/** + * @summary The AutoSuggest API lets you send a search query to Bing and get + * back a list of suggestions. This section provides technical details about + * the query parameters and headers that you use to request suggestions and the + * JSON response objects that contain them. + * + * @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](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#cc) + * query parameter. To determine the market to return results for, Bing uses + * the first supported language it finds from the list and combines it with the + * cc parameter value. If the list does not include a supported language, Bing + * finds the closest language and market that supports the request or it uses + * an aggregated or default market for the results. To determine the market + * that Bing used, see the BingAPIs-Market header. Use this header and the cc + * query parameter only if you specify multiple languages. Otherwise, use the + * [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#mkt) + * and + * [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#setlang) + * query parameters. 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. Any links to Bing.com properties in the response objects + * 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 encouraged to always specify this + * header. The user-agent should be the same string that any commonly used + * browser sends. For information about user agents, see [RFC + * 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following + * are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible; + * MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; + * Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH - + * I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version / + * 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 + * like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 + * iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + * WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad; + * CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version + * / 7.0 Mobile / 11A465 Safari / 9537.53 + * + * @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 ID’s 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 :. 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 exclusive—do 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 + * exclusive—do not specify both. + * + * @param {string} [options.safeSearch] Filter suggestions for adult content. + * The following are the possible filter values. Off: Return suggestions with + * adult text, images, or videos. Moderate: Return suggestion with adult text + * but not adult images or videos. Strict: Do not return news articles with + * adult text, images, or videos. 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 {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 {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 AutoSuggest} 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 _autoSuggestMethod(query, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + 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 : 'en-us'; + let safeSearch = (options && options.safeSearch !== undefined) ? options.safeSearch : undefined; + let setLang = (options && options.setLang !== undefined) ? options.setLang : undefined; + let responseFormat = (options && options.responseFormat !== undefined) ? options.responseFormat : undefined; + let xBingApisSDK = 'true'; + // 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 (safeSearch !== null && safeSearch !== undefined && typeof safeSearch.valueOf() !== 'string') { + throw new Error('safeSearch must be of type string.'); + } + if (setLang !== null && setLang !== undefined && typeof setLang.valueOf() !== 'string') { + throw new Error('setLang must be of type string.'); + } + if (Array.isArray(responseFormat)) { + for (let i = 0; i < responseFormat.length; i++) { + if (responseFormat[i] !== null && responseFormat[i] !== undefined && typeof responseFormat[i].valueOf() !== 'string') { + throw new Error('responseFormat[i] must be of type string.'); + } + } + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'Suggestions'; + 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 (safeSearch !== null && safeSearch !== undefined) { + queryParameters.push('safeSearch=' + encodeURIComponent(safeSearch)); + } + if (setLang !== null && setLang !== undefined) { + queryParameters.push('setLang=' + encodeURIComponent(setLang)); + } + if (responseFormat !== null && responseFormat !== undefined) { + queryParameters.push('ResponseFormat=' + encodeURIComponent(responseFormat.join(','))); + } + 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 (xBingApisSDK !== undefined && xBingApisSDK !== null) { + httpRequest.headers['X-BingApis-SDK'] = xBingApisSDK; + } + 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['AutoSuggest']().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 AutoSuggestAPIClient. */ +class AutoSuggestAPIClient extends ServiceClient { + /** + * Create a AutoSuggestAPIClient. + * @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.models = models; + this._autoSuggestMethod = _autoSuggestMethod; + msRest.addSerializationMixin(this); + } + + /** + * @summary The AutoSuggest API lets you send a search query to Bing and get + * back a list of suggestions. This section provides technical details about + * the query parameters and headers that you use to request suggestions and the + * JSON response objects that contain them. + * + * @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](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#cc) + * query parameter. To determine the market to return results for, Bing uses + * the first supported language it finds from the list and combines it with the + * cc parameter value. If the list does not include a supported language, Bing + * finds the closest language and market that supports the request or it uses + * an aggregated or default market for the results. To determine the market + * that Bing used, see the BingAPIs-Market header. Use this header and the cc + * query parameter only if you specify multiple languages. Otherwise, use the + * [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#mkt) + * and + * [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#setlang) + * query parameters. 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. Any links to Bing.com properties in the response objects + * 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 encouraged to always specify this + * header. The user-agent should be the same string that any commonly used + * browser sends. For information about user agents, see [RFC + * 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following + * are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible; + * MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; + * Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH - + * I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version / + * 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 + * like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 + * iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + * WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad; + * CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version + * / 7.0 Mobile / 11A465 Safari / 9537.53 + * + * @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 ID’s 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 :. 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 exclusive—do 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 + * exclusive—do not specify both. + * + * @param {string} [options.safeSearch] Filter suggestions for adult content. + * The following are the possible filter values. Off: Return suggestions with + * adult text, images, or videos. Moderate: Return suggestion with adult text + * but not adult images or videos. Strict: Do not return news articles with + * adult text, images, or videos. 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 {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 {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + autoSuggestMethodWithHttpOperationResponse(query, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._autoSuggestMethod(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 AutoSuggest API lets you send a search query to Bing and get + * back a list of suggestions. This section provides technical details about + * the query parameters and headers that you use to request suggestions and the + * JSON response objects that contain them. + * + * @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](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#cc) + * query parameter. To determine the market to return results for, Bing uses + * the first supported language it finds from the list and combines it with the + * cc parameter value. If the list does not include a supported language, Bing + * finds the closest language and market that supports the request or it uses + * an aggregated or default market for the results. To determine the market + * that Bing used, see the BingAPIs-Market header. Use this header and the cc + * query parameter only if you specify multiple languages. Otherwise, use the + * [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#mkt) + * and + * [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-autosuggest-api-v7-reference#setlang) + * query parameters. 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. Any links to Bing.com properties in the response objects + * 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 encouraged to always specify this + * header. The user-agent should be the same string that any commonly used + * browser sends. For information about user agents, see [RFC + * 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following + * are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible; + * MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; + * Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH - + * I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version / + * 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1 + * like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142 + * iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3; + * WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad; + * CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version + * / 7.0 Mobile / 11A465 Safari / 9537.53 + * + * @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 ID’s 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 :. 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 exclusive—do 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 + * exclusive—do not specify both. + * + * @param {string} [options.safeSearch] Filter suggestions for adult content. + * The following are the possible filter values. Off: Return suggestions with + * adult text, images, or videos. Moderate: Return suggestion with adult text + * but not adult images or videos. Strict: Do not return news articles with + * adult text, images, or videos. 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 {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 {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 {AutoSuggest} - 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 AutoSuggest} 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. + */ + autoSuggestMethod(query, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._autoSuggestMethod(query, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._autoSuggestMethod(query, options, optionalCallback); + } + } + +} + +module.exports = AutoSuggestAPIClient; +module.exports['default'] = AutoSuggestAPIClient; +module.exports.AutoSuggestAPIClient = AutoSuggestAPIClient; +module.exports.AutoSuggestAPIModels = models; diff --git a/lib/services/autosuggest/lib/models/action.js b/lib/services/autosuggest/lib/models/action.js new file mode 100644 index 0000000000..772a290771 --- /dev/null +++ b/lib/services/autosuggest/lib/models/action.js @@ -0,0 +1,398 @@ +/* + * 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 Action. + * @extends models['CreativeWork'] + */ +class Action extends models['CreativeWork'] { + /** + * Create a Action. + * @member {array} [result] + * @member {string} [displayName] + * @member {boolean} [isTopAction] + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Action + * + * @returns {object} metadata of Action + * + */ + mapper() { + return { + required: false, + serializedName: 'Action', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + wikipediaId: { + required: false, + readOnly: true, + serializedName: 'wikipediaId', + type: { + name: 'String' + } + }, + freebaseId: { + required: false, + readOnly: true, + serializedName: 'freebaseId', + type: { + name: 'String' + } + }, + alternateName: { + required: false, + readOnly: true, + serializedName: 'alternateName', + type: { + name: 'String' + } + }, + bingId: { + required: false, + readOnly: true, + serializedName: 'bingId', + type: { + name: 'String' + } + }, + satoriId: { + required: false, + readOnly: true, + serializedName: 'satoriId', + type: { + name: 'String' + } + }, + ypId: { + required: false, + readOnly: true, + serializedName: 'ypId', + type: { + name: 'String' + } + }, + about: { + required: false, + readOnly: true, + serializedName: 'about', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + mentions: { + required: false, + readOnly: true, + serializedName: 'mentions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + creator: { + required: false, + readOnly: true, + serializedName: 'creator', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + text: { + required: false, + readOnly: true, + serializedName: 'text', + type: { + name: 'String' + } + }, + commentCount: { + required: false, + readOnly: true, + serializedName: 'commentCount', + type: { + name: 'Number' + } + }, + mainEntity: { + required: false, + readOnly: true, + serializedName: 'mainEntity', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + headLine: { + required: false, + readOnly: true, + serializedName: 'headLine', + type: { + name: 'String' + } + }, + copyrightHolder: { + required: false, + readOnly: true, + serializedName: 'copyrightHolder', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + copyrightYear: { + required: false, + readOnly: true, + serializedName: 'copyrightYear', + type: { + name: 'Number' + } + }, + disclaimer: { + required: false, + readOnly: true, + serializedName: 'disclaimer', + type: { + name: 'String' + } + }, + isAccessibleForFree: { + required: false, + readOnly: true, + serializedName: 'isAccessibleForFree', + type: { + name: 'Boolean' + } + }, + genre: { + required: false, + readOnly: true, + serializedName: 'genre', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isFamilyFriendly: { + required: false, + readOnly: true, + serializedName: 'isFamilyFriendly', + type: { + name: 'Boolean' + } + }, + result: { + required: false, + readOnly: true, + serializedName: 'result', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + isTopAction: { + required: false, + readOnly: true, + serializedName: 'isTopAction', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = Action; diff --git a/lib/services/autosuggest/lib/models/answer.js b/lib/services/autosuggest/lib/models/answer.js new file mode 100644 index 0000000000..4dab72080f --- /dev/null +++ b/lib/services/autosuggest/lib/models/answer.js @@ -0,0 +1,119 @@ +/* + * 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 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', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Answer', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Answer; diff --git a/lib/services/autosuggest/lib/models/autoSuggest.js b/lib/services/autosuggest/lib/models/autoSuggest.js new file mode 100644 index 0000000000..50b117b0de --- /dev/null +++ b/lib/services/autosuggest/lib/models/autoSuggest.js @@ -0,0 +1,144 @@ +/* + * 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 AutoSuggest answer + * + * @extends models['SearchResultsAnswer'] + */ +class AutoSuggest extends models['SearchResultsAnswer'] { + /** + * Create a AutoSuggest. + * @member {array} suggestionGroups + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutoSuggest + * + * @returns {object} metadata of AutoSuggest + * + */ + mapper() { + return { + required: false, + serializedName: 'AutoSuggest', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'AutoSuggest', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + queryContext: { + required: false, + readOnly: true, + serializedName: 'queryContext', + type: { + name: 'Composite', + className: 'QueryContext' + } + }, + suggestionGroups: { + required: true, + serializedName: 'suggestionGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SuggestionsSuggestionGroupElementType', + type: { + name: 'Composite', + className: 'SuggestionsSuggestionGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = AutoSuggest; diff --git a/lib/services/autosuggest/lib/models/creativeWork.js b/lib/services/autosuggest/lib/models/creativeWork.js new file mode 100644 index 0000000000..633a4b9800 --- /dev/null +++ b/lib/services/autosuggest/lib/models/creativeWork.js @@ -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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The most generic kind of creative work, including books, movies, + * photographs, software programs, etc. + * + * @extends models['Thing'] + */ +class CreativeWork extends models['Thing'] { + /** + * Create a CreativeWork. + * @member {array} [about] For internal use only. + * @member {array} [mentions] For internal use only. + * @member {array} [provider] The source of the creative work. + * @member {object} [creator] + * @member {string} [creator.name] The name of the thing represented by this + * object. + * @member {string} [creator.description] A short description of the item. + * @member {string} [creator.wikipediaId] + * @member {string} [creator.freebaseId] + * @member {string} [creator.alternateName] An alias for the item + * @member {string} [creator.bingId] An ID that uniquely identifies this + * item. + * @member {string} [creator.satoriId] + * @member {string} [creator.ypId] + * @member {string} [text] Text content of this creative work + * @member {number} [commentCount] + * @member {object} [mainEntity] + * @member {string} [mainEntity.name] The name of the thing represented by + * this object. + * @member {string} [mainEntity.description] A short description of the item. + * @member {string} [mainEntity.wikipediaId] + * @member {string} [mainEntity.freebaseId] + * @member {string} [mainEntity.alternateName] An alias for the item + * @member {string} [mainEntity.bingId] An ID that uniquely identifies this + * item. + * @member {string} [mainEntity.satoriId] + * @member {string} [mainEntity.ypId] + * @member {string} [headLine] + * @member {object} [copyrightHolder] + * @member {string} [copyrightHolder.name] The name of the thing represented + * by this object. + * @member {string} [copyrightHolder.description] A short description of the + * item. + * @member {string} [copyrightHolder.wikipediaId] + * @member {string} [copyrightHolder.freebaseId] + * @member {string} [copyrightHolder.alternateName] An alias for the item + * @member {string} [copyrightHolder.bingId] An ID that uniquely identifies + * this item. + * @member {string} [copyrightHolder.satoriId] + * @member {string} [copyrightHolder.ypId] + * @member {number} [copyrightYear] + * @member {string} [disclaimer] + * @member {boolean} [isAccessibleForFree] + * @member {array} [genre] + * @member {boolean} [isFamilyFriendly] + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CreativeWork + * + * @returns {object} metadata of CreativeWork + * + */ + mapper() { + return { + required: false, + serializedName: 'CreativeWork', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'CreativeWork', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + wikipediaId: { + required: false, + readOnly: true, + serializedName: 'wikipediaId', + type: { + name: 'String' + } + }, + freebaseId: { + required: false, + readOnly: true, + serializedName: 'freebaseId', + type: { + name: 'String' + } + }, + alternateName: { + required: false, + readOnly: true, + serializedName: 'alternateName', + type: { + name: 'String' + } + }, + bingId: { + required: false, + readOnly: true, + serializedName: 'bingId', + type: { + name: 'String' + } + }, + satoriId: { + required: false, + readOnly: true, + serializedName: 'satoriId', + type: { + name: 'String' + } + }, + ypId: { + required: false, + readOnly: true, + serializedName: 'ypId', + type: { + name: 'String' + } + }, + about: { + required: false, + readOnly: true, + serializedName: 'about', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + mentions: { + required: false, + readOnly: true, + serializedName: 'mentions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + creator: { + required: false, + readOnly: true, + serializedName: 'creator', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + text: { + required: false, + readOnly: true, + serializedName: 'text', + type: { + name: 'String' + } + }, + commentCount: { + required: false, + readOnly: true, + serializedName: 'commentCount', + type: { + name: 'Number' + } + }, + mainEntity: { + required: false, + readOnly: true, + serializedName: 'mainEntity', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + headLine: { + required: false, + readOnly: true, + serializedName: 'headLine', + type: { + name: 'String' + } + }, + copyrightHolder: { + required: false, + readOnly: true, + serializedName: 'copyrightHolder', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + copyrightYear: { + required: false, + readOnly: true, + serializedName: 'copyrightYear', + type: { + name: 'Number' + } + }, + disclaimer: { + required: false, + readOnly: true, + serializedName: 'disclaimer', + type: { + name: 'String' + } + }, + isAccessibleForFree: { + required: false, + readOnly: true, + serializedName: 'isAccessibleForFree', + type: { + name: 'Boolean' + } + }, + genre: { + required: false, + readOnly: true, + serializedName: 'genre', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isFamilyFriendly: { + required: false, + readOnly: true, + serializedName: 'isFamilyFriendly', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = CreativeWork; diff --git a/lib/services/autosuggest/lib/models/errorModel.js b/lib/services/autosuggest/lib/models/errorModel.js new file mode 100644 index 0000000000..46f9da6943 --- /dev/null +++ b/lib/services/autosuggest/lib/models/errorModel.js @@ -0,0 +1,94 @@ +/* + * 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} message A description of the error. + * @member {string} [moreDetails] A description that provides additional + * information about the error. + * @member {string} [parameter] The parameter in the request that caused the + * error. + * @member {string} [value] The parameter's value in the request that was not + * valid. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: true, + serializedName: 'code', + defaultValue: 'None', + type: { + name: 'String' + } + }, + message: { + required: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + moreDetails: { + required: false, + readOnly: true, + serializedName: 'moreDetails', + type: { + name: 'String' + } + }, + parameter: { + required: false, + readOnly: true, + serializedName: 'parameter', + type: { + name: 'String' + } + }, + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/autosuggest/lib/models/errorResponse.js b/lib/services/autosuggest/lib/models/errorResponse.js new file mode 100644 index 0000000000..c72e96369b --- /dev/null +++ b/lib/services/autosuggest/lib/models/errorResponse.js @@ -0,0 +1,136 @@ +/* + * 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', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'ErrorResponse', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + errors: { + required: true, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorModelElementType', + type: { + name: 'Composite', + className: 'ErrorModel' + } + } + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/autosuggest/lib/models/identifiable.js b/lib/services/autosuggest/lib/models/identifiable.js new file mode 100644 index 0000000000..6cc9e3d679 --- /dev/null +++ b/lib/services/autosuggest/lib/models/identifiable.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines the identity of a resource. + * + * @extends models['ResponseBase'] + */ +class Identifiable extends models['ResponseBase'] { + /** + * Create a Identifiable. + * @member {string} [id] A String identifier. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Identifiable + * + * @returns {object} metadata of Identifiable + * + */ + mapper() { + return { + required: false, + serializedName: 'Identifiable', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Identifiable', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Identifiable; diff --git a/lib/services/autosuggest/lib/models/index.d.ts b/lib/services/autosuggest/lib/models/index.d.ts new file mode 100644 index 0000000000..0e09af901e --- /dev/null +++ b/lib/services/autosuggest/lib/models/index.d.ts @@ -0,0 +1,328 @@ +/* + * 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 ResponseBase class. + * @constructor + * Response base + * + * @member {string} _type Polymorphic Discriminator + */ +export interface ResponseBase { + _type: string; +} + +/** + * @class + * Initializes a new instance of the Identifiable class. + * @constructor + * Defines the identity of a resource. + * + * @member {string} [id] A String identifier. + */ +export interface Identifiable extends ResponseBase { + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the Response class. + * @constructor + * Defines a response. All schemas that could be returned at the root of a + * response should inherit from this + * + * @member {array} [potentialAction] + * @member {array} [immediateAction] + * @member {string} [adaptiveCard] + */ +export interface Response extends Identifiable { + readonly potentialAction?: Action[]; + readonly immediateAction?: Action[]; + readonly adaptiveCard?: string; +} + +/** + * @class + * Initializes a new instance of the Thing class. + * @constructor + * Defines a thing. + * + * @member {string} [name] The name of the thing represented by this object. + * @member {string} [description] A short description of the item. + * @member {string} [wikipediaId] + * @member {string} [freebaseId] + * @member {string} [alternateName] An alias for the item + * @member {string} [bingId] An ID that uniquely identifies this item. + * @member {string} [satoriId] + * @member {string} [ypId] + */ +export interface Thing extends Response { + readonly name?: string; + readonly description?: string; + readonly wikipediaId?: string; + readonly freebaseId?: string; + readonly alternateName?: string; + readonly bingId?: string; + readonly satoriId?: string; + readonly ypId?: string; +} + +/** + * @class + * Initializes a new instance of the CreativeWork class. + * @constructor + * The most generic kind of creative work, including books, movies, + * photographs, software programs, etc. + * + * @member {array} [about] For internal use only. + * @member {array} [mentions] For internal use only. + * @member {array} [provider] The source of the creative work. + * @member {object} [creator] + * @member {string} [creator.name] The name of the thing represented by this + * object. + * @member {string} [creator.description] A short description of the item. + * @member {string} [creator.wikipediaId] + * @member {string} [creator.freebaseId] + * @member {string} [creator.alternateName] An alias for the item + * @member {string} [creator.bingId] An ID that uniquely identifies this item. + * @member {string} [creator.satoriId] + * @member {string} [creator.ypId] + * @member {string} [text] Text content of this creative work + * @member {number} [commentCount] + * @member {object} [mainEntity] + * @member {string} [mainEntity.name] The name of the thing represented by this + * object. + * @member {string} [mainEntity.description] A short description of the item. + * @member {string} [mainEntity.wikipediaId] + * @member {string} [mainEntity.freebaseId] + * @member {string} [mainEntity.alternateName] An alias for the item + * @member {string} [mainEntity.bingId] An ID that uniquely identifies this + * item. + * @member {string} [mainEntity.satoriId] + * @member {string} [mainEntity.ypId] + * @member {string} [headLine] + * @member {object} [copyrightHolder] + * @member {string} [copyrightHolder.name] The name of the thing represented by + * this object. + * @member {string} [copyrightHolder.description] A short description of the + * item. + * @member {string} [copyrightHolder.wikipediaId] + * @member {string} [copyrightHolder.freebaseId] + * @member {string} [copyrightHolder.alternateName] An alias for the item + * @member {string} [copyrightHolder.bingId] An ID that uniquely identifies + * this item. + * @member {string} [copyrightHolder.satoriId] + * @member {string} [copyrightHolder.ypId] + * @member {number} [copyrightYear] + * @member {string} [disclaimer] + * @member {boolean} [isAccessibleForFree] + * @member {array} [genre] + * @member {boolean} [isFamilyFriendly] + */ +export interface CreativeWork extends Thing { + readonly about?: Thing[]; + readonly mentions?: Thing[]; + readonly provider?: Thing[]; + readonly creator?: Thing; + readonly text?: string; + readonly commentCount?: number; + readonly mainEntity?: Thing; + readonly headLine?: string; + readonly copyrightHolder?: Thing; + readonly copyrightYear?: number; + readonly disclaimer?: string; + readonly isAccessibleForFree?: boolean; + readonly genre?: string[]; + readonly isFamilyFriendly?: boolean; +} + +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * @member {array} [result] + * @member {string} [displayName] + * @member {boolean} [isTopAction] + */ +export interface Action extends CreativeWork { + readonly result?: Thing[]; + readonly displayName?: string; + readonly isTopAction?: boolean; +} + +/** + * @class + * Initializes a new instance of the SearchAction class. + * @constructor + * @member {string} [displayText] + * @member {string} [query] + * @member {string} [searchKind] Possible values include: 'WebSearch', + * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', + * 'CustomSearch'. Default value: 'WebSearch' . + */ +export interface SearchAction extends Action { + readonly displayText?: string; + readonly query?: string; + readonly searchKind?: string; +} + +/** + * @class + * Initializes a new instance of the SuggestionsSuggestionGroup class. + * @constructor + * @member {array} searchSuggestions + */ +export interface SuggestionsSuggestionGroup { + searchSuggestions: SearchAction[]; +} + +/** + * @class + * Initializes a new instance of the Answer class. + * @constructor + * Defines an answer. + * + */ +export interface Answer extends Response { +} + +/** + * @class + * Initializes a new instance of the SearchResultsAnswer class. + * @constructor + * Defines a search result answer. + * + * @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". + * @member {boolean} [queryContext.isTransactional] + */ +export interface SearchResultsAnswer extends Answer { + readonly queryContext?: QueryContext; +} + +/** + * @class + * Initializes a new instance of the AutoSuggest class. + * @constructor + * Defines an AutoSuggest answer + * + * @member {array} suggestionGroups + */ +export interface AutoSuggest extends SearchResultsAnswer { + suggestionGroups: SuggestionsSuggestionGroup[]; +} + +/** + * @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". + * @member {boolean} [isTransactional] + */ +export interface QueryContext { + originalQuery: string; + readonly alteredQuery?: string; + readonly alterationOverrideQuery?: string; + readonly adultIntent?: boolean; + readonly askUserForLocation?: boolean; + readonly isTransactional?: boolean; +} + +/** + * @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} 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; + 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[]; +} diff --git a/lib/services/autosuggest/lib/models/index.js b/lib/services/autosuggest/lib/models/index.js new file mode 100644 index 0000000000..8c9dbf5425 --- /dev/null +++ b/lib/services/autosuggest/lib/models/index.js @@ -0,0 +1,43 @@ +/* + * 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.ResponseBase = require('./responseBase'); +exports.Identifiable = require('./identifiable'); +exports.Response = require('./response'); +exports.Thing = require('./thing'); +exports.CreativeWork = require('./creativeWork'); +exports.Action = require('./action'); +exports.SearchAction = require('./searchAction'); +exports.SuggestionsSuggestionGroup = require('./suggestionsSuggestionGroup'); +exports.Answer = require('./answer'); +exports.SearchResultsAnswer = require('./searchResultsAnswer'); +exports.AutoSuggest = require('./autoSuggest'); +exports.QueryContext = require('./queryContext'); +exports.ErrorModel = require('./errorModel'); +exports.ErrorResponse = require('./errorResponse'); +exports.discriminators = { + 'ResponseBase.SearchAction' : exports.SearchAction, + 'ResponseBase.AutoSuggest' : exports.AutoSuggest, + 'ResponseBase.SearchResultsAnswer' : exports.SearchResultsAnswer, + 'ResponseBase.Answer' : exports.Answer, + 'ResponseBase.Thing' : exports.Thing, + 'ResponseBase.Action' : exports.Action, + 'ResponseBase.Response' : exports.Response, + 'ResponseBase.Identifiable' : exports.Identifiable, + 'ResponseBase.ErrorResponse' : exports.ErrorResponse, + 'ResponseBase' : exports.ResponseBase, + 'ResponseBase.CreativeWork' : exports.CreativeWork +}; diff --git a/lib/services/autosuggest/lib/models/queryContext.js b/lib/services/autosuggest/lib/models/queryContext.js new file mode 100644 index 0000000000..348f2ae1bd --- /dev/null +++ b/lib/services/autosuggest/lib/models/queryContext.js @@ -0,0 +1,117 @@ +/* + * 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". + * @member {boolean} [isTransactional] + */ + 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' + } + }, + isTransactional: { + required: false, + readOnly: true, + serializedName: 'isTransactional', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = QueryContext; diff --git a/lib/services/autosuggest/lib/models/response.js b/lib/services/autosuggest/lib/models/response.js new file mode 100644 index 0000000000..b010bc10eb --- /dev/null +++ b/lib/services/autosuggest/lib/models/response.js @@ -0,0 +1,123 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Defines a response. All schemas that could be returned at the root of a + * response should inherit from this + * + * @extends models['Identifiable'] + */ +class Response extends models['Identifiable'] { + /** + * Create a Response. + * @member {array} [potentialAction] + * @member {array} [immediateAction] + * @member {string} [adaptiveCard] + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Response + * + * @returns {object} metadata of Response + * + */ + mapper() { + return { + required: false, + serializedName: 'Response', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Response', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Response; diff --git a/lib/services/autosuggest/lib/models/responseBase.js b/lib/services/autosuggest/lib/models/responseBase.js new file mode 100644 index 0000000000..28a5d0d020 --- /dev/null +++ b/lib/services/autosuggest/lib/models/responseBase.js @@ -0,0 +1,58 @@ +/* + * 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'; + +/** + * Response base + * + */ +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', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResponseBase; diff --git a/lib/services/autosuggest/lib/models/searchAction.js b/lib/services/autosuggest/lib/models/searchAction.js new file mode 100644 index 0000000000..27ef7023d5 --- /dev/null +++ b/lib/services/autosuggest/lib/models/searchAction.js @@ -0,0 +1,425 @@ +/* + * 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 SearchAction. + * @extends models['Action'] + */ +class SearchAction extends models['Action'] { + /** + * Create a SearchAction. + * @member {string} [displayText] + * @member {string} [query] + * @member {string} [searchKind] Possible values include: 'WebSearch', + * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', + * 'CustomSearch'. Default value: 'WebSearch' . + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SearchAction + * + * @returns {object} metadata of SearchAction + * + */ + mapper() { + return { + required: false, + serializedName: 'SearchAction', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'SearchAction', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + wikipediaId: { + required: false, + readOnly: true, + serializedName: 'wikipediaId', + type: { + name: 'String' + } + }, + freebaseId: { + required: false, + readOnly: true, + serializedName: 'freebaseId', + type: { + name: 'String' + } + }, + alternateName: { + required: false, + readOnly: true, + serializedName: 'alternateName', + type: { + name: 'String' + } + }, + bingId: { + required: false, + readOnly: true, + serializedName: 'bingId', + type: { + name: 'String' + } + }, + satoriId: { + required: false, + readOnly: true, + serializedName: 'satoriId', + type: { + name: 'String' + } + }, + ypId: { + required: false, + readOnly: true, + serializedName: 'ypId', + type: { + name: 'String' + } + }, + about: { + required: false, + readOnly: true, + serializedName: 'about', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + mentions: { + required: false, + readOnly: true, + serializedName: 'mentions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + creator: { + required: false, + readOnly: true, + serializedName: 'creator', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + text: { + required: false, + readOnly: true, + serializedName: 'text', + type: { + name: 'String' + } + }, + commentCount: { + required: false, + readOnly: true, + serializedName: 'commentCount', + type: { + name: 'Number' + } + }, + mainEntity: { + required: false, + readOnly: true, + serializedName: 'mainEntity', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + headLine: { + required: false, + readOnly: true, + serializedName: 'headLine', + type: { + name: 'String' + } + }, + copyrightHolder: { + required: false, + readOnly: true, + serializedName: 'copyrightHolder', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + copyrightYear: { + required: false, + readOnly: true, + serializedName: 'copyrightYear', + type: { + name: 'Number' + } + }, + disclaimer: { + required: false, + readOnly: true, + serializedName: 'disclaimer', + type: { + name: 'String' + } + }, + isAccessibleForFree: { + required: false, + readOnly: true, + serializedName: 'isAccessibleForFree', + type: { + name: 'Boolean' + } + }, + genre: { + required: false, + readOnly: true, + serializedName: 'genre', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isFamilyFriendly: { + required: false, + readOnly: true, + serializedName: 'isFamilyFriendly', + type: { + name: 'Boolean' + } + }, + result: { + required: false, + readOnly: true, + serializedName: 'result', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + isTopAction: { + required: false, + readOnly: true, + serializedName: 'isTopAction', + type: { + name: 'Boolean' + } + }, + displayText: { + required: false, + readOnly: true, + serializedName: 'displayText', + type: { + name: 'String' + } + }, + query: { + required: false, + readOnly: true, + serializedName: 'query', + type: { + name: 'String' + } + }, + searchKind: { + required: false, + readOnly: true, + serializedName: 'searchKind', + defaultValue: 'WebSearch', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SearchAction; diff --git a/lib/services/autosuggest/lib/models/searchResultsAnswer.js b/lib/services/autosuggest/lib/models/searchResultsAnswer.js new file mode 100644 index 0000000000..0f5e6b2d5f --- /dev/null +++ b/lib/services/autosuggest/lib/models/searchResultsAnswer.js @@ -0,0 +1,157 @@ +/* + * 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 search result answer. + * + * @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". + * @member {boolean} [queryContext.isTransactional] + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SearchResultsAnswer + * + * @returns {object} metadata of SearchResultsAnswer + * + */ + mapper() { + return { + required: false, + serializedName: 'SearchResultsAnswer', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'SearchResultsAnswer', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + queryContext: { + required: false, + readOnly: true, + serializedName: 'queryContext', + type: { + name: 'Composite', + className: 'QueryContext' + } + } + } + } + }; + } +} + +module.exports = SearchResultsAnswer; diff --git a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js new file mode 100644 index 0000000000..99507508f3 --- /dev/null +++ b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js @@ -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'; + +const models = require('./index'); + +/** + * Class representing a SuggestionsSuggestionGroup. + */ +class SuggestionsSuggestionGroup { + /** + * Create a SuggestionsSuggestionGroup. + * @member {array} searchSuggestions + */ + constructor() { + } + + /** + * Defines the metadata of SuggestionsSuggestionGroup + * + * @returns {object} metadata of SuggestionsSuggestionGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'Suggestions/SuggestionGroup', + type: { + name: 'Composite', + className: 'SuggestionsSuggestionGroup', + modelProperties: { + searchSuggestions: { + required: true, + serializedName: 'searchSuggestions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SearchActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'SearchAction' + } + } + } + } + } + } + }; + } +} + +module.exports = SuggestionsSuggestionGroup; diff --git a/lib/services/autosuggest/lib/models/thing.js b/lib/services/autosuggest/lib/models/thing.js new file mode 100644 index 0000000000..425b058fea --- /dev/null +++ b/lib/services/autosuggest/lib/models/thing.js @@ -0,0 +1,191 @@ +/* + * 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 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} [description] A short description of the item. + * @member {string} [wikipediaId] + * @member {string} [freebaseId] + * @member {string} [alternateName] An alias for the item + * @member {string} [bingId] An ID that uniquely identifies this item. + * @member {string} [satoriId] + * @member {string} [ypId] + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Thing + * + * @returns {object} metadata of Thing + * + */ + mapper() { + return { + required: false, + serializedName: 'Thing', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + wikipediaId: { + required: false, + readOnly: true, + serializedName: 'wikipediaId', + type: { + name: 'String' + } + }, + freebaseId: { + required: false, + readOnly: true, + serializedName: 'freebaseId', + type: { + name: 'String' + } + }, + alternateName: { + required: false, + readOnly: true, + serializedName: 'alternateName', + type: { + name: 'String' + } + }, + bingId: { + required: false, + readOnly: true, + serializedName: 'bingId', + type: { + name: 'String' + } + }, + satoriId: { + required: false, + readOnly: true, + serializedName: 'satoriId', + type: { + name: 'String' + } + }, + ypId: { + required: false, + readOnly: true, + serializedName: 'ypId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Thing; diff --git a/lib/services/autosuggest/package.json b/lib/services/autosuggest/package.json new file mode 100644 index 0000000000..279f5a7700 --- /dev/null +++ b/lib/services/autosuggest/package.json @@ -0,0 +1,24 @@ +{ + "name": "azure-cognitiveservices-autosuggest", + "author": "Microsoft Corporation", + "description": "AutoSuggestAPIClient Library with typescript type definitions for node", + "version": "1.1.0", + "dependencies": { + "ms-rest": "^2.3.3" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/autoSuggestAPIClient.js", + "types": "./lib/autoSuggestAPIClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +} From 9ec3925695326ba4eb5d171b1221ade5e1d78cc0 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 6 Jun 2018 23:43:31 +0000 Subject: [PATCH 2/5] Generated from 78b0ffab51e34bd623178af8fbae067f755aa447 add name in SuggestionGroup --- lib/services/autosuggest/lib/models/index.d.ts | 4 ++++ .../lib/models/suggestionsSuggestionGroup.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/services/autosuggest/lib/models/index.d.ts b/lib/services/autosuggest/lib/models/index.d.ts index 0e09af901e..272f228100 100644 --- a/lib/services/autosuggest/lib/models/index.d.ts +++ b/lib/services/autosuggest/lib/models/index.d.ts @@ -181,9 +181,13 @@ export interface SearchAction extends Action { * @class * Initializes a new instance of the SuggestionsSuggestionGroup class. * @constructor + * @member {string} name Possible values include: 'Unknown', 'Web', + * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', + * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . * @member {array} searchSuggestions */ export interface SuggestionsSuggestionGroup { + name: string; searchSuggestions: SearchAction[]; } diff --git a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js index 99507508f3..7a8cc304d2 100644 --- a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js +++ b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js @@ -18,6 +18,9 @@ const models = require('./index'); class SuggestionsSuggestionGroup { /** * Create a SuggestionsSuggestionGroup. + * @member {string} name Possible values include: 'Unknown', 'Web', + * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', + * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . * @member {array} searchSuggestions */ constructor() { @@ -37,6 +40,14 @@ class SuggestionsSuggestionGroup { name: 'Composite', className: 'SuggestionsSuggestionGroup', modelProperties: { + name: { + required: true, + serializedName: 'name', + defaultValue: 'Unknown', + type: { + name: 'String' + } + }, searchSuggestions: { required: true, serializedName: 'searchSuggestions', From a8bd17509eaf4f38f039eb867b45b9d1f7233663 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 7 Jun 2018 03:43:19 +0000 Subject: [PATCH 3/5] Generated from 65c2b3d0a8d19d23482be01dec65f6618306470c update spec --- .../autosuggest/lib/autoSuggestAPIClient.d.ts | 16 +- .../autosuggest/lib/autoSuggestAPIClient.js | 24 +- .../autosuggest/lib/models/index.d.ts | 265 ++++++------- lib/services/autosuggest/lib/models/index.js | 15 +- .../autosuggest/lib/models/searchAction.js | 364 +----------------- .../autosuggest/lib/models/suggestions.js | 144 +++++++ .../lib/models/suggestionsSuggestionGroup.js | 5 - 7 files changed, 316 insertions(+), 517 deletions(-) create mode 100644 lib/services/autosuggest/lib/models/suggestions.js diff --git a/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts b/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts index c8958bb799..a24a8e6596 100644 --- a/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts +++ b/lib/services/autosuggest/lib/autoSuggestAPIClient.d.ts @@ -219,11 +219,11 @@ export default class AutoSuggestAPIClient extends ServiceClient { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - autoSuggestMethodWithHttpOperationResponse(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>; + autoSuggestWithHttpOperationResponse(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise>; /** * @summary The AutoSuggest API lets you send a search query to Bing and get @@ -413,7 +413,7 @@ export default class AutoSuggestAPIClient extends ServiceClient { * * {Promise} A promise is returned. * - * @resolve {AutoSuggest} - The deserialized result object. + * @resolve {Suggestions} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -421,16 +421,16 @@ export default class AutoSuggestAPIClient extends ServiceClient { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AutoSuggest} [result] - The deserialized result object if an error did not occur. - * See {@link AutoSuggest} for more information. + * {Suggestions} [result] - The deserialized result object if an error did not occur. + * See {@link Suggestions} 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. */ - autoSuggestMethod(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise; - autoSuggestMethod(query: string, callback: ServiceCallback): void; - autoSuggestMethod(query: string, options: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + autoSuggest(query: string, options?: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }): Promise; + autoSuggest(query: string, callback: ServiceCallback): void; + autoSuggest(query: string, options: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, countryCode? : string, market? : string, safeSearch? : string, setLang? : string, responseFormat? : string[], customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } export { AutoSuggestAPIClient, models as AutoSuggestAPIModels }; diff --git a/lib/services/autosuggest/lib/autoSuggestAPIClient.js b/lib/services/autosuggest/lib/autoSuggestAPIClient.js index e068f8ee4d..b3ce58de52 100644 --- a/lib/services/autosuggest/lib/autoSuggestAPIClient.js +++ b/lib/services/autosuggest/lib/autoSuggestAPIClient.js @@ -209,13 +209,13 @@ const models = require('./models'); * {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 AutoSuggest} for more information. + * See {@link Suggestions} 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 _autoSuggestMethod(query, options, callback) { +function _autoSuggest(query, options, callback) { /* jshint validthis: true */ let client = this; if(!callback && typeof options === 'function') { @@ -385,7 +385,7 @@ function _autoSuggestMethod(query, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['AutoSuggest']().mapper(); + let resultMapper = new client.models['Suggestions']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -430,7 +430,7 @@ class AutoSuggestAPIClient extends ServiceClient { let packageInfo = this.getPackageJsonInfo(__dirname); this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); this.models = models; - this._autoSuggestMethod = _autoSuggestMethod; + this._autoSuggest = _autoSuggest; msRest.addSerializationMixin(this); } @@ -617,15 +617,15 @@ class AutoSuggestAPIClient extends ServiceClient { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - autoSuggestMethodWithHttpOperationResponse(query, options) { + autoSuggestWithHttpOperationResponse(query, options) { let client = this; let self = this; return new Promise((resolve, reject) => { - self._autoSuggestMethod(query, options, (err, result, request, response) => { + self._autoSuggest(query, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -823,7 +823,7 @@ class AutoSuggestAPIClient extends ServiceClient { * * {Promise} A promise is returned * - * @resolve {AutoSuggest} - The deserialized result object. + * @resolve {Suggestions} - The deserialized result object. * * @reject {Error} - The error object. * @@ -832,13 +832,13 @@ class AutoSuggestAPIClient extends ServiceClient { * {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 AutoSuggest} for more information. + * See {@link Suggestions} 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. */ - autoSuggestMethod(query, options, optionalCallback) { + autoSuggest(query, options, optionalCallback) { let client = this; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -847,14 +847,14 @@ class AutoSuggestAPIClient extends ServiceClient { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._autoSuggestMethod(query, options, (err, result, request, response) => { + self._autoSuggest(query, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._autoSuggestMethod(query, options, optionalCallback); + return self._autoSuggest(query, options, optionalCallback); } } diff --git a/lib/services/autosuggest/lib/models/index.d.ts b/lib/services/autosuggest/lib/models/index.d.ts index 272f228100..8a3a74a8a2 100644 --- a/lib/services/autosuggest/lib/models/index.d.ts +++ b/lib/services/autosuggest/lib/models/index.d.ts @@ -11,6 +11,39 @@ import * as moment from "moment"; +/** + * @class + * Initializes a new instance of the SearchAction class. + * @constructor + * @member {string} [displayText] + * @member {string} [query] + * @member {string} [searchKind] Possible values include: 'WebSearch', + * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', + * 'CustomSearch'. Default value: 'WebSearch' . + * @member {string} [url] The URL to get more information about the thing + * represented by this object. + */ +export interface SearchAction { + readonly displayText?: string; + readonly query?: string; + readonly searchKind?: string; + readonly url?: string; +} + +/** + * @class + * Initializes a new instance of the SuggestionsSuggestionGroup class. + * @constructor + * @member {string} name Possible values include: 'Unknown', 'Web', + * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', + * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . + * @member {array} searchSuggestions + */ +export interface SuggestionsSuggestionGroup { + name: string; + searchSuggestions: SearchAction[]; +} + /** * @class * Initializes a new instance of the ResponseBase class. @@ -52,6 +85,107 @@ export interface Response extends Identifiable { readonly adaptiveCard?: string; } +/** + * @class + * Initializes a new instance of the Answer class. + * @constructor + * Defines an answer. + * + */ +export interface Answer extends Response { +} + +/** + * @class + * Initializes a new instance of the SearchResultsAnswer class. + * @constructor + * Defines a search result answer. + * + * @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". + * @member {boolean} [queryContext.isTransactional] + */ +export interface SearchResultsAnswer extends Answer { + readonly queryContext?: QueryContext; +} + +/** + * @class + * Initializes a new instance of the Suggestions class. + * @constructor + * Defines an AutoSuggest answer + * + * @member {array} suggestionGroups + */ +export interface Suggestions extends SearchResultsAnswer { + suggestionGroups: SuggestionsSuggestionGroup[]; +} + +/** + * @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". + * @member {boolean} [isTransactional] + */ +export interface QueryContext { + originalQuery: string; + readonly alteredQuery?: string; + readonly alterationOverrideQuery?: string; + readonly adultIntent?: boolean; + readonly askUserForLocation?: boolean; + readonly isTransactional?: boolean; +} + /** * @class * Initializes a new instance of the Thing class. @@ -161,137 +295,6 @@ export interface Action extends CreativeWork { readonly isTopAction?: boolean; } -/** - * @class - * Initializes a new instance of the SearchAction class. - * @constructor - * @member {string} [displayText] - * @member {string} [query] - * @member {string} [searchKind] Possible values include: 'WebSearch', - * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', - * 'CustomSearch'. Default value: 'WebSearch' . - */ -export interface SearchAction extends Action { - readonly displayText?: string; - readonly query?: string; - readonly searchKind?: string; -} - -/** - * @class - * Initializes a new instance of the SuggestionsSuggestionGroup class. - * @constructor - * @member {string} name Possible values include: 'Unknown', 'Web', - * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', - * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . - * @member {array} searchSuggestions - */ -export interface SuggestionsSuggestionGroup { - name: string; - searchSuggestions: SearchAction[]; -} - -/** - * @class - * Initializes a new instance of the Answer class. - * @constructor - * Defines an answer. - * - */ -export interface Answer extends Response { -} - -/** - * @class - * Initializes a new instance of the SearchResultsAnswer class. - * @constructor - * Defines a search result answer. - * - * @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". - * @member {boolean} [queryContext.isTransactional] - */ -export interface SearchResultsAnswer extends Answer { - readonly queryContext?: QueryContext; -} - -/** - * @class - * Initializes a new instance of the AutoSuggest class. - * @constructor - * Defines an AutoSuggest answer - * - * @member {array} suggestionGroups - */ -export interface AutoSuggest extends SearchResultsAnswer { - suggestionGroups: SuggestionsSuggestionGroup[]; -} - -/** - * @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". - * @member {boolean} [isTransactional] - */ -export interface QueryContext { - originalQuery: string; - readonly alteredQuery?: string; - readonly alterationOverrideQuery?: string; - readonly adultIntent?: boolean; - readonly askUserForLocation?: boolean; - readonly isTransactional?: boolean; -} - /** * @class * Initializes a new instance of the ErrorModel class. diff --git a/lib/services/autosuggest/lib/models/index.js b/lib/services/autosuggest/lib/models/index.js index 8c9dbf5425..3c35b92e27 100644 --- a/lib/services/autosuggest/lib/models/index.js +++ b/lib/services/autosuggest/lib/models/index.js @@ -14,23 +14,22 @@ 'use strict'; +exports.SearchAction = require('./searchAction'); +exports.SuggestionsSuggestionGroup = require('./suggestionsSuggestionGroup'); exports.ResponseBase = require('./responseBase'); exports.Identifiable = require('./identifiable'); exports.Response = require('./response'); -exports.Thing = require('./thing'); -exports.CreativeWork = require('./creativeWork'); -exports.Action = require('./action'); -exports.SearchAction = require('./searchAction'); -exports.SuggestionsSuggestionGroup = require('./suggestionsSuggestionGroup'); exports.Answer = require('./answer'); exports.SearchResultsAnswer = require('./searchResultsAnswer'); -exports.AutoSuggest = require('./autoSuggest'); +exports.Suggestions = require('./suggestions'); exports.QueryContext = require('./queryContext'); +exports.Thing = require('./thing'); +exports.CreativeWork = require('./creativeWork'); +exports.Action = require('./action'); exports.ErrorModel = require('./errorModel'); exports.ErrorResponse = require('./errorResponse'); exports.discriminators = { - 'ResponseBase.SearchAction' : exports.SearchAction, - 'ResponseBase.AutoSuggest' : exports.AutoSuggest, + 'ResponseBase.Suggestions' : exports.Suggestions, 'ResponseBase.SearchResultsAnswer' : exports.SearchResultsAnswer, 'ResponseBase.Answer' : exports.Answer, 'ResponseBase.Thing' : exports.Thing, diff --git a/lib/services/autosuggest/lib/models/searchAction.js b/lib/services/autosuggest/lib/models/searchAction.js index 27ef7023d5..54aa712674 100644 --- a/lib/services/autosuggest/lib/models/searchAction.js +++ b/lib/services/autosuggest/lib/models/searchAction.js @@ -10,13 +10,10 @@ 'use strict'; -const models = require('./index'); - /** * Class representing a SearchAction. - * @extends models['Action'] */ -class SearchAction extends models['Action'] { +class SearchAction { /** * Create a SearchAction. * @member {string} [displayText] @@ -24,9 +21,10 @@ class SearchAction extends models['Action'] { * @member {string} [searchKind] Possible values include: 'WebSearch', * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', * 'CustomSearch'. Default value: 'WebSearch' . + * @member {string} [url] The URL to get more information about the thing + * represented by this object. */ constructor() { - super(); } /** @@ -41,356 +39,8 @@ class SearchAction extends models['Action'] { serializedName: 'SearchAction', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', className: 'SearchAction', modelProperties: { - _type: { - required: true, - serializedName: '_type', - isPolymorphicDiscriminator: true, - type: { - name: 'String' - } - }, - id: { - required: false, - readOnly: true, - serializedName: 'id', - type: { - name: 'String' - } - }, - potentialAction: { - required: false, - readOnly: true, - serializedName: 'potentialAction', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Action' - } - } - } - }, - immediateAction: { - required: false, - readOnly: true, - serializedName: 'immediateAction', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ActionElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Action' - } - } - } - }, - adaptiveCard: { - required: false, - readOnly: true, - serializedName: 'adaptiveCard', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - wikipediaId: { - required: false, - readOnly: true, - serializedName: 'wikipediaId', - type: { - name: 'String' - } - }, - freebaseId: { - required: false, - readOnly: true, - serializedName: 'freebaseId', - type: { - name: 'String' - } - }, - alternateName: { - required: false, - readOnly: true, - serializedName: 'alternateName', - type: { - name: 'String' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - satoriId: { - required: false, - readOnly: true, - serializedName: 'satoriId', - type: { - name: 'String' - } - }, - ypId: { - required: false, - readOnly: true, - serializedName: 'ypId', - type: { - name: 'String' - } - }, - about: { - required: false, - readOnly: true, - serializedName: 'about', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - } - } - }, - mentions: { - required: false, - readOnly: true, - serializedName: 'mentions', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - } - } - }, - provider: { - required: false, - readOnly: true, - serializedName: 'provider', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - } - } - }, - creator: { - required: false, - readOnly: true, - serializedName: 'creator', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - }, - text: { - required: false, - readOnly: true, - serializedName: 'text', - type: { - name: 'String' - } - }, - commentCount: { - required: false, - readOnly: true, - serializedName: 'commentCount', - type: { - name: 'Number' - } - }, - mainEntity: { - required: false, - readOnly: true, - serializedName: 'mainEntity', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - }, - headLine: { - required: false, - readOnly: true, - serializedName: 'headLine', - type: { - name: 'String' - } - }, - copyrightHolder: { - required: false, - readOnly: true, - serializedName: 'copyrightHolder', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - }, - copyrightYear: { - required: false, - readOnly: true, - serializedName: 'copyrightYear', - type: { - name: 'Number' - } - }, - disclaimer: { - required: false, - readOnly: true, - serializedName: 'disclaimer', - type: { - name: 'String' - } - }, - isAccessibleForFree: { - required: false, - readOnly: true, - serializedName: 'isAccessibleForFree', - type: { - name: 'Boolean' - } - }, - genre: { - required: false, - readOnly: true, - serializedName: 'genre', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - isFamilyFriendly: { - required: false, - readOnly: true, - serializedName: 'isFamilyFriendly', - type: { - name: 'Boolean' - } - }, - result: { - required: false, - readOnly: true, - serializedName: 'result', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ThingElementType', - type: { - name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', - className: 'Thing' - } - } - } - }, - displayName: { - required: false, - readOnly: true, - serializedName: 'displayName', - type: { - name: 'String' - } - }, - isTopAction: { - required: false, - readOnly: true, - serializedName: 'isTopAction', - type: { - name: 'Boolean' - } - }, displayText: { required: false, readOnly: true, @@ -415,6 +65,14 @@ class SearchAction extends models['Action'] { type: { name: 'String' } + }, + url: { + required: false, + readOnly: true, + serializedName: 'url', + type: { + name: 'String' + } } } } diff --git a/lib/services/autosuggest/lib/models/suggestions.js b/lib/services/autosuggest/lib/models/suggestions.js new file mode 100644 index 0000000000..eebe2f39f6 --- /dev/null +++ b/lib/services/autosuggest/lib/models/suggestions.js @@ -0,0 +1,144 @@ +/* + * 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 AutoSuggest answer + * + * @extends models['SearchResultsAnswer'] + */ +class Suggestions extends models['SearchResultsAnswer'] { + /** + * Create a Suggestions. + * @member {array} suggestionGroups + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Suggestions + * + * @returns {object} metadata of Suggestions + * + */ + mapper() { + return { + required: false, + serializedName: 'Suggestions', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Suggestions', + modelProperties: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', + type: { + name: 'String' + } + }, + queryContext: { + required: false, + readOnly: true, + serializedName: 'queryContext', + type: { + name: 'Composite', + className: 'QueryContext' + } + }, + suggestionGroups: { + required: true, + serializedName: 'suggestionGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SuggestionsSuggestionGroupElementType', + type: { + name: 'Composite', + className: 'SuggestionsSuggestionGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = Suggestions; diff --git a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js index 7a8cc304d2..f556bd687b 100644 --- a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js +++ b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js @@ -58,11 +58,6 @@ class SuggestionsSuggestionGroup { serializedName: 'SearchActionElementType', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: '_type', - clientName: '_type' - }, - uberParent: 'ResponseBase', className: 'SearchAction' } } From ed50a6b1aff0a8abb598ca7af4062dfa086c77fc Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 7 Jun 2018 22:25:59 +0000 Subject: [PATCH 4/5] Generated from 4a7c236ecccc70ae4476757aef255a56237d22ff update spec --- lib/services/autosuggest/lib/models/action.js | 89 ++--- lib/services/autosuggest/lib/models/answer.js | 24 ++ .../autosuggest/lib/models/creativeWork.js | 119 ++---- .../autosuggest/lib/models/errorResponse.js | 24 ++ .../autosuggest/lib/models/index.d.ts | 259 ++++++------- lib/services/autosuggest/lib/models/index.js | 15 +- .../autosuggest/lib/models/response.js | 28 ++ .../autosuggest/lib/models/searchAction.js | 354 +++++++++++++++++- .../lib/models/searchResultsAnswer.js | 24 ++ .../autosuggest/lib/models/suggestions.js | 27 +- .../lib/models/suggestionsSuggestionGroup.js | 5 + lib/services/autosuggest/lib/models/thing.js | 86 ++--- 12 files changed, 702 insertions(+), 352 deletions(-) diff --git a/lib/services/autosuggest/lib/models/action.js b/lib/services/autosuggest/lib/models/action.js index 772a290771..496d2171e4 100644 --- a/lib/services/autosuggest/lib/models/action.js +++ b/lib/services/autosuggest/lib/models/action.js @@ -22,6 +22,7 @@ class Action extends models['CreativeWork'] { * @member {array} [result] * @member {string} [displayName] * @member {boolean} [isTopAction] + * @member {string} [serviceUrl] */ constructor() { super(); @@ -62,6 +63,22 @@ class Action extends models['CreativeWork'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -104,74 +121,34 @@ class Action extends models['CreativeWork'] { } } }, - adaptiveCard: { - required: false, - readOnly: true, - serializedName: 'adaptiveCard', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - description: { - required: false, - readOnly: true, - serializedName: 'description', - type: { - name: 'String' - } - }, - wikipediaId: { - required: false, - readOnly: true, - serializedName: 'wikipediaId', - type: { - name: 'String' - } - }, - freebaseId: { - required: false, - readOnly: true, - serializedName: 'freebaseId', - type: { - name: 'String' - } - }, - alternateName: { + preferredClickthroughUrl: { required: false, readOnly: true, - serializedName: 'alternateName', + serializedName: 'preferredClickthroughUrl', type: { name: 'String' } }, - bingId: { + adaptiveCard: { required: false, readOnly: true, - serializedName: 'bingId', + serializedName: 'adaptiveCard', type: { name: 'String' } }, - satoriId: { + url: { required: false, readOnly: true, - serializedName: 'satoriId', + serializedName: 'url', type: { name: 'String' } }, - ypId: { + thumbnailUrl: { required: false, readOnly: true, - serializedName: 'ypId', + serializedName: 'thumbnailUrl', type: { name: 'String' } @@ -261,6 +238,14 @@ class Action extends models['CreativeWork'] { name: 'String' } }, + discussionUrl: { + required: false, + readOnly: true, + serializedName: 'discussionUrl', + type: { + name: 'String' + } + }, commentCount: { required: false, readOnly: true, @@ -388,6 +373,14 @@ class Action extends models['CreativeWork'] { type: { name: 'Boolean' } + }, + serviceUrl: { + required: false, + readOnly: true, + serializedName: 'serviceUrl', + type: { + name: 'String' + } } } } diff --git a/lib/services/autosuggest/lib/models/answer.js b/lib/services/autosuggest/lib/models/answer.js index 4dab72080f..4a784445c9 100644 --- a/lib/services/autosuggest/lib/models/answer.js +++ b/lib/services/autosuggest/lib/models/answer.js @@ -60,6 +60,22 @@ class Answer extends models['Response'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -102,6 +118,14 @@ class Answer extends models['Response'] { } } }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, adaptiveCard: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/creativeWork.js b/lib/services/autosuggest/lib/models/creativeWork.js index 633a4b9800..7e9c564dc9 100644 --- a/lib/services/autosuggest/lib/models/creativeWork.js +++ b/lib/services/autosuggest/lib/models/creativeWork.js @@ -21,46 +21,23 @@ const models = require('./index'); class CreativeWork extends models['Thing'] { /** * Create a CreativeWork. + * @member {string} [thumbnailUrl] The URL to a thumbnail of the item. * @member {array} [about] For internal use only. * @member {array} [mentions] For internal use only. * @member {array} [provider] The source of the creative work. * @member {object} [creator] - * @member {string} [creator.name] The name of the thing represented by this - * object. - * @member {string} [creator.description] A short description of the item. - * @member {string} [creator.wikipediaId] - * @member {string} [creator.freebaseId] - * @member {string} [creator.alternateName] An alias for the item - * @member {string} [creator.bingId] An ID that uniquely identifies this - * item. - * @member {string} [creator.satoriId] - * @member {string} [creator.ypId] + * @member {string} [creator.url] The URL to get more information about the + * thing represented by this object. * @member {string} [text] Text content of this creative work + * @member {string} [discussionUrl] * @member {number} [commentCount] * @member {object} [mainEntity] - * @member {string} [mainEntity.name] The name of the thing represented by - * this object. - * @member {string} [mainEntity.description] A short description of the item. - * @member {string} [mainEntity.wikipediaId] - * @member {string} [mainEntity.freebaseId] - * @member {string} [mainEntity.alternateName] An alias for the item - * @member {string} [mainEntity.bingId] An ID that uniquely identifies this - * item. - * @member {string} [mainEntity.satoriId] - * @member {string} [mainEntity.ypId] + * @member {string} [mainEntity.url] The URL to get more information about + * the thing represented by this object. * @member {string} [headLine] * @member {object} [copyrightHolder] - * @member {string} [copyrightHolder.name] The name of the thing represented - * by this object. - * @member {string} [copyrightHolder.description] A short description of the - * item. - * @member {string} [copyrightHolder.wikipediaId] - * @member {string} [copyrightHolder.freebaseId] - * @member {string} [copyrightHolder.alternateName] An alias for the item - * @member {string} [copyrightHolder.bingId] An ID that uniquely identifies - * this item. - * @member {string} [copyrightHolder.satoriId] - * @member {string} [copyrightHolder.ypId] + * @member {string} [copyrightHolder.url] The URL to get more information + * about the thing represented by this object. * @member {number} [copyrightYear] * @member {string} [disclaimer] * @member {boolean} [isAccessibleForFree] @@ -106,6 +83,22 @@ class CreativeWork extends models['Thing'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -148,74 +141,34 @@ class CreativeWork extends models['Thing'] { } } }, - adaptiveCard: { - required: false, - readOnly: true, - serializedName: 'adaptiveCard', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - description: { + preferredClickthroughUrl: { required: false, readOnly: true, - serializedName: 'description', + serializedName: 'preferredClickthroughUrl', type: { name: 'String' } }, - wikipediaId: { - required: false, - readOnly: true, - serializedName: 'wikipediaId', - type: { - name: 'String' - } - }, - freebaseId: { - required: false, - readOnly: true, - serializedName: 'freebaseId', - type: { - name: 'String' - } - }, - alternateName: { - required: false, - readOnly: true, - serializedName: 'alternateName', - type: { - name: 'String' - } - }, - bingId: { + adaptiveCard: { required: false, readOnly: true, - serializedName: 'bingId', + serializedName: 'adaptiveCard', type: { name: 'String' } }, - satoriId: { + url: { required: false, readOnly: true, - serializedName: 'satoriId', + serializedName: 'url', type: { name: 'String' } }, - ypId: { + thumbnailUrl: { required: false, readOnly: true, - serializedName: 'ypId', + serializedName: 'thumbnailUrl', type: { name: 'String' } @@ -305,6 +258,14 @@ class CreativeWork extends models['Thing'] { name: 'String' } }, + discussionUrl: { + required: false, + readOnly: true, + serializedName: 'discussionUrl', + type: { + name: 'String' + } + }, commentCount: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/errorResponse.js b/lib/services/autosuggest/lib/models/errorResponse.js index c72e96369b..489d2d8a3a 100644 --- a/lib/services/autosuggest/lib/models/errorResponse.js +++ b/lib/services/autosuggest/lib/models/errorResponse.js @@ -62,6 +62,22 @@ class ErrorResponse extends models['Response'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -104,6 +120,14 @@ class ErrorResponse extends models['Response'] { } } }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, adaptiveCard: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/index.d.ts b/lib/services/autosuggest/lib/models/index.d.ts index 8a3a74a8a2..d06b3579e1 100644 --- a/lib/services/autosuggest/lib/models/index.d.ts +++ b/lib/services/autosuggest/lib/models/index.d.ts @@ -11,39 +11,6 @@ import * as moment from "moment"; -/** - * @class - * Initializes a new instance of the SearchAction class. - * @constructor - * @member {string} [displayText] - * @member {string} [query] - * @member {string} [searchKind] Possible values include: 'WebSearch', - * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', - * 'CustomSearch'. Default value: 'WebSearch' . - * @member {string} [url] The URL to get more information about the thing - * represented by this object. - */ -export interface SearchAction { - readonly displayText?: string; - readonly query?: string; - readonly searchKind?: string; - readonly url?: string; -} - -/** - * @class - * Initializes a new instance of the SuggestionsSuggestionGroup class. - * @constructor - * @member {string} name Possible values include: 'Unknown', 'Web', - * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', - * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . - * @member {array} searchSuggestions - */ -export interface SuggestionsSuggestionGroup { - name: string; - searchSuggestions: SearchAction[]; -} - /** * @class * Initializes a new instance of the ResponseBase class. @@ -75,16 +42,131 @@ export interface Identifiable extends ResponseBase { * Defines a response. All schemas that could be returned at the root of a * response should inherit from this * + * @member {string} [readLink] The URL that returns this resource. + * @member {string} [webSearchUrl] The URL To Bing's search result for this + * item. * @member {array} [potentialAction] * @member {array} [immediateAction] + * @member {string} [preferredClickthroughUrl] * @member {string} [adaptiveCard] */ export interface Response extends Identifiable { + readonly readLink?: string; + readonly webSearchUrl?: string; readonly potentialAction?: Action[]; readonly immediateAction?: Action[]; + readonly preferredClickthroughUrl?: string; readonly adaptiveCard?: string; } +/** + * @class + * Initializes a new instance of the Thing class. + * @constructor + * Defines a thing. + * + * @member {string} [url] The URL to get more information about the thing + * represented by this object. + */ +export interface Thing extends Response { + readonly url?: string; +} + +/** + * @class + * Initializes a new instance of the CreativeWork class. + * @constructor + * The most generic kind of creative work, including books, movies, + * photographs, software programs, etc. + * + * @member {string} [thumbnailUrl] The URL to a thumbnail of the item. + * @member {array} [about] For internal use only. + * @member {array} [mentions] For internal use only. + * @member {array} [provider] The source of the creative work. + * @member {object} [creator] + * @member {string} [creator.url] The URL to get more information about the + * thing represented by this object. + * @member {string} [text] Text content of this creative work + * @member {string} [discussionUrl] + * @member {number} [commentCount] + * @member {object} [mainEntity] + * @member {string} [mainEntity.url] The URL to get more information about the + * thing represented by this object. + * @member {string} [headLine] + * @member {object} [copyrightHolder] + * @member {string} [copyrightHolder.url] The URL to get more information about + * the thing represented by this object. + * @member {number} [copyrightYear] + * @member {string} [disclaimer] + * @member {boolean} [isAccessibleForFree] + * @member {array} [genre] + * @member {boolean} [isFamilyFriendly] + */ +export interface CreativeWork extends Thing { + readonly thumbnailUrl?: string; + readonly about?: Thing[]; + readonly mentions?: Thing[]; + readonly provider?: Thing[]; + readonly creator?: Thing; + readonly text?: string; + readonly discussionUrl?: string; + readonly commentCount?: number; + readonly mainEntity?: Thing; + readonly headLine?: string; + readonly copyrightHolder?: Thing; + readonly copyrightYear?: number; + readonly disclaimer?: string; + readonly isAccessibleForFree?: boolean; + readonly genre?: string[]; + readonly isFamilyFriendly?: boolean; +} + +/** + * @class + * Initializes a new instance of the Action class. + * @constructor + * @member {array} [result] + * @member {string} [displayName] + * @member {boolean} [isTopAction] + * @member {string} [serviceUrl] + */ +export interface Action extends CreativeWork { + readonly result?: Thing[]; + readonly displayName?: string; + readonly isTopAction?: boolean; + readonly serviceUrl?: string; +} + +/** + * @class + * Initializes a new instance of the SearchAction class. + * @constructor + * @member {string} [displayText] + * @member {string} [query] + * @member {string} [searchKind] Possible values include: 'WebSearch', + * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', + * 'CustomSearch'. Default value: 'WebSearch' . + */ +export interface SearchAction extends Action { + readonly displayText?: string; + readonly query?: string; + readonly searchKind?: string; +} + +/** + * @class + * Initializes a new instance of the SuggestionsSuggestionGroup class. + * @constructor + * @member {string} name Possible values include: 'Unknown', 'Web', + * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', + * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . + * @member {array} searchSuggestions + */ +export interface SuggestionsSuggestionGroup { + name: string; + searchSuggestions: SearchAction[]; +} + /** * @class * Initializes a new instance of the Answer class. @@ -138,8 +220,6 @@ export interface SearchResultsAnswer extends Answer { * @class * Initializes a new instance of the Suggestions class. * @constructor - * Defines an AutoSuggest answer - * * @member {array} suggestionGroups */ export interface Suggestions extends SearchResultsAnswer { @@ -186,115 +266,6 @@ export interface QueryContext { readonly isTransactional?: boolean; } -/** - * @class - * Initializes a new instance of the Thing class. - * @constructor - * Defines a thing. - * - * @member {string} [name] The name of the thing represented by this object. - * @member {string} [description] A short description of the item. - * @member {string} [wikipediaId] - * @member {string} [freebaseId] - * @member {string} [alternateName] An alias for the item - * @member {string} [bingId] An ID that uniquely identifies this item. - * @member {string} [satoriId] - * @member {string} [ypId] - */ -export interface Thing extends Response { - readonly name?: string; - readonly description?: string; - readonly wikipediaId?: string; - readonly freebaseId?: string; - readonly alternateName?: string; - readonly bingId?: string; - readonly satoriId?: string; - readonly ypId?: string; -} - -/** - * @class - * Initializes a new instance of the CreativeWork class. - * @constructor - * The most generic kind of creative work, including books, movies, - * photographs, software programs, etc. - * - * @member {array} [about] For internal use only. - * @member {array} [mentions] For internal use only. - * @member {array} [provider] The source of the creative work. - * @member {object} [creator] - * @member {string} [creator.name] The name of the thing represented by this - * object. - * @member {string} [creator.description] A short description of the item. - * @member {string} [creator.wikipediaId] - * @member {string} [creator.freebaseId] - * @member {string} [creator.alternateName] An alias for the item - * @member {string} [creator.bingId] An ID that uniquely identifies this item. - * @member {string} [creator.satoriId] - * @member {string} [creator.ypId] - * @member {string} [text] Text content of this creative work - * @member {number} [commentCount] - * @member {object} [mainEntity] - * @member {string} [mainEntity.name] The name of the thing represented by this - * object. - * @member {string} [mainEntity.description] A short description of the item. - * @member {string} [mainEntity.wikipediaId] - * @member {string} [mainEntity.freebaseId] - * @member {string} [mainEntity.alternateName] An alias for the item - * @member {string} [mainEntity.bingId] An ID that uniquely identifies this - * item. - * @member {string} [mainEntity.satoriId] - * @member {string} [mainEntity.ypId] - * @member {string} [headLine] - * @member {object} [copyrightHolder] - * @member {string} [copyrightHolder.name] The name of the thing represented by - * this object. - * @member {string} [copyrightHolder.description] A short description of the - * item. - * @member {string} [copyrightHolder.wikipediaId] - * @member {string} [copyrightHolder.freebaseId] - * @member {string} [copyrightHolder.alternateName] An alias for the item - * @member {string} [copyrightHolder.bingId] An ID that uniquely identifies - * this item. - * @member {string} [copyrightHolder.satoriId] - * @member {string} [copyrightHolder.ypId] - * @member {number} [copyrightYear] - * @member {string} [disclaimer] - * @member {boolean} [isAccessibleForFree] - * @member {array} [genre] - * @member {boolean} [isFamilyFriendly] - */ -export interface CreativeWork extends Thing { - readonly about?: Thing[]; - readonly mentions?: Thing[]; - readonly provider?: Thing[]; - readonly creator?: Thing; - readonly text?: string; - readonly commentCount?: number; - readonly mainEntity?: Thing; - readonly headLine?: string; - readonly copyrightHolder?: Thing; - readonly copyrightYear?: number; - readonly disclaimer?: string; - readonly isAccessibleForFree?: boolean; - readonly genre?: string[]; - readonly isFamilyFriendly?: boolean; -} - -/** - * @class - * Initializes a new instance of the Action class. - * @constructor - * @member {array} [result] - * @member {string} [displayName] - * @member {boolean} [isTopAction] - */ -export interface Action extends CreativeWork { - readonly result?: Thing[]; - readonly displayName?: string; - readonly isTopAction?: boolean; -} - /** * @class * Initializes a new instance of the ErrorModel class. diff --git a/lib/services/autosuggest/lib/models/index.js b/lib/services/autosuggest/lib/models/index.js index 3c35b92e27..80e8c568b2 100644 --- a/lib/services/autosuggest/lib/models/index.js +++ b/lib/services/autosuggest/lib/models/index.js @@ -14,21 +14,22 @@ 'use strict'; -exports.SearchAction = require('./searchAction'); -exports.SuggestionsSuggestionGroup = require('./suggestionsSuggestionGroup'); exports.ResponseBase = require('./responseBase'); exports.Identifiable = require('./identifiable'); exports.Response = require('./response'); +exports.Thing = require('./thing'); +exports.CreativeWork = require('./creativeWork'); +exports.Action = require('./action'); +exports.SearchAction = require('./searchAction'); +exports.SuggestionsSuggestionGroup = require('./suggestionsSuggestionGroup'); exports.Answer = require('./answer'); exports.SearchResultsAnswer = require('./searchResultsAnswer'); exports.Suggestions = require('./suggestions'); exports.QueryContext = require('./queryContext'); -exports.Thing = require('./thing'); -exports.CreativeWork = require('./creativeWork'); -exports.Action = require('./action'); exports.ErrorModel = require('./errorModel'); exports.ErrorResponse = require('./errorResponse'); exports.discriminators = { + 'ResponseBase.SearchAction' : exports.SearchAction, 'ResponseBase.Suggestions' : exports.Suggestions, 'ResponseBase.SearchResultsAnswer' : exports.SearchResultsAnswer, 'ResponseBase.Answer' : exports.Answer, @@ -37,6 +38,6 @@ exports.discriminators = { 'ResponseBase.Response' : exports.Response, 'ResponseBase.Identifiable' : exports.Identifiable, 'ResponseBase.ErrorResponse' : exports.ErrorResponse, - 'ResponseBase' : exports.ResponseBase, - 'ResponseBase.CreativeWork' : exports.CreativeWork + 'ResponseBase.CreativeWork' : exports.CreativeWork, + 'ResponseBase' : exports.ResponseBase }; diff --git a/lib/services/autosuggest/lib/models/response.js b/lib/services/autosuggest/lib/models/response.js index b010bc10eb..8842125193 100644 --- a/lib/services/autosuggest/lib/models/response.js +++ b/lib/services/autosuggest/lib/models/response.js @@ -21,8 +21,12 @@ const models = require('./index'); class Response extends models['Identifiable'] { /** * Create a Response. + * @member {string} [readLink] The URL that returns this resource. + * @member {string} [webSearchUrl] The URL To Bing's search result for this + * item. * @member {array} [potentialAction] * @member {array} [immediateAction] + * @member {string} [preferredClickthroughUrl] * @member {string} [adaptiveCard] */ constructor() { @@ -64,6 +68,22 @@ class Response extends models['Identifiable'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -106,6 +126,14 @@ class Response extends models['Identifiable'] { } } }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, adaptiveCard: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/searchAction.js b/lib/services/autosuggest/lib/models/searchAction.js index 54aa712674..a54564f3e9 100644 --- a/lib/services/autosuggest/lib/models/searchAction.js +++ b/lib/services/autosuggest/lib/models/searchAction.js @@ -10,10 +10,13 @@ 'use strict'; +const models = require('./index'); + /** * Class representing a SearchAction. + * @extends models['Action'] */ -class SearchAction { +class SearchAction extends models['Action'] { /** * Create a SearchAction. * @member {string} [displayText] @@ -21,10 +24,9 @@ class SearchAction { * @member {string} [searchKind] Possible values include: 'WebSearch', * 'HistorySearch', 'DocumentSearch', 'TagSearch', 'LocationSearch', * 'CustomSearch'. Default value: 'WebSearch' . - * @member {string} [url] The URL to get more information about the thing - * represented by this object. */ constructor() { + super(); } /** @@ -39,29 +41,99 @@ class SearchAction { serializedName: 'SearchAction', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', className: 'SearchAction', modelProperties: { - displayText: { + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + id: { required: false, readOnly: true, - serializedName: 'displayText', + serializedName: 'id', type: { name: 'String' } }, - query: { + readLink: { required: false, readOnly: true, - serializedName: 'query', + serializedName: 'readLink', type: { name: 'String' } }, - searchKind: { + webSearchUrl: { required: false, readOnly: true, - serializedName: 'searchKind', - defaultValue: 'WebSearch', + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, + potentialAction: { + required: false, + readOnly: true, + serializedName: 'potentialAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + immediateAction: { + required: false, + readOnly: true, + serializedName: 'immediateAction', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActionElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Action' + } + } + } + }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, + adaptiveCard: { + required: false, + readOnly: true, + serializedName: 'adaptiveCard', type: { name: 'String' } @@ -73,6 +145,268 @@ class SearchAction { type: { name: 'String' } + }, + thumbnailUrl: { + required: false, + readOnly: true, + serializedName: 'thumbnailUrl', + type: { + name: 'String' + } + }, + about: { + required: false, + readOnly: true, + serializedName: 'about', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + mentions: { + required: false, + readOnly: true, + serializedName: 'mentions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + creator: { + required: false, + readOnly: true, + serializedName: 'creator', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + text: { + required: false, + readOnly: true, + serializedName: 'text', + type: { + name: 'String' + } + }, + discussionUrl: { + required: false, + readOnly: true, + serializedName: 'discussionUrl', + type: { + name: 'String' + } + }, + commentCount: { + required: false, + readOnly: true, + serializedName: 'commentCount', + type: { + name: 'Number' + } + }, + mainEntity: { + required: false, + readOnly: true, + serializedName: 'mainEntity', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + headLine: { + required: false, + readOnly: true, + serializedName: 'headLine', + type: { + name: 'String' + } + }, + copyrightHolder: { + required: false, + readOnly: true, + serializedName: 'copyrightHolder', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + }, + copyrightYear: { + required: false, + readOnly: true, + serializedName: 'copyrightYear', + type: { + name: 'Number' + } + }, + disclaimer: { + required: false, + readOnly: true, + serializedName: 'disclaimer', + type: { + name: 'String' + } + }, + isAccessibleForFree: { + required: false, + readOnly: true, + serializedName: 'isAccessibleForFree', + type: { + name: 'Boolean' + } + }, + genre: { + required: false, + readOnly: true, + serializedName: 'genre', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isFamilyFriendly: { + required: false, + readOnly: true, + serializedName: 'isFamilyFriendly', + type: { + name: 'Boolean' + } + }, + result: { + required: false, + readOnly: true, + serializedName: 'result', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThingElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', + className: 'Thing' + } + } + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + isTopAction: { + required: false, + readOnly: true, + serializedName: 'isTopAction', + type: { + name: 'Boolean' + } + }, + serviceUrl: { + required: false, + readOnly: true, + serializedName: 'serviceUrl', + type: { + name: 'String' + } + }, + displayText: { + required: false, + readOnly: true, + serializedName: 'displayText', + type: { + name: 'String' + } + }, + query: { + required: false, + readOnly: true, + serializedName: 'query', + type: { + name: 'String' + } + }, + searchKind: { + required: false, + readOnly: true, + serializedName: 'searchKind', + defaultValue: 'WebSearch', + type: { + name: 'String' + } } } } diff --git a/lib/services/autosuggest/lib/models/searchResultsAnswer.js b/lib/services/autosuggest/lib/models/searchResultsAnswer.js index 0f5e6b2d5f..1e9fb334b2 100644 --- a/lib/services/autosuggest/lib/models/searchResultsAnswer.js +++ b/lib/services/autosuggest/lib/models/searchResultsAnswer.js @@ -89,6 +89,22 @@ class SearchResultsAnswer extends models['Answer'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -131,6 +147,14 @@ class SearchResultsAnswer extends models['Answer'] { } } }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, adaptiveCard: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/suggestions.js b/lib/services/autosuggest/lib/models/suggestions.js index eebe2f39f6..3a20af0e45 100644 --- a/lib/services/autosuggest/lib/models/suggestions.js +++ b/lib/services/autosuggest/lib/models/suggestions.js @@ -13,8 +13,7 @@ const models = require('./index'); /** - * Defines an AutoSuggest answer - * + * Class representing a Suggestions. * @extends models['SearchResultsAnswer'] */ class Suggestions extends models['SearchResultsAnswer'] { @@ -61,6 +60,22 @@ class Suggestions extends models['SearchResultsAnswer'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -103,6 +118,14 @@ class Suggestions extends models['SearchResultsAnswer'] { } } }, + preferredClickthroughUrl: { + required: false, + readOnly: true, + serializedName: 'preferredClickthroughUrl', + type: { + name: 'String' + } + }, adaptiveCard: { required: false, readOnly: true, diff --git a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js index f556bd687b..7a8cc304d2 100644 --- a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js +++ b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js @@ -58,6 +58,11 @@ class SuggestionsSuggestionGroup { serializedName: 'SearchActionElementType', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ResponseBase', className: 'SearchAction' } } diff --git a/lib/services/autosuggest/lib/models/thing.js b/lib/services/autosuggest/lib/models/thing.js index 425b058fea..5cb36eb6b6 100644 --- a/lib/services/autosuggest/lib/models/thing.js +++ b/lib/services/autosuggest/lib/models/thing.js @@ -20,14 +20,8 @@ const models = require('./index'); class Thing extends models['Response'] { /** * Create a Thing. - * @member {string} [name] The name of the thing represented by this object. - * @member {string} [description] A short description of the item. - * @member {string} [wikipediaId] - * @member {string} [freebaseId] - * @member {string} [alternateName] An alias for the item - * @member {string} [bingId] An ID that uniquely identifies this item. - * @member {string} [satoriId] - * @member {string} [ypId] + * @member {string} [url] The URL to get more information about the thing + * represented by this object. */ constructor() { super(); @@ -68,6 +62,22 @@ class Thing extends models['Response'] { name: 'String' } }, + readLink: { + required: false, + readOnly: true, + serializedName: 'readLink', + type: { + name: 'String' + } + }, + webSearchUrl: { + required: false, + readOnly: true, + serializedName: 'webSearchUrl', + type: { + name: 'String' + } + }, potentialAction: { required: false, readOnly: true, @@ -110,74 +120,26 @@ class Thing extends models['Response'] { } } }, - adaptiveCard: { - required: false, - readOnly: true, - serializedName: 'adaptiveCard', - type: { - name: 'String' - } - }, - name: { - required: false, - readOnly: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - description: { + preferredClickthroughUrl: { required: false, readOnly: true, - serializedName: 'description', + serializedName: 'preferredClickthroughUrl', type: { name: 'String' } }, - wikipediaId: { - required: false, - readOnly: true, - serializedName: 'wikipediaId', - type: { - name: 'String' - } - }, - freebaseId: { - required: false, - readOnly: true, - serializedName: 'freebaseId', - type: { - name: 'String' - } - }, - alternateName: { - required: false, - readOnly: true, - serializedName: 'alternateName', - type: { - name: 'String' - } - }, - bingId: { - required: false, - readOnly: true, - serializedName: 'bingId', - type: { - name: 'String' - } - }, - satoriId: { + adaptiveCard: { required: false, readOnly: true, - serializedName: 'satoriId', + serializedName: 'adaptiveCard', type: { name: 'String' } }, - ypId: { + url: { required: false, readOnly: true, - serializedName: 'ypId', + serializedName: 'url', type: { name: 'String' } From f587f6a02469d1a8adf3e498a72d46afede20e29 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 8 Jun 2018 23:49:24 +0000 Subject: [PATCH 5/5] Generated from 9c480eede855a9c96ace45a597f92e950c74c6ad update spec --- lib/services/autosuggest/lib/models/errorModel.js | 14 ++++++++++++++ .../autosuggest/lib/models/errorResponse.js | 5 +++++ lib/services/autosuggest/lib/models/index.d.ts | 7 +++++++ lib/services/autosuggest/lib/models/index.js | 3 +++ .../autosuggest/lib/models/queryContext.js | 14 ++++++++++++++ .../autosuggest/lib/models/searchResultsAnswer.js | 6 ++++++ lib/services/autosuggest/lib/models/suggestions.js | 10 ++++++++++ .../lib/models/suggestionsSuggestionGroup.js | 14 ++++++++++++++ 8 files changed, 73 insertions(+) diff --git a/lib/services/autosuggest/lib/models/errorModel.js b/lib/services/autosuggest/lib/models/errorModel.js index 46f9da6943..3c95c71a32 100644 --- a/lib/services/autosuggest/lib/models/errorModel.js +++ b/lib/services/autosuggest/lib/models/errorModel.js @@ -28,6 +28,7 @@ class ErrorModel { * error. * @member {string} [value] The parameter's value in the request that was not * valid. + * @member {string} _type Polymorphic Discriminator */ constructor() { } @@ -44,6 +45,11 @@ class ErrorModel { serializedName: 'Error', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ErrorModel', className: 'ErrorModel', modelProperties: { code: { @@ -84,6 +90,14 @@ class ErrorModel { type: { name: 'String' } + }, + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } } } } diff --git a/lib/services/autosuggest/lib/models/errorResponse.js b/lib/services/autosuggest/lib/models/errorResponse.js index 489d2d8a3a..56a80f0a89 100644 --- a/lib/services/autosuggest/lib/models/errorResponse.js +++ b/lib/services/autosuggest/lib/models/errorResponse.js @@ -146,6 +146,11 @@ class ErrorResponse extends models['Response'] { serializedName: 'ErrorModelElementType', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'ErrorModel', className: 'ErrorModel' } } diff --git a/lib/services/autosuggest/lib/models/index.d.ts b/lib/services/autosuggest/lib/models/index.d.ts index d06b3579e1..aabc4bb493 100644 --- a/lib/services/autosuggest/lib/models/index.d.ts +++ b/lib/services/autosuggest/lib/models/index.d.ts @@ -161,10 +161,12 @@ export interface SearchAction extends Action { * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . * @member {array} searchSuggestions + * @member {string} _type Polymorphic Discriminator */ export interface SuggestionsSuggestionGroup { name: string; searchSuggestions: SearchAction[]; + _type: string; } /** @@ -211,6 +213,7 @@ export interface Answer extends Response { * 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 {boolean} [queryContext.isTransactional] + * @member {string} [queryContext._type] Polymorphic Discriminator */ export interface SearchResultsAnswer extends Answer { readonly queryContext?: QueryContext; @@ -256,6 +259,7 @@ export interface Suggestions extends SearchResultsAnswer { * 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 {boolean} [isTransactional] + * @member {string} _type Polymorphic Discriminator */ export interface QueryContext { originalQuery: string; @@ -264,6 +268,7 @@ export interface QueryContext { readonly adultIntent?: boolean; readonly askUserForLocation?: boolean; readonly isTransactional?: boolean; + _type: string; } /** @@ -283,6 +288,7 @@ export interface QueryContext { * error. * @member {string} [value] The parameter's value in the request that was not * valid. + * @member {string} _type Polymorphic Discriminator */ export interface ErrorModel { code: string; @@ -290,6 +296,7 @@ export interface ErrorModel { readonly moreDetails?: string; readonly parameter?: string; readonly value?: string; + _type: string; } /** diff --git a/lib/services/autosuggest/lib/models/index.js b/lib/services/autosuggest/lib/models/index.js index 80e8c568b2..0f605e5b37 100644 --- a/lib/services/autosuggest/lib/models/index.js +++ b/lib/services/autosuggest/lib/models/index.js @@ -30,13 +30,16 @@ exports.ErrorModel = require('./errorModel'); exports.ErrorResponse = require('./errorResponse'); exports.discriminators = { 'ResponseBase.SearchAction' : exports.SearchAction, + 'Suggestions/SuggestionGroup' : exports.SuggestionsSuggestionGroup, 'ResponseBase.Suggestions' : exports.Suggestions, + 'QueryContext' : exports.QueryContext, 'ResponseBase.SearchResultsAnswer' : exports.SearchResultsAnswer, 'ResponseBase.Answer' : exports.Answer, 'ResponseBase.Thing' : exports.Thing, 'ResponseBase.Action' : exports.Action, 'ResponseBase.Response' : exports.Response, 'ResponseBase.Identifiable' : exports.Identifiable, + 'Error' : exports.ErrorModel, 'ResponseBase.ErrorResponse' : exports.ErrorResponse, 'ResponseBase.CreativeWork' : exports.CreativeWork, 'ResponseBase' : exports.ResponseBase diff --git a/lib/services/autosuggest/lib/models/queryContext.js b/lib/services/autosuggest/lib/models/queryContext.js index 348f2ae1bd..cbdd045c40 100644 --- a/lib/services/autosuggest/lib/models/queryContext.js +++ b/lib/services/autosuggest/lib/models/queryContext.js @@ -43,6 +43,7 @@ class QueryContext { * "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 {boolean} [isTransactional] + * @member {string} _type Polymorphic Discriminator */ constructor() { } @@ -59,6 +60,11 @@ class QueryContext { serializedName: 'QueryContext', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'QueryContext', className: 'QueryContext', modelProperties: { originalQuery: { @@ -107,6 +113,14 @@ class QueryContext { type: { name: 'Boolean' } + }, + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } } } } diff --git a/lib/services/autosuggest/lib/models/searchResultsAnswer.js b/lib/services/autosuggest/lib/models/searchResultsAnswer.js index 1e9fb334b2..9422b5d447 100644 --- a/lib/services/autosuggest/lib/models/searchResultsAnswer.js +++ b/lib/services/autosuggest/lib/models/searchResultsAnswer.js @@ -49,6 +49,7 @@ class SearchResultsAnswer extends models['Answer'] { * to false. This field is also set to false for queries that are not * location aware, such as "best sellers". * @member {boolean} [queryContext.isTransactional] + * @member {string} [queryContext._type] Polymorphic Discriminator */ constructor() { super(); @@ -169,6 +170,11 @@ class SearchResultsAnswer extends models['Answer'] { serializedName: 'queryContext', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'QueryContext', className: 'QueryContext' } } diff --git a/lib/services/autosuggest/lib/models/suggestions.js b/lib/services/autosuggest/lib/models/suggestions.js index 3a20af0e45..297ff06801 100644 --- a/lib/services/autosuggest/lib/models/suggestions.js +++ b/lib/services/autosuggest/lib/models/suggestions.js @@ -140,6 +140,11 @@ class Suggestions extends models['SearchResultsAnswer'] { serializedName: 'queryContext', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'QueryContext', className: 'QueryContext' } }, @@ -153,6 +158,11 @@ class Suggestions extends models['SearchResultsAnswer'] { serializedName: 'SuggestionsSuggestionGroupElementType', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'SuggestionsSuggestionGroup', className: 'SuggestionsSuggestionGroup' } } diff --git a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js index 7a8cc304d2..8cc1a9e646 100644 --- a/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js +++ b/lib/services/autosuggest/lib/models/suggestionsSuggestionGroup.js @@ -22,6 +22,7 @@ class SuggestionsSuggestionGroup { * 'StoreApps', 'SearchHistory', 'PersonalSearchDocuments', * 'PersonalSearchTags', 'Custom'. Default value: 'Unknown' . * @member {array} searchSuggestions + * @member {string} _type Polymorphic Discriminator */ constructor() { } @@ -38,6 +39,11 @@ class SuggestionsSuggestionGroup { serializedName: 'Suggestions/SuggestionGroup', type: { name: 'Composite', + polymorphicDiscriminator: { + serializedName: '_type', + clientName: '_type' + }, + uberParent: 'SuggestionsSuggestionGroup', className: 'SuggestionsSuggestionGroup', modelProperties: { name: { @@ -67,6 +73,14 @@ class SuggestionsSuggestionGroup { } } } + }, + _type: { + required: true, + serializedName: '_type', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } } } }