azure_cognitiveservices_visualsearch 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/1.0/generated/azure_cognitiveservices_visualsearch.rb +75 -0
  4. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/images.rb +639 -0
  5. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/action.rb +237 -0
  6. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/aggregate_offer.rb +211 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/aggregate_rating.rb +89 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/content_types.rb +20 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/creative_work.rb +190 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/crop_area.rb +92 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/currency.rb +175 -0
  12. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/error.rb +116 -0
  13. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/error_code.rb +20 -0
  14. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/error_response.rb +98 -0
  15. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/error_sub_code.rb +25 -0
  16. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/filters.rb +48 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/identifiable.rb +62 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_action.rb +234 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_entity_action.rb +231 -0
  20. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_info.rb +86 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_knowledge.rb +112 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_module_action.rb +244 -0
  23. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_object.rb +326 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_recipes_action.rb +244 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_related_searches_action.rb +244 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_shopping_sources_action.rb +245 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_tag.rb +182 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/image_tag_region.rb +61 -0
  29. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/images_image_metadata.rb +80 -0
  30. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/images_module.rb +56 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/intangible.rb +133 -0
  32. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/item_availability.rb +22 -0
  33. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/knowledge_request.rb +49 -0
  34. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/media_object.rb +263 -0
  35. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/normalized_quadrilateral.rb +183 -0
  36. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/offer.rb +231 -0
  37. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/organization.rb +132 -0
  38. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/person.rb +156 -0
  39. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/point2d.rb +154 -0
  40. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/properties_item.rb +59 -0
  41. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/query.rb +101 -0
  42. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/rating.rb +84 -0
  43. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/recipe.rb +219 -0
  44. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/recipes_module.rb +56 -0
  45. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/related_searches_module.rb +56 -0
  46. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/response.rb +86 -0
  47. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/response_base.rb +70 -0
  48. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/safe_search.rb +17 -0
  49. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/structured_value.rb +133 -0
  50. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/thing.rb +151 -0
  51. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/models/visual_search_request.rb +62 -0
  52. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/module_definition.rb +9 -0
  53. data/lib/1.0/generated/azure_cognitiveservices_visualsearch/visual_search_client.rb +128 -0
  54. data/lib/azure_cognitiveservices_visualsearch.rb +6 -0
  55. data/lib/module_definition.rb +7 -0
  56. data/lib/profiles/latest/modules/visualsearch_profile_module.rb +247 -0
  57. data/lib/profiles/latest/visualsearch_latest_profile_client.rb +38 -0
  58. data/lib/profiles/latest/visualsearch_module_definition.rb +8 -0
  59. data/lib/version.rb +7 -0
  60. metadata +177 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e15ef480b7df619f6dea70096bf49c65ff649c5d
