azure_cognitiveservices_entitysearch 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.0/generated/azure_cognitiveservices_entitysearch.rb +74 -0
  4. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/entities_operations.rb +573 -0
  5. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/entity_search_client.rb +127 -0
  6. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/airport.rb +188 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/answer.rb +89 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/answer_type.rb +16 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/civic_structure.rb +164 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_attribution.rb +76 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_contractual_rule.rb +63 -0
  12. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_license_attribution.rb +93 -0
  13. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_link_attribution.rb +104 -0
  14. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_media_attribution.rb +82 -0
  15. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_text_attribution.rb +96 -0
  16. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/creative_work.rb +190 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entertainment_business.rb +209 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entities.rb +142 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entities_entity_presentation_info.rb +85 -0
  20. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entity_query_scenario.rb +19 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entity_scenario.rb +17 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/entity_type.rb +63 -0
  23. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/error.rb +116 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/error_code.rb +20 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/error_response.rb +109 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/error_sub_code.rb +25 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/food_establishment.rb +209 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/hotel.rb +241 -0
  29. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/identifiable.rb +62 -0
  30. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/image_object.rb +229 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/intangible.rb +145 -0
  32. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/license.rb +180 -0
  33. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/local_business.rb +221 -0
  34. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/lodging_business.rb +209 -0
  35. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/media_object.rb +230 -0
  36. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/movie_theater.rb +221 -0
  37. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/organization.rb +144 -0
  38. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/place.rb +170 -0
  39. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/places.rb +119 -0
  40. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/postal_address.rb +285 -0
  41. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/query_context.rb +114 -0
  42. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/response.rb +96 -0
  43. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/response_base.rb +74 -0
  44. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/response_format.rb +16 -0
  45. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/restaurant.rb +265 -0
  46. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/safe_search.rb +17 -0
  47. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/search_response.rb +134 -0
  48. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/search_results_answer.rb +102 -0
  49. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/structured_value.rb +145 -0
  50. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/thing.rb +167 -0
  51. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/models/tourist_attraction.rb +164 -0
  52. data/lib/1.0/generated/azure_cognitiveservices_entitysearch/module_definition.rb +9 -0
  53. data/lib/azure_cognitiveservices_entitysearch.rb +6 -0
  54. data/lib/module_definition.rb +7 -0
  55. data/lib/profiles/latest/entitysearch_latest_profile_client.rb +38 -0
  56. data/lib/profiles/latest/entitysearch_module_definition.rb +8 -0
  57. data/lib/profiles/latest/modules/entitysearch_profile_module.rb +243 -0
  58. data/lib/version.rb +7 -0
  59. metadata +176 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ef70d11f8bf6cb18d7533f4dc9b2844f985e69a
