azure_cognitiveservices_imagesearch 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.0/generated/azure_cognitiveservices_imagesearch.rb +86 -0
  4. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/image_search_client.rb +127 -0
  5. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/images_operations.rb +2526 -0
  6. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/aggregate_offer.rb +211 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/aggregate_rating.rb +89 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/answer.rb +77 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/collection_page.rb +177 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/creative_work.rb +190 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/currency.rb +175 -0
  12. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/error.rb +116 -0
  13. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/error_code.rb +20 -0
  14. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/error_response.rb +98 -0
  15. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/error_sub_code.rb +25 -0
  16. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/freshness.rb +17 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/identifiable.rb +62 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_aspect.rb +18 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_color.rb +28 -0
  20. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_content.rb +16 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_crop_type.rb +15 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_gallery.rb +216 -0
  23. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_insight_module.rb +26 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_insights.rb +267 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_insights_image_caption.rb +82 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_license.rb +21 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_object.rb +326 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_size.rb +19 -0
  29. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_tags_module.rb +59 -0
  30. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/image_type.rb +20 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/images.rb +191 -0
  32. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/images_image_metadata.rb +80 -0
  33. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/images_module.rb +56 -0
  34. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/insights_tag.rb +48 -0
  35. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/intangible.rb +133 -0
  36. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/item_availability.rb +22 -0
  37. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/media_object.rb +263 -0
  38. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/normalized_rectangle.rb +179 -0
  39. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/offer.rb +231 -0
  40. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/organization.rb +132 -0
  41. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/person.rb +156 -0
  42. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/pivot_suggestions.rb +66 -0
  43. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/properties_item.rb +59 -0
  44. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/query.rb +104 -0
  45. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/rating.rb +84 -0
  46. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recipe.rb +219 -0
  47. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recipes_module.rb +56 -0
  48. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entities_module.rb +56 -0
  49. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity.rb +105 -0
  50. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity_group.rb +72 -0
  51. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity_region.rb +122 -0
  52. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/related_collections_module.rb +57 -0
  53. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/related_searches_module.rb +56 -0
  54. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/response.rb +84 -0
  55. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/response_base.rb +70 -0
  56. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/safe_search.rb +17 -0
  57. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/search_results_answer.rb +91 -0
  58. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/structured_value.rb +133 -0
  59. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/thing.rb +151 -0
  60. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images.rb +99 -0
  61. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images_category.rb +71 -0
  62. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images_tile.rb +63 -0
  63. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/models/web_page.rb +177 -0
  64. data/lib/1.0/generated/azure_cognitiveservices_imagesearch/module_definition.rb +9 -0
  65. data/lib/azure_cognitiveservices_imagesearch.rb +6 -0
  66. data/lib/module_definition.rb +7 -0
  67. data/lib/profiles/latest/imagesearch_latest_profile_client.rb +38 -0
  68. data/lib/profiles/latest/imagesearch_module_definition.rb +8 -0
  69. data/lib/profiles/latest/modules/imagesearch_profile_module.rb +291 -0
  70. data/lib/version.rb +7 -0
  71. metadata +188 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e8ba6bf6122c6a80b3f5030db24c86737c543c0e
