azure_cognitiveservices_customimagesearch 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch.rb +52 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/custom_instance.rb +1015 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/customimagesearch_client.rb +133 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/answer.rb +77 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/creative_work.rb +178 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/error.rb +116 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/error_code.rb +20 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/error_response.rb +98 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/error_sub_code.rb +25 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/freshness.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/identifiable.rb +62 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_aspect.rb +18 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_color.rb +28 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_content.rb +16 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_license.rb +21 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_object.rb +298 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_size.rb +19 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/image_type.rb +20 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/images.rb +120 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/media_object.rb +254 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/query.rb +104 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/response.rb +84 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/response_base.rb +56 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/safe_search.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/search_results_answer.rb +91 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/thing.rb +151 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/models/web_page.rb +168 -0
- data/lib/1.0/generated/azure_cognitiveservices_customimagesearch/module_definition.rb +9 -0
- data/lib/azure_cognitiveservices_customimagesearch.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/customimagesearch_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/customimagesearch_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/customimagesearch_profile_module.rb +155 -0
- data/lib/version.rb +7 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d045e47fd45e93fedad07935a223d8ab7fa82ab4
|
4
|
+
data.tar.gz: 07b6c07dfb31d1aea8271c09cd524802078dbe0c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a18e6eb0e2b5daa322315078f1f28b8b9add89aa06a834506533d97f09c65a2938a1544828fa4f0e3a947e0b33fe5b9a61b93ed4ebd7c0c794521d0df81a676c
|
7
|
+
data.tar.gz: cf944f3df270cdb86d49aed6d8e1994515f4666fefba4d04ed220f67dc312ee1a86593f2acc6d03290b01f08d7bfe52dddca9c7d8ef98d1f367a6cd0c5ad3876
|
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,52 @@
|
|
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_customimagesearch/module_definition'
|
20
|
+
require 'ms_rest_azure'
|
21
|
+
|
22
|
+
module Azure::CognitiveServices::Customimagesearch::V1_0
|
23
|
+
autoload :CustomInstance, '1.0/generated/azure_cognitiveservices_customimagesearch/custom_instance.rb'
|
24
|
+
autoload :CustomimagesearchClient, '1.0/generated/azure_cognitiveservices_customimagesearch/customimagesearch_client.rb'
|
25
|
+
|
26
|
+
module Models
|
27
|
+
autoload :Query, '1.0/generated/azure_cognitiveservices_customimagesearch/models/query.rb'
|
28
|
+
autoload :Error, '1.0/generated/azure_cognitiveservices_customimagesearch/models/error.rb'
|
29
|
+
autoload :ResponseBase, '1.0/generated/azure_cognitiveservices_customimagesearch/models/response_base.rb'
|
30
|
+
autoload :ImageObject, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_object.rb'
|
31
|
+
autoload :Images, '1.0/generated/azure_cognitiveservices_customimagesearch/models/images.rb'
|
32
|
+
autoload :Response, '1.0/generated/azure_cognitiveservices_customimagesearch/models/response.rb'
|
33
|
+
autoload :Answer, '1.0/generated/azure_cognitiveservices_customimagesearch/models/answer.rb'
|
34
|
+
autoload :SearchResultsAnswer, '1.0/generated/azure_cognitiveservices_customimagesearch/models/search_results_answer.rb'
|
35
|
+
autoload :MediaObject, '1.0/generated/azure_cognitiveservices_customimagesearch/models/media_object.rb'
|
36
|
+
autoload :Thing, '1.0/generated/azure_cognitiveservices_customimagesearch/models/thing.rb'
|
37
|
+
autoload :CreativeWork, '1.0/generated/azure_cognitiveservices_customimagesearch/models/creative_work.rb'
|
38
|
+
autoload :Identifiable, '1.0/generated/azure_cognitiveservices_customimagesearch/models/identifiable.rb'
|
39
|
+
autoload :ErrorResponse, '1.0/generated/azure_cognitiveservices_customimagesearch/models/error_response.rb'
|
40
|
+
autoload :WebPage, '1.0/generated/azure_cognitiveservices_customimagesearch/models/web_page.rb'
|
41
|
+
autoload :ErrorCode, '1.0/generated/azure_cognitiveservices_customimagesearch/models/error_code.rb'
|
42
|
+
autoload :ErrorSubCode, '1.0/generated/azure_cognitiveservices_customimagesearch/models/error_sub_code.rb'
|
43
|
+
autoload :ImageAspect, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_aspect.rb'
|
44
|
+
autoload :ImageColor, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_color.rb'
|
45
|
+
autoload :Freshness, '1.0/generated/azure_cognitiveservices_customimagesearch/models/freshness.rb'
|
46
|
+
autoload :ImageContent, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_content.rb'
|
47
|
+
autoload :ImageType, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_type.rb'
|
48
|
+
autoload :ImageLicense, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_license.rb'
|
49
|
+
autoload :SafeSearch, '1.0/generated/azure_cognitiveservices_customimagesearch/models/safe_search.rb'
|
50
|
+
autoload :ImageSize, '1.0/generated/azure_cognitiveservices_customimagesearch/models/image_size.rb'
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,1015 @@
|
|
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::Customimagesearch::V1_0
|
7
|
+
#
|
8
|
+
# The Bing Custom Image Search API lets you send an image search query to
|
9
|
+
# Bing and get back image search results customized to meet your custom
|
10
|
+
# search definition.
|
11
|
+
#
|
12
|
+
class CustomInstance
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
#
|
16
|
+
# Creates and initializes a new instance of the CustomInstance class.
|
17
|
+
# @param client service class for accessing basic functionality.
|
18
|
+
#
|
19
|
+
def initialize(client)
|
20
|
+
@client = client
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [CustomimagesearchClient] reference to the CustomimagesearchClient
|
24
|
+
attr_reader :client
|
25
|
+
|
26
|
+
#
|
27
|
+
# The Custom Image Search API lets you send an image search query to Bing and
|
28
|
+
# get image results found in your custom view of the web.
|
29
|
+
#
|
30
|
+
# @param custom_config [String] The identifier for the custom search
|
31
|
+
# configuration
|
32
|
+
# @param query [String] The user's search query term. The term cannot be empty.
|
33
|
+
# The term may contain [Bing Advanced
|
34
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
35
|
+
# limit images to a specific domain, use the
|
36
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
|
37
|
+
# improve relevance of an insights query (see
|
38
|
+
# [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
|
39
|
+
# you should always include the user's query term. Use this parameter only with
|
40
|
+
# the Image Search API.Do not specify this parameter when calling the Trending
|
41
|
+
# Images API.
|
42
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
43
|
+
# languages to use for user interface strings. The list is in decreasing order
|
44
|
+
# of preference. For additional information, including expected format, see
|
45
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
46
|
+
# header and the
|
47
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
48
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
49
|
+
# header, you must also specify the
|
50
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
51
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
52
|
+
# first supported language it finds from the list and combines it with the cc
|
53
|
+
# parameter value. If the list does not include a supported language, Bing
|
54
|
+
# finds the closest language and market that supports the request or it uses an
|
55
|
+
# aggregated or default market for the results. To determine the market that
|
56
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
57
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
58
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
59
|
+
# and
|
60
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
61
|
+
# query parameters. A user interface string is a string that's used as a label
|
62
|
+
# in a user interface. There are few user interface strings in the JSON
|
63
|
+
# response objects. Any links to Bing.com properties in the response objects
|
64
|
+
# apply the specified language.
|
65
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
66
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
67
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
68
|
+
# should be the same string that any commonly used browser sends. For
|
69
|
+
# information about user agents, see [RFC
|
70
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
71
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
72
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
73
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
74
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
75
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
76
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
77
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
78
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
79
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
80
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
81
|
+
# @param client_id [String] Bing uses this header to provide users with
|
82
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
83
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
84
|
+
# different flights. If you do not use the same client ID for a user across
|
85
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
86
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
87
|
+
# inconsistent user experience. For example, if the second request has a
|
88
|
+
# different flight assignment than the first, the experience may be unexpected.
|
89
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
90
|
+
# search history, providing a richer experience for the user. Bing also uses
|
91
|
+
# this header to help improve result rankings by analyzing the activity
|
92
|
+
# generated by a client ID. The relevance improvements help with better quality
|
93
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
94
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
95
|
+
# this header required. Persisting the client ID across multiple requests for
|
96
|
+
# the same end user and device combination enables 1) the API consumer to
|
97
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
98
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
99
|
+
# application on the device must have a unique, Bing generated client ID. If
|
100
|
+
# you do not include this header in the request, Bing generates an ID and
|
101
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
102
|
+
# should NOT include this header in a request is the first time the user uses
|
103
|
+
# your app on that device. Use the client ID for each Bing API request that
|
104
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
105
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
106
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
107
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
108
|
+
# time the user uses your app on that device, get the client ID that you
|
109
|
+
# persisted. Bing responses may or may not include this header. If the response
|
110
|
+
# includes this header, capture the client ID and use it for all subsequent
|
111
|
+
# Bing requests for the user on that device. If you include the
|
112
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
113
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
114
|
+
# IP address is used to discover the user's location. Bing uses the location
|
115
|
+
# information to determine safe search behavior. Although optional, you are
|
116
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
117
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
118
|
+
# Obfuscating the address results in the location not being anywhere near the
|
119
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
120
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
121
|
+
# describe the client's geographical location. Bing uses the location
|
122
|
+
# information to determine safe search behavior and to return relevant local
|
123
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
124
|
+
# keys that you use to specify the user's location. lat (required): The
|
125
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
126
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
127
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
128
|
+
# long (required): The longitude of the client's location, in degrees. The
|
129
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
130
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
131
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
132
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
133
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
134
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
135
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
136
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
137
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
138
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
139
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
140
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
141
|
+
# client device is traveling. alt (optional): The altitude of the client
|
142
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
143
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
144
|
+
# the alt key. Although many of the keys are optional, the more information
|
145
|
+
# that you provide, the more accurate the location results are. Although
|
146
|
+
# optional, you are encouraged to always specify the user's geographical
|
147
|
+
# location. Providing the location is especially important if the client's IP
|
148
|
+
# address does not accurately reflect the user's physical location (for
|
149
|
+
# example, if the client uses VPN). For optimal results, you should include
|
150
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
151
|
+
# include this header.
|
152
|
+
# @param aspect [ImageAspect] Filter images by the following aspect ratios.
|
153
|
+
# All: Do not filter by aspect.Specifying this value is the same as not
|
154
|
+
# specifying the aspect parameter. Square: Return images with standard aspect
|
155
|
+
# ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
|
156
|
+
# with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
|
157
|
+
# 'Tall'
|
158
|
+
# @param color [ImageColor] Filter images by the following color options.
|
159
|
+
# ColorOnly: Return color images. Monochrome: Return black and white images.
|
160
|
+
# Return images with one of the following dominant colors: Black, Blue, Brown,
|
161
|
+
# Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
|
162
|
+
# include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
|
163
|
+
# 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
|
164
|
+
# @param country_code [String] A 2-character country code of the country where
|
165
|
+
# the results come from. For a list of possible values, see [Market
|
166
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
167
|
+
# If you set this parameter, you must also specify the
|
168
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
169
|
+
# header. Bing uses the first supported language it finds from the languages
|
170
|
+
# list, and combine that language with the country code that you specify to
|
171
|
+
# determine the market to return results for. If the languages list does not
|
172
|
+
# include a supported language, Bing finds the closest language and market that
|
173
|
+
# supports the request, or it may use an aggregated or default market for the
|
174
|
+
# results instead of a specified one. You should use this query parameter and
|
175
|
+
# the Accept-Language query parameter only if you specify multiple languages;
|
176
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
177
|
+
# parameter and the
|
178
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
179
|
+
# query parameter are mutually exclusive—do not specify both.
|
180
|
+
# @param count [Integer] The number of images to return in the response. The
|
181
|
+
# actual number delivered may be less than requested. The default is 35. The
|
182
|
+
# maximum value is 150. You use this parameter along with the offset parameter
|
183
|
+
# to page results.For example, if your user interface displays 20 images per
|
184
|
+
# page, set count to 20 and offset to 0 to get the first page of results.For
|
185
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
186
|
+
# this parameter only with the Image Search API.Do not specify this parameter
|
187
|
+
# when calling the Insights, Trending Images, or Web Search APIs.
|
188
|
+
# @param freshness [Freshness] Filter images by the following discovery
|
189
|
+
# options. Day: Return images discovered by Bing within the last 24 hours.
|
190
|
+
# Week: Return images discovered by Bing within the last 7 days. Month: Return
|
191
|
+
# images discovered by Bing within the last 30 days. Possible values include:
|
192
|
+
# 'Day', 'Week', 'Month'
|
193
|
+
# @param height [Integer] Filter images that have the specified height, in
|
194
|
+
# pixels. You may use this filter with the size filter to return small images
|
195
|
+
# that have a height of 150 pixels.
|
196
|
+
# @param id [String] An ID that uniquely identifies an image. Use this
|
197
|
+
# parameter to ensure that the specified image is the first image in the list
|
198
|
+
# of images that Bing returns. The
|
199
|
+
# [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
|
200
|
+
# object's imageId field contains the ID that you set this parameter to.
|
201
|
+
# @param image_content [ImageContent] Filter images by the following content
|
202
|
+
# types. Face: Return images that show only a person's face. Portrait: Return
|
203
|
+
# images that show only a person's head and shoulders. Possible values include:
|
204
|
+
# 'Face', 'Portrait'
|
205
|
+
# @param image_type [ImageType] Filter images by the following image types.
|
206
|
+
# AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
|
207
|
+
# Line: Return only line drawings. Photo: Return only photographs(excluding
|
208
|
+
# line drawings, animated Gifs, and clip art). Shopping: Return only images
|
209
|
+
# that contain items where Bing knows of a merchant that is selling the items.
|
210
|
+
# This option is valid in the en - US market only.Transparent: Return only
|
211
|
+
# images with a transparent background. Possible values include: 'AnimatedGif',
|
212
|
+
# 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
|
213
|
+
# @param license [ImageLicense] Filter images by the following license types.
|
214
|
+
# All: Do not filter by license type.Specifying this value is the same as not
|
215
|
+
# specifying the license parameter. Any: Return images that are under any
|
216
|
+
# license type. The response doesn't include images that do not specify a
|
217
|
+
# license or the license is unknown. Public: Return images where the creator
|
218
|
+
# has waived their exclusive rights, to the fullest extent allowed by law.
|
219
|
+
# Share: Return images that may be shared with others. Changing or editing the
|
220
|
+
# image might not be allowed. Also, modifying, sharing, and using the image for
|
221
|
+
# commercial purposes might not be allowed. Typically, this option returns the
|
222
|
+
# most images. ShareCommercially: Return images that may be shared with others
|
223
|
+
# for personal or commercial purposes. Changing or editing the image might not
|
224
|
+
# be allowed. Modify: Return images that may be modified, shared, and used.
|
225
|
+
# Changing or editing the image might not be allowed. Modifying, sharing, and
|
226
|
+
# using the image for commercial purposes might not be allowed.
|
227
|
+
# ModifyCommercially: Return images that may be modified, shared, and used for
|
228
|
+
# personal or commercial purposes. Typically, this option returns the fewest
|
229
|
+
# images. For more information about these license types, see [Filter Images By
|
230
|
+
# License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
|
231
|
+
# include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
|
232
|
+
# 'ModifyCommercially'
|
233
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
234
|
+
# is the country where the user is making the request from. However, it could
|
235
|
+
# be a different country if the user is not located in a country where Bing
|
236
|
+
# delivers results. The market must be in the form <language code>-<country
|
237
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
238
|
+
# possible market values, see [Market
|
239
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
240
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
241
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
242
|
+
# response. If you specify a market that is not listed in [Market
|
243
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
|
244
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
245
|
+
# to change. This parameter and the
|
246
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
247
|
+
# query parameter are mutually exclusive—do not specify both.
|
248
|
+
# @param max_file_size [Integer] Filter images that are less than or equal to
|
249
|
+
# the specified file size. The maximum file size that you may specify is
|
250
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
251
|
+
# possible that the response may include images that are slightly larger than
|
252
|
+
# the specified maximum. You may specify this filter and minFileSize to filter
|
253
|
+
# images within a range of file sizes.
|
254
|
+
# @param max_height [Integer] Filter images that have a height that is less
|
255
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
256
|
+
# specify this filter and minHeight to filter images within a range of heights.
|
257
|
+
# This filter and the height filter are mutually exclusive.
|
258
|
+
# @param max_width [Integer] Filter images that have a width that is less than
|
259
|
+
# or equal to the specified width. Specify the width in pixels. You may specify
|
260
|
+
# this filter and maxWidth to filter images within a range of widths. This
|
261
|
+
# filter and the width filter are mutually exclusive.
|
262
|
+
# @param min_file_size [Integer] Filter images that are greater than or equal
|
263
|
+
# to the specified file size. The maximum file size that you may specify is
|
264
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
265
|
+
# possible that the response may include images that are slightly smaller than
|
266
|
+
# the specified minimum. You may specify this filter and maxFileSize to filter
|
267
|
+
# images within a range of file sizes.
|
268
|
+
# @param min_height [Integer] Filter images that have a height that is greater
|
269
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
270
|
+
# specify this filter and maxHeight to filter images within a range of heights.
|
271
|
+
# This filter and the height filter are mutually exclusive.
|
272
|
+
# @param min_width [Integer] Filter images that have a width that is greater
|
273
|
+
# than or equal to the specified width. Specify the width in pixels. You may
|
274
|
+
# specify this filter and maxWidth to filter images within a range of widths.
|
275
|
+
# This filter and the width filter are mutually exclusive.
|
276
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
277
|
+
# images to skip before returning images. The default is 0. The offset should
|
278
|
+
# be less than
|
279
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
|
280
|
+
# - count). Use this parameter along with the count parameter to page results.
|
281
|
+
# For example, if your user interface displays 20 images per page, set count to
|
282
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
283
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
284
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
285
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
|
286
|
+
# Use this parameter only with the Image API. Do not specify this parameter
|
287
|
+
# when calling the Trending Images API or the Web Search API.
|
288
|
+
# @param safe_search [SafeSearch] Filter images for adult content. The
|
289
|
+
# following are the possible filter values. Off: May return images with adult
|
290
|
+
# content. If the request is through the Image Search API, the response
|
291
|
+
# includes thumbnail images that are clear (non-fuzzy). However, if the request
|
292
|
+
# is through the Web Search API, the response includes thumbnail images that
|
293
|
+
# are pixelated (fuzzy). Moderate: If the request is through the Image Search
|
294
|
+
# API, the response doesn't include images with adult content. If the request
|
295
|
+
# is through the Web Search API, the response may include images with adult
|
296
|
+
# content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
|
297
|
+
# images with adult content. The default is Moderate. If the request comes from
|
298
|
+
# a market that Bing's adult policy requires that safeSearch is set to Strict,
|
299
|
+
# Bing ignores the safeSearch value and uses Strict. If you use the site: query
|
300
|
+
# operator, there is the chance that the response may contain adult content
|
301
|
+
# regardless of what the safeSearch query parameter is set to. Use site: only
|
302
|
+
# if you are aware of the content on the site and your scenario supports the
|
303
|
+
# possibility of adult content. Possible values include: 'Off', 'Moderate',
|
304
|
+
# 'Strict'
|
305
|
+
# @param size [ImageSize] Filter images by the following sizes. All: Do not
|
306
|
+
# filter by size. Specifying this value is the same as not specifying the size
|
307
|
+
# parameter. Small: Return images that are less than 200x200 pixels. Medium:
|
308
|
+
# Return images that are greater than or equal to 200x200 pixels but less than
|
309
|
+
# 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
|
310
|
+
# Wallpaper: Return wallpaper images. You may use this parameter along with the
|
311
|
+
# height or width parameters. For example, you may use height and size to
|
312
|
+
# request small images that are 150 pixels tall. Possible values include:
|
313
|
+
# 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
|
314
|
+
# @param set_lang [String] The language to use for user interface strings.
|
315
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
316
|
+
# the language code for English is EN. The default is EN (English). Although
|
317
|
+
# optional, you should always specify the language. Typically, you set setLang
|
318
|
+
# to the same language specified by mkt unless the user wants the user
|
319
|
+
# interface strings displayed in a different language. This parameter and the
|
320
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
321
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
322
|
+
# is a string that's used as a label in a user interface. There are few user
|
323
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
324
|
+
# properties in the response objects apply the specified language.
|
325
|
+
# @param width [Integer] Filter images that have the specified width, in
|
326
|
+
# pixels. You may use this filter with the size filter to return small images
|
327
|
+
# that have a width of 150 pixels.
|
328
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
329
|
+
# will be added to the HTTP request.
|
330
|
+
#
|
331
|
+
# @return [Images] operation results.
|
332
|
+
#
|
333
|
+
def image_search(custom_config, 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)
|
334
|
+
response = image_search_async(custom_config, 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!
|
335
|
+
response.body unless response.nil?
|
336
|
+
end
|
337
|
+
|
338
|
+
#
|
339
|
+
# The Custom Image Search API lets you send an image search query to Bing and
|
340
|
+
# get image results found in your custom view of the web.
|
341
|
+
#
|
342
|
+
# @param custom_config [String] The identifier for the custom search
|
343
|
+
# configuration
|
344
|
+
# @param query [String] The user's search query term. The term cannot be empty.
|
345
|
+
# The term may contain [Bing Advanced
|
346
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
347
|
+
# limit images to a specific domain, use the
|
348
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
|
349
|
+
# improve relevance of an insights query (see
|
350
|
+
# [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
|
351
|
+
# you should always include the user's query term. Use this parameter only with
|
352
|
+
# the Image Search API.Do not specify this parameter when calling the Trending
|
353
|
+
# Images API.
|
354
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
355
|
+
# languages to use for user interface strings. The list is in decreasing order
|
356
|
+
# of preference. For additional information, including expected format, see
|
357
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
358
|
+
# header and the
|
359
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
360
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
361
|
+
# header, you must also specify the
|
362
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
363
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
364
|
+
# first supported language it finds from the list and combines it with the cc
|
365
|
+
# parameter value. If the list does not include a supported language, Bing
|
366
|
+
# finds the closest language and market that supports the request or it uses an
|
367
|
+
# aggregated or default market for the results. To determine the market that
|
368
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
369
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
370
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
371
|
+
# and
|
372
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
373
|
+
# query parameters. A user interface string is a string that's used as a label
|
374
|
+
# in a user interface. There are few user interface strings in the JSON
|
375
|
+
# response objects. Any links to Bing.com properties in the response objects
|
376
|
+
# apply the specified language.
|
377
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
378
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
379
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
380
|
+
# should be the same string that any commonly used browser sends. For
|
381
|
+
# information about user agents, see [RFC
|
382
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
383
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
384
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
385
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
386
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
387
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
388
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
389
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
390
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
391
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
392
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
393
|
+
# @param client_id [String] Bing uses this header to provide users with
|
394
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
395
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
396
|
+
# different flights. If you do not use the same client ID for a user across
|
397
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
398
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
399
|
+
# inconsistent user experience. For example, if the second request has a
|
400
|
+
# different flight assignment than the first, the experience may be unexpected.
|
401
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
402
|
+
# search history, providing a richer experience for the user. Bing also uses
|
403
|
+
# this header to help improve result rankings by analyzing the activity
|
404
|
+
# generated by a client ID. The relevance improvements help with better quality
|
405
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
406
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
407
|
+
# this header required. Persisting the client ID across multiple requests for
|
408
|
+
# the same end user and device combination enables 1) the API consumer to
|
409
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
410
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
411
|
+
# application on the device must have a unique, Bing generated client ID. If
|
412
|
+
# you do not include this header in the request, Bing generates an ID and
|
413
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
414
|
+
# should NOT include this header in a request is the first time the user uses
|
415
|
+
# your app on that device. Use the client ID for each Bing API request that
|
416
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
417
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
418
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
419
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
420
|
+
# time the user uses your app on that device, get the client ID that you
|
421
|
+
# persisted. Bing responses may or may not include this header. If the response
|
422
|
+
# includes this header, capture the client ID and use it for all subsequent
|
423
|
+
# Bing requests for the user on that device. If you include the
|
424
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
425
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
426
|
+
# IP address is used to discover the user's location. Bing uses the location
|
427
|
+
# information to determine safe search behavior. Although optional, you are
|
428
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
429
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
430
|
+
# Obfuscating the address results in the location not being anywhere near the
|
431
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
432
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
433
|
+
# describe the client's geographical location. Bing uses the location
|
434
|
+
# information to determine safe search behavior and to return relevant local
|
435
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
436
|
+
# keys that you use to specify the user's location. lat (required): The
|
437
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
438
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
439
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
440
|
+
# long (required): The longitude of the client's location, in degrees. The
|
441
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
442
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
443
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
444
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
445
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
446
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
447
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
448
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
449
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
450
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
451
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
452
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
453
|
+
# client device is traveling. alt (optional): The altitude of the client
|
454
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
455
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
456
|
+
# the alt key. Although many of the keys are optional, the more information
|
457
|
+
# that you provide, the more accurate the location results are. Although
|
458
|
+
# optional, you are encouraged to always specify the user's geographical
|
459
|
+
# location. Providing the location is especially important if the client's IP
|
460
|
+
# address does not accurately reflect the user's physical location (for
|
461
|
+
# example, if the client uses VPN). For optimal results, you should include
|
462
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
463
|
+
# include this header.
|
464
|
+
# @param aspect [ImageAspect] Filter images by the following aspect ratios.
|
465
|
+
# All: Do not filter by aspect.Specifying this value is the same as not
|
466
|
+
# specifying the aspect parameter. Square: Return images with standard aspect
|
467
|
+
# ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
|
468
|
+
# with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
|
469
|
+
# 'Tall'
|
470
|
+
# @param color [ImageColor] Filter images by the following color options.
|
471
|
+
# ColorOnly: Return color images. Monochrome: Return black and white images.
|
472
|
+
# Return images with one of the following dominant colors: Black, Blue, Brown,
|
473
|
+
# Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
|
474
|
+
# include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
|
475
|
+
# 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
|
476
|
+
# @param country_code [String] A 2-character country code of the country where
|
477
|
+
# the results come from. For a list of possible values, see [Market
|
478
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
479
|
+
# If you set this parameter, you must also specify the
|
480
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
481
|
+
# header. Bing uses the first supported language it finds from the languages
|
482
|
+
# list, and combine that language with the country code that you specify to
|
483
|
+
# determine the market to return results for. If the languages list does not
|
484
|
+
# include a supported language, Bing finds the closest language and market that
|
485
|
+
# supports the request, or it may use an aggregated or default market for the
|
486
|
+
# results instead of a specified one. You should use this query parameter and
|
487
|
+
# the Accept-Language query parameter only if you specify multiple languages;
|
488
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
489
|
+
# parameter and the
|
490
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
491
|
+
# query parameter are mutually exclusive—do not specify both.
|
492
|
+
# @param count [Integer] The number of images to return in the response. The
|
493
|
+
# actual number delivered may be less than requested. The default is 35. The
|
494
|
+
# maximum value is 150. You use this parameter along with the offset parameter
|
495
|
+
# to page results.For example, if your user interface displays 20 images per
|
496
|
+
# page, set count to 20 and offset to 0 to get the first page of results.For
|
497
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
498
|
+
# this parameter only with the Image Search API.Do not specify this parameter
|
499
|
+
# when calling the Insights, Trending Images, or Web Search APIs.
|
500
|
+
# @param freshness [Freshness] Filter images by the following discovery
|
501
|
+
# options. Day: Return images discovered by Bing within the last 24 hours.
|
502
|
+
# Week: Return images discovered by Bing within the last 7 days. Month: Return
|
503
|
+
# images discovered by Bing within the last 30 days. Possible values include:
|
504
|
+
# 'Day', 'Week', 'Month'
|
505
|
+
# @param height [Integer] Filter images that have the specified height, in
|
506
|
+
# pixels. You may use this filter with the size filter to return small images
|
507
|
+
# that have a height of 150 pixels.
|
508
|
+
# @param id [String] An ID that uniquely identifies an image. Use this
|
509
|
+
# parameter to ensure that the specified image is the first image in the list
|
510
|
+
# of images that Bing returns. The
|
511
|
+
# [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
|
512
|
+
# object's imageId field contains the ID that you set this parameter to.
|
513
|
+
# @param image_content [ImageContent] Filter images by the following content
|
514
|
+
# types. Face: Return images that show only a person's face. Portrait: Return
|
515
|
+
# images that show only a person's head and shoulders. Possible values include:
|
516
|
+
# 'Face', 'Portrait'
|
517
|
+
# @param image_type [ImageType] Filter images by the following image types.
|
518
|
+
# AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
|
519
|
+
# Line: Return only line drawings. Photo: Return only photographs(excluding
|
520
|
+
# line drawings, animated Gifs, and clip art). Shopping: Return only images
|
521
|
+
# that contain items where Bing knows of a merchant that is selling the items.
|
522
|
+
# This option is valid in the en - US market only.Transparent: Return only
|
523
|
+
# images with a transparent background. Possible values include: 'AnimatedGif',
|
524
|
+
# 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
|
525
|
+
# @param license [ImageLicense] Filter images by the following license types.
|
526
|
+
# All: Do not filter by license type.Specifying this value is the same as not
|
527
|
+
# specifying the license parameter. Any: Return images that are under any
|
528
|
+
# license type. The response doesn't include images that do not specify a
|
529
|
+
# license or the license is unknown. Public: Return images where the creator
|
530
|
+
# has waived their exclusive rights, to the fullest extent allowed by law.
|
531
|
+
# Share: Return images that may be shared with others. Changing or editing the
|
532
|
+
# image might not be allowed. Also, modifying, sharing, and using the image for
|
533
|
+
# commercial purposes might not be allowed. Typically, this option returns the
|
534
|
+
# most images. ShareCommercially: Return images that may be shared with others
|
535
|
+
# for personal or commercial purposes. Changing or editing the image might not
|
536
|
+
# be allowed. Modify: Return images that may be modified, shared, and used.
|
537
|
+
# Changing or editing the image might not be allowed. Modifying, sharing, and
|
538
|
+
# using the image for commercial purposes might not be allowed.
|
539
|
+
# ModifyCommercially: Return images that may be modified, shared, and used for
|
540
|
+
# personal or commercial purposes. Typically, this option returns the fewest
|
541
|
+
# images. For more information about these license types, see [Filter Images By
|
542
|
+
# License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
|
543
|
+
# include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
|
544
|
+
# 'ModifyCommercially'
|
545
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
546
|
+
# is the country where the user is making the request from. However, it could
|
547
|
+
# be a different country if the user is not located in a country where Bing
|
548
|
+
# delivers results. The market must be in the form <language code>-<country
|
549
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
550
|
+
# possible market values, see [Market
|
551
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
552
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
553
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
554
|
+
# response. If you specify a market that is not listed in [Market
|
555
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
|
556
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
557
|
+
# to change. This parameter and the
|
558
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
559
|
+
# query parameter are mutually exclusive—do not specify both.
|
560
|
+
# @param max_file_size [Integer] Filter images that are less than or equal to
|
561
|
+
# the specified file size. The maximum file size that you may specify is
|
562
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
563
|
+
# possible that the response may include images that are slightly larger than
|
564
|
+
# the specified maximum. You may specify this filter and minFileSize to filter
|
565
|
+
# images within a range of file sizes.
|
566
|
+
# @param max_height [Integer] Filter images that have a height that is less
|
567
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
568
|
+
# specify this filter and minHeight to filter images within a range of heights.
|
569
|
+
# This filter and the height filter are mutually exclusive.
|
570
|
+
# @param max_width [Integer] Filter images that have a width that is less than
|
571
|
+
# or equal to the specified width. Specify the width in pixels. You may specify
|
572
|
+
# this filter and maxWidth to filter images within a range of widths. This
|
573
|
+
# filter and the width filter are mutually exclusive.
|
574
|
+
# @param min_file_size [Integer] Filter images that are greater than or equal
|
575
|
+
# to the specified file size. The maximum file size that you may specify is
|
576
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
577
|
+
# possible that the response may include images that are slightly smaller than
|
578
|
+
# the specified minimum. You may specify this filter and maxFileSize to filter
|
579
|
+
# images within a range of file sizes.
|
580
|
+
# @param min_height [Integer] Filter images that have a height that is greater
|
581
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
582
|
+
# specify this filter and maxHeight to filter images within a range of heights.
|
583
|
+
# This filter and the height filter are mutually exclusive.
|
584
|
+
# @param min_width [Integer] Filter images that have a width that is greater
|
585
|
+
# than or equal to the specified width. Specify the width in pixels. You may
|
586
|
+
# specify this filter and maxWidth to filter images within a range of widths.
|
587
|
+
# This filter and the width filter are mutually exclusive.
|
588
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
589
|
+
# images to skip before returning images. The default is 0. The offset should
|
590
|
+
# be less than
|
591
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
|
592
|
+
# - count). Use this parameter along with the count parameter to page results.
|
593
|
+
# For example, if your user interface displays 20 images per page, set count to
|
594
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
595
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
596
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
597
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
|
598
|
+
# Use this parameter only with the Image API. Do not specify this parameter
|
599
|
+
# when calling the Trending Images API or the Web Search API.
|
600
|
+
# @param safe_search [SafeSearch] Filter images for adult content. The
|
601
|
+
# following are the possible filter values. Off: May return images with adult
|
602
|
+
# content. If the request is through the Image Search API, the response
|
603
|
+
# includes thumbnail images that are clear (non-fuzzy). However, if the request
|
604
|
+
# is through the Web Search API, the response includes thumbnail images that
|
605
|
+
# are pixelated (fuzzy). Moderate: If the request is through the Image Search
|
606
|
+
# API, the response doesn't include images with adult content. If the request
|
607
|
+
# is through the Web Search API, the response may include images with adult
|
608
|
+
# content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
|
609
|
+
# images with adult content. The default is Moderate. If the request comes from
|
610
|
+
# a market that Bing's adult policy requires that safeSearch is set to Strict,
|
611
|
+
# Bing ignores the safeSearch value and uses Strict. If you use the site: query
|
612
|
+
# operator, there is the chance that the response may contain adult content
|
613
|
+
# regardless of what the safeSearch query parameter is set to. Use site: only
|
614
|
+
# if you are aware of the content on the site and your scenario supports the
|
615
|
+
# possibility of adult content. Possible values include: 'Off', 'Moderate',
|
616
|
+
# 'Strict'
|
617
|
+
# @param size [ImageSize] Filter images by the following sizes. All: Do not
|
618
|
+
# filter by size. Specifying this value is the same as not specifying the size
|
619
|
+
# parameter. Small: Return images that are less than 200x200 pixels. Medium:
|
620
|
+
# Return images that are greater than or equal to 200x200 pixels but less than
|
621
|
+
# 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
|
622
|
+
# Wallpaper: Return wallpaper images. You may use this parameter along with the
|
623
|
+
# height or width parameters. For example, you may use height and size to
|
624
|
+
# request small images that are 150 pixels tall. Possible values include:
|
625
|
+
# 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
|
626
|
+
# @param set_lang [String] The language to use for user interface strings.
|
627
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
628
|
+
# the language code for English is EN. The default is EN (English). Although
|
629
|
+
# optional, you should always specify the language. Typically, you set setLang
|
630
|
+
# to the same language specified by mkt unless the user wants the user
|
631
|
+
# interface strings displayed in a different language. This parameter and the
|
632
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
633
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
634
|
+
# is a string that's used as a label in a user interface. There are few user
|
635
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
636
|
+
# properties in the response objects apply the specified language.
|
637
|
+
# @param width [Integer] Filter images that have the specified width, in
|
638
|
+
# pixels. You may use this filter with the size filter to return small images
|
639
|
+
# that have a width of 150 pixels.
|
640
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
641
|
+
# will be added to the HTTP request.
|
642
|
+
#
|
643
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
644
|
+
#
|
645
|
+
def image_search_with_http_info(custom_config, 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)
|
646
|
+
image_search_async(custom_config, 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!
|
647
|
+
end
|
648
|
+
|
649
|
+
#
|
650
|
+
# The Custom Image Search API lets you send an image search query to Bing and
|
651
|
+
# get image results found in your custom view of the web.
|
652
|
+
#
|
653
|
+
# @param custom_config [String] The identifier for the custom search
|
654
|
+
# configuration
|
655
|
+
# @param query [String] The user's search query term. The term cannot be empty.
|
656
|
+
# The term may contain [Bing Advanced
|
657
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
658
|
+
# limit images to a specific domain, use the
|
659
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. To help
|
660
|
+
# improve relevance of an insights query (see
|
661
|
+
# [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)),
|
662
|
+
# you should always include the user's query term. Use this parameter only with
|
663
|
+
# the Image Search API.Do not specify this parameter when calling the Trending
|
664
|
+
# Images API.
|
665
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
666
|
+
# languages to use for user interface strings. The list is in decreasing order
|
667
|
+
# of preference. For additional information, including expected format, see
|
668
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
669
|
+
# header and the
|
670
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
671
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
672
|
+
# header, you must also specify the
|
673
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
674
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
675
|
+
# first supported language it finds from the list and combines it with the cc
|
676
|
+
# parameter value. If the list does not include a supported language, Bing
|
677
|
+
# finds the closest language and market that supports the request or it uses an
|
678
|
+
# aggregated or default market for the results. To determine the market that
|
679
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
680
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
681
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
682
|
+
# and
|
683
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#setlang)
|
684
|
+
# query parameters. A user interface string is a string that's used as a label
|
685
|
+
# in a user interface. There are few user interface strings in the JSON
|
686
|
+
# response objects. Any links to Bing.com properties in the response objects
|
687
|
+
# apply the specified language.
|
688
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
689
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
690
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
691
|
+
# should be the same string that any commonly used browser sends. For
|
692
|
+
# information about user agents, see [RFC
|
693
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
694
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
695
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
696
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
697
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
698
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
699
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
700
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
701
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
702
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
703
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
704
|
+
# @param client_id [String] Bing uses this header to provide users with
|
705
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
706
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
707
|
+
# different flights. If you do not use the same client ID for a user across
|
708
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
709
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
710
|
+
# inconsistent user experience. For example, if the second request has a
|
711
|
+
# different flight assignment than the first, the experience may be unexpected.
|
712
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
713
|
+
# search history, providing a richer experience for the user. Bing also uses
|
714
|
+
# this header to help improve result rankings by analyzing the activity
|
715
|
+
# generated by a client ID. The relevance improvements help with better quality
|
716
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
717
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
718
|
+
# this header required. Persisting the client ID across multiple requests for
|
719
|
+
# the same end user and device combination enables 1) the API consumer to
|
720
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
721
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
722
|
+
# application on the device must have a unique, Bing generated client ID. If
|
723
|
+
# you do not include this header in the request, Bing generates an ID and
|
724
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
725
|
+
# should NOT include this header in a request is the first time the user uses
|
726
|
+
# your app on that device. Use the client ID for each Bing API request that
|
727
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
728
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
729
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
730
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
731
|
+
# time the user uses your app on that device, get the client ID that you
|
732
|
+
# persisted. Bing responses may or may not include this header. If the response
|
733
|
+
# includes this header, capture the client ID and use it for all subsequent
|
734
|
+
# Bing requests for the user on that device. If you include the
|
735
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
736
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
737
|
+
# IP address is used to discover the user's location. Bing uses the location
|
738
|
+
# information to determine safe search behavior. Although optional, you are
|
739
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
740
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
741
|
+
# Obfuscating the address results in the location not being anywhere near the
|
742
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
743
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
744
|
+
# describe the client's geographical location. Bing uses the location
|
745
|
+
# information to determine safe search behavior and to return relevant local
|
746
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
747
|
+
# keys that you use to specify the user's location. lat (required): The
|
748
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
749
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
750
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
751
|
+
# long (required): The longitude of the client's location, in degrees. The
|
752
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
753
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
754
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
755
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
756
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
757
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
758
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
759
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
760
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
761
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
762
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
763
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
764
|
+
# client device is traveling. alt (optional): The altitude of the client
|
765
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
766
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
767
|
+
# the alt key. Although many of the keys are optional, the more information
|
768
|
+
# that you provide, the more accurate the location results are. Although
|
769
|
+
# optional, you are encouraged to always specify the user's geographical
|
770
|
+
# location. Providing the location is especially important if the client's IP
|
771
|
+
# address does not accurately reflect the user's physical location (for
|
772
|
+
# example, if the client uses VPN). For optimal results, you should include
|
773
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
774
|
+
# include this header.
|
775
|
+
# @param aspect [ImageAspect] Filter images by the following aspect ratios.
|
776
|
+
# All: Do not filter by aspect.Specifying this value is the same as not
|
777
|
+
# specifying the aspect parameter. Square: Return images with standard aspect
|
778
|
+
# ratio. Wide: Return images with wide screen aspect ratio. Tall: Return images
|
779
|
+
# with tall aspect ratio. Possible values include: 'All', 'Square', 'Wide',
|
780
|
+
# 'Tall'
|
781
|
+
# @param color [ImageColor] Filter images by the following color options.
|
782
|
+
# ColorOnly: Return color images. Monochrome: Return black and white images.
|
783
|
+
# Return images with one of the following dominant colors: Black, Blue, Brown,
|
784
|
+
# Gray, Green, Orange, Pink, Purple, Red, Teal, White, Yellow. Possible values
|
785
|
+
# include: 'ColorOnly', 'Monochrome', 'Black', 'Blue', 'Brown', 'Gray',
|
786
|
+
# 'Green', 'Orange', 'Pink', 'Purple', 'Red', 'Teal', 'White', 'Yellow'
|
787
|
+
# @param country_code [String] A 2-character country code of the country where
|
788
|
+
# the results come from. For a list of possible values, see [Market
|
789
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
790
|
+
# If you set this parameter, you must also specify the
|
791
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
792
|
+
# header. Bing uses the first supported language it finds from the languages
|
793
|
+
# list, and combine that language with the country code that you specify to
|
794
|
+
# determine the market to return results for. If the languages list does not
|
795
|
+
# include a supported language, Bing finds the closest language and market that
|
796
|
+
# supports the request, or it may use an aggregated or default market for the
|
797
|
+
# results instead of a specified one. You should use this query parameter and
|
798
|
+
# the Accept-Language query parameter only if you specify multiple languages;
|
799
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
800
|
+
# parameter and the
|
801
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#mkt)
|
802
|
+
# query parameter are mutually exclusive—do not specify both.
|
803
|
+
# @param count [Integer] The number of images to return in the response. The
|
804
|
+
# actual number delivered may be less than requested. The default is 35. The
|
805
|
+
# maximum value is 150. You use this parameter along with the offset parameter
|
806
|
+
# to page results.For example, if your user interface displays 20 images per
|
807
|
+
# page, set count to 20 and offset to 0 to get the first page of results.For
|
808
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
809
|
+
# this parameter only with the Image Search API.Do not specify this parameter
|
810
|
+
# when calling the Insights, Trending Images, or Web Search APIs.
|
811
|
+
# @param freshness [Freshness] Filter images by the following discovery
|
812
|
+
# options. Day: Return images discovered by Bing within the last 24 hours.
|
813
|
+
# Week: Return images discovered by Bing within the last 7 days. Month: Return
|
814
|
+
# images discovered by Bing within the last 30 days. Possible values include:
|
815
|
+
# 'Day', 'Week', 'Month'
|
816
|
+
# @param height [Integer] Filter images that have the specified height, in
|
817
|
+
# pixels. You may use this filter with the size filter to return small images
|
818
|
+
# that have a height of 150 pixels.
|
819
|
+
# @param id [String] An ID that uniquely identifies an image. Use this
|
820
|
+
# parameter to ensure that the specified image is the first image in the list
|
821
|
+
# of images that Bing returns. The
|
822
|
+
# [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
|
823
|
+
# object's imageId field contains the ID that you set this parameter to.
|
824
|
+
# @param image_content [ImageContent] Filter images by the following content
|
825
|
+
# types. Face: Return images that show only a person's face. Portrait: Return
|
826
|
+
# images that show only a person's head and shoulders. Possible values include:
|
827
|
+
# 'Face', 'Portrait'
|
828
|
+
# @param image_type [ImageType] Filter images by the following image types.
|
829
|
+
# AnimatedGif: Return only animated GIFs. Clipart: Return only clip art images.
|
830
|
+
# Line: Return only line drawings. Photo: Return only photographs(excluding
|
831
|
+
# line drawings, animated Gifs, and clip art). Shopping: Return only images
|
832
|
+
# that contain items where Bing knows of a merchant that is selling the items.
|
833
|
+
# This option is valid in the en - US market only.Transparent: Return only
|
834
|
+
# images with a transparent background. Possible values include: 'AnimatedGif',
|
835
|
+
# 'Clipart', 'Line', 'Photo', 'Shopping', 'Transparent'
|
836
|
+
# @param license [ImageLicense] Filter images by the following license types.
|
837
|
+
# All: Do not filter by license type.Specifying this value is the same as not
|
838
|
+
# specifying the license parameter. Any: Return images that are under any
|
839
|
+
# license type. The response doesn't include images that do not specify a
|
840
|
+
# license or the license is unknown. Public: Return images where the creator
|
841
|
+
# has waived their exclusive rights, to the fullest extent allowed by law.
|
842
|
+
# Share: Return images that may be shared with others. Changing or editing the
|
843
|
+
# image might not be allowed. Also, modifying, sharing, and using the image for
|
844
|
+
# commercial purposes might not be allowed. Typically, this option returns the
|
845
|
+
# most images. ShareCommercially: Return images that may be shared with others
|
846
|
+
# for personal or commercial purposes. Changing or editing the image might not
|
847
|
+
# be allowed. Modify: Return images that may be modified, shared, and used.
|
848
|
+
# Changing or editing the image might not be allowed. Modifying, sharing, and
|
849
|
+
# using the image for commercial purposes might not be allowed.
|
850
|
+
# ModifyCommercially: Return images that may be modified, shared, and used for
|
851
|
+
# personal or commercial purposes. Typically, this option returns the fewest
|
852
|
+
# images. For more information about these license types, see [Filter Images By
|
853
|
+
# License Type](http://go.microsoft.com/fwlink/?LinkId=309768). Possible values
|
854
|
+
# include: 'All', 'Any', 'Public', 'Share', 'ShareCommercially', 'Modify',
|
855
|
+
# 'ModifyCommercially'
|
856
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
857
|
+
# is the country where the user is making the request from. However, it could
|
858
|
+
# be a different country if the user is not located in a country where Bing
|
859
|
+
# delivers results. The market must be in the form <language code>-<country
|
860
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
861
|
+
# possible market values, see [Market
|
862
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes).
|
863
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
864
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
865
|
+
# response. If you specify a market that is not listed in [Market
|
866
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#market-codes),
|
867
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
868
|
+
# to change. This parameter and the
|
869
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#cc)
|
870
|
+
# query parameter are mutually exclusive—do not specify both.
|
871
|
+
# @param max_file_size [Integer] Filter images that are less than or equal to
|
872
|
+
# the specified file size. The maximum file size that you may specify is
|
873
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
874
|
+
# possible that the response may include images that are slightly larger than
|
875
|
+
# the specified maximum. You may specify this filter and minFileSize to filter
|
876
|
+
# images within a range of file sizes.
|
877
|
+
# @param max_height [Integer] Filter images that have a height that is less
|
878
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
879
|
+
# specify this filter and minHeight to filter images within a range of heights.
|
880
|
+
# This filter and the height filter are mutually exclusive.
|
881
|
+
# @param max_width [Integer] Filter images that have a width that is less than
|
882
|
+
# or equal to the specified width. Specify the width in pixels. You may specify
|
883
|
+
# this filter and maxWidth to filter images within a range of widths. This
|
884
|
+
# filter and the width filter are mutually exclusive.
|
885
|
+
# @param min_file_size [Integer] Filter images that are greater than or equal
|
886
|
+
# to the specified file size. The maximum file size that you may specify is
|
887
|
+
# 520,192 bytes. If you specify a larger value, the API uses 520,192. It is
|
888
|
+
# possible that the response may include images that are slightly smaller than
|
889
|
+
# the specified minimum. You may specify this filter and maxFileSize to filter
|
890
|
+
# images within a range of file sizes.
|
891
|
+
# @param min_height [Integer] Filter images that have a height that is greater
|
892
|
+
# than or equal to the specified height. Specify the height in pixels. You may
|
893
|
+
# specify this filter and maxHeight to filter images within a range of heights.
|
894
|
+
# This filter and the height filter are mutually exclusive.
|
895
|
+
# @param min_width [Integer] Filter images that have a width that is greater
|
896
|
+
# than or equal to the specified width. Specify the width in pixels. You may
|
897
|
+
# specify this filter and maxWidth to filter images within a range of widths.
|
898
|
+
# This filter and the width filter are mutually exclusive.
|
899
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
900
|
+
# images to skip before returning images. The default is 0. The offset should
|
901
|
+
# be less than
|
902
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#totalestimatedmatches)
|
903
|
+
# - count). Use this parameter along with the count parameter to page results.
|
904
|
+
# For example, if your user interface displays 20 images per page, set count to
|
905
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
906
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
907
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
908
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#nextoffset).
|
909
|
+
# Use this parameter only with the Image API. Do not specify this parameter
|
910
|
+
# when calling the Trending Images API or the Web Search API.
|
911
|
+
# @param safe_search [SafeSearch] Filter images for adult content. The
|
912
|
+
# following are the possible filter values. Off: May return images with adult
|
913
|
+
# content. If the request is through the Image Search API, the response
|
914
|
+
# includes thumbnail images that are clear (non-fuzzy). However, if the request
|
915
|
+
# is through the Web Search API, the response includes thumbnail images that
|
916
|
+
# are pixelated (fuzzy). Moderate: If the request is through the Image Search
|
917
|
+
# API, the response doesn't include images with adult content. If the request
|
918
|
+
# is through the Web Search API, the response may include images with adult
|
919
|
+
# content (the thumbnail images are pixelated (fuzzy)). Strict: Do not return
|
920
|
+
# images with adult content. The default is Moderate. If the request comes from
|
921
|
+
# a market that Bing's adult policy requires that safeSearch is set to Strict,
|
922
|
+
# Bing ignores the safeSearch value and uses Strict. If you use the site: query
|
923
|
+
# operator, there is the chance that the response may contain adult content
|
924
|
+
# regardless of what the safeSearch query parameter is set to. Use site: only
|
925
|
+
# if you are aware of the content on the site and your scenario supports the
|
926
|
+
# possibility of adult content. Possible values include: 'Off', 'Moderate',
|
927
|
+
# 'Strict'
|
928
|
+
# @param size [ImageSize] Filter images by the following sizes. All: Do not
|
929
|
+
# filter by size. Specifying this value is the same as not specifying the size
|
930
|
+
# parameter. Small: Return images that are less than 200x200 pixels. Medium:
|
931
|
+
# Return images that are greater than or equal to 200x200 pixels but less than
|
932
|
+
# 500x500 pixels. Large: Return images that are 500x500 pixels or larger.
|
933
|
+
# Wallpaper: Return wallpaper images. You may use this parameter along with the
|
934
|
+
# height or width parameters. For example, you may use height and size to
|
935
|
+
# request small images that are 150 pixels tall. Possible values include:
|
936
|
+
# 'All', 'Small', 'Medium', 'Large', 'Wallpaper'
|
937
|
+
# @param set_lang [String] The language to use for user interface strings.
|
938
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
939
|
+
# the language code for English is EN. The default is EN (English). Although
|
940
|
+
# optional, you should always specify the language. Typically, you set setLang
|
941
|
+
# to the same language specified by mkt unless the user wants the user
|
942
|
+
# interface strings displayed in a different language. This parameter and the
|
943
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#acceptlanguage)
|
944
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
945
|
+
# is a string that's used as a label in a user interface. There are few user
|
946
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
947
|
+
# properties in the response objects apply the specified language.
|
948
|
+
# @param width [Integer] Filter images that have the specified width, in
|
949
|
+
# pixels. You may use this filter with the size filter to return small images
|
950
|
+
# that have a width of 150 pixels.
|
951
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
952
|
+
# to the HTTP request.
|
953
|
+
#
|
954
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
955
|
+
#
|
956
|
+
def image_search_async(custom_config, 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)
|
957
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
958
|
+
x_bing_apis_sdk = 'true'
|
959
|
+
fail ArgumentError, 'custom_config is nil' if custom_config.nil?
|
960
|
+
fail ArgumentError, 'query is nil' if query.nil?
|
961
|
+
|
962
|
+
|
963
|
+
request_headers = {}
|
964
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
965
|
+
|
966
|
+
# Set Headers
|
967
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
968
|
+
request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
|
969
|
+
request_headers['Accept-Language'] = accept_language unless accept_language.nil?
|
970
|
+
request_headers['User-Agent'] = user_agent unless user_agent.nil?
|
971
|
+
request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
|
972
|
+
request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
|
973
|
+
request_headers['X-Search-Location'] = location unless location.nil?
|
974
|
+
path_template = 'images/search'
|
975
|
+
|
976
|
+
request_url = @base_url || @client.base_url
|
977
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
978
|
+
|
979
|
+
options = {
|
980
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
981
|
+
query_params: {'customConfig' => custom_config,'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},
|
982
|
+
headers: request_headers.merge(custom_headers || {}),
|
983
|
+
base_url: request_url
|
984
|
+
}
|
985
|
+
promise = @client.make_request_async(:get, path_template, options)
|
986
|
+
|
987
|
+
promise = promise.then do |result|
|
988
|
+
http_response = result.response
|
989
|
+
status_code = http_response.status
|
990
|
+
response_content = http_response.body
|
991
|
+
unless status_code == 200
|
992
|
+
error_model = JSON.load(response_content)
|
993
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
994
|
+
end
|
995
|
+
|
996
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
997
|
+
# Deserialize Response
|
998
|
+
if status_code == 200
|
999
|
+
begin
|
1000
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1001
|
+
result_mapper = Azure::CognitiveServices::Customimagesearch::V1_0::Models::Images.mapper()
|
1002
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1003
|
+
rescue Exception => e
|
1004
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1005
|
+
end
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
result
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
promise.execute
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
end
|
1015
|
+
end
|