4
+ data.tar.gz: e087d2e494191cbd42a29e2e899a5f56fbe4e8a2
5
+ SHA512:
6
+ metadata.gz: 39b4f6976ed9de0ea7d60b995ac43e71c8e8dadbcf3d8522a9d6770d565013592014531edff73b8f1457cc8c4b99160de5dd3602511e943f99c2075ec5c177a9
7
+ data.tar.gz: 21966334da81f739d6cffd9ad122c155ea29a284fb177bbea9f564a134221698b370bf383a783d730bb44e28795c28bbb5a602de46a89eade8b9256632d4dbd1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,74 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '1.0/generated/azure_cognitiveservices_entitysearch/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::CognitiveServices::EntitySearch::V1_0
23
+ autoload :EntitiesOperations, '1.0/generated/azure_cognitiveservices_entitysearch/entities_operations.rb'
24
+ autoload :EntitySearchClient, '1.0/generated/azure_cognitiveservices_entitysearch/entity_search_client.rb'
25
+
26
+ module Models
27
+ autoload :ResponseBase, '1.0/generated/azure_cognitiveservices_entitysearch/models/response_base.rb'
28
+ autoload :QueryContext, '1.0/generated/azure_cognitiveservices_entitysearch/models/query_context.rb'
29
+ autoload :ContractualRulesContractualRule, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_contractual_rule.rb'
30
+ autoload :EntitiesEntityPresentationInfo, '1.0/generated/azure_cognitiveservices_entitysearch/models/entities_entity_presentation_info.rb'
31
+ autoload :Error, '1.0/generated/azure_cognitiveservices_entitysearch/models/error.rb'
32
+ autoload :ImageObject, '1.0/generated/azure_cognitiveservices_entitysearch/models/image_object.rb'
33
+ autoload :Response, '1.0/generated/azure_cognitiveservices_entitysearch/models/response.rb'
34
+ autoload :Thing, '1.0/generated/azure_cognitiveservices_entitysearch/models/thing.rb'
35
+ autoload :SearchResponse, '1.0/generated/azure_cognitiveservices_entitysearch/models/search_response.rb'
36
+ autoload :Answer, '1.0/generated/azure_cognitiveservices_entitysearch/models/answer.rb'
37
+ autoload :SearchResultsAnswer, '1.0/generated/azure_cognitiveservices_entitysearch/models/search_results_answer.rb'
38
+ autoload :Entities, '1.0/generated/azure_cognitiveservices_entitysearch/models/entities.rb'
39
+ autoload :Places, '1.0/generated/azure_cognitiveservices_entitysearch/models/places.rb'
40
+ autoload :Identifiable, '1.0/generated/azure_cognitiveservices_entitysearch/models/identifiable.rb'
41
+ autoload :ErrorResponse, '1.0/generated/azure_cognitiveservices_entitysearch/models/error_response.rb'
42
+ autoload :PostalAddress, '1.0/generated/azure_cognitiveservices_entitysearch/models/postal_address.rb'
43
+ autoload :Place, '1.0/generated/azure_cognitiveservices_entitysearch/models/place.rb'
44
+ autoload :Organization, '1.0/generated/azure_cognitiveservices_entitysearch/models/organization.rb'
45
+ autoload :CreativeWork, '1.0/generated/azure_cognitiveservices_entitysearch/models/creative_work.rb'
46
+ autoload :Intangible, '1.0/generated/azure_cognitiveservices_entitysearch/models/intangible.rb'
47
+ autoload :ContractualRulesAttribution, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_attribution.rb'
48
+ autoload :MediaObject, '1.0/generated/azure_cognitiveservices_entitysearch/models/media_object.rb'
49
+ autoload :CivicStructure, '1.0/generated/azure_cognitiveservices_entitysearch/models/civic_structure.rb'
50
+ autoload :LocalBusiness, '1.0/generated/azure_cognitiveservices_entitysearch/models/local_business.rb'
51
+ autoload :TouristAttraction, '1.0/generated/azure_cognitiveservices_entitysearch/models/tourist_attraction.rb'
52
+ autoload :Airport, '1.0/generated/azure_cognitiveservices_entitysearch/models/airport.rb'
53
+ autoload :License, '1.0/generated/azure_cognitiveservices_entitysearch/models/license.rb'
54
+ autoload :StructuredValue, '1.0/generated/azure_cognitiveservices_entitysearch/models/structured_value.rb'
55
+ autoload :EntertainmentBusiness, '1.0/generated/azure_cognitiveservices_entitysearch/models/entertainment_business.rb'
56
+ autoload :MovieTheater, '1.0/generated/azure_cognitiveservices_entitysearch/models/movie_theater.rb'
57
+ autoload :ContractualRulesLicenseAttribution, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_license_attribution.rb'
58
+ autoload :ContractualRulesLinkAttribution, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_link_attribution.rb'
59
+ autoload :ContractualRulesMediaAttribution, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_media_attribution.rb'
60
+ autoload :ContractualRulesTextAttribution, '1.0/generated/azure_cognitiveservices_entitysearch/models/contractual_rules_text_attribution.rb'
61
+ autoload :FoodEstablishment, '1.0/generated/azure_cognitiveservices_entitysearch/models/food_establishment.rb'
62
+ autoload :LodgingBusiness, '1.0/generated/azure_cognitiveservices_entitysearch/models/lodging_business.rb'
63
+ autoload :Restaurant, '1.0/generated/azure_cognitiveservices_entitysearch/models/restaurant.rb'
64
+ autoload :Hotel, '1.0/generated/azure_cognitiveservices_entitysearch/models/hotel.rb'
65
+ autoload :EntityQueryScenario, '1.0/generated/azure_cognitiveservices_entitysearch/models/entity_query_scenario.rb'
66
+ autoload :EntityScenario, '1.0/generated/azure_cognitiveservices_entitysearch/models/entity_scenario.rb'
67
+ autoload :EntityType, '1.0/generated/azure_cognitiveservices_entitysearch/models/entity_type.rb'
68
+ autoload :ErrorCode, '1.0/generated/azure_cognitiveservices_entitysearch/models/error_code.rb'
69
+ autoload :ErrorSubCode, '1.0/generated/azure_cognitiveservices_entitysearch/models/error_sub_code.rb'
70
+ autoload :AnswerType, '1.0/generated/azure_cognitiveservices_entitysearch/models/answer_type.rb'
71
+ autoload :ResponseFormat, '1.0/generated/azure_cognitiveservices_entitysearch/models/response_format.rb'
72
+ autoload :SafeSearch, '1.0/generated/azure_cognitiveservices_entitysearch/models/safe_search.rb'
73
+ end
74
+ end
@@ -0,0 +1,573 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::EntitySearch::V1_0
7
+ #
8
+ # The Entity Search API lets you send a search query to Bing and get back
9
+ # search results that include entities and places. Place results include
10
+ # restaurants, hotel, or other local businesses. For places, the query can
11
+ # specify the name of the local business or it can ask for a list (for
12
+ # example, restaurants near me). Entity results include persons, places, or
13
+ # things. Place in this context is tourist attractions, states, countries,
14
+ # etc.
15
+ #
16
+ class EntitiesOperations
17
+ include MsRestAzure
18
+
19
+ #
20
+ # Creates and initializes a new instance of the EntitiesOperations class.
21
+ # @param client service class for accessing basic functionality.
22
+ #
23
+ def initialize(client)
24
+ @client = client
25
+ end
26
+
27
+ # @return [EntitySearchClient] reference to the EntitySearchClient
28
+ attr_reader :client
29
+
30
+ #
31
+ # The Entity Search API lets you send a search query to Bing and get back
32
+ # search results that include entities and places. Place results include
33
+ # restaurants, hotel, or other local businesses. For places, the query can
34
+ # specify the name of the local business or it can ask for a list (for example,
35
+ # restaurants near me). Entity results include persons, places, or things.
36
+ # Place in this context is tourist attractions, states, countries, etc.
37
+ #
38
+ # @param query [String] The user's search term.
39
+ # @param accept_language [String] A comma-delimited list of one or more
40
+ # languages to use for user interface strings. The list is in decreasing order
41
+ # of preference. For additional information, including expected format, see
42
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
43
+ # header and the setLang query parameter are mutually exclusive; do not specify
44
+ # both. If you set this header, you must also specify the cc query parameter.
45
+ # Bing will use the first supported language it finds from the list, and
46
+ # combine that language with the cc parameter value to determine the market to
47
+ # return results for. If the list does not include a supported language, Bing
48
+ # will find the closest language and market that supports the request, and may
49
+ # use an aggregated or default market for the results instead of a specified
50
+ # one. You should use this header and the cc query parameter only if you
51
+ # specify multiple languages; otherwise, you should use the mkt and setLang
52
+ # query parameters. A user interface string is a string that's used as a label
53
+ # in a user interface. There are very few user interface strings in the JSON
54
+ # response objects. Any links in the response objects to Bing.com properties
55
+ # will apply the specified language.
56
+ # @param pragma [String] By default, Bing returns cached content, if available.
57
+ # To prevent Bing from returning cached content, set the Pragma header to
58
+ # no-cache (for example, Pragma: no-cache).
59
+ # @param user_agent [String] The user agent originating the request. Bing uses
60
+ # the user agent to provide mobile users with an optimized experience. Although
61
+ # optional, you are strongly encouraged to always specify this header. The
62
+ # user-agent should be the same string that any commonly used browser would
63
+ # send. For information about user agents, see [RFC
64
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
65
+ # @param client_id [String] Bing uses this header to provide users with
66
+ # consistent behavior across Bing API calls. Bing often flights new features
67
+ # and improvements, and it uses the client ID as a key for assigning traffic on
68
+ # different flights. If you do not use the same client ID for a user across
69
+ # multiple requests, then Bing may assign the user to multiple conflicting
70
+ # flights. Being assigned to multiple conflicting flights can lead to an
71
+ # inconsistent user experience. For example, if the second request has a
72
+ # different flight assignment than the first, the experience may be unexpected.
73
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
74
+ # search history, providing a richer experience for the user. Bing also uses
75
+ # this header to help improve result rankings by analyzing the activity
76
+ # generated by a client ID. The relevance improvements help with better quality
77
+ # of results delivered by Bing APIs and in turn enables higher click-through
78
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
79
+ # this header required. Persisting the client ID across multiple requests for
80
+ # the same end user and device combination enables 1) the API consumer to
81
+ # receive a consistent user experience, and 2) higher click-through rates via
82
+ # better quality of results from the Bing APIs. Each user that uses your
83
+ # application on the device must have a unique, Bing generated client ID. If
84
+ # you do not include this header in the request, Bing generates an ID and
85
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
86
+ # should NOT include this header in a request is the first time the user uses
87
+ # your app on that device. Use the client ID for each Bing API request that
88
+ # your app makes for this user on the device. Persist the client ID. To persist
89
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
90
+ # used across all sessions. Do not use a session cookie. For other apps such as
91
+ # mobile apps, use the device's persistent storage to persist the ID. The next
92
+ # time the user uses your app on that device, get the client ID that you
93
+ # persisted. Bing responses may or may not include this header. If the response
94
+ # includes this header, capture the client ID and use it for all subsequent
95
+ # Bing requests for the user on that device. If you include the
96
+ # X-MSEdge-ClientID, you must not include cookies in the request.
97
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
98
+ # IP address is used to discover the user's location. Bing uses the location
99
+ # information to determine safe search behavior. Although optional, you are
100
+ # encouraged to always specify this header and the X-Search-Location header. Do
101
+ # not obfuscate the address (for example, by changing the last octet to 0).
102
+ # Obfuscating the address results in the location not being anywhere near the
103
+ # device's actual location, which may result in Bing serving erroneous results.
104
+ # @param location [String] A semicolon-delimited list of key/value pairs that
105
+ # describe the client's geographical location. Bing uses the location
106
+ # information to determine safe search behavior and to return relevant local
107
+ # content. Specify the key/value pair as <key>:<value>. The following are the
108
+ # keys that you use to specify the user's location. lat (required): The
109
+ # latitude of the client's location, in degrees. The latitude must be greater
110
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
111
+ # indicate southern latitudes and positive values indicate northern latitudes.
112
+ # long (required): The longitude of the client's location, in degrees. The
113
+ # longitude must be greater than or equal to -180.0 and less than or equal to
114
+ # +180.0. Negative values indicate western longitudes and positive values
115
+ # indicate eastern longitudes. re (required): The radius, in meters, which
116
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
117
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
118
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
119
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
120
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
121
+ # (optional): The client's relative heading or direction of travel. Specify the
122
+ # direction of travel as degrees from 0 through 360, counting clockwise
123
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
124
+ # (optional): The horizontal velocity (speed), in meters per second, that the
125
+ # client device is traveling. alt (optional): The altitude of the client
126
+ # device, in meters. are (optional): The radius, in meters, that specifies the
127
+ # vertical accuracy of the coordinates. Specify this key only if you specify
128
+ # the alt key. Although many of the keys are optional, the more information
129
+ # that you provide, the more accurate the location results are. Although
130
+ # optional, you are encouraged to always specify the user's geographical
131
+ # location. Providing the location is especially important if the client's IP
132
+ # address does not accurately reflect the user's physical location (for
133
+ # example, if the client uses VPN). For optimal results, you should include
134
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
135
+ # include this header.
136
+ # @param country_code [String] A 2-character country code of the country where
137
+ # the results come from. This API supports only the United States market. If
138
+ # you specify this query parameter, it must be set to us. If you set this
139
+ # parameter, you must also specify the Accept-Language header. Bing uses the
140
+ # first supported language it finds from the languages list, and combine that
141
+ # language with the country code that you specify to determine the market to
142
+ # return results for. If the languages list does not include a supported
143
+ # language, Bing finds the closest language and market that supports the
144
+ # request, or it may use an aggregated or default market for the results
145
+ # instead of a specified one. You should use this query parameter and the
146
+ # Accept-Language query parameter only if you specify multiple languages;
147
+ # otherwise, you should use the mkt and setLang query parameters. This
148
+ # parameter and the mkt query parameter are mutually exclusive—do not specify
149
+ # both.
150
+ # @param market [String] The market where the results come from. You are
151
+ # strongly encouraged to always specify the market, if known. Specifying the
152
+ # market helps Bing route the request and return an appropriate and optimal
153
+ # response. This parameter and the cc query parameter are mutually exclusive—do
154
+ # not specify both.
155
+ # @param response_filter [Array<AnswerType>] A comma-delimited list of answers
156
+ # to include in the response. If you do not specify this parameter, the
157
+ # response includes all search answers for which there's relevant data.
158
+ # @param response_format [Array<ResponseFormat>] The media type to use for the
159
+ # response. The following are the possible case-insensitive values: JSON,
160
+ # JSONLD. The default is JSON. If you specify JSONLD, the response body
161
+ # includes JSON-LD objects that contain the search results.
162
+ # @param safe_search [SafeSearch] A filter used to filter adult content. Off:
163
+ # Return webpages with adult text, images, or videos. Moderate: Return webpages
164
+ # with adult text, but not adult images or videos. Strict: Do not return
165
+ # webpages with adult text, images, or videos. The default is Moderate. If the
166
+ # request comes from a market that Bing's adult policy requires that safeSearch
167
+ # is set to Strict, Bing ignores the safeSearch value and uses Strict. If you
168
+ # use the site: query operator, there is the chance that the response may
169
+ # contain adult content regardless of what the safeSearch query parameter is
170
+ # set to. Use site: only if you are aware of the content on the site and your
171
+ # scenario supports the possibility of adult content. Possible values include:
172
+ # 'Off', 'Moderate', 'Strict'
173
+ # @param set_lang [String] The language to use for user interface strings.
174
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
175
+ # the language code for English is EN. The default is EN (English). Although
176
+ # optional, you should always specify the language. Typically, you set setLang
177
+ # to the same language specified by mkt unless the user wants the user
178
+ # interface strings displayed in a different language. This parameter and the
179
+ # Accept-Language header are mutually exclusive; do not specify both. A user
180
+ # interface string is a string that's used as a label in a user interface.
181
+ # There are few user interface strings in the JSON response objects. Also, any
182
+ # links to Bing.com properties in the response objects apply the specified
183
+ # language.
184
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
185
+ # will be added to the HTTP request.
186
+ #
187
+ # @return [SearchResponse] operation results.
188
+ #
189
+ def search(query, accept_language:nil, pragma:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:'en-us', response_filter:nil, response_format:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
190
+ response = search_async(query, accept_language:accept_language, pragma:pragma, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, response_filter:response_filter, response_format:response_format, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
191
+ response.body unless response.nil?
192
+ end
193
+
194
+ #
195
+ # The Entity Search API lets you send a search query to Bing and get back
196
+ # search results that include entities and places. Place results include
197
+ # restaurants, hotel, or other local businesses. For places, the query can
198
+ # specify the name of the local business or it can ask for a list (for example,
199
+ # restaurants near me). Entity results include persons, places, or things.
200
+ # Place in this context is tourist attractions, states, countries, etc.
201
+ #
202
+ # @param query [String] The user's search term.
203
+ # @param accept_language [String] A comma-delimited list of one or more
204
+ # languages to use for user interface strings. The list is in decreasing order
205
+ # of preference. For additional information, including expected format, see
206
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
207
+ # header and the setLang query parameter are mutually exclusive; do not specify
208
+ # both. If you set this header, you must also specify the cc query parameter.
209
+ # Bing will use the first supported language it finds from the list, and
210
+ # combine that language with the cc parameter value to determine the market to
211
+ # return results for. If the list does not include a supported language, Bing
212
+ # will find the closest language and market that supports the request, and may
213
+ # use an aggregated or default market for the results instead of a specified
214
+ # one. You should use this header and the cc query parameter only if you
215
+ # specify multiple languages; otherwise, you should use the mkt and setLang
216
+ # query parameters. A user interface string is a string that's used as a label
217
+ # in a user interface. There are very few user interface strings in the JSON
218
+ # response objects. Any links in the response objects to Bing.com properties
219
+ # will apply the specified language.
220
+ # @param pragma [String] By default, Bing returns cached content, if available.
221
+ # To prevent Bing from returning cached content, set the Pragma header to
222
+ # no-cache (for example, Pragma: no-cache).
223
+ # @param user_agent [String] The user agent originating the request. Bing uses
224
+ # the user agent to provide mobile users with an optimized experience. Although
225
+ # optional, you are strongly encouraged to always specify this header. The
226
+ # user-agent should be the same string that any commonly used browser would
227
+ # send. For information about user agents, see [RFC
228
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
229
+ # @param client_id [String] Bing uses this header to provide users with
230
+ # consistent behavior across Bing API calls. Bing often flights new features
231
+ # and improvements, and it uses the client ID as a key for assigning traffic on
232
+ # different flights. If you do not use the same client ID for a user across
233
+ # multiple requests, then Bing may assign the user to multiple conflicting
234
+ # flights. Being assigned to multiple conflicting flights can lead to an
235
+ # inconsistent user experience. For example, if the second request has a
236
+ # different flight assignment than the first, the experience may be unexpected.
237
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
238
+ # search history, providing a richer experience for the user. Bing also uses
239
+ # this header to help improve result rankings by analyzing the activity
240
+ # generated by a client ID. The relevance improvements help with better quality
241
+ # of results delivered by Bing APIs and in turn enables higher click-through
242
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
243
+ # this header required. Persisting the client ID across multiple requests for
244
+ # the same end user and device combination enables 1) the API consumer to
245
+ # receive a consistent user experience, and 2) higher click-through rates via
246
+ # better quality of results from the Bing APIs. Each user that uses your
247
+ # application on the device must have a unique, Bing generated client ID. If
248
+ # you do not include this header in the request, Bing generates an ID and
249
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
250
+ # should NOT include this header in a request is the first time the user uses
251
+ # your app on that device. Use the client ID for each Bing API request that
252
+ # your app makes for this user on the device. Persist the client ID. To persist
253
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
254
+ # used across all sessions. Do not use a session cookie. For other apps such as
255
+ # mobile apps, use the device's persistent storage to persist the ID. The next
256
+ # time the user uses your app on that device, get the client ID that you
257
+ # persisted. Bing responses may or may not include this header. If the response
258
+ # includes this header, capture the client ID and use it for all subsequent
259
+ # Bing requests for the user on that device. If you include the
260
+ # X-MSEdge-ClientID, you must not include cookies in the request.
261
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
262
+ # IP address is used to discover the user's location. Bing uses the location
263
+ # information to determine safe search behavior. Although optional, you are
264
+ # encouraged to always specify this header and the X-Search-Location header. Do
265
+ # not obfuscate the address (for example, by changing the last octet to 0).
266
+ # Obfuscating the address results in the location not being anywhere near the
267
+ # device's actual location, which may result in Bing serving erroneous results.
268
+ # @param location [String] A semicolon-delimited list of key/value pairs that
269
+ # describe the client's geographical location. Bing uses the location
270
+ # information to determine safe search behavior and to return relevant local
271
+ # content. Specify the key/value pair as <key>:<value>. The following are the
272
+ # keys that you use to specify the user's location. lat (required): The
273
+ # latitude of the client's location, in degrees. The latitude must be greater
274
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
275
+ # indicate southern latitudes and positive values indicate northern latitudes.
276
+ # long (required): The longitude of the client's location, in degrees. The
277
+ # longitude must be greater than or equal to -180.0 and less than or equal to
278
+ # +180.0. Negative values indicate western longitudes and positive values
279
+ # indicate eastern longitudes. re (required): The radius, in meters, which
280
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
281
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
282
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
283
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
284
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
285
+ # (optional): The client's relative heading or direction of travel. Specify the
286
+ # direction of travel as degrees from 0 through 360, counting clockwise
287
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
288
+ # (optional): The horizontal velocity (speed), in meters per second, that the
289
+ # client device is traveling. alt (optional): The altitude of the client
290
+ # device, in meters. are (optional): The radius, in meters, that specifies the
291
+ # vertical accuracy of the coordinates. Specify this key only if you specify
292
+ # the alt key. Although many of the keys are optional, the more information
293
+ # that you provide, the more accurate the location results are. Although
294
+ # optional, you are encouraged to always specify the user's geographical
295
+ # location. Providing the location is especially important if the client's IP
296
+ # address does not accurately reflect the user's physical location (for
297
+ # example, if the client uses VPN). For optimal results, you should include
298
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
299
+ # include this header.
300
+ # @param country_code [String] A 2-character country code of the country where
301
+ # the results come from. This API supports only the United States market. If
302
+ # you specify this query parameter, it must be set to us. If you set this
303
+ # parameter, you must also specify the Accept-Language header. Bing uses the
304
+ # first supported language it finds from the languages list, and combine that
305
+ # language with the country code that you specify to determine the market to
306
+ # return results for. If the languages list does not include a supported
307
+ # language, Bing finds the closest language and market that supports the
308
+ # request, or it may use an aggregated or default market for the results
309
+ # instead of a specified one. You should use this query parameter and the
310
+ # Accept-Language query parameter only if you specify multiple languages;
311
+ # otherwise, you should use the mkt and setLang query parameters. This
312
+ # parameter and the mkt query parameter are mutually exclusive—do not specify
313
+ # both.
314
+ # @param market [String] The market where the results come from. You are
315
+ # strongly encouraged to always specify the market, if known. Specifying the
316
+ # market helps Bing route the request and return an appropriate and optimal
317
+ # response. This parameter and the cc query parameter are mutually exclusive—do
318
+ # not specify both.
319
+ # @param response_filter [Array<AnswerType>] A comma-delimited list of answers
320
+ # to include in the response. If you do not specify this parameter, the
321
+ # response includes all search answers for which there's relevant data.
322
+ # @param response_format [Array<ResponseFormat>] The media type to use for the
323
+ # response. The following are the possible case-insensitive values: JSON,
324
+ # JSONLD. The default is JSON. If you specify JSONLD, the response body
325
+ # includes JSON-LD objects that contain the search results.
326
+ # @param safe_search [SafeSearch] A filter used to filter adult content. Off:
327
+ # Return webpages with adult text, images, or videos. Moderate: Return webpages
328
+ # with adult text, but not adult images or videos. Strict: Do not return
329
+ # webpages with adult text, images, or videos. The default is Moderate. If the
330
+ # request comes from a market that Bing's adult policy requires that safeSearch
331
+ # is set to Strict, Bing ignores the safeSearch value and uses Strict. If you
332
+ # use the site: query operator, there is the chance that the response may
333
+ # contain adult content regardless of what the safeSearch query parameter is
334
+ # set to. Use site: only if you are aware of the content on the site and your
335
+ # scenario supports the possibility of adult content. Possible values include:
336
+ # 'Off', 'Moderate', 'Strict'
337
+ # @param set_lang [String] The language to use for user interface strings.
338
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
339
+ # the language code for English is EN. The default is EN (English). Although
340
+ # optional, you should always specify the language. Typically, you set setLang
341
+ # to the same language specified by mkt unless the user wants the user
342
+ # interface strings displayed in a different language. This parameter and the
343
+ # Accept-Language header are mutually exclusive; do not specify both. A user
344
+ # interface string is a string that's used as a label in a user interface.
345
+ # There are few user interface strings in the JSON response objects. Also, any
346
+ # links to Bing.com properties in the response objects apply the specified
347
+ # language.
348
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
349
+ # will be added to the HTTP request.
350
+ #
351
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
352
+ #
353
+ def search_with_http_info(query, accept_language:nil, pragma:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:'en-us', response_filter:nil, response_format:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
354
+ search_async(query, accept_language:accept_language, pragma:pragma, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, response_filter:response_filter, response_format:response_format, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
355
+ end
356
+
357
+ #
358
+ # The Entity Search API lets you send a search query to Bing and get back
359
+ # search results that include entities and places. Place results include
360
+ # restaurants, hotel, or other local businesses. For places, the query can
361
+ # specify the name of the local business or it can ask for a list (for example,
362
+ # restaurants near me). Entity results include persons, places, or things.
363
+ # Place in this context is tourist attractions, states, countries, etc.
364
+ #
365
+ # @param query [String] The user's search term.
366
+ # @param accept_language [String] A comma-delimited list of one or more
367
+ # languages to use for user interface strings. The list is in decreasing order
368
+ # of preference. For additional information, including expected format, see
369
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
370
+ # header and the setLang query parameter are mutually exclusive; do not specify
371
+ # both. If you set this header, you must also specify the cc query parameter.
372
+ # Bing will use the first supported language it finds from the list, and
373
+ # combine that language with the cc parameter value to determine the market to
374
+ # return results for. If the list does not include a supported language, Bing
375
+ # will find the closest language and market that supports the request, and may
376
+ # use an aggregated or default market for the results instead of a specified
377
+ # one. You should use this header and the cc query parameter only if you
378
+ # specify multiple languages; otherwise, you should use the mkt and setLang
379
+ # query parameters. A user interface string is a string that's used as a label
380
+ # in a user interface. There are very few user interface strings in the JSON
381
+ # response objects. Any links in the response objects to Bing.com properties
382
+ # will apply the specified language.
383
+ # @param pragma [String] By default, Bing returns cached content, if available.
384
+ # To prevent Bing from returning cached content, set the Pragma header to
385
+ # no-cache (for example, Pragma: no-cache).
386
+ # @param user_agent [String] The user agent originating the request. Bing uses
387
+ # the user agent to provide mobile users with an optimized experience. Although
388
+ # optional, you are strongly encouraged to always specify this header. The
389
+ # user-agent should be the same string that any commonly used browser would
390
+ # send. For information about user agents, see [RFC
391
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
392
+ # @param client_id [String] Bing uses this header to provide users with
393
+ # consistent behavior across Bing API calls. Bing often flights new features
394
+ # and improvements, and it uses the client ID as a key for assigning traffic on
395
+ # different flights. If you do not use the same client ID for a user across
396
+ # multiple requests, then Bing may assign the user to multiple conflicting
397
+ # flights. Being assigned to multiple conflicting flights can lead to an
398
+ # inconsistent user experience. For example, if the second request has a
399
+ # different flight assignment than the first, the experience may be unexpected.
400
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
401
+ # search history, providing a richer experience for the user. Bing also uses
402
+ # this header to help improve result rankings by analyzing the activity
403
+ # generated by a client ID. The relevance improvements help with better quality
404
+ # of results delivered by Bing APIs and in turn enables higher click-through
405
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
406
+ # this header required. Persisting the client ID across multiple requests for
407
+ # the same end user and device combination enables 1) the API consumer to
408
+ # receive a consistent user experience, and 2) higher click-through rates via
409
+ # better quality of results from the Bing APIs. Each user that uses your
410
+ # application on the device must have a unique, Bing generated client ID. If
411
+ # you do not include this header in the request, Bing generates an ID and
412
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
413
+ # should NOT include this header in a request is the first time the user uses
414
+ # your app on that device. Use the client ID for each Bing API request that
415
+ # your app makes for this user on the device. Persist the client ID. To persist
416
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
417
+ # used across all sessions. Do not use a session cookie. For other apps such as
418
+ # mobile apps, use the device's persistent storage to persist the ID. The next
419
+ # time the user uses your app on that device, get the client ID that you
420
+ # persisted. Bing responses may or may not include this header. If the response
421
+ # includes this header, capture the client ID and use it for all subsequent
422
+ # Bing requests for the user on that device. If you include the
423
+ # X-MSEdge-ClientID, you must not include cookies in the request.
424
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
425
+ # IP address is used to discover the user's location. Bing uses the location
426
+ # information to determine safe search behavior. Although optional, you are
427
+ # encouraged to always specify this header and the X-Search-Location header. Do
428
+ # not obfuscate the address (for example, by changing the last octet to 0).
429
+ # Obfuscating the address results in the location not being anywhere near the
430
+ # device's actual location, which may result in Bing serving erroneous results.
431
+ # @param location [String] A semicolon-delimited list of key/value pairs that
432
+ # describe the client's geographical location. Bing uses the location
433
+ # information to determine safe search behavior and to return relevant local
434
+ # content. Specify the key/value pair as <key>:<value>. The following are the
435
+ # keys that you use to specify the user's location. lat (required): The
436
+ # latitude of the client's location, in degrees. The latitude must be greater
437
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
438
+ # indicate southern latitudes and positive values indicate northern latitudes.
439
+ # long (required): The longitude of the client's location, in degrees. The
440
+ # longitude must be greater than or equal to -180.0 and less than or equal to
441
+ # +180.0. Negative values indicate western longitudes and positive values
442
+ # indicate eastern longitudes. re (required): The radius, in meters, which
443
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
444
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
445
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
446
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
447
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
448
+ # (optional): The client's relative heading or direction of travel. Specify the
449
+ # direction of travel as degrees from 0 through 360, counting clockwise
450
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
451
+ # (optional): The horizontal velocity (speed), in meters per second, that the
452
+ # client device is traveling. alt (optional): The altitude of the client
453
+ # device, in meters. are (optional): The radius, in meters, that specifies the
454
+ # vertical accuracy of the coordinates. Specify this key only if you specify
455
+ # the alt key. Although many of the keys are optional, the more information
456
+ # that you provide, the more accurate the location results are. Although
457
+ # optional, you are encouraged to always specify the user's geographical
458
+ # location. Providing the location is especially important if the client's IP
459
+ # address does not accurately reflect the user's physical location (for
460
+ # example, if the client uses VPN). For optimal results, you should include
461
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
462
+ # include this header.
463
+ # @param country_code [String] A 2-character country code of the country where
464
+ # the results come from. This API supports only the United States market. If
465
+ # you specify this query parameter, it must be set to us. If you set this
466
+ # parameter, you must also specify the Accept-Language header. Bing uses the
467
+ # first supported language it finds from the languages list, and combine that
468
+ # language with the country code that you specify to determine the market to
469
+ # return results for. If the languages list does not include a supported
470
+ # language, Bing finds the closest language and market that supports the
471
+ # request, or it may use an aggregated or default market for the results
472
+ # instead of a specified one. You should use this query parameter and the
473
+ # Accept-Language query parameter only if you specify multiple languages;
474
+ # otherwise, you should use the mkt and setLang query parameters. This
475
+ # parameter and the mkt query parameter are mutually exclusive—do not specify
476
+ # both.
477
+ # @param market [String] The market where the results come from. You are
478
+ # strongly encouraged to always specify the market, if known. Specifying the
479
+ # market helps Bing route the request and return an appropriate and optimal
480
+ # response. This parameter and the cc query parameter are mutually exclusive—do
481
+ # not specify both.
482
+ # @param response_filter [Array<AnswerType>] A comma-delimited list of answers
483
+ # to include in the response. If you do not specify this parameter, the
484
+ # response includes all search answers for which there's relevant data.
485
+ # @param response_format [Array<ResponseFormat>] The media type to use for the
486
+ # response. The following are the possible case-insensitive values: JSON,
487
+ # JSONLD. The default is JSON. If you specify JSONLD, the response body
488
+ # includes JSON-LD objects that contain the search results.
489
+ # @param safe_search [SafeSearch] A filter used to filter adult content. Off:
490
+ # Return webpages with adult text, images, or videos. Moderate: Return webpages
491
+ # with adult text, but not adult images or videos. Strict: Do not return
492
+ # webpages with adult text, images, or videos. The default is Moderate. If the
493
+ # request comes from a market that Bing's adult policy requires that safeSearch
494
+ # is set to Strict, Bing ignores the safeSearch value and uses Strict. If you
495
+ # use the site: query operator, there is the chance that the response may
496
+ # contain adult content regardless of what the safeSearch query parameter is
497
+ # set to. Use site: only if you are aware of the content on the site and your
498
+ # scenario supports the possibility of adult content. Possible values include:
499
+ # 'Off', 'Moderate', 'Strict'
500
+ # @param set_lang [String] The language to use for user interface strings.
501
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
502
+ # the language code for English is EN. The default is EN (English). Although
503
+ # optional, you should always specify the language. Typically, you set setLang
504
+ # to the same language specified by mkt unless the user wants the user
505
+ # interface strings displayed in a different language. This parameter and the
506
+ # Accept-Language header are mutually exclusive; do not specify both. A user
507
+ # interface string is a string that's used as a label in a user interface.
508
+ # There are few user interface strings in the JSON response objects. Also, any
509
+ # links to Bing.com properties in the response objects apply the specified
510
+ # language.
511
+ # @param [Hash{String => String}] A hash of custom headers that will be added
512
+ # to the HTTP request.
513
+ #
514
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
515
+ #
516
+ def search_async(query, accept_language:nil, pragma:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:'en-us', response_filter:nil, response_format:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
517
+ x_bing_apis_sdk = 'true'
518
+ fail ArgumentError, 'query is nil' if query.nil?
519
+
520
+
521
+ request_headers = {}
522
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
523
+
524
+ # Set Headers
525
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
526
+ request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
527
+ request_headers['Accept-Language'] = accept_language unless accept_language.nil?
528
+ request_headers['Pragma'] = pragma unless pragma.nil?
529
+ request_headers['User-Agent'] = user_agent unless user_agent.nil?
530
+ request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
531
+ request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
532
+ request_headers['X-Search-Location'] = location unless location.nil?
533
+ path_template = 'entities'
534
+
535
+ request_url = @base_url || @client.base_url
536
+
537
+ options = {
538
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
539
+ query_params: {'cc' => country_code,'mkt' => market,'q' => query,'ResponseFilter' => response_filter.nil? ? nil : response_filter.join(','),'ResponseFormat' => response_format.nil? ? nil : response_format.join(','),'SafeSearch' => safe_search,'SetLang' => set_lang},
540
+ headers: request_headers.merge(custom_headers || {}),
541
+ base_url: request_url
542
+ }
543
+ promise = @client.make_request_async(:get, path_template, options)
544
+
545
+ promise = promise.then do |result|
546
+ http_response = result.response
547
+ status_code = http_response.status
548
+ response_content = http_response.body
549
+ unless status_code == 200
550
+ error_model = JSON.load(response_content)
551
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
552
+ end
553
+
554
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
555
+ # Deserialize Response
556
+ if status_code == 200
557
+ begin
558
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
559
+ result_mapper = Azure::CognitiveServices::EntitySearch::V1_0::Models::SearchResponse.mapper()
560
+ result.body = @client.deserialize(result_mapper, parsed_response)
561
+ rescue Exception => e
562
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
563
+ end
564
+ end
565
+
566
+ result
567
+ end
568
+
569
+ promise.execute
570
+ end
571
+
572
+ end
573
+ end