4
+ data.tar.gz: 537bddaa25a50e08bcb2ba5158b950a198246a8e
5
+ SHA512:
6
+ metadata.gz: 5251ba3d12a9ea50fb3c3955f4f14954027461256efa006336782a1b6594ca7917eda2818b1919edf800d92923b0341f0afe7243a5ac5ceb29e15c3cd0ed1ef8
7
+ data.tar.gz: bb7fa0a09f5327bd5f93b51376e668d583402b5e6353d79b02b66569628947626cf6be030ad491c5324fd9b362fde44a06015d43ed7c0841f02ced6439d0228c
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,75 @@
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_visualsearch/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::CognitiveServices::VisualSearch::V1_0
23
+ autoload :Images, '1.0/generated/azure_cognitiveservices_visualsearch/images.rb'
24
+ autoload :VisualSearchClient, '1.0/generated/azure_cognitiveservices_visualsearch/visual_search_client.rb'
25
+
26
+ module Models
27
+ autoload :Error, '1.0/generated/azure_cognitiveservices_visualsearch/models/error.rb'
28
+ autoload :CropArea, '1.0/generated/azure_cognitiveservices_visualsearch/models/crop_area.rb'
29
+ autoload :ImageInfo, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_info.rb'
30
+ autoload :ImageTagRegion, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_tag_region.rb'
31
+ autoload :ImagesImageMetadata, '1.0/generated/azure_cognitiveservices_visualsearch/models/images_image_metadata.rb'
32
+ autoload :RelatedSearchesModule, '1.0/generated/azure_cognitiveservices_visualsearch/models/related_searches_module.rb'
33
+ autoload :Filters, '1.0/generated/azure_cognitiveservices_visualsearch/models/filters.rb'
34
+ autoload :ImagesModule, '1.0/generated/azure_cognitiveservices_visualsearch/models/images_module.rb'
35
+ autoload :KnowledgeRequest, '1.0/generated/azure_cognitiveservices_visualsearch/models/knowledge_request.rb'
36
+ autoload :RecipesModule, '1.0/generated/azure_cognitiveservices_visualsearch/models/recipes_module.rb'
37
+ autoload :ResponseBase, '1.0/generated/azure_cognitiveservices_visualsearch/models/response_base.rb'
38
+ autoload :Query, '1.0/generated/azure_cognitiveservices_visualsearch/models/query.rb'
39
+ autoload :VisualSearchRequest, '1.0/generated/azure_cognitiveservices_visualsearch/models/visual_search_request.rb'
40
+ autoload :PropertiesItem, '1.0/generated/azure_cognitiveservices_visualsearch/models/properties_item.rb'
41
+ autoload :Point2D, '1.0/generated/azure_cognitiveservices_visualsearch/models/point2d.rb'
42
+ autoload :NormalizedQuadrilateral, '1.0/generated/azure_cognitiveservices_visualsearch/models/normalized_quadrilateral.rb'
43
+ autoload :ImageAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_action.rb'
44
+ autoload :ImageTag, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_tag.rb'
45
+ autoload :Organization, '1.0/generated/azure_cognitiveservices_visualsearch/models/organization.rb'
46
+ autoload :AggregateRating, '1.0/generated/azure_cognitiveservices_visualsearch/models/aggregate_rating.rb'
47
+ autoload :Offer, '1.0/generated/azure_cognitiveservices_visualsearch/models/offer.rb'
48
+ autoload :AggregateOffer, '1.0/generated/azure_cognitiveservices_visualsearch/models/aggregate_offer.rb'
49
+ autoload :ImageObject, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_object.rb'
50
+ autoload :Identifiable, '1.0/generated/azure_cognitiveservices_visualsearch/models/identifiable.rb'
51
+ autoload :Response, '1.0/generated/azure_cognitiveservices_visualsearch/models/response.rb'
52
+ autoload :ImageKnowledge, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_knowledge.rb'
53
+ autoload :ErrorResponse, '1.0/generated/azure_cognitiveservices_visualsearch/models/error_response.rb'
54
+ autoload :Thing, '1.0/generated/azure_cognitiveservices_visualsearch/models/thing.rb'
55
+ autoload :CreativeWork, '1.0/generated/azure_cognitiveservices_visualsearch/models/creative_work.rb'
56
+ autoload :Action, '1.0/generated/azure_cognitiveservices_visualsearch/models/action.rb'
57
+ autoload :MediaObject, '1.0/generated/azure_cognitiveservices_visualsearch/models/media_object.rb'
58
+ autoload :Person, '1.0/generated/azure_cognitiveservices_visualsearch/models/person.rb'
59
+ autoload :Intangible, '1.0/generated/azure_cognitiveservices_visualsearch/models/intangible.rb'
60
+ autoload :ImageEntityAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_entity_action.rb'
61
+ autoload :ImageModuleAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_module_action.rb'
62
+ autoload :Recipe, '1.0/generated/azure_cognitiveservices_visualsearch/models/recipe.rb'
63
+ autoload :ImageRecipesAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_recipes_action.rb'
64
+ autoload :ImageRelatedSearchesAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_related_searches_action.rb'
65
+ autoload :ImageShoppingSourcesAction, '1.0/generated/azure_cognitiveservices_visualsearch/models/image_shopping_sources_action.rb'
66
+ autoload :StructuredValue, '1.0/generated/azure_cognitiveservices_visualsearch/models/structured_value.rb'
67
+ autoload :Rating, '1.0/generated/azure_cognitiveservices_visualsearch/models/rating.rb'
68
+ autoload :Currency, '1.0/generated/azure_cognitiveservices_visualsearch/models/currency.rb'
69
+ autoload :ItemAvailability, '1.0/generated/azure_cognitiveservices_visualsearch/models/item_availability.rb'
70
+ autoload :ErrorCode, '1.0/generated/azure_cognitiveservices_visualsearch/models/error_code.rb'
71
+ autoload :ErrorSubCode, '1.0/generated/azure_cognitiveservices_visualsearch/models/error_sub_code.rb'
72
+ autoload :SafeSearch, '1.0/generated/azure_cognitiveservices_visualsearch/models/safe_search.rb'
73
+ autoload :ContentTypes, '1.0/generated/azure_cognitiveservices_visualsearch/models/content_types.rb'
74
+ end
75
+ end
@@ -0,0 +1,639 @@
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::VisualSearch::V1_0
7
+ #
8
+ # Visual Search API lets you discover insights about an image such as
9
+ # visually similar images, shopping sources, and related searches. The API
10
+ # can also perform text recognition, identify entities (people, places,
11
+ # things), return other topical content for the user to explore, and more.
12
+ # For more information, see [Visual Search
13
+ # Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview).
14
+ #
15
+ class Images
16
+ include MsRestAzure
17
+
18
+ #
19
+ # Creates and initializes a new instance of the Images class.
20
+ # @param client service class for accessing basic functionality.
21
+ #
22
+ def initialize(client)
23
+ @client = client
24
+ end
25
+
26
+ # @return [VisualSearchClient] reference to the VisualSearchClient
27
+ attr_reader :client
28
+
29
+ #
30
+ # Visual Search API lets you discover insights about an image such as visually
31
+ # similar images, shopping sources, and related searches. The API can also
32
+ # perform text recognition, identify entities (people, places, things), return
33
+ # other topical content for the user to explore, and more. For more
34
+ # information, see [Visual Search
35
+ # Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview).
36
+ #
37
+ # @param content_type [Enum] Must be set to multipart/form-data and include a
38
+ # boundary parameter (for example, multipart/form-data; boundary=<boundary
39
+ # string>). For more details, see [Content form types](
40
+ # https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/overview#content-form-types).
41
+ # Possible values include: 'multipart/form-data', 'application/json',
42
+ # 'text/json', 'application/xml', 'text/xml',
43
+ # 'application/x-www-form-urlencoded'
44
+ # @param accept_language [String] A comma-delimited list of one or more
45
+ # languages to use for user interface strings. The list is in decreasing order
46
+ # of preference. For additional information, including expected format, see
47
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
48
+ # header and the
49
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
50
+ # query parameter are mutually exclusive; do not specify both. If you set this
51
+ # header, you must also specify the
52
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#cc)
53
+ # query parameter. To determine the market to return results for, Bing uses the
54
+ # first supported language it finds from the list and combines it with the cc
55
+ # parameter value. If the list does not include a supported language, Bing
56
+ # finds the closest language and market that supports the request or it uses an
57
+ # aggregated or default market for the results. To determine the market that
58
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
59
+ # parameter only if you specify multiple languages. Otherwise, use the
60
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#mkt)
61
+ # and
62
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
63
+ # query parameters. A user interface string is a string that's used as a label
64
+ # in a user interface. There are few user interface strings in the JSON
65
+ # response objects. Any links to Bing.com properties in the response objects
66
+ # apply the specified language.
67
+ # @param user_agent [String] The user agent originating the request. Bing uses
68
+ # the user agent to provide mobile users with an optimized experience. Although
69
+ # optional, you are encouraged to always specify this header. The user-agent
70
+ # should be the same string that any commonly used browser sends. For
71
+ # information about user agents, see [RFC
72
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
73
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
74
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
75
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
76
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
77
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
78
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
79
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
80
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
81
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
82
+ # / 7.0 Mobile / 11A465 Safari / 9537.53.
83
+ # @param client_id [String] Bing uses this header to provide users with
84
+ # consistent behavior across Bing API calls. Bing often flights new features
85
+ # and improvements, and it uses the client ID as a key for assigning traffic on
86
+ # different flights. If you do not use the same client ID for a user across
87
+ # multiple requests, then Bing may assign the user to multiple conflicting
88
+ # flights. Being assigned to multiple conflicting flights can lead to an
89
+ # inconsistent user experience. For example, if the second request has a
90
+ # different flight assignment than the first, the experience may be unexpected.
91
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
92
+ # search history, providing a richer experience for the user. Bing also uses
93
+ # this header to help improve result rankings by analyzing the activity
94
+ # generated by a client ID. The relevance improvements help with better quality
95
+ # of results delivered by Bing APIs and in turn enables higher click-through
96
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
97
+ # this header required. Persisting the client ID across multiple requests for
98
+ # the same end user and device combination enables 1) the API consumer to
99
+ # receive a consistent user experience, and 2) higher click-through rates via
100
+ # better quality of results from the Bing APIs. Each user that uses your
101
+ # application on the device must have a unique, Bing generated client ID. If
102
+ # you do not include this header in the request, Bing generates an ID and
103
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
104
+ # should NOT include this header in a request is the first time the user uses
105
+ # your app on that device. Use the client ID for each Bing API request that
106
+ # your app makes for this user on the device. Persist the client ID. To persist
107
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
108
+ # used across all sessions. Do not use a session cookie. For other apps such as
109
+ # mobile apps, use the device's persistent storage to persist the ID. The next
110
+ # time the user uses your app on that device, get the client ID that you
111
+ # persisted. Bing responses may or may not include this header. If the response
112
+ # includes this header, capture the client ID and use it for all subsequent
113
+ # Bing requests for the user on that device. ATTENTION: You must ensure that
114
+ # this Client ID is not linkable to any authenticatable user account
115
+ # information. If you include the X-MSEdge-ClientID, you must not include
116
+ # cookies in the request.
117
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
118
+ # IP address is used to discover the user's location. Bing uses the location
119
+ # information to determine safe search behavior. Although optional, you are
120
+ # encouraged to always specify this header and the X-Search-Location header. Do
121
+ # not obfuscate the address (for example, by changing the last octet to 0).
122
+ # Obfuscating the address results in the location not being anywhere near the
123
+ # device's actual location, which may result in Bing serving erroneous results.
124
+ # @param location [String] A semicolon-delimited list of key/value pairs that
125
+ # describe the client's geographical location. Bing uses the location
126
+ # information to determine safe search behavior and to return relevant local
127
+ # content. Specify the key/value pair as <key>:<value>. The following are the
128
+ # keys that you use to specify the user's location. lat (required): The
129
+ # latitude of the client's location, in degrees. The latitude must be greater
130
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
131
+ # indicate southern latitudes and positive values indicate northern latitudes.
132
+ # long (required): The longitude of the client's location, in degrees. The
133
+ # longitude must be greater than or equal to -180.0 and less than or equal to
134
+ # +180.0. Negative values indicate western longitudes and positive values
135
+ # indicate eastern longitudes. re (required): The radius, in meters, which
136
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
137
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
138
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
139
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
140
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
141
+ # (optional): The client's relative heading or direction of travel. Specify the
142
+ # direction of travel as degrees from 0 through 360, counting clockwise
143
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
144
+ # (optional): The horizontal velocity (speed), in meters per second, that the
145
+ # client device is traveling. alt (optional): The altitude of the client
146
+ # device, in meters. are (optional): The radius, in meters, that specifies the
147
+ # vertical accuracy of the coordinates. Specify this key only if you specify
148
+ # the alt key. Although many of the keys are optional, the more information
149
+ # that you provide, the more accurate the location results are. Although
150
+ # optional, you are encouraged to always specify the user's geographical
151
+ # location. Providing the location is especially important if the client's IP
152
+ # address does not accurately reflect the user's physical location (for
153
+ # example, if the client uses VPN). For optimal results, you should include
154
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
155
+ # include this header.
156
+ # @param market [String] The market where the results come from. Typically, mkt
157
+ # is the country where the user is making the request from. However, it could
158
+ # be a different country if the user is not located in a country where Bing
159
+ # delivers results. The market must be in the form <language code>-<country
160
+ # code>. For example, en-US. The string is case insensitive. For a list of
161
+ # possible market values, see [Market
162
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets).
163
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
164
+ # the market helps Bing route the request and return an appropriate and optimal
165
+ # response. If you specify a market that is not listed in [Market
166
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets),
167
+ # Bing uses a best fit market code based on an internal mapping that is subject
168
+ # to change.
169
+ # @param safe_search [SafeSearch] Filter the image results in actions with type
170
+ # 'VisualSearch' for adult content. The following are the possible filter
171
+ # values. Off: May return images with adult content. Moderate: Do not return
172
+ # images with adult content. Strict: Do not return images with adult content.
173
+ # The default is Moderate. If the request comes from a market that Bing's adult
174
+ # policy requires that safeSearch is set to Strict, Bing ignores the safeSearch
175
+ # value and uses Strict. If you use the site: filter in the knowledge request,
176
+ # there is the chance that the response may contain adult content regardless of
177
+ # what the safeSearch query parameter is set to. Use site: only if you are
178
+ # aware of the content on the site and your scenario supports the possibility
179
+ # of adult content. Possible values include: 'Off', 'Moderate', 'Strict'
180
+ # @param set_lang [String] The language to use for user interface strings.
181
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
182
+ # the language code for English is EN. The default is EN (English). Although
183
+ # optional, you should always specify the language. Typically, you set setLang
184
+ # to the same language specified by mkt unless the user wants the user
185
+ # interface strings displayed in a different language. A user interface string
186
+ # is a string that's used as a label in a user interface. There are few user
187
+ # interface strings in the JSON response objects. Also, any links to Bing.com
188
+ # properties in the response objects apply the specified language.
189
+ # @param visual_search_request [String] The form data is a JSON object that
190
+ # identifies the image using an insights token or URL to the image. The object
191
+ # may also include an optional crop area that identifies an area of interest in
192
+ # the image. The insights token and URL are mutually exclusive – do not specify
193
+ # both. You may specify knowledgeRequest form data and image form data in the
194
+ # same request only if knowledgeRequest form data specifies the cropArea field
195
+ # only (it must not include an insights token or URL).
196
+ # @param image The form data is an image binary. The Content-Disposition
197
+ # header's name parameter must be set to "image". You must specify an image
198
+ # binary if you do not use knowledgeRequest form data to specify the image; you
199
+ # may not use both forms to specify an image. You may specify knowledgeRequest
200
+ # form data and image form data in the same request only if knowledgeRequest
201
+ # form data specifies the cropArea field only (it must not include an insights
202
+ # token or URL).
203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
204
+ # will be added to the HTTP request.
205
+ #
206
+ # @return [ImageKnowledge] operation results.
207
+ #
208
+ def visual_search(content_type, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, market:nil, safe_search:nil, set_lang:nil, visual_search_request:nil, image:nil, custom_headers:nil)
209
+ response = visual_search_async(content_type, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, market:market, safe_search:safe_search, set_lang:set_lang, visual_search_request:visual_search_request, image:image, custom_headers:custom_headers).value!
210
+ response.body unless response.nil?
211
+ end
212
+
213
+ #
214
+ # Visual Search API lets you discover insights about an image such as visually
215
+ # similar images, shopping sources, and related searches. The API can also
216
+ # perform text recognition, identify entities (people, places, things), return
217
+ # other topical content for the user to explore, and more. For more
218
+ # information, see [Visual Search
219
+ # Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview).
220
+ #
221
+ # @param content_type [Enum] Must be set to multipart/form-data and include a
222
+ # boundary parameter (for example, multipart/form-data; boundary=<boundary
223
+ # string>). For more details, see [Content form types](
224
+ # https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/overview#content-form-types).
225
+ # Possible values include: 'multipart/form-data', 'application/json',
226
+ # 'text/json', 'application/xml', 'text/xml',
227
+ # 'application/x-www-form-urlencoded'
228
+ # @param accept_language [String] A comma-delimited list of one or more
229
+ # languages to use for user interface strings. The list is in decreasing order
230
+ # of preference. For additional information, including expected format, see
231
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
232
+ # header and the
233
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
234
+ # query parameter are mutually exclusive; do not specify both. If you set this
235
+ # header, you must also specify the
236
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#cc)
237
+ # query parameter. To determine the market to return results for, Bing uses the
238
+ # first supported language it finds from the list and combines it with the cc
239
+ # parameter value. If the list does not include a supported language, Bing
240
+ # finds the closest language and market that supports the request or it uses an
241
+ # aggregated or default market for the results. To determine the market that
242
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
243
+ # parameter only if you specify multiple languages. Otherwise, use the
244
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#mkt)
245
+ # and
246
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
247
+ # query parameters. A user interface string is a string that's used as a label
248
+ # in a user interface. There are few user interface strings in the JSON
249
+ # response objects. Any links to Bing.com properties in the response objects
250
+ # apply the specified language.
251
+ # @param user_agent [String] The user agent originating the request. Bing uses
252
+ # the user agent to provide mobile users with an optimized experience. Although
253
+ # optional, you are encouraged to always specify this header. The user-agent
254
+ # should be the same string that any commonly used browser sends. For
255
+ # information about user agents, see [RFC
256
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
257
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
258
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
259
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
260
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
261
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
262
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
263
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
264
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
265
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
266
+ # / 7.0 Mobile / 11A465 Safari / 9537.53.
267
+ # @param client_id [String] Bing uses this header to provide users with
268
+ # consistent behavior across Bing API calls. Bing often flights new features
269
+ # and improvements, and it uses the client ID as a key for assigning traffic on
270
+ # different flights. If you do not use the same client ID for a user across
271
+ # multiple requests, then Bing may assign the user to multiple conflicting
272
+ # flights. Being assigned to multiple conflicting flights can lead to an
273
+ # inconsistent user experience. For example, if the second request has a
274
+ # different flight assignment than the first, the experience may be unexpected.
275
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
276
+ # search history, providing a richer experience for the user. Bing also uses
277
+ # this header to help improve result rankings by analyzing the activity
278
+ # generated by a client ID. The relevance improvements help with better quality
279
+ # of results delivered by Bing APIs and in turn enables higher click-through
280
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
281
+ # this header required. Persisting the client ID across multiple requests for
282
+ # the same end user and device combination enables 1) the API consumer to
283
+ # receive a consistent user experience, and 2) higher click-through rates via
284
+ # better quality of results from the Bing APIs. Each user that uses your
285
+ # application on the device must have a unique, Bing generated client ID. If
286
+ # you do not include this header in the request, Bing generates an ID and
287
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
288
+ # should NOT include this header in a request is the first time the user uses
289
+ # your app on that device. Use the client ID for each Bing API request that
290
+ # your app makes for this user on the device. Persist the client ID. To persist
291
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
292
+ # used across all sessions. Do not use a session cookie. For other apps such as
293
+ # mobile apps, use the device's persistent storage to persist the ID. The next
294
+ # time the user uses your app on that device, get the client ID that you
295
+ # persisted. Bing responses may or may not include this header. If the response
296
+ # includes this header, capture the client ID and use it for all subsequent
297
+ # Bing requests for the user on that device. ATTENTION: You must ensure that
298
+ # this Client ID is not linkable to any authenticatable user account
299
+ # information. If you include the X-MSEdge-ClientID, you must not include
300
+ # cookies in the request.
301
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
302
+ # IP address is used to discover the user's location. Bing uses the location
303
+ # information to determine safe search behavior. Although optional, you are
304
+ # encouraged to always specify this header and the X-Search-Location header. Do
305
+ # not obfuscate the address (for example, by changing the last octet to 0).
306
+ # Obfuscating the address results in the location not being anywhere near the
307
+ # device's actual location, which may result in Bing serving erroneous results.
308
+ # @param location [String] A semicolon-delimited list of key/value pairs that
309
+ # describe the client's geographical location. Bing uses the location
310
+ # information to determine safe search behavior and to return relevant local
311
+ # content. Specify the key/value pair as <key>:<value>. The following are the
312
+ # keys that you use to specify the user's location. lat (required): The
313
+ # latitude of the client's location, in degrees. The latitude must be greater
314
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
315
+ # indicate southern latitudes and positive values indicate northern latitudes.
316
+ # long (required): The longitude of the client's location, in degrees. The
317
+ # longitude must be greater than or equal to -180.0 and less than or equal to
318
+ # +180.0. Negative values indicate western longitudes and positive values
319
+ # indicate eastern longitudes. re (required): The radius, in meters, which
320
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
321
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
322
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
323
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
324
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
325
+ # (optional): The client's relative heading or direction of travel. Specify the
326
+ # direction of travel as degrees from 0 through 360, counting clockwise
327
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
328
+ # (optional): The horizontal velocity (speed), in meters per second, that the
329
+ # client device is traveling. alt (optional): The altitude of the client
330
+ # device, in meters. are (optional): The radius, in meters, that specifies the
331
+ # vertical accuracy of the coordinates. Specify this key only if you specify
332
+ # the alt key. Although many of the keys are optional, the more information
333
+ # that you provide, the more accurate the location results are. Although
334
+ # optional, you are encouraged to always specify the user's geographical
335
+ # location. Providing the location is especially important if the client's IP
336
+ # address does not accurately reflect the user's physical location (for
337
+ # example, if the client uses VPN). For optimal results, you should include
338
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
339
+ # include this header.
340
+ # @param market [String] The market where the results come from. Typically, mkt
341
+ # is the country where the user is making the request from. However, it could
342
+ # be a different country if the user is not located in a country where Bing
343
+ # delivers results. The market must be in the form <language code>-<country
344
+ # code>. For example, en-US. The string is case insensitive. For a list of
345
+ # possible market values, see [Market
346
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets).
347
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
348
+ # the market helps Bing route the request and return an appropriate and optimal
349
+ # response. If you specify a market that is not listed in [Market
350
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets),
351
+ # Bing uses a best fit market code based on an internal mapping that is subject
352
+ # to change.
353
+ # @param safe_search [SafeSearch] Filter the image results in actions with type
354
+ # 'VisualSearch' for adult content. The following are the possible filter
355
+ # values. Off: May return images with adult content. Moderate: Do not return
356
+ # images with adult content. Strict: Do not return images with adult content.
357
+ # The default is Moderate. If the request comes from a market that Bing's adult
358
+ # policy requires that safeSearch is set to Strict, Bing ignores the safeSearch
359
+ # value and uses Strict. If you use the site: filter in the knowledge request,
360
+ # there is the chance that the response may contain adult content regardless of
361
+ # what the safeSearch query parameter is set to. Use site: only if you are
362
+ # aware of the content on the site and your scenario supports the possibility
363
+ # of adult content. Possible values include: 'Off', 'Moderate', 'Strict'
364
+ # @param set_lang [String] The language to use for user interface strings.
365
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
366
+ # the language code for English is EN. The default is EN (English). Although
367
+ # optional, you should always specify the language. Typically, you set setLang
368
+ # to the same language specified by mkt unless the user wants the user
369
+ # interface strings displayed in a different language. A user interface string
370
+ # is a string that's used as a label in a user interface. There are few user
371
+ # interface strings in the JSON response objects. Also, any links to Bing.com
372
+ # properties in the response objects apply the specified language.
373
+ # @param visual_search_request [String] The form data is a JSON object that
374
+ # identifies the image using an insights token or URL to the image. The object
375
+ # may also include an optional crop area that identifies an area of interest in
376
+ # the image. The insights token and URL are mutually exclusive – do not specify
377
+ # both. You may specify knowledgeRequest form data and image form data in the
378
+ # same request only if knowledgeRequest form data specifies the cropArea field
379
+ # only (it must not include an insights token or URL).
380
+ # @param image The form data is an image binary. The Content-Disposition
381
+ # header's name parameter must be set to "image". You must specify an image
382
+ # binary if you do not use knowledgeRequest form data to specify the image; you
383
+ # may not use both forms to specify an image. You may specify knowledgeRequest
384
+ # form data and image form data in the same request only if knowledgeRequest
385
+ # form data specifies the cropArea field only (it must not include an insights
386
+ # token or URL).
387
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
388
+ # will be added to the HTTP request.
389
+ #
390
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
391
+ #
392
+ def visual_search_with_http_info(content_type, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, market:nil, safe_search:nil, set_lang:nil, visual_search_request:nil, image:nil, custom_headers:nil)
393
+ visual_search_async(content_type, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, market:market, safe_search:safe_search, set_lang:set_lang, visual_search_request:visual_search_request, image:image, custom_headers:custom_headers).value!
394
+ end
395
+
396
+ #
397
+ # Visual Search API lets you discover insights about an image such as visually
398
+ # similar images, shopping sources, and related searches. The API can also
399
+ # perform text recognition, identify entities (people, places, things), return
400
+ # other topical content for the user to explore, and more. For more
401
+ # information, see [Visual Search
402
+ # Overview](https://docs.microsoft.com/azure/cognitive-services/bing-visual-search/overview).
403
+ #
404
+ # @param content_type [Enum] Must be set to multipart/form-data and include a
405
+ # boundary parameter (for example, multipart/form-data; boundary=<boundary
406
+ # string>). For more details, see [Content form types](
407
+ # https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/overview#content-form-types).
408
+ # Possible values include: 'multipart/form-data', 'application/json',
409
+ # 'text/json', 'application/xml', 'text/xml',
410
+ # 'application/x-www-form-urlencoded'
411
+ # @param accept_language [String] A comma-delimited list of one or more
412
+ # languages to use for user interface strings. The list is in decreasing order
413
+ # of preference. For additional information, including expected format, see
414
+ # [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
415
+ # header and the
416
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
417
+ # query parameter are mutually exclusive; do not specify both. If you set this
418
+ # header, you must also specify the
419
+ # [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#cc)
420
+ # query parameter. To determine the market to return results for, Bing uses the
421
+ # first supported language it finds from the list and combines it with the cc
422
+ # parameter value. If the list does not include a supported language, Bing
423
+ # finds the closest language and market that supports the request or it uses an
424
+ # aggregated or default market for the results. To determine the market that
425
+ # Bing used, see the BingAPIs-Market header. Use this header and the cc query
426
+ # parameter only if you specify multiple languages. Otherwise, use the
427
+ # [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#mkt)
428
+ # and
429
+ # [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-visual-search-api-v7-reference#setlang)
430
+ # query parameters. A user interface string is a string that's used as a label
431
+ # in a user interface. There are few user interface strings in the JSON
432
+ # response objects. Any links to Bing.com properties in the response objects
433
+ # apply the specified language.
434
+ # @param user_agent [String] The user agent originating the request. Bing uses
435
+ # the user agent to provide mobile users with an optimized experience. Although
436
+ # optional, you are encouraged to always specify this header. The user-agent
437
+ # should be the same string that any commonly used browser sends. For
438
+ # information about user agents, see [RFC
439
+ # 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
440
+ # are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
441
+ # MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
442
+ # Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
443
+ # I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
444
+ # 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
445
+ # like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
446
+ # iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
447
+ # WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
448
+ # CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
449
+ # / 7.0 Mobile / 11A465 Safari / 9537.53.
450
+ # @param client_id [String] Bing uses this header to provide users with
451
+ # consistent behavior across Bing API calls. Bing often flights new features
452
+ # and improvements, and it uses the client ID as a key for assigning traffic on
453
+ # different flights. If you do not use the same client ID for a user across
454
+ # multiple requests, then Bing may assign the user to multiple conflicting
455
+ # flights. Being assigned to multiple conflicting flights can lead to an
456
+ # inconsistent user experience. For example, if the second request has a
457
+ # different flight assignment than the first, the experience may be unexpected.
458
+ # Also, Bing can use the client ID to tailor web results to that client ID’s
459
+ # search history, providing a richer experience for the user. Bing also uses
460
+ # this header to help improve result rankings by analyzing the activity
461
+ # generated by a client ID. The relevance improvements help with better quality
462
+ # of results delivered by Bing APIs and in turn enables higher click-through
463
+ # rates for the API consumer. IMPORTANT: Although optional, you should consider
464
+ # this header required. Persisting the client ID across multiple requests for
465
+ # the same end user and device combination enables 1) the API consumer to
466
+ # receive a consistent user experience, and 2) higher click-through rates via
467
+ # better quality of results from the Bing APIs. Each user that uses your
468
+ # application on the device must have a unique, Bing generated client ID. If
469
+ # you do not include this header in the request, Bing generates an ID and
470
+ # returns it in the X-MSEdge-ClientID response header. The only time that you
471
+ # should NOT include this header in a request is the first time the user uses
472
+ # your app on that device. Use the client ID for each Bing API request that
473
+ # your app makes for this user on the device. Persist the client ID. To persist
474
+ # the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
475
+ # used across all sessions. Do not use a session cookie. For other apps such as
476
+ # mobile apps, use the device's persistent storage to persist the ID. The next
477
+ # time the user uses your app on that device, get the client ID that you
478
+ # persisted. Bing responses may or may not include this header. If the response
479
+ # includes this header, capture the client ID and use it for all subsequent
480
+ # Bing requests for the user on that device. ATTENTION: You must ensure that
481
+ # this Client ID is not linkable to any authenticatable user account
482
+ # information. If you include the X-MSEdge-ClientID, you must not include
483
+ # cookies in the request.
484
+ # @param client_ip [String] The IPv4 or IPv6 address of the client device. The
485
+ # IP address is used to discover the user's location. Bing uses the location
486
+ # information to determine safe search behavior. Although optional, you are
487
+ # encouraged to always specify this header and the X-Search-Location header. Do
488
+ # not obfuscate the address (for example, by changing the last octet to 0).
489
+ # Obfuscating the address results in the location not being anywhere near the
490
+ # device's actual location, which may result in Bing serving erroneous results.
491
+ # @param location [String] A semicolon-delimited list of key/value pairs that
492
+ # describe the client's geographical location. Bing uses the location
493
+ # information to determine safe search behavior and to return relevant local
494
+ # content. Specify the key/value pair as <key>:<value>. The following are the
495
+ # keys that you use to specify the user's location. lat (required): The
496
+ # latitude of the client's location, in degrees. The latitude must be greater
497
+ # than or equal to -90.0 and less than or equal to +90.0. Negative values
498
+ # indicate southern latitudes and positive values indicate northern latitudes.
499
+ # long (required): The longitude of the client's location, in degrees. The
500
+ # longitude must be greater than or equal to -180.0 and less than or equal to
501
+ # +180.0. Negative values indicate western longitudes and positive values
502
+ # indicate eastern longitudes. re (required): The radius, in meters, which
503
+ # specifies the horizontal accuracy of the coordinates. Pass the value returned
504
+ # by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
505
+ # 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
506
+ # (optional): The UTC UNIX timestamp of when the client was at the location.
507
+ # (The UNIX timestamp is the number of seconds since January 1, 1970.) head
508
+ # (optional): The client's relative heading or direction of travel. Specify the
509
+ # direction of travel as degrees from 0 through 360, counting clockwise
510
+ # relative to true north. Specify this key only if the sp key is nonzero. sp
511
+ # (optional): The horizontal velocity (speed), in meters per second, that the
512
+ # client device is traveling. alt (optional): The altitude of the client
513
+ # device, in meters. are (optional): The radius, in meters, that specifies the
514
+ # vertical accuracy of the coordinates. Specify this key only if you specify
515
+ # the alt key. Although many of the keys are optional, the more information
516
+ # that you provide, the more accurate the location results are. Although
517
+ # optional, you are encouraged to always specify the user's geographical
518
+ # location. Providing the location is especially important if the client's IP
519
+ # address does not accurately reflect the user's physical location (for
520
+ # example, if the client uses VPN). For optimal results, you should include
521
+ # this header and the X-MSEdge-ClientIP header, but at a minimum, you should
522
+ # include this header.
523
+ # @param market [String] The market where the results come from. Typically, mkt
524
+ # is the country where the user is making the request from. However, it could
525
+ # be a different country if the user is not located in a country where Bing
526
+ # delivers results. The market must be in the form <language code>-<country
527
+ # code>. For example, en-US. The string is case insensitive. For a list of
528
+ # possible market values, see [Market
529
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets).
530
+ # NOTE: If known, you are encouraged to always specify the market. Specifying
531
+ # the market helps Bing route the request and return an appropriate and optimal
532
+ # response. If you specify a market that is not listed in [Market
533
+ # Codes](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/supported-countries-markets),
534
+ # Bing uses a best fit market code based on an internal mapping that is subject
535
+ # to change.
536
+ # @param safe_search [SafeSearch] Filter the image results in actions with type
537
+ # 'VisualSearch' for adult content. The following are the possible filter
538
+ # values. Off: May return images with adult content. Moderate: Do not return
539
+ # images with adult content. Strict: Do not return images with adult content.
540
+ # The default is Moderate. If the request comes from a market that Bing's adult
541
+ # policy requires that safeSearch is set to Strict, Bing ignores the safeSearch
542
+ # value and uses Strict. If you use the site: filter in the knowledge request,
543
+ # there is the chance that the response may contain adult content regardless of
544
+ # what the safeSearch query parameter is set to. Use site: only if you are
545
+ # aware of the content on the site and your scenario supports the possibility
546
+ # of adult content. Possible values include: 'Off', 'Moderate', 'Strict'
547
+ # @param set_lang [String] The language to use for user interface strings.
548
+ # Specify the language using the ISO 639-1 2-letter language code. For example,
549
+ # the language code for English is EN. The default is EN (English). Although
550
+ # optional, you should always specify the language. Typically, you set setLang
551
+ # to the same language specified by mkt unless the user wants the user
552
+ # interface strings displayed in a different language. A user interface string
553
+ # is a string that's used as a label in a user interface. There are few user
554
+ # interface strings in the JSON response objects. Also, any links to Bing.com
555
+ # properties in the response objects apply the specified language.
556
+ # @param visual_search_request [String] The form data is a JSON object that
557
+ # identifies the image using an insights token or URL to the image. The object
558
+ # may also include an optional crop area that identifies an area of interest in
559
+ # the image. The insights token and URL are mutually exclusive – do not specify
560
+ # both. You may specify knowledgeRequest form data and image form data in the
561
+ # same request only if knowledgeRequest form data specifies the cropArea field
562
+ # only (it must not include an insights token or URL).
563
+ # @param image The form data is an image binary. The Content-Disposition
564
+ # header's name parameter must be set to "image". You must specify an image
565
+ # binary if you do not use knowledgeRequest form data to specify the image; you
566
+ # may not use both forms to specify an image. You may specify knowledgeRequest
567
+ # form data and image form data in the same request only if knowledgeRequest
568
+ # form data specifies the cropArea field only (it must not include an insights
569
+ # token or URL).
570
+ # @param [Hash{String => String}] A hash of custom headers that will be added
571
+ # to the HTTP request.
572
+ #
573
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
574
+ #
575
+ def visual_search_async(content_type, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, market:nil, safe_search:nil, set_lang:nil, visual_search_request:nil, image:nil, custom_headers:nil)
576
+ x_bing_apis_sdk = 'true'
577
+ fail ArgumentError, 'content_type is nil' if content_type.nil?
578
+
579
+
580
+ request_headers = {}
581
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
582
+
583
+ # Set Headers
584
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
585
+ request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
586
+ request_headers['Accept-Language'] = accept_language unless accept_language.nil?
587
+ request_headers['Content-Type'] = content_type.to_s unless content_type.to_s.nil?
588
+ request_headers['User-Agent'] = user_agent unless user_agent.nil?
589
+ request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
590
+ request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
591
+ request_headers['X-Search-Location'] = location unless location.nil?
592
+
593
+ # Set Form Data
594
+ form_data = {}
595
+ form_data['knowledgeRequest'] = visual_search_request unless visual_search_request.nil?
596
+ form_data['image'] = image.to_s unless image.to_s.nil?
597
+
598
+ path_template = 'images/visualsearch'
599
+
600
+ request_url = @base_url || @client.base_url
601
+
602
+ options = {
603
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
604
+ query_params: {'mkt' => market,'safeSearch' => safe_search,'setLang' => set_lang},
605
+ headers: request_headers.merge(custom_headers || {}),
606
+ body: URI.encode_www_form(form_data),
607
+ base_url: request_url
608
+ }
609
+ promise = @client.make_request_async(:post, path_template, options)
610
+
611
+ promise = promise.then do |result|
612
+ http_response = result.response
613
+ status_code = http_response.status
614
+ response_content = http_response.body
615
+ unless status_code == 200
616
+ error_model = JSON.load(response_content)
617
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
618
+ end
619
+
620
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
621
+ # Deserialize Response
622
+ if status_code == 200
623
+ begin
624
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
625
+ result_mapper = Azure::CognitiveServices::VisualSearch::V1_0::Models::ImageKnowledge.mapper()
626
+ result.body = @client.deserialize(result_mapper, parsed_response)
627
+ rescue Exception => e
628
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
629
+ end
630
+ end
631
+
632
+ result
633
+ end
634
+
635
+ promise.execute
636
+ end
637
+
638
+ end
639
+ end