4
+ data.tar.gz: 857a3c544a33826af707bc4e4c2ae3d33f6f4a0e
5
+ SHA512:
6
+ metadata.gz: 3cc48d483df59912b852817805387faef63475a98323973206e227561138a4724bb4fecab86df0d73108dd2c83dc4d25bc843776711314794f93570b3cf2e637
7
+ data.tar.gz: 37f8c3d0c87f4d9e722a376bcf001a7b5ebd4191a4a782785961f01a1cf2e084844893284734fd20a29e5579d7e8a6f6c1ab86e698cef459d81cbe976bff919d
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,86 @@
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_imagesearch/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::CognitiveServices::ImageSearch::V1_0
23
+ autoload :ImagesOperations, '1.0/generated/azure_cognitiveservices_imagesearch/images_operations.rb'
24
+ autoload :ImageSearchClient, '1.0/generated/azure_cognitiveservices_imagesearch/image_search_client.rb'
25
+
26
+ module Models
27
+ autoload :RelatedSearchesModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/related_searches_module.rb'
28
+ autoload :InsightsTag, '1.0/generated/azure_cognitiveservices_imagesearch/models/insights_tag.rb'
29
+ autoload :RecognizedEntitiesModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entities_module.rb'
30
+ autoload :PropertiesItem, '1.0/generated/azure_cognitiveservices_imagesearch/models/properties_item.rb'
31
+ autoload :RecognizedEntityGroup, '1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity_group.rb'
32
+ autoload :TrendingImagesCategory, '1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images_category.rb'
33
+ autoload :Query, '1.0/generated/azure_cognitiveservices_imagesearch/models/query.rb'
34
+ autoload :PivotSuggestions, '1.0/generated/azure_cognitiveservices_imagesearch/models/pivot_suggestions.rb'
35
+ autoload :RelatedCollectionsModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/related_collections_module.rb'
36
+ autoload :ImageTagsModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_tags_module.rb'
37
+ autoload :RecipesModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/recipes_module.rb'
38
+ autoload :ImagesImageMetadata, '1.0/generated/azure_cognitiveservices_imagesearch/models/images_image_metadata.rb'
39
+ autoload :ImageInsightsImageCaption, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_insights_image_caption.rb'
40
+ autoload :ResponseBase, '1.0/generated/azure_cognitiveservices_imagesearch/models/response_base.rb'
41
+ autoload :Error, '1.0/generated/azure_cognitiveservices_imagesearch/models/error.rb'
42
+ autoload :TrendingImagesTile, '1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images_tile.rb'
43
+ autoload :ImagesModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/images_module.rb'
44
+ autoload :Thing, '1.0/generated/azure_cognitiveservices_imagesearch/models/thing.rb'
45
+ autoload :Organization, '1.0/generated/azure_cognitiveservices_imagesearch/models/organization.rb'
46
+ autoload :AggregateRating, '1.0/generated/azure_cognitiveservices_imagesearch/models/aggregate_rating.rb'
47
+ autoload :Offer, '1.0/generated/azure_cognitiveservices_imagesearch/models/offer.rb'
48
+ autoload :AggregateOffer, '1.0/generated/azure_cognitiveservices_imagesearch/models/aggregate_offer.rb'
49
+ autoload :MediaObject, '1.0/generated/azure_cognitiveservices_imagesearch/models/media_object.rb'
50
+ autoload :ImageObject, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_object.rb'
51
+ autoload :SearchResultsAnswer, '1.0/generated/azure_cognitiveservices_imagesearch/models/search_results_answer.rb'
52
+ autoload :Images, '1.0/generated/azure_cognitiveservices_imagesearch/models/images.rb'
53
+ autoload :Identifiable, '1.0/generated/azure_cognitiveservices_imagesearch/models/identifiable.rb'
54
+ autoload :Response, '1.0/generated/azure_cognitiveservices_imagesearch/models/response.rb'
55
+ autoload :Answer, '1.0/generated/azure_cognitiveservices_imagesearch/models/answer.rb'
56
+ autoload :CreativeWork, '1.0/generated/azure_cognitiveservices_imagesearch/models/creative_work.rb'
57
+ autoload :ErrorResponse, '1.0/generated/azure_cognitiveservices_imagesearch/models/error_response.rb'
58
+ autoload :ImageGallery, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_gallery.rb'
59
+ autoload :Recipe, '1.0/generated/azure_cognitiveservices_imagesearch/models/recipe.rb'
60
+ autoload :NormalizedRectangle, '1.0/generated/azure_cognitiveservices_imagesearch/models/normalized_rectangle.rb'
61
+ autoload :RecognizedEntity, '1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity.rb'
62
+ autoload :RecognizedEntityRegion, '1.0/generated/azure_cognitiveservices_imagesearch/models/recognized_entity_region.rb'
63
+ autoload :ImageInsights, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_insights.rb'
64
+ autoload :TrendingImages, '1.0/generated/azure_cognitiveservices_imagesearch/models/trending_images.rb'
65
+ autoload :WebPage, '1.0/generated/azure_cognitiveservices_imagesearch/models/web_page.rb'
66
+ autoload :Person, '1.0/generated/azure_cognitiveservices_imagesearch/models/person.rb'
67
+ autoload :Intangible, '1.0/generated/azure_cognitiveservices_imagesearch/models/intangible.rb'
68
+ autoload :Rating, '1.0/generated/azure_cognitiveservices_imagesearch/models/rating.rb'
69
+ autoload :CollectionPage, '1.0/generated/azure_cognitiveservices_imagesearch/models/collection_page.rb'
70
+ autoload :StructuredValue, '1.0/generated/azure_cognitiveservices_imagesearch/models/structured_value.rb'
71
+ autoload :Currency, '1.0/generated/azure_cognitiveservices_imagesearch/models/currency.rb'
72
+ autoload :ItemAvailability, '1.0/generated/azure_cognitiveservices_imagesearch/models/item_availability.rb'
73
+ autoload :ErrorCode, '1.0/generated/azure_cognitiveservices_imagesearch/models/error_code.rb'
74
+ autoload :ErrorSubCode, '1.0/generated/azure_cognitiveservices_imagesearch/models/error_sub_code.rb'
75
+ autoload :ImageAspect, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_aspect.rb'
76
+ autoload :ImageColor, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_color.rb'
77
+ autoload :Freshness, '1.0/generated/azure_cognitiveservices_imagesearch/models/freshness.rb'
78
+ autoload :ImageContent, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_content.rb'
79
+ autoload :ImageType, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_type.rb'
80
+ autoload :ImageLicense, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_license.rb'
81
+ autoload :SafeSearch, '1.0/generated/azure_cognitiveservices_imagesearch/models/safe_search.rb'
82
+ autoload :ImageSize, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_size.rb'
83
+ autoload :ImageCropType, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_crop_type.rb'
84
+ autoload :ImageInsightModule, '1.0/generated/azure_cognitiveservices_imagesearch/models/image_insight_module.rb'
85
+ end
86
+ end
@@ -0,0 +1,127 @@
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::ImageSearch::V1_0
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ImageSearchClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials1
19
+
20
+ # @return Subscription credentials which uniquely identify client
21
+ # subscription.
22
+ attr_accessor :credentials
23
+
24
+ # @return [String] Gets or sets the preferred language for the response.
25
+ attr_accessor :accept_language
26
+
27
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
28
+ # Running Operations. Default value is 30.
29
+ attr_accessor :long_running_operation_retry_timeout
30
+
31
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
32
+ # is generated and included in each request. Default is true.
33
+ attr_accessor :generate_client_request_id
34
+
35
+ # @return [ImagesOperations] images_operations
36
+ attr_reader :images_operations
37
+
38
+ #
39
+ # Creates initializes a new instance of the ImageSearchClient class.
40
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
41
+ # @param base_url [String] the base URI of the service.
42
+ # @param options [Array] filters to be applied to the HTTP requests.
43
+ #
44
+ def initialize(credentials = nil, base_url = nil, options = nil)
45
+ super(credentials, options)
46
+ @base_url = base_url || 'https://api.cognitive.microsoft.com/bing/v7.0'
47
+
48
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
49
+ @credentials = credentials
50
+
51
+ @images_operations = ImagesOperations.new(self)
52
+ @accept_language = 'en-US'
53
+ @long_running_operation_retry_timeout = 30
54
+ @generate_client_request_id = true
55
+ add_telemetry
56
+ end
57
+
58
+ #
59
+ # Makes a request and returns the body of the response.
60
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
61
+ # @param path [String] the path, relative to {base_url}.
62
+ # @param options [Hash{String=>String}] specifying any request options like :body.
63
+ # @return [Hash{String=>String}] containing the body of the response.
64
+ # Example:
65
+ #
66
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
67
+ # path = "/path"
68
+ # options = {
69
+ # body: request_content,
70
+ # query_params: {'api-version' => '2016-02-01'}
71
+ # }
72
+ # result = @client.make_request(:put, path, options)
73
+ #
74
+ def make_request(method, path, options = {})
75
+ result = make_request_with_http_info(method, path, options)
76
+ result.body unless result.nil?
77
+ end
78
+
79
+ #
80
+ # Makes a request and returns the operation response.
81
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
82
+ # @param path [String] the path, relative to {base_url}.
83
+ # @param options [Hash{String=>String}] specifying any request options like :body.
84
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
85
+ #
86
+ def make_request_with_http_info(method, path, options = {})
87
+ result = make_request_async(method, path, options).value!
88
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
89
+ result
90
+ end
91
+
92
+ #
93
+ # Makes a request asynchronously.
94
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
95
+ # @param path [String] the path, relative to {base_url}.
96
+ # @param options [Hash{String=>String}] specifying any request options like :body.
97
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
98
+ #
99
+ def make_request_async(method, path, options = {})
100
+ fail ArgumentError, 'method is nil' if method.nil?
101
+ fail ArgumentError, 'path is nil' if path.nil?
102
+
103
+ request_url = options[:base_url] || @base_url
104
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
105
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
106
+ end
107
+
108
+ request_headers = @request_headers
109
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
110
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
111
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
112
+
113
+ super(request_url, method, path, options)
114
+ end
115
+
116
+
117
+ private
118
+ #
119
+ # Adds telemetry information.
120
+ #
121
+ def add_telemetry
122
+ sdk_information = 'azure_cognitiveservices_imagesearch'
123
+ sdk_information = "#{sdk_information}/0.16.0"
124
+ add_user_agent_information(sdk_information)
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,2526 @@
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::ImageSearch::V1_0
7
+ #
8
+ # The Image Search API lets you send a search query to Bing and get back a
9
+ # list of relevant images. This section provides technical details about the
10
+ # query parameters and headers that you use to request images and the JSON
11
+ # response objects that contain them. For examples that show how to make
12
+ # requests, see [Searching the Web for
13
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
14
+ #
15
+ class ImagesOperations
16
+ include MsRestAzure
17
+
18
+ #
19
+ # Creates and initializes a new instance of the ImagesOperations class.
20
+ # @param client service class for accessing basic functionality.
21
+ #
22
+ def initialize(client)
23
+ @client = client
24
+ end
25
+
26
+ # @return [ImageSearchClient] reference to the ImageSearchClient
27
+ attr_reader :client
28
+
29
+ #
30
+ # The Image Search API lets you send a search query to Bing and get back a list
31
+ # of relevant images. This section provides technical details about the query
32
+ # parameters and headers that you use to request images and the JSON response
33
+ # objects that contain them. For examples that show how to make requests, see
34
+ # [Searching the Web for
35
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
36
+ #
37
+ # @param query [String] The user's search query term. The term cannot be empty.
38
+ # The term may contain [Bing Advanced
39
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
40
+ # limit images to a specific domain, use the
41
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
42
+ # improve relevance of an insights query (see
43
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
44
+ # you should always include the user's query term. Use this parameter only with
45
+ # the Image Search API.Do not specify this parameter when calling the Trending
46
+ # Images API.
47
+ # @param accept_language [String] A comma-delimited list of one or more
48
+ # languages to use for user interface strings. The list is in decreasing order
49
+ # of preference. For additional information, including expected format, see
50
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
51
+ # header and the
52
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
53
+ # query parameter are mutually exclusive; do not specify both. If you set this
54
+ # header, you must also specify the
55
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
56
+ # query parameter. To determine the market to return results for, Bing uses the
57
+ # first supported language it finds from the list and combines it with the cc
58
+ # parameter value. If the list does not include a supported language, Bing
59
+ # finds the closest language and market that supports the request or it uses an
60
+ # aggregated or default market for the results. To determine the market that
61
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
62
+ # parameter only if you specify multiple languages. Otherwise, use the
63
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
64
+ # and
65
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
66
+ # query parameters. A user interface string is a string that's used as a label
67
+ # in a user interface. There are few user interface strings in the JSON
68
+ # response objects. Any links to Bing.com properties in the response objects
69
+ # apply the specified language.
70
+ # @param user_agent [String] The user agent originating the request. Bing uses
71
+ # the user agent to provide mobile users with an optimized experience. Although
72
+ # optional, you are encouraged to always specify this header. The user-agent
73
+ # should be the same string that any commonly used browser sends. For
74
+ # information about user agents, see [RFC
75
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
76
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
77
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
78
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
79
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
80
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
81
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
82
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
83
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
84
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
85
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
86
+ # @param client_id [String] Bing uses this header to provide users with
87
+ # consistent behavior across Bing API calls. Bing often flights new features
88
+ # and improvements, and it uses the client ID as a key for assigning traffic on
89
+ # different flights. If you do not use the same client ID for a user across
90
+ # multiple requests, then Bing may assign the user to multiple conflicting
91
+ # flights. Being assigned to multiple conflicting flights can lead to an
92
+ # inconsistent user experience. For example, if the second request has a
93
+ # different flight assignment than the first, the experience may be unexpected.
94
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
95
+ # search history, providing a richer experience for the user. Bing also uses
96
+ # this header to help improve result rankings by analyzing the activity
97
+ # generated by a client ID. The relevance improvements help with better quality
98
+ # of results delivered by Bing APIs and in turn enables higher click-through
99
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
100
+ # this header required. Persisting the client ID across multiple requests for
101
+ # the same end user and device combination enables 1) the API consumer to
102
+ # receive a consistent user experience, and 2) higher click-through rates via
103
+ # better quality of results from the Bing APIs. Each user that uses your
104
+ # application on the device must have a unique, Bing generated client ID. If
105
+ # you do not include this header in the request, Bing generates an ID and
106
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
107
+ # should NOT include this header in a request is the first time the user uses
108
+ # your app on that device. Use the client ID for each Bing API request that
109
+ # your app makes for this user on the device. Persist the client ID. To persist
110
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
111
+ # used across all sessions. Do not use a session cookie. For other apps such as
112
+ # mobile apps, use the device's persistent storage to persist the ID. The next
113
+ # time the user uses your app on that device, get the client ID that you
114
+ # persisted. Bing responses may or may not include this header. If the response
115
+ # includes this header, capture the client ID and use it for all subsequent
116
+ # Bing requests for the user on that device. If you include the
117
+ # X-MSEdge-ClientID, you must not include cookies in the request.
118
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
119
+ # IP address is used to discover the user's location. Bing uses the location
120
+ # information to determine safe search behavior. Although optional, you are
121
+ # encouraged to always specify this header and the X-Search-Location header. Do
122
+ # not obfuscate the address (for example, by changing the last octet to 0).
123
+ # Obfuscating the address results in the location not being anywhere near the
124
+ # device's actual location, which may result in Bing serving erroneous results.
125
+ # @param location [String] A semicolon-delimited list of key/value pairs that
126
+ # describe the client's geographical location. Bing uses the location
127
+ # information to determine safe search behavior and to return relevant local
128
+ # content. Specify the key/value pair as <key>:<value>. The following are the
129
+ # keys that you use to specify the user's location. lat (required): The
130
+ # latitude of the client's location, in degrees. The latitude must be greater
131
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
132
+ # indicate southern latitudes and positive values indicate northern latitudes.
133
+ # long (required): The longitude of the client's location, in degrees. The
134
+ # longitude must be greater than or equal to -180.0 and less than or equal to
135
+ # +180.0. Negative values indicate western longitudes and positive values
136
+ # indicate eastern longitudes. re (required): The radius, in meters, which
137
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
138
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
139
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
140
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
141
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
142
+ # (optional): The client's relative heading or direction of travel. Specify the
143
+ # direction of travel as degrees from 0 through 360, counting clockwise
144
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
145
+ # (optional): The horizontal velocity (speed), in meters per second, that the
146
+ # client device is traveling. alt (optional): The altitude of the client
147
+ # device, in meters. are (optional): The radius, in meters, that specifies the
148
+ # vertical accuracy of the coordinates. Specify this key only if you specify
149
+ # the alt key. Although many of the keys are optional, the more information
150
+ # that you provide, the more accurate the location results are. Although
151
+ # optional, you are encouraged to always specify the user's geographical
152
+ # location. Providing the location is especially important if the client's IP
153
+ # address does not accurately reflect the user's physical location (for
154
+ # example, if the client uses VPN). For optimal results, you should include
155
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
156
+ # include this header.
157
+ # @param aspect [ImageAspect] Filter images by the following aspect ratios.
158
+ # All: Do not filter by aspect.Specifying this value is the same as not
159
+ # specifying the aspect parameter. Square: Return images with standard aspect
160
+ # ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
161
+ # with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
162
+ # 'Tall'
163
+ # @param color [ImageColor] Filter images by the following color options.
164
+ # ColorOnly: Return color images. Monochrome: Return black and white images.
165
+ # Return images with one of the following dominant colors: Black, Blue, Brown,
166
+ # Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
167
+ # include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
168
+ # 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
169
+ # @param country_code [String] A 2-character country code of the country where
170
+ # the results come from. For a list of possible values, see [Market
171
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
172
+ # If you set this parameter, you must also specify the
173
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
174
+ # header. Bing uses the first supported language it finds from the languages
175
+ # list, and combine that language with the country code that you specify to
176
+ # determine the market to return results for. If the languages list does not
177
+ # include a supported language, Bing finds the closest language and market that
178
+ # supports the request, or it may use an aggregated or default market for the
179
+ # results instead of a specified one. You should use this query parameter and
180
+ # the Accept-Language query parameter only if you specify multiple languages;
181
+ # otherwise, you should use the mkt and setLang query parameters. This
182
+ # parameter and the
183
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
184
+ # query parameter are mutually exclusive—do not specify both.
185
+ # @param count [Integer] The number of images to return in the response. The
186
+ # actual number delivered may be less than requested. The default is 35. The
187
+ # maximum value is 150. You use this parameter along with the offset parameter
188
+ # to page results.For example, if your user interface displays 20 images per
189
+ # page, set count to 20 and offset to 0 to get the first page of results.For
190
+ # each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
191
+ # this parameter only with the Image Search API.Do not specify this parameter
192
+ # when calling the Insights, Trending Images, or Web Search APIs.
193
+ # @param freshness [Freshness] Filter images by the following discovery
194
+ # options. Day: Return images discovered by Bing within the last 24 hours.
195
+ # Week: Return images discovered by Bing within the last 7 days. Month: Return
196
+ # images discovered by Bing within the last 30 days. Possible values include:
197
+ # 'Day', 'Week', 'Month'
198
+ # @param height [Integer] Filter images that have the specified height, in
199
+ # pixels. You may use this filter with the size filter to return small images
200
+ # that have a height of 150 pixels.
201
+ # @param id [String] An ID that uniquely identifies an image. Use this
202
+ # parameter to ensure that the specified image is the first image in the list
203
+ # of images that Bing returns. The
204
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
205
+ # object's imageId field contains the ID that you set this parameter to.
206
+ # @param image_content [ImageContent] Filter images by the following content
207
+ # types. Face: Return images that show only a person's face. Portrait: Return
208
+ # images that show only a person's head and shoulders. Possible values include:
209
+ # 'Face', 'Portrait'
210
+ # @param image_type [ImageType] Filter images by the following image types.
211
+ # AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
212
+ # Line: Return only line drawings. Photo: Return only photographs(excluding
213
+ # line drawings, animated Gifs, and clip art). Shopping: Return only images
214
+ # that contain items where Bing knows of a merchant that is selling the items.
215
+ # This option is valid in the en - US market only.Transparent: Return only
216
+ # images with a transparent background. Possible values include: 'AnimatedGif',
217
+ # 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
218
+ # @param license [ImageLicense] Filter images by the following license types.
219
+ # All: Do not filter by license type.Specifying this value is the same as not
220
+ # specifying the license parameter. Any: Return images that are under any
221
+ # license type. The response doesn't include images that do not specify a
222
+ # license or the license is unknown. Public: Return images where the creator
223
+ # has waived their exclusive rights, to the fullest extent allowed by law.
224
+ # Share: Return images that may be shared with others. Changing or editing the
225
+ # image might not be allowed. Also, modifying, sharing, and using the image for
226
+ # commercial purposes might not be allowed. Typically, this option returns the
227
+ # most images. ShareCommercially: Return images that may be shared with others
228
+ # for personal or commercial purposes. Changing or editing the image might not
229
+ # be allowed. Modify: Return images that may be modified, shared, and used.
230
+ # Changing or editing the image might not be allowed. Modifying, sharing, and
231
+ # using the image for commercial purposes might not be allowed.
232
+ # ModifyCommercially: Return images that may be modified, shared, and used for
233
+ # personal or commercial purposes. Typically, this option returns the fewest
234
+ # images. For more information about these license types, see [Filter Images By
235
+ # License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
236
+ # include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
237
+ # 'ModifyCommercially'
238
+ # @param market [String] The market where the results come from. Typically, mkt
239
+ # is the country where the user is making the request from. However, it could
240
+ # be a different country if the user is not located in a country where Bing
241
+ # delivers results. The market must be in the form <language code>-<country
242
+ # code>. For example, en-US. The string is case insensitive. For a list of
243
+ # possible market values, see [Market
244
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
245
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
246
+ # the market helps Bing route the request and return an appropriate and optimal
247
+ # response. If you specify a market that is not listed in [Market
248
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
249
+ # Bing uses a best fit market code based on an internal mapping that is subject
250
+ # to change. This parameter and the
251
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
252
+ # query parameter are mutually exclusive—do not specify both.
253
+ # @param max_file_size [Integer] Filter images that are less than or equal to
254
+ # the specified file size. The maximum file size that you may specify is
255
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
256
+ # possible that the response may include images that are slightly larger than
257
+ # the specified maximum. You may specify this filter and minFileSize to filter
258
+ # images within a range of file sizes.
259
+ # @param max_height [Integer] Filter images that have a height that is less
260
+ # than or equal to the specified height. Specify the height in pixels. You may
261
+ # specify this filter and minHeight to filter images within a range of heights.
262
+ # This filter and the height filter are mutually exclusive.
263
+ # @param max_width [Integer] Filter images that have a width that is less than
264
+ # or equal to the specified width. Specify the width in pixels. You may specify
265
+ # this filter and maxWidth to filter images within a range of widths. This
266
+ # filter and the width filter are mutually exclusive.
267
+ # @param min_file_size [Integer] Filter images that are greater than or equal
268
+ # to the specified file size. The maximum file size that you may specify is
269
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
270
+ # possible that the response may include images that are slightly smaller than
271
+ # the specified minimum. You may specify this filter and maxFileSize to filter
272
+ # images within a range of file sizes.
273
+ # @param min_height [Integer] Filter images that have a height that is greater
274
+ # than or equal to the specified height. Specify the height in pixels. You may
275
+ # specify this filter and maxHeight to filter images within a range of heights.
276
+ # This filter and the height filter are mutually exclusive.
277
+ # @param min_width [Integer] Filter images that have a width that is greater
278
+ # than or equal to the specified width. Specify the width in pixels. You may
279
+ # specify this filter and maxWidth to filter images within a range of widths.
280
+ # This filter and the width filter are mutually exclusive.
281
+ # @param offset [Integer] The zero-based offset that indicates the number of
282
+ # images to skip before returning images. The default is 0. The offset should
283
+ # be less than
284
+ # ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
285
+ # - count). Use this parameter along with the count parameter to page results.
286
+ # For example, if your user interface displays 20 images per page, set count to
287
+ # 20 and offset to 0 to get the first page of results. For each subsequent
288
+ # page, increment offset by 20 (for example, 0, 20, 40). It is possible for
289
+ # multiple pages to include some overlap in results. To prevent duplicates, see
290
+ # [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
291
+ # Use this parameter only with the Image API. Do not specify this parameter
292
+ # when calling the Trending Images API or the Web Search API.
293
+ # @param safe_search [SafeSearch] Filter images for adult content. The
294
+ # following are the possible filter values. Off: May return images with adult
295
+ # content. If the request is through the Image Search API, the response
296
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
297
+ # is through the Web Search API, the response includes thumbnail images that
298
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
299
+ # API, the response doesn't include images with adult content. If the request
300
+ # is through the Web Search API, the response may include images with adult
301
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
302
+ # images with adult content. The default is Moderate. If the request comes from
303
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
304
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
305
+ # operator, there is the chance that the response may contain adult content
306
+ # regardless of what the safeSearch query parameter is set to. Use site: only
307
+ # if you are aware of the content on the site and your scenario supports the
308
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
309
+ # 'Strict'
310
+ # @param size [ImageSize] Filter images by the following sizes. All: Do not
311
+ # filter by size. Specifying this value is the same as not specifying the size
312
+ # parameter. Small: Return images that are less than 200x200 pixels. Medium:
313
+ # Return images that are greater than or equal to 200x200 pixels but less than
314
+ # 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
315
+ # Wallpaper: Return wallpaper images. You may use this parameter along with the
316
+ # height or width parameters. For example, you may use height and size to
317
+ # request small images that are 150 pixels tall. Possible values include:
318
+ # 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
319
+ # @param set_lang [String] The language to use for user interface strings.
320
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
321
+ # the language code for English is EN. The default is EN (English). Although
322
+ # optional, you should always specify the language. Typically, you set setLang
323
+ # to the same language specified by mkt unless the user wants the user
324
+ # interface strings displayed in a different language. This parameter and the
325
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
326
+ # header are mutually exclusive; do not specify both. A user interface string
327
+ # is a string that's used as a label in a user interface. There are few user
328
+ # interface strings in the JSON response objects. Also, any links to Bing.com
329
+ # properties in the response objects apply the specified language.
330
+ # @param width [Integer] Filter images that have the specified width, in
331
+ # pixels. You may use this filter with the size filter to return small images
332
+ # that have a width of 150 pixels.
333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
334
+ # will be added to the HTTP request.
335
+ #
336
+ # @return [Images] operation results.
337
+ #
338
+ def search(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, aspect:nil, color:nil, country_code:nil, count:nil, freshness:nil, height:nil, id:nil, image_content:nil, image_type:nil, license:nil, market:nil, max_file_size:nil, max_height:nil, max_width:nil, min_file_size:nil, min_height:nil, min_width:nil, offset:nil, safe_search:nil, size:nil, set_lang:nil, width:nil, custom_headers:nil)
339
+ response = search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, aspect:aspect, color:color, country_code:country_code, count:count, freshness:freshness, height:height, id:id, image_content:image_content, image_type:image_type, license:license, market:market, max_file_size:max_file_size, max_height:max_height, max_width:max_width, min_file_size:min_file_size, min_height:min_height, min_width:min_width, offset:offset, safe_search:safe_search, size:size, set_lang:set_lang, width:width, custom_headers:custom_headers).value!
340
+ response.body unless response.nil?
341
+ end
342
+
343
+ #
344
+ # The Image Search API lets you send a search query to Bing and get back a list
345
+ # of relevant images. This section provides technical details about the query
346
+ # parameters and headers that you use to request images and the JSON response
347
+ # objects that contain them. For examples that show how to make requests, see
348
+ # [Searching the Web for
349
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
350
+ #
351
+ # @param query [String] The user's search query term. The term cannot be empty.
352
+ # The term may contain [Bing Advanced
353
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
354
+ # limit images to a specific domain, use the
355
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
356
+ # improve relevance of an insights query (see
357
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
358
+ # you should always include the user's query term. Use this parameter only with
359
+ # the Image Search API.Do not specify this parameter when calling the Trending
360
+ # Images API.
361
+ # @param accept_language [String] A comma-delimited list of one or more
362
+ # languages to use for user interface strings. The list is in decreasing order
363
+ # of preference. For additional information, including expected format, see
364
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
365
+ # header and the
366
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
367
+ # query parameter are mutually exclusive; do not specify both. If you set this
368
+ # header, you must also specify the
369
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
370
+ # query parameter. To determine the market to return results for, Bing uses the
371
+ # first supported language it finds from the list and combines it with the cc
372
+ # parameter value. If the list does not include a supported language, Bing
373
+ # finds the closest language and market that supports the request or it uses an
374
+ # aggregated or default market for the results. To determine the market that
375
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
376
+ # parameter only if you specify multiple languages. Otherwise, use the
377
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
378
+ # and
379
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
380
+ # query parameters. A user interface string is a string that's used as a label
381
+ # in a user interface. There are few user interface strings in the JSON
382
+ # response objects. Any links to Bing.com properties in the response objects
383
+ # apply the specified language.
384
+ # @param user_agent [String] The user agent originating the request. Bing uses
385
+ # the user agent to provide mobile users with an optimized experience. Although
386
+ # optional, you are encouraged to always specify this header. The user-agent
387
+ # should be the same string that any commonly used browser sends. For
388
+ # information about user agents, see [RFC
389
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
390
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
391
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
392
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
393
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
394
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
395
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
396
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
397
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
398
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
399
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
400
+ # @param client_id [String] Bing uses this header to provide users with
401
+ # consistent behavior across Bing API calls. Bing often flights new features
402
+ # and improvements, and it uses the client ID as a key for assigning traffic on
403
+ # different flights. If you do not use the same client ID for a user across
404
+ # multiple requests, then Bing may assign the user to multiple conflicting
405
+ # flights. Being assigned to multiple conflicting flights can lead to an
406
+ # inconsistent user experience. For example, if the second request has a
407
+ # different flight assignment than the first, the experience may be unexpected.
408
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
409
+ # search history, providing a richer experience for the user. Bing also uses
410
+ # this header to help improve result rankings by analyzing the activity
411
+ # generated by a client ID. The relevance improvements help with better quality
412
+ # of results delivered by Bing APIs and in turn enables higher click-through
413
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
414
+ # this header required. Persisting the client ID across multiple requests for
415
+ # the same end user and device combination enables 1) the API consumer to
416
+ # receive a consistent user experience, and 2) higher click-through rates via
417
+ # better quality of results from the Bing APIs. Each user that uses your
418
+ # application on the device must have a unique, Bing generated client ID. If
419
+ # you do not include this header in the request, Bing generates an ID and
420
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
421
+ # should NOT include this header in a request is the first time the user uses
422
+ # your app on that device. Use the client ID for each Bing API request that
423
+ # your app makes for this user on the device. Persist the client ID. To persist
424
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
425
+ # used across all sessions. Do not use a session cookie. For other apps such as
426
+ # mobile apps, use the device's persistent storage to persist the ID. The next
427
+ # time the user uses your app on that device, get the client ID that you
428
+ # persisted. Bing responses may or may not include this header. If the response
429
+ # includes this header, capture the client ID and use it for all subsequent
430
+ # Bing requests for the user on that device. If you include the
431
+ # X-MSEdge-ClientID, you must not include cookies in the request.
432
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
433
+ # IP address is used to discover the user's location. Bing uses the location
434
+ # information to determine safe search behavior. Although optional, you are
435
+ # encouraged to always specify this header and the X-Search-Location header. Do
436
+ # not obfuscate the address (for example, by changing the last octet to 0).
437
+ # Obfuscating the address results in the location not being anywhere near the
438
+ # device's actual location, which may result in Bing serving erroneous results.
439
+ # @param location [String] A semicolon-delimited list of key/value pairs that
440
+ # describe the client's geographical location. Bing uses the location
441
+ # information to determine safe search behavior and to return relevant local
442
+ # content. Specify the key/value pair as <key>:<value>. The following are the
443
+ # keys that you use to specify the user's location. lat (required): The
444
+ # latitude of the client's location, in degrees. The latitude must be greater
445
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
446
+ # indicate southern latitudes and positive values indicate northern latitudes.
447
+ # long (required): The longitude of the client's location, in degrees. The
448
+ # longitude must be greater than or equal to -180.0 and less than or equal to
449
+ # +180.0. Negative values indicate western longitudes and positive values
450
+ # indicate eastern longitudes. re (required): The radius, in meters, which
451
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
452
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
453
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
454
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
455
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
456
+ # (optional): The client's relative heading or direction of travel. Specify the
457
+ # direction of travel as degrees from 0 through 360, counting clockwise
458
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
459
+ # (optional): The horizontal velocity (speed), in meters per second, that the
460
+ # client device is traveling. alt (optional): The altitude of the client
461
+ # device, in meters. are (optional): The radius, in meters, that specifies the
462
+ # vertical accuracy of the coordinates. Specify this key only if you specify
463
+ # the alt key. Although many of the keys are optional, the more information
464
+ # that you provide, the more accurate the location results are. Although
465
+ # optional, you are encouraged to always specify the user's geographical
466
+ # location. Providing the location is especially important if the client's IP
467
+ # address does not accurately reflect the user's physical location (for
468
+ # example, if the client uses VPN). For optimal results, you should include
469
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
470
+ # include this header.
471
+ # @param aspect [ImageAspect] Filter images by the following aspect ratios.
472
+ # All: Do not filter by aspect.Specifying this value is the same as not
473
+ # specifying the aspect parameter. Square: Return images with standard aspect
474
+ # ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
475
+ # with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
476
+ # 'Tall'
477
+ # @param color [ImageColor] Filter images by the following color options.
478
+ # ColorOnly: Return color images. Monochrome: Return black and white images.
479
+ # Return images with one of the following dominant colors: Black, Blue, Brown,
480
+ # Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
481
+ # include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
482
+ # 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
483
+ # @param country_code [String] A 2-character country code of the country where
484
+ # the results come from. For a list of possible values, see [Market
485
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
486
+ # If you set this parameter, you must also specify the
487
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
488
+ # header. Bing uses the first supported language it finds from the languages
489
+ # list, and combine that language with the country code that you specify to
490
+ # determine the market to return results for. If the languages list does not
491
+ # include a supported language, Bing finds the closest language and market that
492
+ # supports the request, or it may use an aggregated or default market for the
493
+ # results instead of a specified one. You should use this query parameter and
494
+ # the Accept-Language query parameter only if you specify multiple languages;
495
+ # otherwise, you should use the mkt and setLang query parameters. This
496
+ # parameter and the
497
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
498
+ # query parameter are mutually exclusive—do not specify both.
499
+ # @param count [Integer] The number of images to return in the response. The
500
+ # actual number delivered may be less than requested. The default is 35. The
501
+ # maximum value is 150. You use this parameter along with the offset parameter
502
+ # to page results.For example, if your user interface displays 20 images per
503
+ # page, set count to 20 and offset to 0 to get the first page of results.For
504
+ # each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
505
+ # this parameter only with the Image Search API.Do not specify this parameter
506
+ # when calling the Insights, Trending Images, or Web Search APIs.
507
+ # @param freshness [Freshness] Filter images by the following discovery
508
+ # options. Day: Return images discovered by Bing within the last 24 hours.
509
+ # Week: Return images discovered by Bing within the last 7 days. Month: Return
510
+ # images discovered by Bing within the last 30 days. Possible values include:
511
+ # 'Day', 'Week', 'Month'
512
+ # @param height [Integer] Filter images that have the specified height, in
513
+ # pixels. You may use this filter with the size filter to return small images
514
+ # that have a height of 150 pixels.
515
+ # @param id [String] An ID that uniquely identifies an image. Use this
516
+ # parameter to ensure that the specified image is the first image in the list
517
+ # of images that Bing returns. The
518
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
519
+ # object's imageId field contains the ID that you set this parameter to.
520
+ # @param image_content [ImageContent] Filter images by the following content
521
+ # types. Face: Return images that show only a person's face. Portrait: Return
522
+ # images that show only a person's head and shoulders. Possible values include:
523
+ # 'Face', 'Portrait'
524
+ # @param image_type [ImageType] Filter images by the following image types.
525
+ # AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
526
+ # Line: Return only line drawings. Photo: Return only photographs(excluding
527
+ # line drawings, animated Gifs, and clip art). Shopping: Return only images
528
+ # that contain items where Bing knows of a merchant that is selling the items.
529
+ # This option is valid in the en - US market only.Transparent: Return only
530
+ # images with a transparent background. Possible values include: 'AnimatedGif',
531
+ # 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
532
+ # @param license [ImageLicense] Filter images by the following license types.
533
+ # All: Do not filter by license type.Specifying this value is the same as not
534
+ # specifying the license parameter. Any: Return images that are under any
535
+ # license type. The response doesn't include images that do not specify a
536
+ # license or the license is unknown. Public: Return images where the creator
537
+ # has waived their exclusive rights, to the fullest extent allowed by law.
538
+ # Share: Return images that may be shared with others. Changing or editing the
539
+ # image might not be allowed. Also, modifying, sharing, and using the image for
540
+ # commercial purposes might not be allowed. Typically, this option returns the
541
+ # most images. ShareCommercially: Return images that may be shared with others
542
+ # for personal or commercial purposes. Changing or editing the image might not
543
+ # be allowed. Modify: Return images that may be modified, shared, and used.
544
+ # Changing or editing the image might not be allowed. Modifying, sharing, and
545
+ # using the image for commercial purposes might not be allowed.
546
+ # ModifyCommercially: Return images that may be modified, shared, and used for
547
+ # personal or commercial purposes. Typically, this option returns the fewest
548
+ # images. For more information about these license types, see [Filter Images By
549
+ # License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
550
+ # include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
551
+ # 'ModifyCommercially'
552
+ # @param market [String] The market where the results come from. Typically, mkt
553
+ # is the country where the user is making the request from. However, it could
554
+ # be a different country if the user is not located in a country where Bing
555
+ # delivers results. The market must be in the form <language code>-<country
556
+ # code>. For example, en-US. The string is case insensitive. For a list of
557
+ # possible market values, see [Market
558
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
559
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
560
+ # the market helps Bing route the request and return an appropriate and optimal
561
+ # response. If you specify a market that is not listed in [Market
562
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
563
+ # Bing uses a best fit market code based on an internal mapping that is subject
564
+ # to change. This parameter and the
565
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
566
+ # query parameter are mutually exclusive—do not specify both.
567
+ # @param max_file_size [Integer] Filter images that are less than or equal to
568
+ # the specified file size. The maximum file size that you may specify is
569
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
570
+ # possible that the response may include images that are slightly larger than
571
+ # the specified maximum. You may specify this filter and minFileSize to filter
572
+ # images within a range of file sizes.
573
+ # @param max_height [Integer] Filter images that have a height that is less
574
+ # than or equal to the specified height. Specify the height in pixels. You may
575
+ # specify this filter and minHeight to filter images within a range of heights.
576
+ # This filter and the height filter are mutually exclusive.
577
+ # @param max_width [Integer] Filter images that have a width that is less than
578
+ # or equal to the specified width. Specify the width in pixels. You may specify
579
+ # this filter and maxWidth to filter images within a range of widths. This
580
+ # filter and the width filter are mutually exclusive.
581
+ # @param min_file_size [Integer] Filter images that are greater than or equal
582
+ # to the specified file size. The maximum file size that you may specify is
583
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
584
+ # possible that the response may include images that are slightly smaller than
585
+ # the specified minimum. You may specify this filter and maxFileSize to filter
586
+ # images within a range of file sizes.
587
+ # @param min_height [Integer] Filter images that have a height that is greater
588
+ # than or equal to the specified height. Specify the height in pixels. You may
589
+ # specify this filter and maxHeight to filter images within a range of heights.
590
+ # This filter and the height filter are mutually exclusive.
591
+ # @param min_width [Integer] Filter images that have a width that is greater
592
+ # than or equal to the specified width. Specify the width in pixels. You may
593
+ # specify this filter and maxWidth to filter images within a range of widths.
594
+ # This filter and the width filter are mutually exclusive.
595
+ # @param offset [Integer] The zero-based offset that indicates the number of
596
+ # images to skip before returning images. The default is 0. The offset should
597
+ # be less than
598
+ # ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
599
+ # - count). Use this parameter along with the count parameter to page results.
600
+ # For example, if your user interface displays 20 images per page, set count to
601
+ # 20 and offset to 0 to get the first page of results. For each subsequent
602
+ # page, increment offset by 20 (for example, 0, 20, 40). It is possible for
603
+ # multiple pages to include some overlap in results. To prevent duplicates, see
604
+ # [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
605
+ # Use this parameter only with the Image API. Do not specify this parameter
606
+ # when calling the Trending Images API or the Web Search API.
607
+ # @param safe_search [SafeSearch] Filter images for adult content. The
608
+ # following are the possible filter values. Off: May return images with adult
609
+ # content. If the request is through the Image Search API, the response
610
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
611
+ # is through the Web Search API, the response includes thumbnail images that
612
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
613
+ # API, the response doesn't include images with adult content. If the request
614
+ # is through the Web Search API, the response may include images with adult
615
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
616
+ # images with adult content. The default is Moderate. If the request comes from
617
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
618
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
619
+ # operator, there is the chance that the response may contain adult content
620
+ # regardless of what the safeSearch query parameter is set to. Use site: only
621
+ # if you are aware of the content on the site and your scenario supports the
622
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
623
+ # 'Strict'
624
+ # @param size [ImageSize] Filter images by the following sizes. All: Do not
625
+ # filter by size. Specifying this value is the same as not specifying the size
626
+ # parameter. Small: Return images that are less than 200x200 pixels. Medium:
627
+ # Return images that are greater than or equal to 200x200 pixels but less than
628
+ # 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
629
+ # Wallpaper: Return wallpaper images. You may use this parameter along with the
630
+ # height or width parameters. For example, you may use height and size to
631
+ # request small images that are 150 pixels tall. Possible values include:
632
+ # 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
633
+ # @param set_lang [String] The language to use for user interface strings.
634
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
635
+ # the language code for English is EN. The default is EN (English). Although
636
+ # optional, you should always specify the language. Typically, you set setLang
637
+ # to the same language specified by mkt unless the user wants the user
638
+ # interface strings displayed in a different language. This parameter and the
639
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
640
+ # header are mutually exclusive; do not specify both. A user interface string
641
+ # is a string that's used as a label in a user interface. There are few user
642
+ # interface strings in the JSON response objects. Also, any links to Bing.com
643
+ # properties in the response objects apply the specified language.
644
+ # @param width [Integer] Filter images that have the specified width, in
645
+ # pixels. You may use this filter with the size filter to return small images
646
+ # that have a width of 150 pixels.
647
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
648
+ # will be added to the HTTP request.
649
+ #
650
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
651
+ #
652
+ def search_with_http_info(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, aspect:nil, color:nil, country_code:nil, count:nil, freshness:nil, height:nil, id:nil, image_content:nil, image_type:nil, license:nil, market:nil, max_file_size:nil, max_height:nil, max_width:nil, min_file_size:nil, min_height:nil, min_width:nil, offset:nil, safe_search:nil, size:nil, set_lang:nil, width:nil, custom_headers:nil)
653
+ search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, aspect:aspect, color:color, country_code:country_code, count:count, freshness:freshness, height:height, id:id, image_content:image_content, image_type:image_type, license:license, market:market, max_file_size:max_file_size, max_height:max_height, max_width:max_width, min_file_size:min_file_size, min_height:min_height, min_width:min_width, offset:offset, safe_search:safe_search, size:size, set_lang:set_lang, width:width, custom_headers:custom_headers).value!
654
+ end
655
+
656
+ #
657
+ # The Image Search API lets you send a search query to Bing and get back a list
658
+ # of relevant images. This section provides technical details about the query
659
+ # parameters and headers that you use to request images and the JSON response
660
+ # objects that contain them. For examples that show how to make requests, see
661
+ # [Searching the Web for
662
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
663
+ #
664
+ # @param query [String] The user's search query term. The term cannot be empty.
665
+ # The term may contain [Bing Advanced
666
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
667
+ # limit images to a specific domain, use the
668
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
669
+ # improve relevance of an insights query (see
670
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
671
+ # you should always include the user's query term. Use this parameter only with
672
+ # the Image Search API.Do not specify this parameter when calling the Trending
673
+ # Images API.
674
+ # @param accept_language [String] A comma-delimited list of one or more
675
+ # languages to use for user interface strings. The list is in decreasing order
676
+ # of preference. For additional information, including expected format, see
677
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
678
+ # header and the
679
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
680
+ # query parameter are mutually exclusive; do not specify both. If you set this
681
+ # header, you must also specify the
682
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
683
+ # query parameter. To determine the market to return results for, Bing uses the
684
+ # first supported language it finds from the list and combines it with the cc
685
+ # parameter value. If the list does not include a supported language, Bing
686
+ # finds the closest language and market that supports the request or it uses an
687
+ # aggregated or default market for the results. To determine the market that
688
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
689
+ # parameter only if you specify multiple languages. Otherwise, use the
690
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
691
+ # and
692
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
693
+ # query parameters. A user interface string is a string that's used as a label
694
+ # in a user interface. There are few user interface strings in the JSON
695
+ # response objects. Any links to Bing.com properties in the response objects
696
+ # apply the specified language.
697
+ # @param user_agent [String] The user agent originating the request. Bing uses
698
+ # the user agent to provide mobile users with an optimized experience. Although
699
+ # optional, you are encouraged to always specify this header. The user-agent
700
+ # should be the same string that any commonly used browser sends. For
701
+ # information about user agents, see [RFC
702
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
703
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
704
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
705
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
706
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
707
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
708
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
709
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
710
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
711
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
712
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
713
+ # @param client_id [String] Bing uses this header to provide users with
714
+ # consistent behavior across Bing API calls. Bing often flights new features
715
+ # and improvements, and it uses the client ID as a key for assigning traffic on
716
+ # different flights. If you do not use the same client ID for a user across
717
+ # multiple requests, then Bing may assign the user to multiple conflicting
718
+ # flights. Being assigned to multiple conflicting flights can lead to an
719
+ # inconsistent user experience. For example, if the second request has a
720
+ # different flight assignment than the first, the experience may be unexpected.
721
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
722
+ # search history, providing a richer experience for the user. Bing also uses
723
+ # this header to help improve result rankings by analyzing the activity
724
+ # generated by a client ID. The relevance improvements help with better quality
725
+ # of results delivered by Bing APIs and in turn enables higher click-through
726
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
727
+ # this header required. Persisting the client ID across multiple requests for
728
+ # the same end user and device combination enables 1) the API consumer to
729
+ # receive a consistent user experience, and 2) higher click-through rates via
730
+ # better quality of results from the Bing APIs. Each user that uses your
731
+ # application on the device must have a unique, Bing generated client ID. If
732
+ # you do not include this header in the request, Bing generates an ID and
733
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
734
+ # should NOT include this header in a request is the first time the user uses
735
+ # your app on that device. Use the client ID for each Bing API request that
736
+ # your app makes for this user on the device. Persist the client ID. To persist
737
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
738
+ # used across all sessions. Do not use a session cookie. For other apps such as
739
+ # mobile apps, use the device's persistent storage to persist the ID. The next
740
+ # time the user uses your app on that device, get the client ID that you
741
+ # persisted. Bing responses may or may not include this header. If the response
742
+ # includes this header, capture the client ID and use it for all subsequent
743
+ # Bing requests for the user on that device. If you include the
744
+ # X-MSEdge-ClientID, you must not include cookies in the request.
745
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
746
+ # IP address is used to discover the user's location. Bing uses the location
747
+ # information to determine safe search behavior. Although optional, you are
748
+ # encouraged to always specify this header and the X-Search-Location header. Do
749
+ # not obfuscate the address (for example, by changing the last octet to 0).
750
+ # Obfuscating the address results in the location not being anywhere near the
751
+ # device's actual location, which may result in Bing serving erroneous results.
752
+ # @param location [String] A semicolon-delimited list of key/value pairs that
753
+ # describe the client's geographical location. Bing uses the location
754
+ # information to determine safe search behavior and to return relevant local
755
+ # content. Specify the key/value pair as <key>:<value>. The following are the
756
+ # keys that you use to specify the user's location. lat (required): The
757
+ # latitude of the client's location, in degrees. The latitude must be greater
758
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
759
+ # indicate southern latitudes and positive values indicate northern latitudes.
760
+ # long (required): The longitude of the client's location, in degrees. The
761
+ # longitude must be greater than or equal to -180.0 and less than or equal to
762
+ # +180.0. Negative values indicate western longitudes and positive values
763
+ # indicate eastern longitudes. re (required): The radius, in meters, which
764
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
765
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
766
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
767
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
768
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
769
+ # (optional): The client's relative heading or direction of travel. Specify the
770
+ # direction of travel as degrees from 0 through 360, counting clockwise
771
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
772
+ # (optional): The horizontal velocity (speed), in meters per second, that the
773
+ # client device is traveling. alt (optional): The altitude of the client
774
+ # device, in meters. are (optional): The radius, in meters, that specifies the
775
+ # vertical accuracy of the coordinates. Specify this key only if you specify
776
+ # the alt key. Although many of the keys are optional, the more information
777
+ # that you provide, the more accurate the location results are. Although
778
+ # optional, you are encouraged to always specify the user's geographical
779
+ # location. Providing the location is especially important if the client's IP
780
+ # address does not accurately reflect the user's physical location (for
781
+ # example, if the client uses VPN). For optimal results, you should include
782
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
783
+ # include this header.
784
+ # @param aspect [ImageAspect] Filter images by the following aspect ratios.
785
+ # All: Do not filter by aspect.Specifying this value is the same as not
786
+ # specifying the aspect parameter. Square: Return images with standard aspect
787
+ # ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
788
+ # with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
789
+ # 'Tall'
790
+ # @param color [ImageColor] Filter images by the following color options.
791
+ # ColorOnly: Return color images. Monochrome: Return black and white images.
792
+ # Return images with one of the following dominant colors: Black, Blue, Brown,
793
+ # Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
794
+ # include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
795
+ # 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
796
+ # @param country_code [String] A 2-character country code of the country where
797
+ # the results come from. For a list of possible values, see [Market
798
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
799
+ # If you set this parameter, you must also specify the
800
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
801
+ # header. Bing uses the first supported language it finds from the languages
802
+ # list, and combine that language with the country code that you specify to
803
+ # determine the market to return results for. If the languages list does not
804
+ # include a supported language, Bing finds the closest language and market that
805
+ # supports the request, or it may use an aggregated or default market for the
806
+ # results instead of a specified one. You should use this query parameter and
807
+ # the Accept-Language query parameter only if you specify multiple languages;
808
+ # otherwise, you should use the mkt and setLang query parameters. This
809
+ # parameter and the
810
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
811
+ # query parameter are mutually exclusive—do not specify both.
812
+ # @param count [Integer] The number of images to return in the response. The
813
+ # actual number delivered may be less than requested. The default is 35. The
814
+ # maximum value is 150. You use this parameter along with the offset parameter
815
+ # to page results.For example, if your user interface displays 20 images per
816
+ # page, set count to 20 and offset to 0 to get the first page of results.For
817
+ # each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
818
+ # this parameter only with the Image Search API.Do not specify this parameter
819
+ # when calling the Insights, Trending Images, or Web Search APIs.
820
+ # @param freshness [Freshness] Filter images by the following discovery
821
+ # options. Day: Return images discovered by Bing within the last 24 hours.
822
+ # Week: Return images discovered by Bing within the last 7 days. Month: Return
823
+ # images discovered by Bing within the last 30 days. Possible values include:
824
+ # 'Day', 'Week', 'Month'
825
+ # @param height [Integer] Filter images that have the specified height, in
826
+ # pixels. You may use this filter with the size filter to return small images
827
+ # that have a height of 150 pixels.
828
+ # @param id [String] An ID that uniquely identifies an image. Use this
829
+ # parameter to ensure that the specified image is the first image in the list
830
+ # of images that Bing returns. The
831
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
832
+ # object's imageId field contains the ID that you set this parameter to.
833
+ # @param image_content [ImageContent] Filter images by the following content
834
+ # types. Face: Return images that show only a person's face. Portrait: Return
835
+ # images that show only a person's head and shoulders. Possible values include:
836
+ # 'Face', 'Portrait'
837
+ # @param image_type [ImageType] Filter images by the following image types.
838
+ # AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
839
+ # Line: Return only line drawings. Photo: Return only photographs(excluding
840
+ # line drawings, animated Gifs, and clip art). Shopping: Return only images
841
+ # that contain items where Bing knows of a merchant that is selling the items.
842
+ # This option is valid in the en - US market only.Transparent: Return only
843
+ # images with a transparent background. Possible values include: 'AnimatedGif',
844
+ # 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
845
+ # @param license [ImageLicense] Filter images by the following license types.
846
+ # All: Do not filter by license type.Specifying this value is the same as not
847
+ # specifying the license parameter. Any: Return images that are under any
848
+ # license type. The response doesn't include images that do not specify a
849
+ # license or the license is unknown. Public: Return images where the creator
850
+ # has waived their exclusive rights, to the fullest extent allowed by law.
851
+ # Share: Return images that may be shared with others. Changing or editing the
852
+ # image might not be allowed. Also, modifying, sharing, and using the image for
853
+ # commercial purposes might not be allowed. Typically, this option returns the
854
+ # most images. ShareCommercially: Return images that may be shared with others
855
+ # for personal or commercial purposes. Changing or editing the image might not
856
+ # be allowed. Modify: Return images that may be modified, shared, and used.
857
+ # Changing or editing the image might not be allowed. Modifying, sharing, and
858
+ # using the image for commercial purposes might not be allowed.
859
+ # ModifyCommercially: Return images that may be modified, shared, and used for
860
+ # personal or commercial purposes. Typically, this option returns the fewest
861
+ # images. For more information about these license types, see [Filter Images By
862
+ # License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
863
+ # include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
864
+ # 'ModifyCommercially'
865
+ # @param market [String] The market where the results come from. Typically, mkt
866
+ # is the country where the user is making the request from. However, it could
867
+ # be a different country if the user is not located in a country where Bing
868
+ # delivers results. The market must be in the form <language code>-<country
869
+ # code>. For example, en-US. The string is case insensitive. For a list of
870
+ # possible market values, see [Market
871
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
872
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
873
+ # the market helps Bing route the request and return an appropriate and optimal
874
+ # response. If you specify a market that is not listed in [Market
875
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
876
+ # Bing uses a best fit market code based on an internal mapping that is subject
877
+ # to change. This parameter and the
878
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
879
+ # query parameter are mutually exclusive—do not specify both.
880
+ # @param max_file_size [Integer] Filter images that are less than or equal to
881
+ # the specified file size. The maximum file size that you may specify is
882
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
883
+ # possible that the response may include images that are slightly larger than
884
+ # the specified maximum. You may specify this filter and minFileSize to filter
885
+ # images within a range of file sizes.
886
+ # @param max_height [Integer] Filter images that have a height that is less
887
+ # than or equal to the specified height. Specify the height in pixels. You may
888
+ # specify this filter and minHeight to filter images within a range of heights.
889
+ # This filter and the height filter are mutually exclusive.
890
+ # @param max_width [Integer] Filter images that have a width that is less than
891
+ # or equal to the specified width. Specify the width in pixels. You may specify
892
+ # this filter and maxWidth to filter images within a range of widths. This
893
+ # filter and the width filter are mutually exclusive.
894
+ # @param min_file_size [Integer] Filter images that are greater than or equal
895
+ # to the specified file size. The maximum file size that you may specify is
896
+ # 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
897
+ # possible that the response may include images that are slightly smaller than
898
+ # the specified minimum. You may specify this filter and maxFileSize to filter
899
+ # images within a range of file sizes.
900
+ # @param min_height [Integer] Filter images that have a height that is greater
901
+ # than or equal to the specified height. Specify the height in pixels. You may
902
+ # specify this filter and maxHeight to filter images within a range of heights.
903
+ # This filter and the height filter are mutually exclusive.
904
+ # @param min_width [Integer] Filter images that have a width that is greater
905
+ # than or equal to the specified width. Specify the width in pixels. You may
906
+ # specify this filter and maxWidth to filter images within a range of widths.
907
+ # This filter and the width filter are mutually exclusive.
908
+ # @param offset [Integer] The zero-based offset that indicates the number of
909
+ # images to skip before returning images. The default is 0. The offset should
910
+ # be less than
911
+ # ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
912
+ # - count). Use this parameter along with the count parameter to page results.
913
+ # For example, if your user interface displays 20 images per page, set count to
914
+ # 20 and offset to 0 to get the first page of results. For each subsequent
915
+ # page, increment offset by 20 (for example, 0, 20, 40). It is possible for
916
+ # multiple pages to include some overlap in results. To prevent duplicates, see
917
+ # [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
918
+ # Use this parameter only with the Image API. Do not specify this parameter
919
+ # when calling the Trending Images API or the Web Search API.
920
+ # @param safe_search [SafeSearch] Filter images for adult content. The
921
+ # following are the possible filter values. Off: May return images with adult
922
+ # content. If the request is through the Image Search API, the response
923
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
924
+ # is through the Web Search API, the response includes thumbnail images that
925
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
926
+ # API, the response doesn't include images with adult content. If the request
927
+ # is through the Web Search API, the response may include images with adult
928
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
929
+ # images with adult content. The default is Moderate. If the request comes from
930
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
931
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
932
+ # operator, there is the chance that the response may contain adult content
933
+ # regardless of what the safeSearch query parameter is set to. Use site: only
934
+ # if you are aware of the content on the site and your scenario supports the
935
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
936
+ # 'Strict'
937
+ # @param size [ImageSize] Filter images by the following sizes. All: Do not
938
+ # filter by size. Specifying this value is the same as not specifying the size
939
+ # parameter. Small: Return images that are less than 200x200 pixels. Medium:
940
+ # Return images that are greater than or equal to 200x200 pixels but less than
941
+ # 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
942
+ # Wallpaper: Return wallpaper images. You may use this parameter along with the
943
+ # height or width parameters. For example, you may use height and size to
944
+ # request small images that are 150 pixels tall. Possible values include:
945
+ # 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
946
+ # @param set_lang [String] The language to use for user interface strings.
947
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
948
+ # the language code for English is EN. The default is EN (English). Although
949
+ # optional, you should always specify the language. Typically, you set setLang
950
+ # to the same language specified by mkt unless the user wants the user
951
+ # interface strings displayed in a different language. This parameter and the
952
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
953
+ # header are mutually exclusive; do not specify both. A user interface string
954
+ # is a string that's used as a label in a user interface. There are few user
955
+ # interface strings in the JSON response objects. Also, any links to Bing.com
956
+ # properties in the response objects apply the specified language.
957
+ # @param width [Integer] Filter images that have the specified width, in
958
+ # pixels. You may use this filter with the size filter to return small images
959
+ # that have a width of 150 pixels.
960
+ # @param [Hash{String => String}] A hash of custom headers that will be added
961
+ # to the HTTP request.
962
+ #
963
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
964
+ #
965
+ def search_async(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, aspect:nil, color:nil, country_code:nil, count:nil, freshness:nil, height:nil, id:nil, image_content:nil, image_type:nil, license:nil, market:nil, max_file_size:nil, max_height:nil, max_width:nil, min_file_size:nil, min_height:nil, min_width:nil, offset:nil, safe_search:nil, size:nil, set_lang:nil, width:nil, custom_headers:nil)
966
+ x_bing_apis_sdk = 'true'
967
+ fail ArgumentError, 'query is nil' if query.nil?
968
+
969
+
970
+ request_headers = {}
971
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
972
+
973
+ # Set Headers
974
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
975
+ request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
976
+ request_headers['Accept-Language'] = accept_language unless accept_language.nil?
977
+ request_headers['User-Agent'] = user_agent unless user_agent.nil?
978
+ request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
979
+ request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
980
+ request_headers['X-Search-Location'] = location unless location.nil?
981
+ path_template = 'images/search'
982
+
983
+ request_url = @base_url || @client.base_url
984
+
985
+ options = {
986
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
987
+ query_params: {'aspect' => aspect,'color' => color,'cc' => country_code,'count' => count,'freshness' => freshness,'height' => height,'id' => id,'imageContent' => image_content,'imageType' => image_type,'license' => license,'mkt' => market,'maxFileSize' => max_file_size,'maxHeight' => max_height,'maxWidth' => max_width,'minFileSize' => min_file_size,'minHeight' => min_height,'minWidth' => min_width,'offset' => offset,'q' => query,'safeSearch' => safe_search,'size' => size,'setLang' => set_lang,'width' => width},
988
+ headers: request_headers.merge(custom_headers || {}),
989
+ base_url: request_url
990
+ }
991
+ promise = @client.make_request_async(:get, path_template, options)
992
+
993
+ promise = promise.then do |result|
994
+ http_response = result.response
995
+ status_code = http_response.status
996
+ response_content = http_response.body
997
+ unless status_code == 200
998
+ error_model = JSON.load(response_content)
999
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1000
+ end
1001
+
1002
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1003
+ # Deserialize Response
1004
+ if status_code == 200
1005
+ begin
1006
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1007
+ result_mapper = Azure::CognitiveServices::ImageSearch::V1_0::Models::Images.mapper()
1008
+ result.body = @client.deserialize(result_mapper, parsed_response)
1009
+ rescue Exception => e
1010
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1011
+ end
1012
+ end
1013
+
1014
+ result
1015
+ end
1016
+
1017
+ promise.execute
1018
+ end
1019
+
1020
+ #
1021
+ # The Image Detail Search API lets you search on Bing and get back insights
1022
+ # about an image, such as webpages that include the image. This section
1023
+ # provides technical details about the query parameters and headers that you
1024
+ # use to request insights of images and the JSON response objects that contain
1025
+ # them. For examples that show how to make requests, see [Searching the Web for
1026
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
1027
+ #
1028
+ # @param query [String] The user's search query term. The term cannot be empty.
1029
+ # The term may contain [Bing Advanced
1030
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
1031
+ # limit images to a specific domain, use the
1032
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
1033
+ # improve relevance of an insights query (see
1034
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
1035
+ # you should always include the user's query term. Use this parameter only with
1036
+ # the Image Search API.Do not specify this parameter when calling the Trending
1037
+ # Images API.
1038
+ # @param accept_language [String] A comma-delimited list of one or more
1039
+ # languages to use for user interface strings. The list is in decreasing order
1040
+ # of preference. For additional information, including expected format, see
1041
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
1042
+ # header and the
1043
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1044
+ # query parameter are mutually exclusive; do not specify both. If you set this
1045
+ # header, you must also specify the
1046
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1047
+ # query parameter. To determine the market to return results for, Bing uses the
1048
+ # first supported language it finds from the list and combines it with the cc
1049
+ # parameter value. If the list does not include a supported language, Bing
1050
+ # finds the closest language and market that supports the request or it uses an
1051
+ # aggregated or default market for the results. To determine the market that
1052
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
1053
+ # parameter only if you specify multiple languages. Otherwise, use the
1054
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1055
+ # and
1056
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1057
+ # query parameters. A user interface string is a string that's used as a label
1058
+ # in a user interface. There are few user interface strings in the JSON
1059
+ # response objects. Any links to Bing.com properties in the response objects
1060
+ # apply the specified language.
1061
+ # @param content_type [String] Optional request header. If you set the
1062
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1063
+ # query parameter to RecognizedEntities, you may specify the binary of an image
1064
+ # in the body of a POST request. If you specify the image in the body of a POST
1065
+ # request, you must specify this header and set its value to
1066
+ # multipart/form-data. The maximum image size is 1 MB.
1067
+ # @param user_agent [String] The user agent originating the request. Bing uses
1068
+ # the user agent to provide mobile users with an optimized experience. Although
1069
+ # optional, you are encouraged to always specify this header. The user-agent
1070
+ # should be the same string that any commonly used browser sends. For
1071
+ # information about user agents, see [RFC
1072
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
1073
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
1074
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
1075
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
1076
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
1077
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
1078
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
1079
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
1080
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
1081
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
1082
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
1083
+ # @param client_id [String] Bing uses this header to provide users with
1084
+ # consistent behavior across Bing API calls. Bing often flights new features
1085
+ # and improvements, and it uses the client ID as a key for assigning traffic on
1086
+ # different flights. If you do not use the same client ID for a user across
1087
+ # multiple requests, then Bing may assign the user to multiple conflicting
1088
+ # flights. Being assigned to multiple conflicting flights can lead to an
1089
+ # inconsistent user experience. For example, if the second request has a
1090
+ # different flight assignment than the first, the experience may be unexpected.
1091
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
1092
+ # search history, providing a richer experience for the user. Bing also uses
1093
+ # this header to help improve result rankings by analyzing the activity
1094
+ # generated by a client ID. The relevance improvements help with better quality
1095
+ # of results delivered by Bing APIs and in turn enables higher click-through
1096
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
1097
+ # this header required. Persisting the client ID across multiple requests for
1098
+ # the same end user and device combination enables 1) the API consumer to
1099
+ # receive a consistent user experience, and 2) higher click-through rates via
1100
+ # better quality of results from the Bing APIs. Each user that uses your
1101
+ # application on the device must have a unique, Bing generated client ID. If
1102
+ # you do not include this header in the request, Bing generates an ID and
1103
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
1104
+ # should NOT include this header in a request is the first time the user uses
1105
+ # your app on that device. Use the client ID for each Bing API request that
1106
+ # your app makes for this user on the device. Persist the client ID. To persist
1107
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
1108
+ # used across all sessions. Do not use a session cookie. For other apps such as
1109
+ # mobile apps, use the device's persistent storage to persist the ID. The next
1110
+ # time the user uses your app on that device, get the client ID that you
1111
+ # persisted. Bing responses may or may not include this header. If the response
1112
+ # includes this header, capture the client ID and use it for all subsequent
1113
+ # Bing requests for the user on that device. If you include the
1114
+ # X-MSEdge-ClientID, you must not include cookies in the request.
1115
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
1116
+ # IP address is used to discover the user's location. Bing uses the location
1117
+ # information to determine safe search behavior. Although optional, you are
1118
+ # encouraged to always specify this header and the X-Search-Location header. Do
1119
+ # not obfuscate the address (for example, by changing the last octet to 0).
1120
+ # Obfuscating the address results in the location not being anywhere near the
1121
+ # device's actual location, which may result in Bing serving erroneous results.
1122
+ # @param location [String] A semicolon-delimited list of key/value pairs that
1123
+ # describe the client's geographical location. Bing uses the location
1124
+ # information to determine safe search behavior and to return relevant local
1125
+ # content. Specify the key/value pair as <key>:<value>. The following are the
1126
+ # keys that you use to specify the user's location. lat (required): The
1127
+ # latitude of the client's location, in degrees. The latitude must be greater
1128
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
1129
+ # indicate southern latitudes and positive values indicate northern latitudes.
1130
+ # long (required): The longitude of the client's location, in degrees. The
1131
+ # longitude must be greater than or equal to -180.0 and less than or equal to
1132
+ # +180.0. Negative values indicate western longitudes and positive values
1133
+ # indicate eastern longitudes. re (required): The radius, in meters, which
1134
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
1135
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
1136
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
1137
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
1138
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
1139
+ # (optional): The client's relative heading or direction of travel. Specify the
1140
+ # direction of travel as degrees from 0 through 360, counting clockwise
1141
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
1142
+ # (optional): The horizontal velocity (speed), in meters per second, that the
1143
+ # client device is traveling. alt (optional): The altitude of the client
1144
+ # device, in meters. are (optional): The radius, in meters, that specifies the
1145
+ # vertical accuracy of the coordinates. Specify this key only if you specify
1146
+ # the alt key. Although many of the keys are optional, the more information
1147
+ # that you provide, the more accurate the location results are. Although
1148
+ # optional, you are encouraged to always specify the user's geographical
1149
+ # location. Providing the location is especially important if the client's IP
1150
+ # address does not accurately reflect the user's physical location (for
1151
+ # example, if the client uses VPN). For optimal results, you should include
1152
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
1153
+ # include this header.
1154
+ # @param crop_bottom [Float] The bottom coordinate of the region to crop. The
1155
+ # coordinate is a fractional value of the original image's height and is
1156
+ # measured from the top, left corner of the image. Specify the coordinate as a
1157
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1158
+ # not specify this parameter when calling the Images, Trending Images, or Web
1159
+ # Search APIs.
1160
+ # @param crop_left [Float] The left coordinate of the region to crop. The
1161
+ # coordinate is a fractional value of the original image's height and is
1162
+ # measured from the top, left corner of the image. Specify the coordinate as a
1163
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1164
+ # not specify this parameter when calling the Images, Trending Images, or Web
1165
+ # Search APIs.
1166
+ # @param crop_right [Float] The right coordinate of the region to crop. The
1167
+ # coordinate is a fractional value of the original image's height and is
1168
+ # measured from the top, left corner of the image. Specify the coordinate as a
1169
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1170
+ # not specify this parameter when calling the Images, Trending Images, or Web
1171
+ # Search APIs.
1172
+ # @param crop_top [Float] The top coordinate of the region to crop. The
1173
+ # coordinate is a fractional value of the original image's height and is
1174
+ # measured from the top, left corner of the image. Specify the coordinate as a
1175
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1176
+ # not specify this parameter when calling the Images, Trending Images, or Web
1177
+ # Search APIs.
1178
+ # @param crop_type [ImageCropType] The crop type to use when cropping the image
1179
+ # based on the coordinates specified in the cal, cat, car, and cab parameters.
1180
+ # The following are the possible values. 0: Rectangular (default). Use this
1181
+ # parameter only with the Insights API. Do not specify this parameter when
1182
+ # calling the Images, Trending Images, or Web Search APIs. Possible values
1183
+ # include: 'Rectangular'
1184
+ # @param country_code [String] A 2-character country code of the country where
1185
+ # the results come from. For a list of possible values, see [Market
1186
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1187
+ # If you set this parameter, you must also specify the
1188
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1189
+ # header. Bing uses the first supported language it finds from the languages
1190
+ # list, and combine that language with the country code that you specify to
1191
+ # determine the market to return results for. If the languages list does not
1192
+ # include a supported language, Bing finds the closest language and market that
1193
+ # supports the request, or it may use an aggregated or default market for the
1194
+ # results instead of a specified one. You should use this query parameter and
1195
+ # the Accept-Language query parameter only if you specify multiple languages;
1196
+ # otherwise, you should use the mkt and setLang query parameters. This
1197
+ # parameter and the
1198
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1199
+ # query parameter are mutually exclusive—do not specify both.
1200
+ # @param id [String] An ID that uniquely identifies an image. Use this
1201
+ # parameter to ensure that the specified image is the first image in the list
1202
+ # of images that Bing returns. The
1203
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1204
+ # object's imageId field contains the ID that you set this parameter to.
1205
+ # @param image_url [String] The URL of an image that you want to get insights
1206
+ # of. Use this parameter as an alternative to using the insightsToken parameter
1207
+ # to specify the image. You may also specify the image by placing the binary of
1208
+ # the image in the body of a POST request. If you use the binary option, see
1209
+ # the
1210
+ # [Content-Type](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#contenttype)
1211
+ # header. The maximum supported image size is 1 MB. Use this parameter only
1212
+ # with the Insights API. Do not specify this parameter when calling the Images,
1213
+ # Trending Images, or Web Search APIs.
1214
+ # @param insights_token [String] An image token. The
1215
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1216
+ # object's
1217
+ # [imageInsightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image-imageinsightstoken)
1218
+ # contains the token. Specify this parameter to get additional information
1219
+ # about an image, such as a caption or shopping source. For a list of the
1220
+ # additional information about an image that you can get, see the
1221
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1222
+ # query parameter. Use this parameter only with the Insights API. Do not
1223
+ # specify this parameter when calling the Images, Trending Images, or Web
1224
+ # Search APIs.
1225
+ # @param modules [Array<ImageInsightModule>] A comma-delimited list of insights
1226
+ # to request. The following are the possible case-insensitive values. All:
1227
+ # Return all insights, if available, except RecognizedEntities. BRQ: Best
1228
+ # representative query. The query term that best describes the image. Caption:
1229
+ # A caption that provides information about the image. If the caption contains
1230
+ # entities, the response may include links to images of those entities.
1231
+ # Collections: A list of related images. Recipes: A list of recipes for cooking
1232
+ # the food shown in the images. PagesIncluding: A list of webpages that include
1233
+ # the image. RecognizedEntities: A list of entities (people) that were
1234
+ # recognized in the image. NOTE: You may not specify this module with any other
1235
+ # module. If you specify it with other modules, the response doesn't include
1236
+ # recognized entities. RelatedSearches: A list of related searches made by
1237
+ # others. ShoppingSources: A list of merchants where you can buy related
1238
+ # offerings. SimilarImages: A list of images that are visually similar to the
1239
+ # original image. SimilarProducts: A list of images that contain a product that
1240
+ # is similar to a product found in the original image. Tags: Provides
1241
+ # characteristics of the type of content found in the image. For example, if
1242
+ # the image is of a person, the tags might indicate the person's gender and
1243
+ # type of clothes they're wearing. If you specify a module and there is no data
1244
+ # for the module, the response object doesn't include the related field. For
1245
+ # example, if you specify Caption and it does not exist, the response doesn't
1246
+ # include the imageCaption field. To include related searches, the request must
1247
+ # include the original query string. Although the original query string is not
1248
+ # required for similar images or products, you should always include it because
1249
+ # it can help improve relevance and the results. Use this parameter only with
1250
+ # the Insights API. Do not specify this parameter when calling the Images,
1251
+ # Trending Images, or Web Search APIs.
1252
+ # @param market [String] The market where the results come from. Typically, mkt
1253
+ # is the country where the user is making the request from. However, it could
1254
+ # be a different country if the user is not located in a country where Bing
1255
+ # delivers results. The market must be in the form <language code>-<country
1256
+ # code>. For example, en-US. The string is case insensitive. For a list of
1257
+ # possible market values, see [Market
1258
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1259
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
1260
+ # the market helps Bing route the request and return an appropriate and optimal
1261
+ # response. If you specify a market that is not listed in [Market
1262
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
1263
+ # Bing uses a best fit market code based on an internal mapping that is subject
1264
+ # to change. This parameter and the
1265
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1266
+ # query parameter are mutually exclusive—do not specify both.
1267
+ # @param safe_search [SafeSearch] Filter images for adult content. The
1268
+ # following are the possible filter values. Off: May return images with adult
1269
+ # content. If the request is through the Image Search API, the response
1270
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
1271
+ # is through the Web Search API, the response includes thumbnail images that
1272
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
1273
+ # API, the response doesn't include images with adult content. If the request
1274
+ # is through the Web Search API, the response may include images with adult
1275
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
1276
+ # images with adult content. The default is Moderate. If the request comes from
1277
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
1278
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
1279
+ # operator, there is the chance that the response may contain adult content
1280
+ # regardless of what the safeSearch query parameter is set to. Use site: only
1281
+ # if you are aware of the content on the site and your scenario supports the
1282
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
1283
+ # 'Strict'
1284
+ # @param set_lang [String] The language to use for user interface strings.
1285
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
1286
+ # the language code for English is EN. The default is EN (English). Although
1287
+ # optional, you should always specify the language. Typically, you set setLang
1288
+ # to the same language specified by mkt unless the user wants the user
1289
+ # interface strings displayed in a different language. This parameter and the
1290
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1291
+ # header are mutually exclusive; do not specify both. A user interface string
1292
+ # is a string that's used as a label in a user interface. There are few user
1293
+ # interface strings in the JSON response objects. Also, any links to Bing.com
1294
+ # properties in the response objects apply the specified language.
1295
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1296
+ # will be added to the HTTP request.
1297
+ #
1298
+ # @return [ImageInsights] operation results.
1299
+ #
1300
+ def details(query, accept_language:nil, content_type:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, crop_bottom:nil, crop_left:nil, crop_right:nil, crop_top:nil, crop_type:nil, country_code:nil, id:nil, image_url:nil, insights_token:nil, modules:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
1301
+ response = details_async(query, accept_language:accept_language, content_type:content_type, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, crop_bottom:crop_bottom, crop_left:crop_left, crop_right:crop_right, crop_top:crop_top, crop_type:crop_type, country_code:country_code, id:id, image_url:image_url, insights_token:insights_token, modules:modules, market:market, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
1302
+ response.body unless response.nil?
1303
+ end
1304
+
1305
+ #
1306
+ # The Image Detail Search API lets you search on Bing and get back insights
1307
+ # about an image, such as webpages that include the image. This section
1308
+ # provides technical details about the query parameters and headers that you
1309
+ # use to request insights of images and the JSON response objects that contain
1310
+ # them. For examples that show how to make requests, see [Searching the Web for
1311
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
1312
+ #
1313
+ # @param query [String] The user's search query term. The term cannot be empty.
1314
+ # The term may contain [Bing Advanced
1315
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
1316
+ # limit images to a specific domain, use the
1317
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
1318
+ # improve relevance of an insights query (see
1319
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
1320
+ # you should always include the user's query term. Use this parameter only with
1321
+ # the Image Search API.Do not specify this parameter when calling the Trending
1322
+ # Images API.
1323
+ # @param accept_language [String] A comma-delimited list of one or more
1324
+ # languages to use for user interface strings. The list is in decreasing order
1325
+ # of preference. For additional information, including expected format, see
1326
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
1327
+ # header and the
1328
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1329
+ # query parameter are mutually exclusive; do not specify both. If you set this
1330
+ # header, you must also specify the
1331
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1332
+ # query parameter. To determine the market to return results for, Bing uses the
1333
+ # first supported language it finds from the list and combines it with the cc
1334
+ # parameter value. If the list does not include a supported language, Bing
1335
+ # finds the closest language and market that supports the request or it uses an
1336
+ # aggregated or default market for the results. To determine the market that
1337
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
1338
+ # parameter only if you specify multiple languages. Otherwise, use the
1339
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1340
+ # and
1341
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1342
+ # query parameters. A user interface string is a string that's used as a label
1343
+ # in a user interface. There are few user interface strings in the JSON
1344
+ # response objects. Any links to Bing.com properties in the response objects
1345
+ # apply the specified language.
1346
+ # @param content_type [String] Optional request header. If you set the
1347
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1348
+ # query parameter to RecognizedEntities, you may specify the binary of an image
1349
+ # in the body of a POST request. If you specify the image in the body of a POST
1350
+ # request, you must specify this header and set its value to
1351
+ # multipart/form-data. The maximum image size is 1 MB.
1352
+ # @param user_agent [String] The user agent originating the request. Bing uses
1353
+ # the user agent to provide mobile users with an optimized experience. Although
1354
+ # optional, you are encouraged to always specify this header. The user-agent
1355
+ # should be the same string that any commonly used browser sends. For
1356
+ # information about user agents, see [RFC
1357
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
1358
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
1359
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
1360
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
1361
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
1362
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
1363
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
1364
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
1365
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
1366
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
1367
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
1368
+ # @param client_id [String] Bing uses this header to provide users with
1369
+ # consistent behavior across Bing API calls. Bing often flights new features
1370
+ # and improvements, and it uses the client ID as a key for assigning traffic on
1371
+ # different flights. If you do not use the same client ID for a user across
1372
+ # multiple requests, then Bing may assign the user to multiple conflicting
1373
+ # flights. Being assigned to multiple conflicting flights can lead to an
1374
+ # inconsistent user experience. For example, if the second request has a
1375
+ # different flight assignment than the first, the experience may be unexpected.
1376
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
1377
+ # search history, providing a richer experience for the user. Bing also uses
1378
+ # this header to help improve result rankings by analyzing the activity
1379
+ # generated by a client ID. The relevance improvements help with better quality
1380
+ # of results delivered by Bing APIs and in turn enables higher click-through
1381
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
1382
+ # this header required. Persisting the client ID across multiple requests for
1383
+ # the same end user and device combination enables 1) the API consumer to
1384
+ # receive a consistent user experience, and 2) higher click-through rates via
1385
+ # better quality of results from the Bing APIs. Each user that uses your
1386
+ # application on the device must have a unique, Bing generated client ID. If
1387
+ # you do not include this header in the request, Bing generates an ID and
1388
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
1389
+ # should NOT include this header in a request is the first time the user uses
1390
+ # your app on that device. Use the client ID for each Bing API request that
1391
+ # your app makes for this user on the device. Persist the client ID. To persist
1392
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
1393
+ # used across all sessions. Do not use a session cookie. For other apps such as
1394
+ # mobile apps, use the device's persistent storage to persist the ID. The next
1395
+ # time the user uses your app on that device, get the client ID that you
1396
+ # persisted. Bing responses may or may not include this header. If the response
1397
+ # includes this header, capture the client ID and use it for all subsequent
1398
+ # Bing requests for the user on that device. If you include the
1399
+ # X-MSEdge-ClientID, you must not include cookies in the request.
1400
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
1401
+ # IP address is used to discover the user's location. Bing uses the location
1402
+ # information to determine safe search behavior. Although optional, you are
1403
+ # encouraged to always specify this header and the X-Search-Location header. Do
1404
+ # not obfuscate the address (for example, by changing the last octet to 0).
1405
+ # Obfuscating the address results in the location not being anywhere near the
1406
+ # device's actual location, which may result in Bing serving erroneous results.
1407
+ # @param location [String] A semicolon-delimited list of key/value pairs that
1408
+ # describe the client's geographical location. Bing uses the location
1409
+ # information to determine safe search behavior and to return relevant local
1410
+ # content. Specify the key/value pair as <key>:<value>. The following are the
1411
+ # keys that you use to specify the user's location. lat (required): The
1412
+ # latitude of the client's location, in degrees. The latitude must be greater
1413
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
1414
+ # indicate southern latitudes and positive values indicate northern latitudes.
1415
+ # long (required): The longitude of the client's location, in degrees. The
1416
+ # longitude must be greater than or equal to -180.0 and less than or equal to
1417
+ # +180.0. Negative values indicate western longitudes and positive values
1418
+ # indicate eastern longitudes. re (required): The radius, in meters, which
1419
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
1420
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
1421
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
1422
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
1423
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
1424
+ # (optional): The client's relative heading or direction of travel. Specify the
1425
+ # direction of travel as degrees from 0 through 360, counting clockwise
1426
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
1427
+ # (optional): The horizontal velocity (speed), in meters per second, that the
1428
+ # client device is traveling. alt (optional): The altitude of the client
1429
+ # device, in meters. are (optional): The radius, in meters, that specifies the
1430
+ # vertical accuracy of the coordinates. Specify this key only if you specify
1431
+ # the alt key. Although many of the keys are optional, the more information
1432
+ # that you provide, the more accurate the location results are. Although
1433
+ # optional, you are encouraged to always specify the user's geographical
1434
+ # location. Providing the location is especially important if the client's IP
1435
+ # address does not accurately reflect the user's physical location (for
1436
+ # example, if the client uses VPN). For optimal results, you should include
1437
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
1438
+ # include this header.
1439
+ # @param crop_bottom [Float] The bottom coordinate of the region to crop. The
1440
+ # coordinate is a fractional value of the original image's height and is
1441
+ # measured from the top, left corner of the image. Specify the coordinate as a
1442
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1443
+ # not specify this parameter when calling the Images, Trending Images, or Web
1444
+ # Search APIs.
1445
+ # @param crop_left [Float] The left coordinate of the region to crop. The
1446
+ # coordinate is a fractional value of the original image's height and is
1447
+ # measured from the top, left corner of the image. Specify the coordinate as a
1448
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1449
+ # not specify this parameter when calling the Images, Trending Images, or Web
1450
+ # Search APIs.
1451
+ # @param crop_right [Float] The right coordinate of the region to crop. The
1452
+ # coordinate is a fractional value of the original image's height and is
1453
+ # measured from the top, left corner of the image. Specify the coordinate as a
1454
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1455
+ # not specify this parameter when calling the Images, Trending Images, or Web
1456
+ # Search APIs.
1457
+ # @param crop_top [Float] The top coordinate of the region to crop. The
1458
+ # coordinate is a fractional value of the original image's height and is
1459
+ # measured from the top, left corner of the image. Specify the coordinate as a
1460
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1461
+ # not specify this parameter when calling the Images, Trending Images, or Web
1462
+ # Search APIs.
1463
+ # @param crop_type [ImageCropType] The crop type to use when cropping the image
1464
+ # based on the coordinates specified in the cal, cat, car, and cab parameters.
1465
+ # The following are the possible values. 0: Rectangular (default). Use this
1466
+ # parameter only with the Insights API. Do not specify this parameter when
1467
+ # calling the Images, Trending Images, or Web Search APIs. Possible values
1468
+ # include: 'Rectangular'
1469
+ # @param country_code [String] A 2-character country code of the country where
1470
+ # the results come from. For a list of possible values, see [Market
1471
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1472
+ # If you set this parameter, you must also specify the
1473
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1474
+ # header. Bing uses the first supported language it finds from the languages
1475
+ # list, and combine that language with the country code that you specify to
1476
+ # determine the market to return results for. If the languages list does not
1477
+ # include a supported language, Bing finds the closest language and market that
1478
+ # supports the request, or it may use an aggregated or default market for the
1479
+ # results instead of a specified one. You should use this query parameter and
1480
+ # the Accept-Language query parameter only if you specify multiple languages;
1481
+ # otherwise, you should use the mkt and setLang query parameters. This
1482
+ # parameter and the
1483
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1484
+ # query parameter are mutually exclusive—do not specify both.
1485
+ # @param id [String] An ID that uniquely identifies an image. Use this
1486
+ # parameter to ensure that the specified image is the first image in the list
1487
+ # of images that Bing returns. The
1488
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1489
+ # object's imageId field contains the ID that you set this parameter to.
1490
+ # @param image_url [String] The URL of an image that you want to get insights
1491
+ # of. Use this parameter as an alternative to using the insightsToken parameter
1492
+ # to specify the image. You may also specify the image by placing the binary of
1493
+ # the image in the body of a POST request. If you use the binary option, see
1494
+ # the
1495
+ # [Content-Type](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#contenttype)
1496
+ # header. The maximum supported image size is 1 MB. Use this parameter only
1497
+ # with the Insights API. Do not specify this parameter when calling the Images,
1498
+ # Trending Images, or Web Search APIs.
1499
+ # @param insights_token [String] An image token. The
1500
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1501
+ # object's
1502
+ # [imageInsightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image-imageinsightstoken)
1503
+ # contains the token. Specify this parameter to get additional information
1504
+ # about an image, such as a caption or shopping source. For a list of the
1505
+ # additional information about an image that you can get, see the
1506
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1507
+ # query parameter. Use this parameter only with the Insights API. Do not
1508
+ # specify this parameter when calling the Images, Trending Images, or Web
1509
+ # Search APIs.
1510
+ # @param modules [Array<ImageInsightModule>] A comma-delimited list of insights
1511
+ # to request. The following are the possible case-insensitive values. All:
1512
+ # Return all insights, if available, except RecognizedEntities. BRQ: Best
1513
+ # representative query. The query term that best describes the image. Caption:
1514
+ # A caption that provides information about the image. If the caption contains
1515
+ # entities, the response may include links to images of those entities.
1516
+ # Collections: A list of related images. Recipes: A list of recipes for cooking
1517
+ # the food shown in the images. PagesIncluding: A list of webpages that include
1518
+ # the image. RecognizedEntities: A list of entities (people) that were
1519
+ # recognized in the image. NOTE: You may not specify this module with any other
1520
+ # module. If you specify it with other modules, the response doesn't include
1521
+ # recognized entities. RelatedSearches: A list of related searches made by
1522
+ # others. ShoppingSources: A list of merchants where you can buy related
1523
+ # offerings. SimilarImages: A list of images that are visually similar to the
1524
+ # original image. SimilarProducts: A list of images that contain a product that
1525
+ # is similar to a product found in the original image. Tags: Provides
1526
+ # characteristics of the type of content found in the image. For example, if
1527
+ # the image is of a person, the tags might indicate the person's gender and
1528
+ # type of clothes they're wearing. If you specify a module and there is no data
1529
+ # for the module, the response object doesn't include the related field. For
1530
+ # example, if you specify Caption and it does not exist, the response doesn't
1531
+ # include the imageCaption field. To include related searches, the request must
1532
+ # include the original query string. Although the original query string is not
1533
+ # required for similar images or products, you should always include it because
1534
+ # it can help improve relevance and the results. Use this parameter only with
1535
+ # the Insights API. Do not specify this parameter when calling the Images,
1536
+ # Trending Images, or Web Search APIs.
1537
+ # @param market [String] The market where the results come from. Typically, mkt
1538
+ # is the country where the user is making the request from. However, it could
1539
+ # be a different country if the user is not located in a country where Bing
1540
+ # delivers results. The market must be in the form <language code>-<country
1541
+ # code>. For example, en-US. The string is case insensitive. For a list of
1542
+ # possible market values, see [Market
1543
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1544
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
1545
+ # the market helps Bing route the request and return an appropriate and optimal
1546
+ # response. If you specify a market that is not listed in [Market
1547
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
1548
+ # Bing uses a best fit market code based on an internal mapping that is subject
1549
+ # to change. This parameter and the
1550
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1551
+ # query parameter are mutually exclusive—do not specify both.
1552
+ # @param safe_search [SafeSearch] Filter images for adult content. The
1553
+ # following are the possible filter values. Off: May return images with adult
1554
+ # content. If the request is through the Image Search API, the response
1555
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
1556
+ # is through the Web Search API, the response includes thumbnail images that
1557
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
1558
+ # API, the response doesn't include images with adult content. If the request
1559
+ # is through the Web Search API, the response may include images with adult
1560
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
1561
+ # images with adult content. The default is Moderate. If the request comes from
1562
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
1563
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
1564
+ # operator, there is the chance that the response may contain adult content
1565
+ # regardless of what the safeSearch query parameter is set to. Use site: only
1566
+ # if you are aware of the content on the site and your scenario supports the
1567
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
1568
+ # 'Strict'
1569
+ # @param set_lang [String] The language to use for user interface strings.
1570
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
1571
+ # the language code for English is EN. The default is EN (English). Although
1572
+ # optional, you should always specify the language. Typically, you set setLang
1573
+ # to the same language specified by mkt unless the user wants the user
1574
+ # interface strings displayed in a different language. This parameter and the
1575
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1576
+ # header are mutually exclusive; do not specify both. A user interface string
1577
+ # is a string that's used as a label in a user interface. There are few user
1578
+ # interface strings in the JSON response objects. Also, any links to Bing.com
1579
+ # properties in the response objects apply the specified language.
1580
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1581
+ # will be added to the HTTP request.
1582
+ #
1583
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1584
+ #
1585
+ def details_with_http_info(query, accept_language:nil, content_type:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, crop_bottom:nil, crop_left:nil, crop_right:nil, crop_top:nil, crop_type:nil, country_code:nil, id:nil, image_url:nil, insights_token:nil, modules:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
1586
+ details_async(query, accept_language:accept_language, content_type:content_type, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, crop_bottom:crop_bottom, crop_left:crop_left, crop_right:crop_right, crop_top:crop_top, crop_type:crop_type, country_code:country_code, id:id, image_url:image_url, insights_token:insights_token, modules:modules, market:market, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
1587
+ end
1588
+
1589
+ #
1590
+ # The Image Detail Search API lets you search on Bing and get back insights
1591
+ # about an image, such as webpages that include the image. This section
1592
+ # provides technical details about the query parameters and headers that you
1593
+ # use to request insights of images and the JSON response objects that contain
1594
+ # them. For examples that show how to make requests, see [Searching the Web for
1595
+ # Images](https://docs.microsoft.com/azure/cognitive-services/bing-image-search/search-the-web).
1596
+ #
1597
+ # @param query [String] The user's search query term. The term cannot be empty.
1598
+ # The term may contain [Bing Advanced
1599
+ # Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
1600
+ # limit images to a specific domain, use the
1601
+ # [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
1602
+ # improve relevance of an insights query (see
1603
+ # [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
1604
+ # you should always include the user's query term. Use this parameter only with
1605
+ # the Image Search API.Do not specify this parameter when calling the Trending
1606
+ # Images API.
1607
+ # @param accept_language [String] A comma-delimited list of one or more
1608
+ # languages to use for user interface strings. The list is in decreasing order
1609
+ # of preference. For additional information, including expected format, see
1610
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
1611
+ # header and the
1612
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1613
+ # query parameter are mutually exclusive; do not specify both. If you set this
1614
+ # header, you must also specify the
1615
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1616
+ # query parameter. To determine the market to return results for, Bing uses the
1617
+ # first supported language it finds from the list and combines it with the cc
1618
+ # parameter value. If the list does not include a supported language, Bing
1619
+ # finds the closest language and market that supports the request or it uses an
1620
+ # aggregated or default market for the results. To determine the market that
1621
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
1622
+ # parameter only if you specify multiple languages. Otherwise, use the
1623
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1624
+ # and
1625
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1626
+ # query parameters. A user interface string is a string that's used as a label
1627
+ # in a user interface. There are few user interface strings in the JSON
1628
+ # response objects. Any links to Bing.com properties in the response objects
1629
+ # apply the specified language.
1630
+ # @param content_type [String] Optional request header. If you set the
1631
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1632
+ # query parameter to RecognizedEntities, you may specify the binary of an image
1633
+ # in the body of a POST request. If you specify the image in the body of a POST
1634
+ # request, you must specify this header and set its value to
1635
+ # multipart/form-data. The maximum image size is 1 MB.
1636
+ # @param user_agent [String] The user agent originating the request. Bing uses
1637
+ # the user agent to provide mobile users with an optimized experience. Although
1638
+ # optional, you are encouraged to always specify this header. The user-agent
1639
+ # should be the same string that any commonly used browser sends. For
1640
+ # information about user agents, see [RFC
1641
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
1642
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
1643
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
1644
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
1645
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
1646
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
1647
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
1648
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
1649
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
1650
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
1651
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
1652
+ # @param client_id [String] Bing uses this header to provide users with
1653
+ # consistent behavior across Bing API calls. Bing often flights new features
1654
+ # and improvements, and it uses the client ID as a key for assigning traffic on
1655
+ # different flights. If you do not use the same client ID for a user across
1656
+ # multiple requests, then Bing may assign the user to multiple conflicting
1657
+ # flights. Being assigned to multiple conflicting flights can lead to an
1658
+ # inconsistent user experience. For example, if the second request has a
1659
+ # different flight assignment than the first, the experience may be unexpected.
1660
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
1661
+ # search history, providing a richer experience for the user. Bing also uses
1662
+ # this header to help improve result rankings by analyzing the activity
1663
+ # generated by a client ID. The relevance improvements help with better quality
1664
+ # of results delivered by Bing APIs and in turn enables higher click-through
1665
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
1666
+ # this header required. Persisting the client ID across multiple requests for
1667
+ # the same end user and device combination enables 1) the API consumer to
1668
+ # receive a consistent user experience, and 2) higher click-through rates via
1669
+ # better quality of results from the Bing APIs. Each user that uses your
1670
+ # application on the device must have a unique, Bing generated client ID. If
1671
+ # you do not include this header in the request, Bing generates an ID and
1672
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
1673
+ # should NOT include this header in a request is the first time the user uses
1674
+ # your app on that device. Use the client ID for each Bing API request that
1675
+ # your app makes for this user on the device. Persist the client ID. To persist
1676
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
1677
+ # used across all sessions. Do not use a session cookie. For other apps such as
1678
+ # mobile apps, use the device's persistent storage to persist the ID. The next
1679
+ # time the user uses your app on that device, get the client ID that you
1680
+ # persisted. Bing responses may or may not include this header. If the response
1681
+ # includes this header, capture the client ID and use it for all subsequent
1682
+ # Bing requests for the user on that device. If you include the
1683
+ # X-MSEdge-ClientID, you must not include cookies in the request.
1684
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
1685
+ # IP address is used to discover the user's location. Bing uses the location
1686
+ # information to determine safe search behavior. Although optional, you are
1687
+ # encouraged to always specify this header and the X-Search-Location header. Do
1688
+ # not obfuscate the address (for example, by changing the last octet to 0).
1689
+ # Obfuscating the address results in the location not being anywhere near the
1690
+ # device's actual location, which may result in Bing serving erroneous results.
1691
+ # @param location [String] A semicolon-delimited list of key/value pairs that
1692
+ # describe the client's geographical location. Bing uses the location
1693
+ # information to determine safe search behavior and to return relevant local
1694
+ # content. Specify the key/value pair as <key>:<value>. The following are the
1695
+ # keys that you use to specify the user's location. lat (required): The
1696
+ # latitude of the client's location, in degrees. The latitude must be greater
1697
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
1698
+ # indicate southern latitudes and positive values indicate northern latitudes.
1699
+ # long (required): The longitude of the client's location, in degrees. The
1700
+ # longitude must be greater than or equal to -180.0 and less than or equal to
1701
+ # +180.0. Negative values indicate western longitudes and positive values
1702
+ # indicate eastern longitudes. re (required): The radius, in meters, which
1703
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
1704
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
1705
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
1706
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
1707
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
1708
+ # (optional): The client's relative heading or direction of travel. Specify the
1709
+ # direction of travel as degrees from 0 through 360, counting clockwise
1710
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
1711
+ # (optional): The horizontal velocity (speed), in meters per second, that the
1712
+ # client device is traveling. alt (optional): The altitude of the client
1713
+ # device, in meters. are (optional): The radius, in meters, that specifies the
1714
+ # vertical accuracy of the coordinates. Specify this key only if you specify
1715
+ # the alt key. Although many of the keys are optional, the more information
1716
+ # that you provide, the more accurate the location results are. Although
1717
+ # optional, you are encouraged to always specify the user's geographical
1718
+ # location. Providing the location is especially important if the client's IP
1719
+ # address does not accurately reflect the user's physical location (for
1720
+ # example, if the client uses VPN). For optimal results, you should include
1721
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
1722
+ # include this header.
1723
+ # @param crop_bottom [Float] The bottom coordinate of the region to crop. The
1724
+ # coordinate is a fractional value of the original image's height and is
1725
+ # measured from the top, left corner of the image. Specify the coordinate as a
1726
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1727
+ # not specify this parameter when calling the Images, Trending Images, or Web
1728
+ # Search APIs.
1729
+ # @param crop_left [Float] The left coordinate of the region to crop. The
1730
+ # coordinate is a fractional value of the original image's height and is
1731
+ # measured from the top, left corner of the image. Specify the coordinate as a
1732
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1733
+ # not specify this parameter when calling the Images, Trending Images, or Web
1734
+ # Search APIs.
1735
+ # @param crop_right [Float] The right coordinate of the region to crop. The
1736
+ # coordinate is a fractional value of the original image's height and is
1737
+ # measured from the top, left corner of the image. Specify the coordinate as a
1738
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1739
+ # not specify this parameter when calling the Images, Trending Images, or Web
1740
+ # Search APIs.
1741
+ # @param crop_top [Float] The top coordinate of the region to crop. The
1742
+ # coordinate is a fractional value of the original image's height and is
1743
+ # measured from the top, left corner of the image. Specify the coordinate as a
1744
+ # value from 0.0 through 1.0. Use this parameter only with the Insights API. Do
1745
+ # not specify this parameter when calling the Images, Trending Images, or Web
1746
+ # Search APIs.
1747
+ # @param crop_type [ImageCropType] The crop type to use when cropping the image
1748
+ # based on the coordinates specified in the cal, cat, car, and cab parameters.
1749
+ # The following are the possible values. 0: Rectangular (default). Use this
1750
+ # parameter only with the Insights API. Do not specify this parameter when
1751
+ # calling the Images, Trending Images, or Web Search APIs. Possible values
1752
+ # include: 'Rectangular'
1753
+ # @param country_code [String] A 2-character country code of the country where
1754
+ # the results come from. For a list of possible values, see [Market
1755
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1756
+ # If you set this parameter, you must also specify the
1757
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1758
+ # header. Bing uses the first supported language it finds from the languages
1759
+ # list, and combine that language with the country code that you specify to
1760
+ # determine the market to return results for. If the languages list does not
1761
+ # include a supported language, Bing finds the closest language and market that
1762
+ # supports the request, or it may use an aggregated or default market for the
1763
+ # results instead of a specified one. You should use this query parameter and
1764
+ # the Accept-Language query parameter only if you specify multiple languages;
1765
+ # otherwise, you should use the mkt and setLang query parameters. This
1766
+ # parameter and the
1767
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1768
+ # query parameter are mutually exclusive—do not specify both.
1769
+ # @param id [String] An ID that uniquely identifies an image. Use this
1770
+ # parameter to ensure that the specified image is the first image in the list
1771
+ # of images that Bing returns. The
1772
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1773
+ # object's imageId field contains the ID that you set this parameter to.
1774
+ # @param image_url [String] The URL of an image that you want to get insights
1775
+ # of. Use this parameter as an alternative to using the insightsToken parameter
1776
+ # to specify the image. You may also specify the image by placing the binary of
1777
+ # the image in the body of a POST request. If you use the binary option, see
1778
+ # the
1779
+ # [Content-Type](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#contenttype)
1780
+ # header. The maximum supported image size is 1 MB. Use this parameter only
1781
+ # with the Insights API. Do not specify this parameter when calling the Images,
1782
+ # Trending Images, or Web Search APIs.
1783
+ # @param insights_token [String] An image token. The
1784
+ # [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
1785
+ # object's
1786
+ # [imageInsightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image-imageinsightstoken)
1787
+ # contains the token. Specify this parameter to get additional information
1788
+ # about an image, such as a caption or shopping source. For a list of the
1789
+ # additional information about an image that you can get, see the
1790
+ # [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
1791
+ # query parameter. Use this parameter only with the Insights API. Do not
1792
+ # specify this parameter when calling the Images, Trending Images, or Web
1793
+ # Search APIs.
1794
+ # @param modules [Array<ImageInsightModule>] A comma-delimited list of insights
1795
+ # to request. The following are the possible case-insensitive values. All:
1796
+ # Return all insights, if available, except RecognizedEntities. BRQ: Best
1797
+ # representative query. The query term that best describes the image. Caption:
1798
+ # A caption that provides information about the image. If the caption contains
1799
+ # entities, the response may include links to images of those entities.
1800
+ # Collections: A list of related images. Recipes: A list of recipes for cooking
1801
+ # the food shown in the images. PagesIncluding: A list of webpages that include
1802
+ # the image. RecognizedEntities: A list of entities (people) that were
1803
+ # recognized in the image. NOTE: You may not specify this module with any other
1804
+ # module. If you specify it with other modules, the response doesn't include
1805
+ # recognized entities. RelatedSearches: A list of related searches made by
1806
+ # others. ShoppingSources: A list of merchants where you can buy related
1807
+ # offerings. SimilarImages: A list of images that are visually similar to the
1808
+ # original image. SimilarProducts: A list of images that contain a product that
1809
+ # is similar to a product found in the original image. Tags: Provides
1810
+ # characteristics of the type of content found in the image. For example, if
1811
+ # the image is of a person, the tags might indicate the person's gender and
1812
+ # type of clothes they're wearing. If you specify a module and there is no data
1813
+ # for the module, the response object doesn't include the related field. For
1814
+ # example, if you specify Caption and it does not exist, the response doesn't
1815
+ # include the imageCaption field. To include related searches, the request must
1816
+ # include the original query string. Although the original query string is not
1817
+ # required for similar images or products, you should always include it because
1818
+ # it can help improve relevance and the results. Use this parameter only with
1819
+ # the Insights API. Do not specify this parameter when calling the Images,
1820
+ # Trending Images, or Web Search APIs.
1821
+ # @param market [String] The market where the results come from. Typically, mkt
1822
+ # is the country where the user is making the request from. However, it could
1823
+ # be a different country if the user is not located in a country where Bing
1824
+ # delivers results. The market must be in the form <language code>-<country
1825
+ # code>. For example, en-US. The string is case insensitive. For a list of
1826
+ # possible market values, see [Market
1827
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
1828
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
1829
+ # the market helps Bing route the request and return an appropriate and optimal
1830
+ # response. If you specify a market that is not listed in [Market
1831
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
1832
+ # Bing uses a best fit market code based on an internal mapping that is subject
1833
+ # to change. This parameter and the
1834
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1835
+ # query parameter are mutually exclusive—do not specify both.
1836
+ # @param safe_search [SafeSearch] Filter images for adult content. The
1837
+ # following are the possible filter values. Off: May return images with adult
1838
+ # content. If the request is through the Image Search API, the response
1839
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
1840
+ # is through the Web Search API, the response includes thumbnail images that
1841
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
1842
+ # API, the response doesn't include images with adult content. If the request
1843
+ # is through the Web Search API, the response may include images with adult
1844
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
1845
+ # images with adult content. The default is Moderate. If the request comes from
1846
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
1847
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
1848
+ # operator, there is the chance that the response may contain adult content
1849
+ # regardless of what the safeSearch query parameter is set to. Use site: only
1850
+ # if you are aware of the content on the site and your scenario supports the
1851
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
1852
+ # 'Strict'
1853
+ # @param set_lang [String] The language to use for user interface strings.
1854
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
1855
+ # the language code for English is EN. The default is EN (English). Although
1856
+ # optional, you should always specify the language. Typically, you set setLang
1857
+ # to the same language specified by mkt unless the user wants the user
1858
+ # interface strings displayed in a different language. This parameter and the
1859
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
1860
+ # header are mutually exclusive; do not specify both. A user interface string
1861
+ # is a string that's used as a label in a user interface. There are few user
1862
+ # interface strings in the JSON response objects. Also, any links to Bing.com
1863
+ # properties in the response objects apply the specified language.
1864
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1865
+ # to the HTTP request.
1866
+ #
1867
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1868
+ #
1869
+ def details_async(query, accept_language:nil, content_type:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, crop_bottom:nil, crop_left:nil, crop_right:nil, crop_top:nil, crop_type:nil, country_code:nil, id:nil, image_url:nil, insights_token:nil, modules:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
1870
+ x_bing_apis_sdk = 'true'
1871
+ fail ArgumentError, 'query is nil' if query.nil?
1872
+
1873
+
1874
+ request_headers = {}
1875
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1876
+
1877
+ # Set Headers
1878
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1879
+ request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
1880
+ request_headers['Accept-Language'] = accept_language unless accept_language.nil?
1881
+ request_headers['Content-Type'] = content_type unless content_type.nil?
1882
+ request_headers['User-Agent'] = user_agent unless user_agent.nil?
1883
+ request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
1884
+ request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
1885
+ request_headers['X-Search-Location'] = location unless location.nil?
1886
+ path_template = 'images/details'
1887
+
1888
+ request_url = @base_url || @client.base_url
1889
+
1890
+ options = {
1891
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1892
+ query_params: {'cab' => crop_bottom,'cal' => crop_left,'car' => crop_right,'cat' => crop_top,'ct' => crop_type,'cc' => country_code,'id' => id,'imgUrl' => image_url,'insightsToken' => insights_token,'modules' => modules.nil? ? nil : modules.join(','),'mkt' => market,'q' => query,'safeSearch' => safe_search,'setLang' => set_lang},
1893
+ headers: request_headers.merge(custom_headers || {}),
1894
+ base_url: request_url
1895
+ }
1896
+ promise = @client.make_request_async(:get, path_template, options)
1897
+
1898
+ promise = promise.then do |result|
1899
+ http_response = result.response
1900
+ status_code = http_response.status
1901
+ response_content = http_response.body
1902
+ unless status_code == 200
1903
+ error_model = JSON.load(response_content)
1904
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1905
+ end
1906
+
1907
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1908
+ # Deserialize Response
1909
+ if status_code == 200
1910
+ begin
1911
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1912
+ result_mapper = Azure::CognitiveServices::ImageSearch::V1_0::Models::ImageInsights.mapper()
1913
+ result.body = @client.deserialize(result_mapper, parsed_response)
1914
+ rescue Exception => e
1915
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1916
+ end
1917
+ end
1918
+
1919
+ result
1920
+ end
1921
+
1922
+ promise.execute
1923
+ end
1924
+
1925
+ #
1926
+ # The Image Trending Search API lets you search on Bing and get back a list of
1927
+ # images that are trending based on search requests made by others. The images
1928
+ # are broken out into different categories. For example, Popular People
1929
+ # Searches. For a list of markets that support trending images, see [Trending
1930
+ # Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images).
1931
+ #
1932
+ # @param accept_language [String] A comma-delimited list of one or more
1933
+ # languages to use for user interface strings. The list is in decreasing order
1934
+ # of preference. For additional information, including expected format, see
1935
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
1936
+ # header and the
1937
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1938
+ # query parameter are mutually exclusive; do not specify both. If you set this
1939
+ # header, you must also specify the
1940
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
1941
+ # query parameter. To determine the market to return results for, Bing uses the
1942
+ # first supported language it finds from the list and combines it with the cc
1943
+ # parameter value. If the list does not include a supported language, Bing
1944
+ # finds the closest language and market that supports the request or it uses an
1945
+ # aggregated or default market for the results. To determine the market that
1946
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
1947
+ # parameter only if you specify multiple languages. Otherwise, use the
1948
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
1949
+ # and
1950
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
1951
+ # query parameters. A user interface string is a string that's used as a label
1952
+ # in a user interface. There are few user interface strings in the JSON
1953
+ # response objects. Any links to Bing.com properties in the response objects
1954
+ # apply the specified language.
1955
+ # @param user_agent [String] The user agent originating the request. Bing uses
1956
+ # the user agent to provide mobile users with an optimized experience. Although
1957
+ # optional, you are encouraged to always specify this header. The user-agent
1958
+ # should be the same string that any commonly used browser sends. For
1959
+ # information about user agents, see [RFC
1960
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
1961
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
1962
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
1963
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
1964
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
1965
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
1966
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
1967
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
1968
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
1969
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
1970
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
1971
+ # @param client_id [String] Bing uses this header to provide users with
1972
+ # consistent behavior across Bing API calls. Bing often flights new features
1973
+ # and improvements, and it uses the client ID as a key for assigning traffic on
1974
+ # different flights. If you do not use the same client ID for a user across
1975
+ # multiple requests, then Bing may assign the user to multiple conflicting
1976
+ # flights. Being assigned to multiple conflicting flights can lead to an
1977
+ # inconsistent user experience. For example, if the second request has a
1978
+ # different flight assignment than the first, the experience may be unexpected.
1979
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
1980
+ # search history, providing a richer experience for the user. Bing also uses
1981
+ # this header to help improve result rankings by analyzing the activity
1982
+ # generated by a client ID. The relevance improvements help with better quality
1983
+ # of results delivered by Bing APIs and in turn enables higher click-through
1984
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
1985
+ # this header required. Persisting the client ID across multiple requests for
1986
+ # the same end user and device combination enables 1) the API consumer to
1987
+ # receive a consistent user experience, and 2) higher click-through rates via
1988
+ # better quality of results from the Bing APIs. Each user that uses your
1989
+ # application on the device must have a unique, Bing generated client ID. If
1990
+ # you do not include this header in the request, Bing generates an ID and
1991
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
1992
+ # should NOT include this header in a request is the first time the user uses
1993
+ # your app on that device. Use the client ID for each Bing API request that
1994
+ # your app makes for this user on the device. Persist the client ID. To persist
1995
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
1996
+ # used across all sessions. Do not use a session cookie. For other apps such as
1997
+ # mobile apps, use the device's persistent storage to persist the ID. The next
1998
+ # time the user uses your app on that device, get the client ID that you
1999
+ # persisted. Bing responses may or may not include this header. If the response
2000
+ # includes this header, capture the client ID and use it for all subsequent
2001
+ # Bing requests for the user on that device. If you include the
2002
+ # X-MSEdge-ClientID, you must not include cookies in the request.
2003
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
2004
+ # IP address is used to discover the user's location. Bing uses the location
2005
+ # information to determine safe search behavior. Although optional, you are
2006
+ # encouraged to always specify this header and the X-Search-Location header. Do
2007
+ # not obfuscate the address (for example, by changing the last octet to 0).
2008
+ # Obfuscating the address results in the location not being anywhere near the
2009
+ # device's actual location, which may result in Bing serving erroneous results.
2010
+ # @param location [String] A semicolon-delimited list of key/value pairs that
2011
+ # describe the client's geographical location. Bing uses the location
2012
+ # information to determine safe search behavior and to return relevant local
2013
+ # content. Specify the key/value pair as <key>:<value>. The following are the
2014
+ # keys that you use to specify the user's location. lat (required): The
2015
+ # latitude of the client's location, in degrees. The latitude must be greater
2016
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
2017
+ # indicate southern latitudes and positive values indicate northern latitudes.
2018
+ # long (required): The longitude of the client's location, in degrees. The
2019
+ # longitude must be greater than or equal to -180.0 and less than or equal to
2020
+ # +180.0. Negative values indicate western longitudes and positive values
2021
+ # indicate eastern longitudes. re (required): The radius, in meters, which
2022
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
2023
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
2024
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
2025
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
2026
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
2027
+ # (optional): The client's relative heading or direction of travel. Specify the
2028
+ # direction of travel as degrees from 0 through 360, counting clockwise
2029
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
2030
+ # (optional): The horizontal velocity (speed), in meters per second, that the
2031
+ # client device is traveling. alt (optional): The altitude of the client
2032
+ # device, in meters. are (optional): The radius, in meters, that specifies the
2033
+ # vertical accuracy of the coordinates. Specify this key only if you specify
2034
+ # the alt key. Although many of the keys are optional, the more information
2035
+ # that you provide, the more accurate the location results are. Although
2036
+ # optional, you are encouraged to always specify the user's geographical
2037
+ # location. Providing the location is especially important if the client's IP
2038
+ # address does not accurately reflect the user's physical location (for
2039
+ # example, if the client uses VPN). For optimal results, you should include
2040
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
2041
+ # include this header.
2042
+ # @param country_code [String] A 2-character country code of the country where
2043
+ # the results come from. This API supports only the United States, Canada,
2044
+ # Australia, and China markets. If you specify this query parameter, it must be
2045
+ # set to us, ca, au, or cn. If you set this parameter, you must also specify
2046
+ # the Accept-Language header. Bing uses the first supported language it finds
2047
+ # from the languages list, and combine that language with the country code that
2048
+ # you specify to determine the market to return results for. If the languages
2049
+ # list does not include a supported language, Bing finds the closest language
2050
+ # and market that supports the request, or it may use an aggregated or default
2051
+ # market for the results instead of a specified one. You should use this query
2052
+ # parameter and the Accept-Language query parameter only if you specify
2053
+ # multiple languages; otherwise, you should use the mkt and setLang query
2054
+ # parameters. This parameter and the mkt query parameter are mutually
2055
+ # exclusive—do not specify both.
2056
+ # @param market [String] The market where the results come from. Typically, mkt
2057
+ # is the country where the user is making the request from. However, it could
2058
+ # be a different country if the user is not located in a country where Bing
2059
+ # delivers results. The market must be in the form <language code>-<country
2060
+ # code>. For example, en-US. The string is case insensitive. For a list of
2061
+ # possible market values, see [Market
2062
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
2063
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
2064
+ # the market helps Bing route the request and return an appropriate and optimal
2065
+ # response. If you specify a market that is not listed in [Market
2066
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
2067
+ # Bing uses a best fit market code based on an internal mapping that is subject
2068
+ # to change. This parameter and the
2069
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
2070
+ # query parameter are mutually exclusive—do not specify both.
2071
+ # @param safe_search [SafeSearch] Filter images for adult content. The
2072
+ # following are the possible filter values. Off: May return images with adult
2073
+ # content. If the request is through the Image Search API, the response
2074
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
2075
+ # is through the Web Search API, the response includes thumbnail images that
2076
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
2077
+ # API, the response doesn't include images with adult content. If the request
2078
+ # is through the Web Search API, the response may include images with adult
2079
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
2080
+ # images with adult content. The default is Moderate. If the request comes from
2081
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
2082
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
2083
+ # operator, there is the chance that the response may contain adult content
2084
+ # regardless of what the safeSearch query parameter is set to. Use site: only
2085
+ # if you are aware of the content on the site and your scenario supports the
2086
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
2087
+ # 'Strict'
2088
+ # @param set_lang [String] The language to use for user interface strings.
2089
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
2090
+ # the language code for English is EN. The default is EN (English). Although
2091
+ # optional, you should always specify the language. Typically, you set setLang
2092
+ # to the same language specified by mkt unless the user wants the user
2093
+ # interface strings displayed in a different language. This parameter and the
2094
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
2095
+ # header are mutually exclusive; do not specify both. A user interface string
2096
+ # is a string that's used as a label in a user interface. There are few user
2097
+ # interface strings in the JSON response objects. Also, any links to Bing.com
2098
+ # properties in the response objects apply the specified language.
2099
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2100
+ # will be added to the HTTP request.
2101
+ #
2102
+ # @return [TrendingImages] operation results.
2103
+ #
2104
+ def trending(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
2105
+ response = trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
2106
+ response.body unless response.nil?
2107
+ end
2108
+
2109
+ #
2110
+ # The Image Trending Search API lets you search on Bing and get back a list of
2111
+ # images that are trending based on search requests made by others. The images
2112
+ # are broken out into different categories. For example, Popular People
2113
+ # Searches. For a list of markets that support trending images, see [Trending
2114
+ # Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images).
2115
+ #
2116
+ # @param accept_language [String] A comma-delimited list of one or more
2117
+ # languages to use for user interface strings. The list is in decreasing order
2118
+ # of preference. For additional information, including expected format, see
2119
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
2120
+ # header and the
2121
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
2122
+ # query parameter are mutually exclusive; do not specify both. If you set this
2123
+ # header, you must also specify the
2124
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
2125
+ # query parameter. To determine the market to return results for, Bing uses the
2126
+ # first supported language it finds from the list and combines it with the cc
2127
+ # parameter value. If the list does not include a supported language, Bing
2128
+ # finds the closest language and market that supports the request or it uses an
2129
+ # aggregated or default market for the results. To determine the market that
2130
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
2131
+ # parameter only if you specify multiple languages. Otherwise, use the
2132
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
2133
+ # and
2134
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
2135
+ # query parameters. A user interface string is a string that's used as a label
2136
+ # in a user interface. There are few user interface strings in the JSON
2137
+ # response objects. Any links to Bing.com properties in the response objects
2138
+ # apply the specified language.
2139
+ # @param user_agent [String] The user agent originating the request. Bing uses
2140
+ # the user agent to provide mobile users with an optimized experience. Although
2141
+ # optional, you are encouraged to always specify this header. The user-agent
2142
+ # should be the same string that any commonly used browser sends. For
2143
+ # information about user agents, see [RFC
2144
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
2145
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
2146
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
2147
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
2148
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
2149
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
2150
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
2151
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
2152
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
2153
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
2154
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
2155
+ # @param client_id [String] Bing uses this header to provide users with
2156
+ # consistent behavior across Bing API calls. Bing often flights new features
2157
+ # and improvements, and it uses the client ID as a key for assigning traffic on
2158
+ # different flights. If you do not use the same client ID for a user across
2159
+ # multiple requests, then Bing may assign the user to multiple conflicting
2160
+ # flights. Being assigned to multiple conflicting flights can lead to an
2161
+ # inconsistent user experience. For example, if the second request has a
2162
+ # different flight assignment than the first, the experience may be unexpected.
2163
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
2164
+ # search history, providing a richer experience for the user. Bing also uses
2165
+ # this header to help improve result rankings by analyzing the activity
2166
+ # generated by a client ID. The relevance improvements help with better quality
2167
+ # of results delivered by Bing APIs and in turn enables higher click-through
2168
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
2169
+ # this header required. Persisting the client ID across multiple requests for
2170
+ # the same end user and device combination enables 1) the API consumer to
2171
+ # receive a consistent user experience, and 2) higher click-through rates via
2172
+ # better quality of results from the Bing APIs. Each user that uses your
2173
+ # application on the device must have a unique, Bing generated client ID. If
2174
+ # you do not include this header in the request, Bing generates an ID and
2175
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
2176
+ # should NOT include this header in a request is the first time the user uses
2177
+ # your app on that device. Use the client ID for each Bing API request that
2178
+ # your app makes for this user on the device. Persist the client ID. To persist
2179
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
2180
+ # used across all sessions. Do not use a session cookie. For other apps such as
2181
+ # mobile apps, use the device's persistent storage to persist the ID. The next
2182
+ # time the user uses your app on that device, get the client ID that you
2183
+ # persisted. Bing responses may or may not include this header. If the response
2184
+ # includes this header, capture the client ID and use it for all subsequent
2185
+ # Bing requests for the user on that device. If you include the
2186
+ # X-MSEdge-ClientID, you must not include cookies in the request.
2187
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
2188
+ # IP address is used to discover the user's location. Bing uses the location
2189
+ # information to determine safe search behavior. Although optional, you are
2190
+ # encouraged to always specify this header and the X-Search-Location header. Do
2191
+ # not obfuscate the address (for example, by changing the last octet to 0).
2192
+ # Obfuscating the address results in the location not being anywhere near the
2193
+ # device's actual location, which may result in Bing serving erroneous results.
2194
+ # @param location [String] A semicolon-delimited list of key/value pairs that
2195
+ # describe the client's geographical location. Bing uses the location
2196
+ # information to determine safe search behavior and to return relevant local
2197
+ # content. Specify the key/value pair as <key>:<value>. The following are the
2198
+ # keys that you use to specify the user's location. lat (required): The
2199
+ # latitude of the client's location, in degrees. The latitude must be greater
2200
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
2201
+ # indicate southern latitudes and positive values indicate northern latitudes.
2202
+ # long (required): The longitude of the client's location, in degrees. The
2203
+ # longitude must be greater than or equal to -180.0 and less than or equal to
2204
+ # +180.0. Negative values indicate western longitudes and positive values
2205
+ # indicate eastern longitudes. re (required): The radius, in meters, which
2206
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
2207
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
2208
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
2209
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
2210
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
2211
+ # (optional): The client's relative heading or direction of travel. Specify the
2212
+ # direction of travel as degrees from 0 through 360, counting clockwise
2213
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
2214
+ # (optional): The horizontal velocity (speed), in meters per second, that the
2215
+ # client device is traveling. alt (optional): The altitude of the client
2216
+ # device, in meters. are (optional): The radius, in meters, that specifies the
2217
+ # vertical accuracy of the coordinates. Specify this key only if you specify
2218
+ # the alt key. Although many of the keys are optional, the more information
2219
+ # that you provide, the more accurate the location results are. Although
2220
+ # optional, you are encouraged to always specify the user's geographical
2221
+ # location. Providing the location is especially important if the client's IP
2222
+ # address does not accurately reflect the user's physical location (for
2223
+ # example, if the client uses VPN). For optimal results, you should include
2224
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
2225
+ # include this header.
2226
+ # @param country_code [String] A 2-character country code of the country where
2227
+ # the results come from. This API supports only the United States, Canada,
2228
+ # Australia, and China markets. If you specify this query parameter, it must be
2229
+ # set to us, ca, au, or cn. If you set this parameter, you must also specify
2230
+ # the Accept-Language header. Bing uses the first supported language it finds
2231
+ # from the languages list, and combine that language with the country code that
2232
+ # you specify to determine the market to return results for. If the languages
2233
+ # list does not include a supported language, Bing finds the closest language
2234
+ # and market that supports the request, or it may use an aggregated or default
2235
+ # market for the results instead of a specified one. You should use this query
2236
+ # parameter and the Accept-Language query parameter only if you specify
2237
+ # multiple languages; otherwise, you should use the mkt and setLang query
2238
+ # parameters. This parameter and the mkt query parameter are mutually
2239
+ # exclusive—do not specify both.
2240
+ # @param market [String] The market where the results come from. Typically, mkt
2241
+ # is the country where the user is making the request from. However, it could
2242
+ # be a different country if the user is not located in a country where Bing
2243
+ # delivers results. The market must be in the form <language code>-<country
2244
+ # code>. For example, en-US. The string is case insensitive. For a list of
2245
+ # possible market values, see [Market
2246
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
2247
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
2248
+ # the market helps Bing route the request and return an appropriate and optimal
2249
+ # response. If you specify a market that is not listed in [Market
2250
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
2251
+ # Bing uses a best fit market code based on an internal mapping that is subject
2252
+ # to change. This parameter and the
2253
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
2254
+ # query parameter are mutually exclusive—do not specify both.
2255
+ # @param safe_search [SafeSearch] Filter images for adult content. The
2256
+ # following are the possible filter values. Off: May return images with adult
2257
+ # content. If the request is through the Image Search API, the response
2258
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
2259
+ # is through the Web Search API, the response includes thumbnail images that
2260
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
2261
+ # API, the response doesn't include images with adult content. If the request
2262
+ # is through the Web Search API, the response may include images with adult
2263
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
2264
+ # images with adult content. The default is Moderate. If the request comes from
2265
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
2266
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
2267
+ # operator, there is the chance that the response may contain adult content
2268
+ # regardless of what the safeSearch query parameter is set to. Use site: only
2269
+ # if you are aware of the content on the site and your scenario supports the
2270
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
2271
+ # 'Strict'
2272
+ # @param set_lang [String] The language to use for user interface strings.
2273
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
2274
+ # the language code for English is EN. The default is EN (English). Although
2275
+ # optional, you should always specify the language. Typically, you set setLang
2276
+ # to the same language specified by mkt unless the user wants the user
2277
+ # interface strings displayed in a different language. This parameter and the
2278
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
2279
+ # header are mutually exclusive; do not specify both. A user interface string
2280
+ # is a string that's used as a label in a user interface. There are few user
2281
+ # interface strings in the JSON response objects. Also, any links to Bing.com
2282
+ # properties in the response objects apply the specified language.
2283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2284
+ # will be added to the HTTP request.
2285
+ #
2286
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2287
+ #
2288
+ def trending_with_http_info(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
2289
+ trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, custom_headers:custom_headers).value!
2290
+ end
2291
+
2292
+ #
2293
+ # The Image Trending Search API lets you search on Bing and get back a list of
2294
+ # images that are trending based on search requests made by others. The images
2295
+ # are broken out into different categories. For example, Popular People
2296
+ # Searches. For a list of markets that support trending images, see [Trending
2297
+ # Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images).
2298
+ #
2299
+ # @param accept_language [String] A comma-delimited list of one or more
2300
+ # languages to use for user interface strings. The list is in decreasing order
2301
+ # of preference. For additional information, including expected format, see
2302
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
2303
+ # header and the
2304
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
2305
+ # query parameter are mutually exclusive; do not specify both. If you set this
2306
+ # header, you must also specify the
2307
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
2308
+ # query parameter. To determine the market to return results for, Bing uses the
2309
+ # first supported language it finds from the list and combines it with the cc
2310
+ # parameter value. If the list does not include a supported language, Bing
2311
+ # finds the closest language and market that supports the request or it uses an
2312
+ # aggregated or default market for the results. To determine the market that
2313
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
2314
+ # parameter only if you specify multiple languages. Otherwise, use the
2315
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
2316
+ # and
2317
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
2318
+ # query parameters. A user interface string is a string that's used as a label
2319
+ # in a user interface. There are few user interface strings in the JSON
2320
+ # response objects. Any links to Bing.com properties in the response objects
2321
+ # apply the specified language.
2322
+ # @param user_agent [String] The user agent originating the request. Bing uses
2323
+ # the user agent to provide mobile users with an optimized experience. Although
2324
+ # optional, you are encouraged to always specify this header. The user-agent
2325
+ # should be the same string that any commonly used browser sends. For
2326
+ # information about user agents, see [RFC
2327
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
2328
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
2329
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
2330
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
2331
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
2332
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
2333
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
2334
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
2335
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
2336
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
2337
+ # / 7.0 Mobile / 11A465 Safari / 9537.53
2338
+ # @param client_id [String] Bing uses this header to provide users with
2339
+ # consistent behavior across Bing API calls. Bing often flights new features
2340
+ # and improvements, and it uses the client ID as a key for assigning traffic on
2341
+ # different flights. If you do not use the same client ID for a user across
2342
+ # multiple requests, then Bing may assign the user to multiple conflicting
2343
+ # flights. Being assigned to multiple conflicting flights can lead to an
2344
+ # inconsistent user experience. For example, if the second request has a
2345
+ # different flight assignment than the first, the experience may be unexpected.
2346
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
2347
+ # search history, providing a richer experience for the user. Bing also uses
2348
+ # this header to help improve result rankings by analyzing the activity
2349
+ # generated by a client ID. The relevance improvements help with better quality
2350
+ # of results delivered by Bing APIs and in turn enables higher click-through
2351
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
2352
+ # this header required. Persisting the client ID across multiple requests for
2353
+ # the same end user and device combination enables 1) the API consumer to
2354
+ # receive a consistent user experience, and 2) higher click-through rates via
2355
+ # better quality of results from the Bing APIs. Each user that uses your
2356
+ # application on the device must have a unique, Bing generated client ID. If
2357
+ # you do not include this header in the request, Bing generates an ID and
2358
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
2359
+ # should NOT include this header in a request is the first time the user uses
2360
+ # your app on that device. Use the client ID for each Bing API request that
2361
+ # your app makes for this user on the device. Persist the client ID. To persist
2362
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
2363
+ # used across all sessions. Do not use a session cookie. For other apps such as
2364
+ # mobile apps, use the device's persistent storage to persist the ID. The next
2365
+ # time the user uses your app on that device, get the client ID that you
2366
+ # persisted. Bing responses may or may not include this header. If the response
2367
+ # includes this header, capture the client ID and use it for all subsequent
2368
+ # Bing requests for the user on that device. If you include the
2369
+ # X-MSEdge-ClientID, you must not include cookies in the request.
2370
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
2371
+ # IP address is used to discover the user's location. Bing uses the location
2372
+ # information to determine safe search behavior. Although optional, you are
2373
+ # encouraged to always specify this header and the X-Search-Location header. Do
2374
+ # not obfuscate the address (for example, by changing the last octet to 0).
2375
+ # Obfuscating the address results in the location not being anywhere near the
2376
+ # device's actual location, which may result in Bing serving erroneous results.
2377
+ # @param location [String] A semicolon-delimited list of key/value pairs that
2378
+ # describe the client's geographical location. Bing uses the location
2379
+ # information to determine safe search behavior and to return relevant local
2380
+ # content. Specify the key/value pair as <key>:<value>. The following are the
2381
+ # keys that you use to specify the user's location. lat (required): The
2382
+ # latitude of the client's location, in degrees. The latitude must be greater
2383
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
2384
+ # indicate southern latitudes and positive values indicate northern latitudes.
2385
+ # long (required): The longitude of the client's location, in degrees. The
2386
+ # longitude must be greater than or equal to -180.0 and less than or equal to
2387
+ # +180.0. Negative values indicate western longitudes and positive values
2388
+ # indicate eastern longitudes. re (required): The radius, in meters, which
2389
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
2390
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
2391
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
2392
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
2393
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
2394
+ # (optional): The client's relative heading or direction of travel. Specify the
2395
+ # direction of travel as degrees from 0 through 360, counting clockwise
2396
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
2397
+ # (optional): The horizontal velocity (speed), in meters per second, that the
2398
+ # client device is traveling. alt (optional): The altitude of the client
2399
+ # device, in meters. are (optional): The radius, in meters, that specifies the
2400
+ # vertical accuracy of the coordinates. Specify this key only if you specify
2401
+ # the alt key. Although many of the keys are optional, the more information
2402
+ # that you provide, the more accurate the location results are. Although
2403
+ # optional, you are encouraged to always specify the user's geographical
2404
+ # location. Providing the location is especially important if the client's IP
2405
+ # address does not accurately reflect the user's physical location (for
2406
+ # example, if the client uses VPN). For optimal results, you should include
2407
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
2408
+ # include this header.
2409
+ # @param country_code [String] A 2-character country code of the country where
2410
+ # the results come from. This API supports only the United States, Canada,
2411
+ # Australia, and China markets. If you specify this query parameter, it must be
2412
+ # set to us, ca, au, or cn. If you set this parameter, you must also specify
2413
+ # the Accept-Language header. Bing uses the first supported language it finds
2414
+ # from the languages list, and combine that language with the country code that
2415
+ # you specify to determine the market to return results for. If the languages
2416
+ # list does not include a supported language, Bing finds the closest language
2417
+ # and market that supports the request, or it may use an aggregated or default
2418
+ # market for the results instead of a specified one. You should use this query
2419
+ # parameter and the Accept-Language query parameter only if you specify
2420
+ # multiple languages; otherwise, you should use the mkt and setLang query
2421
+ # parameters. This parameter and the mkt query parameter are mutually
2422
+ # exclusive—do not specify both.
2423
+ # @param market [String] The market where the results come from. Typically, mkt
2424
+ # is the country where the user is making the request from. However, it could
2425
+ # be a different country if the user is not located in a country where Bing
2426
+ # delivers results. The market must be in the form <language code>-<country
2427
+ # code>. For example, en-US. The string is case insensitive. For a list of
2428
+ # possible market values, see [Market
2429
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
2430
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
2431
+ # the market helps Bing route the request and return an appropriate and optimal
2432
+ # response. If you specify a market that is not listed in [Market
2433
+ # Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
2434
+ # Bing uses a best fit market code based on an internal mapping that is subject
2435
+ # to change. This parameter and the
2436
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
2437
+ # query parameter are mutually exclusive—do not specify both.
2438
+ # @param safe_search [SafeSearch] Filter images for adult content. The
2439
+ # following are the possible filter values. Off: May return images with adult
2440
+ # content. If the request is through the Image Search API, the response
2441
+ # includes thumbnail images that are clear (non-fuzzy). However, if the request
2442
+ # is through the Web Search API, the response includes thumbnail images that
2443
+ # are pixelated (fuzzy). Moderate: If the request is through the Image Search
2444
+ # API, the response doesn't include images with adult content. If the request
2445
+ # is through the Web Search API, the response may include images with adult
2446
+ # content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
2447
+ # images with adult content. The default is Moderate. If the request comes from
2448
+ # a market that Bing's adult policy requires that safeSearch is set to Strict,
2449
+ # Bing ignores the safeSearch value and uses Strict. If you use the site: query
2450
+ # operator, there is the chance that the response may contain adult content
2451
+ # regardless of what the safeSearch query parameter is set to. Use site: only
2452
+ # if you are aware of the content on the site and your scenario supports the
2453
+ # possibility of adult content. Possible values include: 'Off', 'Moderate',
2454
+ # 'Strict'
2455
+ # @param set_lang [String] The language to use for user interface strings.
2456
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
2457
+ # the language code for English is EN. The default is EN (English). Although
2458
+ # optional, you should always specify the language. Typically, you set setLang
2459
+ # to the same language specified by mkt unless the user wants the user
2460
+ # interface strings displayed in a different language. This parameter and the
2461
+ # [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
2462
+ # header are mutually exclusive; do not specify both. A user interface string
2463
+ # is a string that's used as a label in a user interface. There are few user
2464
+ # interface strings in the JSON response objects. Also, any links to Bing.com
2465
+ # properties in the response objects apply the specified language.
2466
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2467
+ # to the HTTP request.
2468
+ #
2469
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2470
+ #
2471
+ def trending_async(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, custom_headers:nil)
2472
+ x_bing_apis_sdk = 'true'
2473
+
2474
+
2475
+ request_headers = {}
2476
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2477
+
2478
+ # Set Headers
2479
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2480
+ request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
2481
+ request_headers['Accept-Language'] = accept_language unless accept_language.nil?
2482
+ request_headers['User-Agent'] = user_agent unless user_agent.nil?
2483
+ request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
2484
+ request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
2485
+ request_headers['X-Search-Location'] = location unless location.nil?
2486
+ path_template = 'images/trending'
2487
+
2488
+ request_url = @base_url || @client.base_url
2489
+
2490
+ options = {
2491
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2492
+ query_params: {'cc' => country_code,'mkt' => market,'safeSearch' => safe_search,'setLang' => set_lang},
2493
+ headers: request_headers.merge(custom_headers || {}),
2494
+ base_url: request_url
2495
+ }
2496
+ promise = @client.make_request_async(:get, path_template, options)
2497
+
2498
+ promise = promise.then do |result|
2499
+ http_response = result.response
2500
+ status_code = http_response.status
2501
+ response_content = http_response.body
2502
+ unless status_code == 200
2503
+ error_model = JSON.load(response_content)
2504
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2505
+ end
2506
+
2507
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2508
+ # Deserialize Response
2509
+ if status_code == 200
2510
+ begin
2511
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2512
+ result_mapper = Azure::CognitiveServices::ImageSearch::V1_0::Models::TrendingImages.mapper()
2513
+ result.body = @client.deserialize(result_mapper, parsed_response)
2514
+ rescue Exception => e
2515
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2516
+ end
2517
+ end
2518
+
2519
+ result
2520
+ end
2521
+
2522
+ promise.execute
2523
+ end
2524
+
2525
+ end
2526
+ end