azure_cognitiveservices_videosearch 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch.rb +60 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/answer.rb +90 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/creative_work.rb +169 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/error.rb +118 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/error_code.rb +20 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/error_response.rb +89 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/error_sub_code.rb +25 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/freshness.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/identifiable.rb +62 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/image_object.rb +208 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/media_object.rb +209 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/pivot_suggestions.rb +67 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/query.rb +100 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/query_context.rb +126 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/response.rb +72 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/response_base.rb +59 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/safe_search.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/search_results_answer.rb +113 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/text_format.rb +16 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/thing.rb +143 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/trending_videos.rb +109 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/trending_videos_category.rb +67 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/trending_videos_subcategory.rb +67 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/trending_videos_tile.rb +61 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_details.rb +95 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_insight_module.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_length.rb +18 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_object.rb +304 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_pricing.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_query_scenario.rb +16 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/video_resolution.rb +18 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/videos.rb +193 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/models/videos_module.rb +57 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/module_definition.rb +9 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/video_search_client.rb +127 -0
- data/lib/1.0/generated/azure_cognitiveservices_videosearch/videos_operations.rb +2253 -0
- data/lib/azure_cognitiveservices_videosearch.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/modules/videosearch_profile_module.rb +187 -0
- data/lib/profiles/latest/videosearch_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/videosearch_module_definition.rb +8 -0
- data/lib/version.rb +7 -0
- metadata +162 -0
@@ -0,0 +1,17 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for VideoPricing
|
10
|
+
#
|
11
|
+
module VideoPricing
|
12
|
+
All = "All"
|
13
|
+
Free = "Free"
|
14
|
+
Paid = "Paid"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for VideoQueryScenario
|
10
|
+
#
|
11
|
+
module VideoQueryScenario
|
12
|
+
List = "List"
|
13
|
+
SingleDominantVideo = "SingleDominantVideo"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for VideoResolution
|
10
|
+
#
|
11
|
+
module VideoResolution
|
12
|
+
All = "All"
|
13
|
+
SD480p = "SD480p"
|
14
|
+
HD720p = "HD720p"
|
15
|
+
HD1080p = "HD1080p"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,193 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines a video answer.
|
10
|
+
#
|
11
|
+
class Videos < SearchResultsAnswer
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@_type = "Videos"
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :_type
|
21
|
+
|
22
|
+
# @return [Array<VideoObject>] A list of video objects that are relevant
|
23
|
+
# to the query.
|
24
|
+
attr_accessor :value
|
25
|
+
|
26
|
+
# @return [Integer]
|
27
|
+
attr_accessor :next_offset
|
28
|
+
|
29
|
+
# @return [VideoQueryScenario] Possible values include: 'List',
|
30
|
+
# 'SingleDominantVideo'
|
31
|
+
attr_accessor :scenario
|
32
|
+
|
33
|
+
# @return [Array<Query>]
|
34
|
+
attr_accessor :query_expansions
|
35
|
+
|
36
|
+
# @return [Array<PivotSuggestions>]
|
37
|
+
attr_accessor :pivot_suggestions
|
38
|
+
|
39
|
+
|
40
|
+
#
|
41
|
+
# Mapper for Videos class as Ruby Hash.
|
42
|
+
# This will be used for serialization/deserialization.
|
43
|
+
#
|
44
|
+
def self.mapper()
|
45
|
+
{
|
46
|
+
client_side_validation: true,
|
47
|
+
required: false,
|
48
|
+
serialized_name: 'Videos',
|
49
|
+
type: {
|
50
|
+
name: 'Composite',
|
51
|
+
class_name: 'Videos',
|
52
|
+
model_properties: {
|
53
|
+
_type: {
|
54
|
+
client_side_validation: true,
|
55
|
+
required: true,
|
56
|
+
serialized_name: '_type',
|
57
|
+
type: {
|
58
|
+
name: 'String'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
id: {
|
62
|
+
client_side_validation: true,
|
63
|
+
required: false,
|
64
|
+
read_only: true,
|
65
|
+
serialized_name: 'id',
|
66
|
+
type: {
|
67
|
+
name: 'String'
|
68
|
+
}
|
69
|
+
},
|
70
|
+
web_search_url: {
|
71
|
+
client_side_validation: true,
|
72
|
+
required: false,
|
73
|
+
read_only: true,
|
74
|
+
serialized_name: 'webSearchUrl',
|
75
|
+
type: {
|
76
|
+
name: 'String'
|
77
|
+
}
|
78
|
+
},
|
79
|
+
follow_up_queries: {
|
80
|
+
client_side_validation: true,
|
81
|
+
required: false,
|
82
|
+
read_only: true,
|
83
|
+
serialized_name: 'followUpQueries',
|
84
|
+
type: {
|
85
|
+
name: 'Sequence',
|
86
|
+
element: {
|
87
|
+
client_side_validation: true,
|
88
|
+
required: false,
|
89
|
+
serialized_name: 'QueryElementType',
|
90
|
+
type: {
|
91
|
+
name: 'Composite',
|
92
|
+
class_name: 'Query'
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
},
|
97
|
+
total_estimated_matches: {
|
98
|
+
client_side_validation: true,
|
99
|
+
required: false,
|
100
|
+
read_only: true,
|
101
|
+
serialized_name: 'totalEstimatedMatches',
|
102
|
+
type: {
|
103
|
+
name: 'Number'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
is_family_friendly: {
|
107
|
+
client_side_validation: true,
|
108
|
+
required: false,
|
109
|
+
read_only: true,
|
110
|
+
serialized_name: 'isFamilyFriendly',
|
111
|
+
type: {
|
112
|
+
name: 'Boolean'
|
113
|
+
}
|
114
|
+
},
|
115
|
+
value: {
|
116
|
+
client_side_validation: true,
|
117
|
+
required: true,
|
118
|
+
serialized_name: 'value',
|
119
|
+
type: {
|
120
|
+
name: 'Sequence',
|
121
|
+
element: {
|
122
|
+
client_side_validation: true,
|
123
|
+
required: false,
|
124
|
+
serialized_name: 'VideoObjectElementType',
|
125
|
+
type: {
|
126
|
+
name: 'Composite',
|
127
|
+
class_name: 'VideoObject'
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
},
|
132
|
+
next_offset: {
|
133
|
+
client_side_validation: true,
|
134
|
+
required: false,
|
135
|
+
read_only: true,
|
136
|
+
serialized_name: 'nextOffset',
|
137
|
+
type: {
|
138
|
+
name: 'Number'
|
139
|
+
}
|
140
|
+
},
|
141
|
+
scenario: {
|
142
|
+
client_side_validation: true,
|
143
|
+
required: false,
|
144
|
+
read_only: true,
|
145
|
+
serialized_name: 'scenario',
|
146
|
+
type: {
|
147
|
+
name: 'Enum',
|
148
|
+
module: 'VideoQueryScenario'
|
149
|
+
}
|
150
|
+
},
|
151
|
+
query_expansions: {
|
152
|
+
client_side_validation: true,
|
153
|
+
required: false,
|
154
|
+
read_only: true,
|
155
|
+
serialized_name: 'queryExpansions',
|
156
|
+
type: {
|
157
|
+
name: 'Sequence',
|
158
|
+
element: {
|
159
|
+
client_side_validation: true,
|
160
|
+
required: false,
|
161
|
+
serialized_name: 'QueryElementType',
|
162
|
+
type: {
|
163
|
+
name: 'Composite',
|
164
|
+
class_name: 'Query'
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
},
|
169
|
+
pivot_suggestions: {
|
170
|
+
client_side_validation: true,
|
171
|
+
required: false,
|
172
|
+
read_only: true,
|
173
|
+
serialized_name: 'pivotSuggestions',
|
174
|
+
type: {
|
175
|
+
name: 'Sequence',
|
176
|
+
element: {
|
177
|
+
client_side_validation: true,
|
178
|
+
required: false,
|
179
|
+
serialized_name: 'PivotSuggestionsElementType',
|
180
|
+
type: {
|
181
|
+
name: 'Composite',
|
182
|
+
class_name: 'PivotSuggestions'
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
}
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1,57 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class VideosModule
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [Array<VideoObject>]
|
17
|
+
attr_accessor :value
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# Mapper for VideosModule class as Ruby Hash.
|
22
|
+
# This will be used for serialization/deserialization.
|
23
|
+
#
|
24
|
+
def self.mapper()
|
25
|
+
{
|
26
|
+
client_side_validation: true,
|
27
|
+
required: false,
|
28
|
+
serialized_name: 'VideosModule',
|
29
|
+
type: {
|
30
|
+
name: 'Composite',
|
31
|
+
class_name: 'VideosModule',
|
32
|
+
model_properties: {
|
33
|
+
value: {
|
34
|
+
client_side_validation: true,
|
35
|
+
required: false,
|
36
|
+
read_only: true,
|
37
|
+
serialized_name: 'value',
|
38
|
+
type: {
|
39
|
+
name: 'Sequence',
|
40
|
+
element: {
|
41
|
+
client_side_validation: true,
|
42
|
+
required: false,
|
43
|
+
serialized_name: 'VideoObjectElementType',
|
44
|
+
type: {
|
45
|
+
name: 'Composite',
|
46
|
+
class_name: 'VideoObject'
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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 end
|
7
|
+
module Azure::CognitiveServices end
|
8
|
+
module Azure::CognitiveServices::VideoSearch end
|
9
|
+
module Azure::CognitiveServices::VideoSearch::V1_0 end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::CognitiveServices::VideoSearch::V1_0
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class VideoSearchClient < MsRestAzure::AzureServiceClient
|
11
|
+
include MsRestAzure
|
12
|
+
include MsRestAzure::Serialization
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Credentials needed for the client to connect to Azure.
|
18
|
+
attr_reader :credentials1
|
19
|
+
|
20
|
+
# @return Subscription credentials which uniquely identify client
|
21
|
+
# subscription.
|
22
|
+
attr_accessor :credentials
|
23
|
+
|
24
|
+
# @return [String] Gets or sets the preferred language for the response.
|
25
|
+
attr_accessor :accept_language
|
26
|
+
|
27
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
28
|
+
# Running Operations. Default value is 30.
|
29
|
+
attr_accessor :long_running_operation_retry_timeout
|
30
|
+
|
31
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
32
|
+
# is generated and included in each request. Default is true.
|
33
|
+
attr_accessor :generate_client_request_id
|
34
|
+
|
35
|
+
# @return [VideosOperations] videos_operations
|
36
|
+
attr_reader :videos_operations
|
37
|
+
|
38
|
+
#
|
39
|
+
# Creates initializes a new instance of the VideoSearchClient class.
|
40
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
41
|
+
# @param base_url [String] the base URI of the service.
|
42
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
43
|
+
#
|
44
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
45
|
+
super(credentials, options)
|
46
|
+
@base_url = base_url || 'https://api.cognitive.microsoft.com/bing/v7.0'
|
47
|
+
|
48
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
49
|
+
@credentials = credentials
|
50
|
+
|
51
|
+
@videos_operations = VideosOperations.new(self)
|
52
|
+
@accept_language = 'en-US'
|
53
|
+
@long_running_operation_retry_timeout = 30
|
54
|
+
@generate_client_request_id = true
|
55
|
+
add_telemetry
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Makes a request and returns the body of the response.
|
60
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
61
|
+
# @param path [String] the path, relative to {base_url}.
|
62
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
63
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
64
|
+
# Example:
|
65
|
+
#
|
66
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
67
|
+
# path = "/path"
|
68
|
+
# options = {
|
69
|
+
# body: request_content,
|
70
|
+
# query_params: {'api-version' => '2016-02-01'}
|
71
|
+
# }
|
72
|
+
# result = @client.make_request(:put, path, options)
|
73
|
+
#
|
74
|
+
def make_request(method, path, options = {})
|
75
|
+
result = make_request_with_http_info(method, path, options)
|
76
|
+
result.body unless result.nil?
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Makes a request and returns the operation response.
|
81
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
82
|
+
# @param path [String] the path, relative to {base_url}.
|
83
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
84
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
85
|
+
#
|
86
|
+
def make_request_with_http_info(method, path, options = {})
|
87
|
+
result = make_request_async(method, path, options).value!
|
88
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
89
|
+
result
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# Makes a request asynchronously.
|
94
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
95
|
+
# @param path [String] the path, relative to {base_url}.
|
96
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
97
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
98
|
+
#
|
99
|
+
def make_request_async(method, path, options = {})
|
100
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
101
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
102
|
+
|
103
|
+
request_url = options[:base_url] || @base_url
|
104
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
105
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
106
|
+
end
|
107
|
+
|
108
|
+
request_headers = @request_headers
|
109
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
110
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
111
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
112
|
+
|
113
|
+
super(request_url, method, path, options)
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
private
|
118
|
+
#
|
119
|
+
# Adds telemetry information.
|
120
|
+
#
|
121
|
+
def add_telemetry
|
122
|
+
sdk_information = 'azure_cognitiveservices_videosearch'
|
123
|
+
sdk_information = "#{sdk_information}/0.16.0"
|
124
|
+
add_user_agent_information(sdk_information)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,2253 @@
|
|
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::VideoSearch::V1_0
|
7
|
+
#
|
8
|
+
# The Video Search API lets you search on Bing for video that are relevant to
|
9
|
+
# the user's search query, for insights about a video or for videos that are
|
10
|
+
# trending based on search requests made by others. This section provides
|
11
|
+
# technical details about the query parameters and headers that you use to
|
12
|
+
# request videos and the JSON response objects that contain them. For
|
13
|
+
# examples that show how to make requests, see [Searching the Web for
|
14
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
15
|
+
#
|
16
|
+
class VideosOperations
|
17
|
+
include MsRestAzure
|
18
|
+
|
19
|
+
#
|
20
|
+
# Creates and initializes a new instance of the VideosOperations class.
|
21
|
+
# @param client service class for accessing basic functionality.
|
22
|
+
#
|
23
|
+
def initialize(client)
|
24
|
+
@client = client
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [VideoSearchClient] reference to the VideoSearchClient
|
28
|
+
attr_reader :client
|
29
|
+
|
30
|
+
#
|
31
|
+
# The Video Search API lets you send a search query to Bing and get back a list
|
32
|
+
# of videos that are relevant to the search query. This section provides
|
33
|
+
# technical details about the query parameters and headers that you use to
|
34
|
+
# request videos and the JSON response objects that contain them. For examples
|
35
|
+
# that show how to make requests, see [Searching the Web for
|
36
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
37
|
+
#
|
38
|
+
# @param query [String] The user's search query string. The query string cannot
|
39
|
+
# be empty. The query string may contain [Bing Advanced
|
40
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
41
|
+
# limit videos to a specific domain, use the
|
42
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
43
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
44
|
+
# calling the Trending Videos API.
|
45
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
46
|
+
# languages to use for user interface strings. The list is in decreasing order
|
47
|
+
# of preference. For additional information, including expected format, see
|
48
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
49
|
+
# header and the
|
50
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
51
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
52
|
+
# header, you must also specify the
|
53
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
54
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
55
|
+
# first supported language it finds from the list and combines it with the cc
|
56
|
+
# parameter value. If the list does not include a supported language, Bing
|
57
|
+
# finds the closest language and market that supports the request or it uses an
|
58
|
+
# aggregated or default market for the results. To determine the market that
|
59
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
60
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
61
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
62
|
+
# and
|
63
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
64
|
+
# query parameters. A user interface string is a string that's used as a label
|
65
|
+
# in a user interface. There are few user interface strings in the JSON
|
66
|
+
# response objects. Any links to Bing.com properties in the response objects
|
67
|
+
# apply the specified language.
|
68
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
69
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
70
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
71
|
+
# should be the same string that any commonly used browser sends. For
|
72
|
+
# information about user agents, see [RFC
|
73
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
74
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
75
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
76
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
77
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
78
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
79
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
80
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
81
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
82
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
83
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
84
|
+
# @param client_id [String] Bing uses this header to provide users with
|
85
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
86
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
87
|
+
# different flights. If you do not use the same client ID for a user across
|
88
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
89
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
90
|
+
# inconsistent user experience. For example, if the second request has a
|
91
|
+
# different flight assignment than the first, the experience may be unexpected.
|
92
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
93
|
+
# search history, providing a richer experience for the user. Bing also uses
|
94
|
+
# this header to help improve result rankings by analyzing the activity
|
95
|
+
# generated by a client ID. The relevance improvements help with better quality
|
96
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
97
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
98
|
+
# this header required. Persisting the client ID across multiple requests for
|
99
|
+
# the same end user and device combination enables 1) the API consumer to
|
100
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
101
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
102
|
+
# application on the device must have a unique, Bing generated client ID. If
|
103
|
+
# you do not include this header in the request, Bing generates an ID and
|
104
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
105
|
+
# should NOT include this header in a request is the first time the user uses
|
106
|
+
# your app on that device. Use the client ID for each Bing API request that
|
107
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
108
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
109
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
110
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
111
|
+
# time the user uses your app on that device, get the client ID that you
|
112
|
+
# persisted. Bing responses may or may not include this header. If the response
|
113
|
+
# includes this header, capture the client ID and use it for all subsequent
|
114
|
+
# Bing requests for the user on that device. If you include the
|
115
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
116
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
117
|
+
# IP address is used to discover the user's location. Bing uses the location
|
118
|
+
# information to determine safe search behavior. Although optional, you are
|
119
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
120
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
121
|
+
# Obfuscating the address results in the location not being anywhere near the
|
122
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
123
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
124
|
+
# describe the client's geographical location. Bing uses the location
|
125
|
+
# information to determine safe search behavior and to return relevant local
|
126
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
127
|
+
# keys that you use to specify the user's location. lat (required): The
|
128
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
129
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
130
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
131
|
+
# long (required): The longitude of the client's location, in degrees. The
|
132
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
133
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
134
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
135
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
136
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
137
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
138
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
139
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
140
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
141
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
142
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
143
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
144
|
+
# client device is traveling. alt (optional): The altitude of the client
|
145
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
146
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
147
|
+
# the alt key. Although many of the keys are optional, the more information
|
148
|
+
# that you provide, the more accurate the location results are. Although
|
149
|
+
# optional, you are encouraged to always specify the user's geographical
|
150
|
+
# location. Providing the location is especially important if the client's IP
|
151
|
+
# address does not accurately reflect the user's physical location (for
|
152
|
+
# example, if the client uses VPN). For optimal results, you should include
|
153
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
154
|
+
# include this header.
|
155
|
+
# @param country_code [String] A 2-character country code of the country where
|
156
|
+
# the results come from. This API supports only the United States market. If
|
157
|
+
# you specify this query parameter, it must be set to us. If you set this
|
158
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
159
|
+
# first supported language it finds from the languages list, and combine that
|
160
|
+
# language with the country code that you specify to determine the market to
|
161
|
+
# return results for. If the languages list does not include a supported
|
162
|
+
# language, Bing finds the closest language and market that supports the
|
163
|
+
# request, or it may use an aggregated or default market for the results
|
164
|
+
# instead of a specified one. You should use this query parameter and the
|
165
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
166
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
167
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
168
|
+
# both.
|
169
|
+
# @param count [Integer] The number of videos to return in the response. The
|
170
|
+
# actual number delivered may be less than requested. The default is 35. The
|
171
|
+
# maximum is 105. You may use this parameter along with the offset parameter to
|
172
|
+
# page results. For example, if your user interface presents 20 videos per
|
173
|
+
# page, set count to 20 and offset to 0 to get the first page of results. For
|
174
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
175
|
+
# this parameter only with the Video Search API. Do not specify this parameter
|
176
|
+
# when calling the Trending Videos API or the Web Search API.
|
177
|
+
# @param freshness [Freshness] Filter videos by the date and time that Bing
|
178
|
+
# discovered the video. The following are the possible filter values. Day:
|
179
|
+
# Return videos discovered within the last 24 hours. Week: Return videos
|
180
|
+
# discovered within the last 7 days. Month: Return videos discovered within the
|
181
|
+
# last 30 days. Possible values include: 'Day', 'Week', 'Month'
|
182
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
183
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
184
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
185
|
+
# use this parameter to ensure that the specified video is the first video in
|
186
|
+
# the list of videos that Bing returns.
|
187
|
+
# @param length [VideoLength] Filter videos by the following lengths: Short:
|
188
|
+
# Return videos that are less than 5 minutes. Medium: Return videos that are
|
189
|
+
# between 5 and 20 minutes, inclusive. Long: Return videos that are longer than
|
190
|
+
# 20 minutes. All: Do not filter by length.Specifying this value is the same as
|
191
|
+
# not specifying the videoLength parameter. Possible values include: 'All',
|
192
|
+
# 'Short', 'Medium', 'Long'
|
193
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
194
|
+
# is the country where the user is making the request from. However, it could
|
195
|
+
# be a different country if the user is not located in a country where Bing
|
196
|
+
# delivers results. The market must be in the form <language code>-<country
|
197
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
198
|
+
# possible market values, see [Market
|
199
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
200
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
201
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
202
|
+
# response. If you specify a market that is not listed in [Market
|
203
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
204
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
205
|
+
# to change. This parameter and the
|
206
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
207
|
+
# query parameter are mutually exclusive—do not specify both.
|
208
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
209
|
+
# videos to skip before returning videos. The default is 0. The offset should
|
210
|
+
# be less than
|
211
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-totalmatches)
|
212
|
+
# - count). Use this parameter along with the count parameter to page results.
|
213
|
+
# For example, if your user interface displays 20 videos per page, set count to
|
214
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
215
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
216
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
217
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-nextoffset).
|
218
|
+
# Use this parameter only with the Video Search API.
|
219
|
+
# @param pricing [VideoPricing] Filter videos by the following pricing options:
|
220
|
+
# Free: Return videos that are free to view. Paid: Return videos that require a
|
221
|
+
# subscription or payment to view. All: Do not filter by pricing.Specifying
|
222
|
+
# this value is the same as not specifying the pricing parameter. Possible
|
223
|
+
# values include: 'All', 'Free', 'Paid'
|
224
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
225
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
226
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
227
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
228
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
229
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
230
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
231
|
+
# following are the possible filter values. Off: If the request is through the
|
232
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
233
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
234
|
+
# API, the response includes adult videos but the thumbnail images of the
|
235
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
236
|
+
# Search API, the response does not include videos with adult content. If the
|
237
|
+
# request is through the Web Search API, the response may include videos with
|
238
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
239
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
240
|
+
# If the request comes from a market that Bing's adult policy requires that
|
241
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
242
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
243
|
+
# response may contain adult content regardless of what the safeSearch query
|
244
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
245
|
+
# site and your scenario supports the possibility of adult content. Possible
|
246
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
247
|
+
# @param set_lang [String] The language to use for user interface strings.
|
248
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
249
|
+
# the language code for English is EN. The default is EN (English). Although
|
250
|
+
# optional, you should always specify the language. Typically, you set setLang
|
251
|
+
# to the same language specified by mkt unless the user wants the user
|
252
|
+
# interface strings displayed in a different language. This parameter and the
|
253
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
254
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
255
|
+
# is a string that's used as a label in a user interface. There are few user
|
256
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
257
|
+
# properties in the response objects apply the specified language.
|
258
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
259
|
+
# display strings contain decoration markers such as hit highlighting
|
260
|
+
# characters. If true, the strings may include markers. The default is false.
|
261
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
262
|
+
# the
|
263
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
264
|
+
# query parameter. For information about hit highlighting, see [Hit
|
265
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
266
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
267
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
268
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
269
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
270
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
271
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
272
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
273
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
274
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
275
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
276
|
+
# values include: 'Raw', 'Html'
|
277
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
278
|
+
# will be added to the HTTP request.
|
279
|
+
#
|
280
|
+
# @return [Videos] operation results.
|
281
|
+
#
|
282
|
+
def search(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, count:nil, freshness:nil, id:nil, length:nil, market:nil, offset:nil, pricing:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
283
|
+
response = search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, count:count, freshness:freshness, id:id, length:length, market:market, offset:offset, pricing:pricing, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
284
|
+
response.body unless response.nil?
|
285
|
+
end
|
286
|
+
|
287
|
+
#
|
288
|
+
# The Video Search API lets you send a search query to Bing and get back a list
|
289
|
+
# of videos that are relevant to the search query. This section provides
|
290
|
+
# technical details about the query parameters and headers that you use to
|
291
|
+
# request videos and the JSON response objects that contain them. For examples
|
292
|
+
# that show how to make requests, see [Searching the Web for
|
293
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
294
|
+
#
|
295
|
+
# @param query [String] The user's search query string. The query string cannot
|
296
|
+
# be empty. The query string may contain [Bing Advanced
|
297
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
298
|
+
# limit videos to a specific domain, use the
|
299
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
300
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
301
|
+
# calling the Trending Videos API.
|
302
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
303
|
+
# languages to use for user interface strings. The list is in decreasing order
|
304
|
+
# of preference. For additional information, including expected format, see
|
305
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
306
|
+
# header and the
|
307
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
308
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
309
|
+
# header, you must also specify the
|
310
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
311
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
312
|
+
# first supported language it finds from the list and combines it with the cc
|
313
|
+
# parameter value. If the list does not include a supported language, Bing
|
314
|
+
# finds the closest language and market that supports the request or it uses an
|
315
|
+
# aggregated or default market for the results. To determine the market that
|
316
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
317
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
318
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
319
|
+
# and
|
320
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
321
|
+
# query parameters. A user interface string is a string that's used as a label
|
322
|
+
# in a user interface. There are few user interface strings in the JSON
|
323
|
+
# response objects. Any links to Bing.com properties in the response objects
|
324
|
+
# apply the specified language.
|
325
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
326
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
327
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
328
|
+
# should be the same string that any commonly used browser sends. For
|
329
|
+
# information about user agents, see [RFC
|
330
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
331
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
332
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
333
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
334
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
335
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
336
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
337
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
338
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
339
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
340
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
341
|
+
# @param client_id [String] Bing uses this header to provide users with
|
342
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
343
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
344
|
+
# different flights. If you do not use the same client ID for a user across
|
345
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
346
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
347
|
+
# inconsistent user experience. For example, if the second request has a
|
348
|
+
# different flight assignment than the first, the experience may be unexpected.
|
349
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
350
|
+
# search history, providing a richer experience for the user. Bing also uses
|
351
|
+
# this header to help improve result rankings by analyzing the activity
|
352
|
+
# generated by a client ID. The relevance improvements help with better quality
|
353
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
354
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
355
|
+
# this header required. Persisting the client ID across multiple requests for
|
356
|
+
# the same end user and device combination enables 1) the API consumer to
|
357
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
358
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
359
|
+
# application on the device must have a unique, Bing generated client ID. If
|
360
|
+
# you do not include this header in the request, Bing generates an ID and
|
361
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
362
|
+
# should NOT include this header in a request is the first time the user uses
|
363
|
+
# your app on that device. Use the client ID for each Bing API request that
|
364
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
365
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
366
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
367
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
368
|
+
# time the user uses your app on that device, get the client ID that you
|
369
|
+
# persisted. Bing responses may or may not include this header. If the response
|
370
|
+
# includes this header, capture the client ID and use it for all subsequent
|
371
|
+
# Bing requests for the user on that device. If you include the
|
372
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
373
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
374
|
+
# IP address is used to discover the user's location. Bing uses the location
|
375
|
+
# information to determine safe search behavior. Although optional, you are
|
376
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
377
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
378
|
+
# Obfuscating the address results in the location not being anywhere near the
|
379
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
380
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
381
|
+
# describe the client's geographical location. Bing uses the location
|
382
|
+
# information to determine safe search behavior and to return relevant local
|
383
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
384
|
+
# keys that you use to specify the user's location. lat (required): The
|
385
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
386
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
387
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
388
|
+
# long (required): The longitude of the client's location, in degrees. The
|
389
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
390
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
391
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
392
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
393
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
394
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
395
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
396
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
397
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
398
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
399
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
400
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
401
|
+
# client device is traveling. alt (optional): The altitude of the client
|
402
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
403
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
404
|
+
# the alt key. Although many of the keys are optional, the more information
|
405
|
+
# that you provide, the more accurate the location results are. Although
|
406
|
+
# optional, you are encouraged to always specify the user's geographical
|
407
|
+
# location. Providing the location is especially important if the client's IP
|
408
|
+
# address does not accurately reflect the user's physical location (for
|
409
|
+
# example, if the client uses VPN). For optimal results, you should include
|
410
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
411
|
+
# include this header.
|
412
|
+
# @param country_code [String] A 2-character country code of the country where
|
413
|
+
# the results come from. This API supports only the United States market. If
|
414
|
+
# you specify this query parameter, it must be set to us. If you set this
|
415
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
416
|
+
# first supported language it finds from the languages list, and combine that
|
417
|
+
# language with the country code that you specify to determine the market to
|
418
|
+
# return results for. If the languages list does not include a supported
|
419
|
+
# language, Bing finds the closest language and market that supports the
|
420
|
+
# request, or it may use an aggregated or default market for the results
|
421
|
+
# instead of a specified one. You should use this query parameter and the
|
422
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
423
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
424
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
425
|
+
# both.
|
426
|
+
# @param count [Integer] The number of videos to return in the response. The
|
427
|
+
# actual number delivered may be less than requested. The default is 35. The
|
428
|
+
# maximum is 105. You may use this parameter along with the offset parameter to
|
429
|
+
# page results. For example, if your user interface presents 20 videos per
|
430
|
+
# page, set count to 20 and offset to 0 to get the first page of results. For
|
431
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
432
|
+
# this parameter only with the Video Search API. Do not specify this parameter
|
433
|
+
# when calling the Trending Videos API or the Web Search API.
|
434
|
+
# @param freshness [Freshness] Filter videos by the date and time that Bing
|
435
|
+
# discovered the video. The following are the possible filter values. Day:
|
436
|
+
# Return videos discovered within the last 24 hours. Week: Return videos
|
437
|
+
# discovered within the last 7 days. Month: Return videos discovered within the
|
438
|
+
# last 30 days. Possible values include: 'Day', 'Week', 'Month'
|
439
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
440
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
441
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
442
|
+
# use this parameter to ensure that the specified video is the first video in
|
443
|
+
# the list of videos that Bing returns.
|
444
|
+
# @param length [VideoLength] Filter videos by the following lengths: Short:
|
445
|
+
# Return videos that are less than 5 minutes. Medium: Return videos that are
|
446
|
+
# between 5 and 20 minutes, inclusive. Long: Return videos that are longer than
|
447
|
+
# 20 minutes. All: Do not filter by length.Specifying this value is the same as
|
448
|
+
# not specifying the videoLength parameter. Possible values include: 'All',
|
449
|
+
# 'Short', 'Medium', 'Long'
|
450
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
451
|
+
# is the country where the user is making the request from. However, it could
|
452
|
+
# be a different country if the user is not located in a country where Bing
|
453
|
+
# delivers results. The market must be in the form <language code>-<country
|
454
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
455
|
+
# possible market values, see [Market
|
456
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
457
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
458
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
459
|
+
# response. If you specify a market that is not listed in [Market
|
460
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
461
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
462
|
+
# to change. This parameter and the
|
463
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
464
|
+
# query parameter are mutually exclusive—do not specify both.
|
465
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
466
|
+
# videos to skip before returning videos. The default is 0. The offset should
|
467
|
+
# be less than
|
468
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-totalmatches)
|
469
|
+
# - count). Use this parameter along with the count parameter to page results.
|
470
|
+
# For example, if your user interface displays 20 videos per page, set count to
|
471
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
472
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
473
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
474
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-nextoffset).
|
475
|
+
# Use this parameter only with the Video Search API.
|
476
|
+
# @param pricing [VideoPricing] Filter videos by the following pricing options:
|
477
|
+
# Free: Return videos that are free to view. Paid: Return videos that require a
|
478
|
+
# subscription or payment to view. All: Do not filter by pricing.Specifying
|
479
|
+
# this value is the same as not specifying the pricing parameter. Possible
|
480
|
+
# values include: 'All', 'Free', 'Paid'
|
481
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
482
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
483
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
484
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
485
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
486
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
487
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
488
|
+
# following are the possible filter values. Off: If the request is through the
|
489
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
490
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
491
|
+
# API, the response includes adult videos but the thumbnail images of the
|
492
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
493
|
+
# Search API, the response does not include videos with adult content. If the
|
494
|
+
# request is through the Web Search API, the response may include videos with
|
495
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
496
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
497
|
+
# If the request comes from a market that Bing's adult policy requires that
|
498
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
499
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
500
|
+
# response may contain adult content regardless of what the safeSearch query
|
501
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
502
|
+
# site and your scenario supports the possibility of adult content. Possible
|
503
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
504
|
+
# @param set_lang [String] The language to use for user interface strings.
|
505
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
506
|
+
# the language code for English is EN. The default is EN (English). Although
|
507
|
+
# optional, you should always specify the language. Typically, you set setLang
|
508
|
+
# to the same language specified by mkt unless the user wants the user
|
509
|
+
# interface strings displayed in a different language. This parameter and the
|
510
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
511
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
512
|
+
# is a string that's used as a label in a user interface. There are few user
|
513
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
514
|
+
# properties in the response objects apply the specified language.
|
515
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
516
|
+
# display strings contain decoration markers such as hit highlighting
|
517
|
+
# characters. If true, the strings may include markers. The default is false.
|
518
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
519
|
+
# the
|
520
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
521
|
+
# query parameter. For information about hit highlighting, see [Hit
|
522
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
523
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
524
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
525
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
526
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
527
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
528
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
529
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
530
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
531
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
532
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
533
|
+
# values include: 'Raw', 'Html'
|
534
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
535
|
+
# will be added to the HTTP request.
|
536
|
+
#
|
537
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
538
|
+
#
|
539
|
+
def search_with_http_info(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, count:nil, freshness:nil, id:nil, length:nil, market:nil, offset:nil, pricing:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
540
|
+
search_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, count:count, freshness:freshness, id:id, length:length, market:market, offset:offset, pricing:pricing, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
541
|
+
end
|
542
|
+
|
543
|
+
#
|
544
|
+
# The Video Search API lets you send a search query to Bing and get back a list
|
545
|
+
# of videos that are relevant to the search query. This section provides
|
546
|
+
# technical details about the query parameters and headers that you use to
|
547
|
+
# request videos and the JSON response objects that contain them. For examples
|
548
|
+
# that show how to make requests, see [Searching the Web for
|
549
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
550
|
+
#
|
551
|
+
# @param query [String] The user's search query string. The query string cannot
|
552
|
+
# be empty. The query string may contain [Bing Advanced
|
553
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
554
|
+
# limit videos to a specific domain, use the
|
555
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
556
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
557
|
+
# calling the Trending Videos API.
|
558
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
559
|
+
# languages to use for user interface strings. The list is in decreasing order
|
560
|
+
# of preference. For additional information, including expected format, see
|
561
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
562
|
+
# header and the
|
563
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
564
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
565
|
+
# header, you must also specify the
|
566
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
567
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
568
|
+
# first supported language it finds from the list and combines it with the cc
|
569
|
+
# parameter value. If the list does not include a supported language, Bing
|
570
|
+
# finds the closest language and market that supports the request or it uses an
|
571
|
+
# aggregated or default market for the results. To determine the market that
|
572
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
573
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
574
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
575
|
+
# and
|
576
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
577
|
+
# query parameters. A user interface string is a string that's used as a label
|
578
|
+
# in a user interface. There are few user interface strings in the JSON
|
579
|
+
# response objects. Any links to Bing.com properties in the response objects
|
580
|
+
# apply the specified language.
|
581
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
582
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
583
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
584
|
+
# should be the same string that any commonly used browser sends. For
|
585
|
+
# information about user agents, see [RFC
|
586
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
587
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
588
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
589
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
590
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
591
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
592
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
593
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
594
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
595
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
596
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
597
|
+
# @param client_id [String] Bing uses this header to provide users with
|
598
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
599
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
600
|
+
# different flights. If you do not use the same client ID for a user across
|
601
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
602
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
603
|
+
# inconsistent user experience. For example, if the second request has a
|
604
|
+
# different flight assignment than the first, the experience may be unexpected.
|
605
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
606
|
+
# search history, providing a richer experience for the user. Bing also uses
|
607
|
+
# this header to help improve result rankings by analyzing the activity
|
608
|
+
# generated by a client ID. The relevance improvements help with better quality
|
609
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
610
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
611
|
+
# this header required. Persisting the client ID across multiple requests for
|
612
|
+
# the same end user and device combination enables 1) the API consumer to
|
613
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
614
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
615
|
+
# application on the device must have a unique, Bing generated client ID. If
|
616
|
+
# you do not include this header in the request, Bing generates an ID and
|
617
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
618
|
+
# should NOT include this header in a request is the first time the user uses
|
619
|
+
# your app on that device. Use the client ID for each Bing API request that
|
620
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
621
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
622
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
623
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
624
|
+
# time the user uses your app on that device, get the client ID that you
|
625
|
+
# persisted. Bing responses may or may not include this header. If the response
|
626
|
+
# includes this header, capture the client ID and use it for all subsequent
|
627
|
+
# Bing requests for the user on that device. If you include the
|
628
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
629
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
630
|
+
# IP address is used to discover the user's location. Bing uses the location
|
631
|
+
# information to determine safe search behavior. Although optional, you are
|
632
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
633
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
634
|
+
# Obfuscating the address results in the location not being anywhere near the
|
635
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
636
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
637
|
+
# describe the client's geographical location. Bing uses the location
|
638
|
+
# information to determine safe search behavior and to return relevant local
|
639
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
640
|
+
# keys that you use to specify the user's location. lat (required): The
|
641
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
642
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
643
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
644
|
+
# long (required): The longitude of the client's location, in degrees. The
|
645
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
646
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
647
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
648
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
649
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
650
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
651
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
652
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
653
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
654
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
655
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
656
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
657
|
+
# client device is traveling. alt (optional): The altitude of the client
|
658
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
659
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
660
|
+
# the alt key. Although many of the keys are optional, the more information
|
661
|
+
# that you provide, the more accurate the location results are. Although
|
662
|
+
# optional, you are encouraged to always specify the user's geographical
|
663
|
+
# location. Providing the location is especially important if the client's IP
|
664
|
+
# address does not accurately reflect the user's physical location (for
|
665
|
+
# example, if the client uses VPN). For optimal results, you should include
|
666
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
667
|
+
# include this header.
|
668
|
+
# @param country_code [String] A 2-character country code of the country where
|
669
|
+
# the results come from. This API supports only the United States market. If
|
670
|
+
# you specify this query parameter, it must be set to us. If you set this
|
671
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
672
|
+
# first supported language it finds from the languages list, and combine that
|
673
|
+
# language with the country code that you specify to determine the market to
|
674
|
+
# return results for. If the languages list does not include a supported
|
675
|
+
# language, Bing finds the closest language and market that supports the
|
676
|
+
# request, or it may use an aggregated or default market for the results
|
677
|
+
# instead of a specified one. You should use this query parameter and the
|
678
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
679
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
680
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
681
|
+
# both.
|
682
|
+
# @param count [Integer] The number of videos to return in the response. The
|
683
|
+
# actual number delivered may be less than requested. The default is 35. The
|
684
|
+
# maximum is 105. You may use this parameter along with the offset parameter to
|
685
|
+
# page results. For example, if your user interface presents 20 videos per
|
686
|
+
# page, set count to 20 and offset to 0 to get the first page of results. For
|
687
|
+
# each subsequent page, increment offset by 20 (for example, 0, 20, 40). Use
|
688
|
+
# this parameter only with the Video Search API. Do not specify this parameter
|
689
|
+
# when calling the Trending Videos API or the Web Search API.
|
690
|
+
# @param freshness [Freshness] Filter videos by the date and time that Bing
|
691
|
+
# discovered the video. The following are the possible filter values. Day:
|
692
|
+
# Return videos discovered within the last 24 hours. Week: Return videos
|
693
|
+
# discovered within the last 7 days. Month: Return videos discovered within the
|
694
|
+
# last 30 days. Possible values include: 'Day', 'Week', 'Month'
|
695
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
696
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
697
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
698
|
+
# use this parameter to ensure that the specified video is the first video in
|
699
|
+
# the list of videos that Bing returns.
|
700
|
+
# @param length [VideoLength] Filter videos by the following lengths: Short:
|
701
|
+
# Return videos that are less than 5 minutes. Medium: Return videos that are
|
702
|
+
# between 5 and 20 minutes, inclusive. Long: Return videos that are longer than
|
703
|
+
# 20 minutes. All: Do not filter by length.Specifying this value is the same as
|
704
|
+
# not specifying the videoLength parameter. Possible values include: 'All',
|
705
|
+
# 'Short', 'Medium', 'Long'
|
706
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
707
|
+
# is the country where the user is making the request from. However, it could
|
708
|
+
# be a different country if the user is not located in a country where Bing
|
709
|
+
# delivers results. The market must be in the form <language code>-<country
|
710
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
711
|
+
# possible market values, see [Market
|
712
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
713
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
714
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
715
|
+
# response. If you specify a market that is not listed in [Market
|
716
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
717
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
718
|
+
# to change. This parameter and the
|
719
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
720
|
+
# query parameter are mutually exclusive—do not specify both.
|
721
|
+
# @param offset [Integer] The zero-based offset that indicates the number of
|
722
|
+
# videos to skip before returning videos. The default is 0. The offset should
|
723
|
+
# be less than
|
724
|
+
# ([totalEstimatedMatches](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-totalmatches)
|
725
|
+
# - count). Use this parameter along with the count parameter to page results.
|
726
|
+
# For example, if your user interface displays 20 videos per page, set count to
|
727
|
+
# 20 and offset to 0 to get the first page of results. For each subsequent
|
728
|
+
# page, increment offset by 20 (for example, 0, 20, 40). It is possible for
|
729
|
+
# multiple pages to include some overlap in results. To prevent duplicates, see
|
730
|
+
# [nextOffset](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#videos-nextoffset).
|
731
|
+
# Use this parameter only with the Video Search API.
|
732
|
+
# @param pricing [VideoPricing] Filter videos by the following pricing options:
|
733
|
+
# Free: Return videos that are free to view. Paid: Return videos that require a
|
734
|
+
# subscription or payment to view. All: Do not filter by pricing.Specifying
|
735
|
+
# this value is the same as not specifying the pricing parameter. Possible
|
736
|
+
# values include: 'All', 'Free', 'Paid'
|
737
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
738
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
739
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
740
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
741
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
742
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
743
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
744
|
+
# following are the possible filter values. Off: If the request is through the
|
745
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
746
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
747
|
+
# API, the response includes adult videos but the thumbnail images of the
|
748
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
749
|
+
# Search API, the response does not include videos with adult content. If the
|
750
|
+
# request is through the Web Search API, the response may include videos with
|
751
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
752
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
753
|
+
# If the request comes from a market that Bing's adult policy requires that
|
754
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
755
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
756
|
+
# response may contain adult content regardless of what the safeSearch query
|
757
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
758
|
+
# site and your scenario supports the possibility of adult content. Possible
|
759
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
760
|
+
# @param set_lang [String] The language to use for user interface strings.
|
761
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
762
|
+
# the language code for English is EN. The default is EN (English). Although
|
763
|
+
# optional, you should always specify the language. Typically, you set setLang
|
764
|
+
# to the same language specified by mkt unless the user wants the user
|
765
|
+
# interface strings displayed in a different language. This parameter and the
|
766
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
767
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
768
|
+
# is a string that's used as a label in a user interface. There are few user
|
769
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
770
|
+
# properties in the response objects apply the specified language.
|
771
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
772
|
+
# display strings contain decoration markers such as hit highlighting
|
773
|
+
# characters. If true, the strings may include markers. The default is false.
|
774
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
775
|
+
# the
|
776
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
777
|
+
# query parameter. For information about hit highlighting, see [Hit
|
778
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
779
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
780
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
781
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
782
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
783
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
784
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
785
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
786
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
787
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
788
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
789
|
+
# values include: 'Raw', 'Html'
|
790
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
791
|
+
# to the HTTP request.
|
792
|
+
#
|
793
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
794
|
+
#
|
795
|
+
def search_async(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, count:nil, freshness:nil, id:nil, length:nil, market:nil, offset:nil, pricing:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
796
|
+
x_bing_apis_sdk = 'true'
|
797
|
+
fail ArgumentError, 'query is nil' if query.nil?
|
798
|
+
|
799
|
+
|
800
|
+
request_headers = {}
|
801
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
802
|
+
|
803
|
+
# Set Headers
|
804
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
805
|
+
request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
|
806
|
+
request_headers['Accept-Language'] = accept_language unless accept_language.nil?
|
807
|
+
request_headers['User-Agent'] = user_agent unless user_agent.nil?
|
808
|
+
request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
|
809
|
+
request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
|
810
|
+
request_headers['X-Search-Location'] = location unless location.nil?
|
811
|
+
path_template = 'videos/search'
|
812
|
+
|
813
|
+
request_url = @base_url || @client.base_url
|
814
|
+
|
815
|
+
options = {
|
816
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
817
|
+
query_params: {'cc' => country_code,'count' => count,'freshness' => freshness,'id' => id,'length' => length,'mkt' => market,'offset' => offset,'pricing' => pricing,'q' => query,'resolution' => resolution,'safeSearch' => safe_search,'setLang' => set_lang,'textDecorations' => text_decorations,'textFormat' => text_format},
|
818
|
+
headers: request_headers.merge(custom_headers || {}),
|
819
|
+
base_url: request_url
|
820
|
+
}
|
821
|
+
promise = @client.make_request_async(:get, path_template, options)
|
822
|
+
|
823
|
+
promise = promise.then do |result|
|
824
|
+
http_response = result.response
|
825
|
+
status_code = http_response.status
|
826
|
+
response_content = http_response.body
|
827
|
+
unless status_code == 200
|
828
|
+
error_model = JSON.load(response_content)
|
829
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
830
|
+
end
|
831
|
+
|
832
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
833
|
+
# Deserialize Response
|
834
|
+
if status_code == 200
|
835
|
+
begin
|
836
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
837
|
+
result_mapper = Azure::CognitiveServices::VideoSearch::V1_0::Models::Videos.mapper()
|
838
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
839
|
+
rescue Exception => e
|
840
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
844
|
+
result
|
845
|
+
end
|
846
|
+
|
847
|
+
promise.execute
|
848
|
+
end
|
849
|
+
|
850
|
+
#
|
851
|
+
# The Video Detail Search API lets you search on Bing and get back insights
|
852
|
+
# about a video, such as related videos. This section provides technical
|
853
|
+
# details about the query parameters and headers that you use to request
|
854
|
+
# insights of videos and the JSON response objects that contain them. For
|
855
|
+
# examples that show how to make requests, see [Searching the Web for
|
856
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
857
|
+
#
|
858
|
+
# @param query [String] The user's search query string. The query string cannot
|
859
|
+
# be empty. The query string may contain [Bing Advanced
|
860
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
861
|
+
# limit videos to a specific domain, use the
|
862
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
863
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
864
|
+
# calling the Trending Videos API.
|
865
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
866
|
+
# languages to use for user interface strings. The list is in decreasing order
|
867
|
+
# of preference. For additional information, including expected format, see
|
868
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
869
|
+
# header and the
|
870
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
871
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
872
|
+
# header, you must also specify the
|
873
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
874
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
875
|
+
# first supported language it finds from the list and combines it with the cc
|
876
|
+
# parameter value. If the list does not include a supported language, Bing
|
877
|
+
# finds the closest language and market that supports the request or it uses an
|
878
|
+
# aggregated or default market for the results. To determine the market that
|
879
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
880
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
881
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
882
|
+
# and
|
883
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
884
|
+
# query parameters. A user interface string is a string that's used as a label
|
885
|
+
# in a user interface. There are few user interface strings in the JSON
|
886
|
+
# response objects. Any links to Bing.com properties in the response objects
|
887
|
+
# apply the specified language.
|
888
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
889
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
890
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
891
|
+
# should be the same string that any commonly used browser sends. For
|
892
|
+
# information about user agents, see [RFC
|
893
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
894
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
895
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
896
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
897
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
898
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
899
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
900
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
901
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
902
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
903
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
904
|
+
# @param client_id [String] Bing uses this header to provide users with
|
905
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
906
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
907
|
+
# different flights. If you do not use the same client ID for a user across
|
908
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
909
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
910
|
+
# inconsistent user experience. For example, if the second request has a
|
911
|
+
# different flight assignment than the first, the experience may be unexpected.
|
912
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
913
|
+
# search history, providing a richer experience for the user. Bing also uses
|
914
|
+
# this header to help improve result rankings by analyzing the activity
|
915
|
+
# generated by a client ID. The relevance improvements help with better quality
|
916
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
917
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
918
|
+
# this header required. Persisting the client ID across multiple requests for
|
919
|
+
# the same end user and device combination enables 1) the API consumer to
|
920
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
921
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
922
|
+
# application on the device must have a unique, Bing generated client ID. If
|
923
|
+
# you do not include this header in the request, Bing generates an ID and
|
924
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
925
|
+
# should NOT include this header in a request is the first time the user uses
|
926
|
+
# your app on that device. Use the client ID for each Bing API request that
|
927
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
928
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
929
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
930
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
931
|
+
# time the user uses your app on that device, get the client ID that you
|
932
|
+
# persisted. Bing responses may or may not include this header. If the response
|
933
|
+
# includes this header, capture the client ID and use it for all subsequent
|
934
|
+
# Bing requests for the user on that device. If you include the
|
935
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
936
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
937
|
+
# IP address is used to discover the user's location. Bing uses the location
|
938
|
+
# information to determine safe search behavior. Although optional, you are
|
939
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
940
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
941
|
+
# Obfuscating the address results in the location not being anywhere near the
|
942
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
943
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
944
|
+
# describe the client's geographical location. Bing uses the location
|
945
|
+
# information to determine safe search behavior and to return relevant local
|
946
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
947
|
+
# keys that you use to specify the user's location. lat (required): The
|
948
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
949
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
950
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
951
|
+
# long (required): The longitude of the client's location, in degrees. The
|
952
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
953
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
954
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
955
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
956
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
957
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
958
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
959
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
960
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
961
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
962
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
963
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
964
|
+
# client device is traveling. alt (optional): The altitude of the client
|
965
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
966
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
967
|
+
# the alt key. Although many of the keys are optional, the more information
|
968
|
+
# that you provide, the more accurate the location results are. Although
|
969
|
+
# optional, you are encouraged to always specify the user's geographical
|
970
|
+
# location. Providing the location is especially important if the client's IP
|
971
|
+
# address does not accurately reflect the user's physical location (for
|
972
|
+
# example, if the client uses VPN). For optimal results, you should include
|
973
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
974
|
+
# include this header.
|
975
|
+
# @param country_code [String] A 2-character country code of the country where
|
976
|
+
# the results come from. This API supports only the United States market. If
|
977
|
+
# you specify this query parameter, it must be set to us. If you set this
|
978
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
979
|
+
# first supported language it finds from the languages list, and combine that
|
980
|
+
# language with the country code that you specify to determine the market to
|
981
|
+
# return results for. If the languages list does not include a supported
|
982
|
+
# language, Bing finds the closest language and market that supports the
|
983
|
+
# request, or it may use an aggregated or default market for the results
|
984
|
+
# instead of a specified one. You should use this query parameter and the
|
985
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
986
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
987
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
988
|
+
# both.
|
989
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
990
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
991
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
992
|
+
# use this parameter to identify the video to get insights of.
|
993
|
+
# @param modules [Array<VideoInsightModule>] A comma-delimited list of insights
|
994
|
+
# to request. The following are the possible case-insensitive values. All:
|
995
|
+
# Return all available insights. RelatedVideos: Return a list of videos that
|
996
|
+
# are similar to the video specified by the id query parameter. VideoResult:
|
997
|
+
# Return the video that you're requesting insights of (this is the video that
|
998
|
+
# you set the id query parameter to in your insights request). If you specify
|
999
|
+
# an insight and there is no data for it, the response object does not include
|
1000
|
+
# the related field. For example, if you specify RelatedVideos and none exist,
|
1001
|
+
# the response does not include the relatedVideos field. Although the user's
|
1002
|
+
# query term is not required, you should always include it because it helps to
|
1003
|
+
# improve relevance and the results.
|
1004
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
1005
|
+
# is the country where the user is making the request from. However, it could
|
1006
|
+
# be a different country if the user is not located in a country where Bing
|
1007
|
+
# delivers results. The market must be in the form <language code>-<country
|
1008
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
1009
|
+
# possible market values, see [Market
|
1010
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
1011
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
1012
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
1013
|
+
# response. If you specify a market that is not listed in [Market
|
1014
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
1015
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
1016
|
+
# to change. This parameter and the
|
1017
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1018
|
+
# query parameter are mutually exclusive—do not specify both.
|
1019
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
1020
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
1021
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
1022
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
1023
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
1024
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
1025
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
1026
|
+
# following are the possible filter values. Off: If the request is through the
|
1027
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
1028
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
1029
|
+
# API, the response includes adult videos but the thumbnail images of the
|
1030
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
1031
|
+
# Search API, the response does not include videos with adult content. If the
|
1032
|
+
# request is through the Web Search API, the response may include videos with
|
1033
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
1034
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
1035
|
+
# If the request comes from a market that Bing's adult policy requires that
|
1036
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
1037
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
1038
|
+
# response may contain adult content regardless of what the safeSearch query
|
1039
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
1040
|
+
# site and your scenario supports the possibility of adult content. Possible
|
1041
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
1042
|
+
# @param set_lang [String] The language to use for user interface strings.
|
1043
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
1044
|
+
# the language code for English is EN. The default is EN (English). Although
|
1045
|
+
# optional, you should always specify the language. Typically, you set setLang
|
1046
|
+
# to the same language specified by mkt unless the user wants the user
|
1047
|
+
# interface strings displayed in a different language. This parameter and the
|
1048
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
1049
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
1050
|
+
# is a string that's used as a label in a user interface. There are few user
|
1051
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
1052
|
+
# properties in the response objects apply the specified language.
|
1053
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
1054
|
+
# display strings contain decoration markers such as hit highlighting
|
1055
|
+
# characters. If true, the strings may include markers. The default is false.
|
1056
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
1057
|
+
# the
|
1058
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
1059
|
+
# query parameter. For information about hit highlighting, see [Hit
|
1060
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
1061
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
1062
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
1063
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
1064
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
1065
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
1066
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
1067
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
1068
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
1069
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
1070
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
1071
|
+
# values include: 'Raw', 'Html'
|
1072
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1073
|
+
# will be added to the HTTP request.
|
1074
|
+
#
|
1075
|
+
# @return [VideoDetails] operation results.
|
1076
|
+
#
|
1077
|
+
def details(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, id:nil, modules:nil, market:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
1078
|
+
response = details_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, id:id, modules:modules, market:market, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
1079
|
+
response.body unless response.nil?
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
#
|
1083
|
+
# The Video Detail Search API lets you search on Bing and get back insights
|
1084
|
+
# about a video, such as related videos. This section provides technical
|
1085
|
+
# details about the query parameters and headers that you use to request
|
1086
|
+
# insights of videos and the JSON response objects that contain them. For
|
1087
|
+
# examples that show how to make requests, see [Searching the Web for
|
1088
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
1089
|
+
#
|
1090
|
+
# @param query [String] The user's search query string. The query string cannot
|
1091
|
+
# be empty. The query string may contain [Bing Advanced
|
1092
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
1093
|
+
# limit videos to a specific domain, use the
|
1094
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
1095
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
1096
|
+
# calling the Trending Videos API.
|
1097
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
1098
|
+
# languages to use for user interface strings. The list is in decreasing order
|
1099
|
+
# of preference. For additional information, including expected format, see
|
1100
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
1101
|
+
# header and the
|
1102
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1103
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
1104
|
+
# header, you must also specify the
|
1105
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1106
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
1107
|
+
# first supported language it finds from the list and combines it with the cc
|
1108
|
+
# parameter value. If the list does not include a supported language, Bing
|
1109
|
+
# finds the closest language and market that supports the request or it uses an
|
1110
|
+
# aggregated or default market for the results. To determine the market that
|
1111
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
1112
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
1113
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
1114
|
+
# and
|
1115
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1116
|
+
# query parameters. A user interface string is a string that's used as a label
|
1117
|
+
# in a user interface. There are few user interface strings in the JSON
|
1118
|
+
# response objects. Any links to Bing.com properties in the response objects
|
1119
|
+
# apply the specified language.
|
1120
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
1121
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
1122
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
1123
|
+
# should be the same string that any commonly used browser sends. For
|
1124
|
+
# information about user agents, see [RFC
|
1125
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
1126
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
1127
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
1128
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
1129
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
1130
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
1131
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
1132
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
1133
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
1134
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
1135
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
1136
|
+
# @param client_id [String] Bing uses this header to provide users with
|
1137
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
1138
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
1139
|
+
# different flights. If you do not use the same client ID for a user across
|
1140
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
1141
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
1142
|
+
# inconsistent user experience. For example, if the second request has a
|
1143
|
+
# different flight assignment than the first, the experience may be unexpected.
|
1144
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
1145
|
+
# search history, providing a richer experience for the user. Bing also uses
|
1146
|
+
# this header to help improve result rankings by analyzing the activity
|
1147
|
+
# generated by a client ID. The relevance improvements help with better quality
|
1148
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
1149
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
1150
|
+
# this header required. Persisting the client ID across multiple requests for
|
1151
|
+
# the same end user and device combination enables 1) the API consumer to
|
1152
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
1153
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
1154
|
+
# application on the device must have a unique, Bing generated client ID. If
|
1155
|
+
# you do not include this header in the request, Bing generates an ID and
|
1156
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
1157
|
+
# should NOT include this header in a request is the first time the user uses
|
1158
|
+
# your app on that device. Use the client ID for each Bing API request that
|
1159
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
1160
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
1161
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
1162
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
1163
|
+
# time the user uses your app on that device, get the client ID that you
|
1164
|
+
# persisted. Bing responses may or may not include this header. If the response
|
1165
|
+
# includes this header, capture the client ID and use it for all subsequent
|
1166
|
+
# Bing requests for the user on that device. If you include the
|
1167
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
1168
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
1169
|
+
# IP address is used to discover the user's location. Bing uses the location
|
1170
|
+
# information to determine safe search behavior. Although optional, you are
|
1171
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
1172
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
1173
|
+
# Obfuscating the address results in the location not being anywhere near the
|
1174
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
1175
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
1176
|
+
# describe the client's geographical location. Bing uses the location
|
1177
|
+
# information to determine safe search behavior and to return relevant local
|
1178
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
1179
|
+
# keys that you use to specify the user's location. lat (required): The
|
1180
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
1181
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
1182
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
1183
|
+
# long (required): The longitude of the client's location, in degrees. The
|
1184
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
1185
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
1186
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
1187
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
1188
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
1189
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
1190
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
1191
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
1192
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
1193
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
1194
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
1195
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
1196
|
+
# client device is traveling. alt (optional): The altitude of the client
|
1197
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
1198
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
1199
|
+
# the alt key. Although many of the keys are optional, the more information
|
1200
|
+
# that you provide, the more accurate the location results are. Although
|
1201
|
+
# optional, you are encouraged to always specify the user's geographical
|
1202
|
+
# location. Providing the location is especially important if the client's IP
|
1203
|
+
# address does not accurately reflect the user's physical location (for
|
1204
|
+
# example, if the client uses VPN). For optimal results, you should include
|
1205
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
1206
|
+
# include this header.
|
1207
|
+
# @param country_code [String] A 2-character country code of the country where
|
1208
|
+
# the results come from. This API supports only the United States market. If
|
1209
|
+
# you specify this query parameter, it must be set to us. If you set this
|
1210
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
1211
|
+
# first supported language it finds from the languages list, and combine that
|
1212
|
+
# language with the country code that you specify to determine the market to
|
1213
|
+
# return results for. If the languages list does not include a supported
|
1214
|
+
# language, Bing finds the closest language and market that supports the
|
1215
|
+
# request, or it may use an aggregated or default market for the results
|
1216
|
+
# instead of a specified one. You should use this query parameter and the
|
1217
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
1218
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
1219
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
1220
|
+
# both.
|
1221
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
1222
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
1223
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
1224
|
+
# use this parameter to identify the video to get insights of.
|
1225
|
+
# @param modules [Array<VideoInsightModule>] A comma-delimited list of insights
|
1226
|
+
# to request. The following are the possible case-insensitive values. All:
|
1227
|
+
# Return all available insights. RelatedVideos: Return a list of videos that
|
1228
|
+
# are similar to the video specified by the id query parameter. VideoResult:
|
1229
|
+
# Return the video that you're requesting insights of (this is the video that
|
1230
|
+
# you set the id query parameter to in your insights request). If you specify
|
1231
|
+
# an insight and there is no data for it, the response object does not include
|
1232
|
+
# the related field. For example, if you specify RelatedVideos and none exist,
|
1233
|
+
# the response does not include the relatedVideos field. Although the user's
|
1234
|
+
# query term is not required, you should always include it because it helps to
|
1235
|
+
# improve relevance and the results.
|
1236
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
1237
|
+
# is the country where the user is making the request from. However, it could
|
1238
|
+
# be a different country if the user is not located in a country where Bing
|
1239
|
+
# delivers results. The market must be in the form <language code>-<country
|
1240
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
1241
|
+
# possible market values, see [Market
|
1242
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
1243
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
1244
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
1245
|
+
# response. If you specify a market that is not listed in [Market
|
1246
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
1247
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
1248
|
+
# to change. This parameter and the
|
1249
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1250
|
+
# query parameter are mutually exclusive—do not specify both.
|
1251
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
1252
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
1253
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
1254
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
1255
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
1256
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
1257
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
1258
|
+
# following are the possible filter values. Off: If the request is through the
|
1259
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
1260
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
1261
|
+
# API, the response includes adult videos but the thumbnail images of the
|
1262
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
1263
|
+
# Search API, the response does not include videos with adult content. If the
|
1264
|
+
# request is through the Web Search API, the response may include videos with
|
1265
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
1266
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
1267
|
+
# If the request comes from a market that Bing's adult policy requires that
|
1268
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
1269
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
1270
|
+
# response may contain adult content regardless of what the safeSearch query
|
1271
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
1272
|
+
# site and your scenario supports the possibility of adult content. Possible
|
1273
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
1274
|
+
# @param set_lang [String] The language to use for user interface strings.
|
1275
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
1276
|
+
# the language code for English is EN. The default is EN (English). Although
|
1277
|
+
# optional, you should always specify the language. Typically, you set setLang
|
1278
|
+
# to the same language specified by mkt unless the user wants the user
|
1279
|
+
# interface strings displayed in a different language. This parameter and the
|
1280
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
1281
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
1282
|
+
# is a string that's used as a label in a user interface. There are few user
|
1283
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
1284
|
+
# properties in the response objects apply the specified language.
|
1285
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
1286
|
+
# display strings contain decoration markers such as hit highlighting
|
1287
|
+
# characters. If true, the strings may include markers. The default is false.
|
1288
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
1289
|
+
# the
|
1290
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
1291
|
+
# query parameter. For information about hit highlighting, see [Hit
|
1292
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
1293
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
1294
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
1295
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
1296
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
1297
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
1298
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
1299
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
1300
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
1301
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
1302
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
1303
|
+
# values include: 'Raw', 'Html'
|
1304
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1305
|
+
# will be added to the HTTP request.
|
1306
|
+
#
|
1307
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1308
|
+
#
|
1309
|
+
def details_with_http_info(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, id:nil, modules:nil, market:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
1310
|
+
details_async(query, accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, id:id, modules:modules, market:market, resolution:resolution, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
1311
|
+
end
|
1312
|
+
|
1313
|
+
#
|
1314
|
+
# The Video Detail Search API lets you search on Bing and get back insights
|
1315
|
+
# about a video, such as related videos. This section provides technical
|
1316
|
+
# details about the query parameters and headers that you use to request
|
1317
|
+
# insights of videos and the JSON response objects that contain them. For
|
1318
|
+
# examples that show how to make requests, see [Searching the Web for
|
1319
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web).
|
1320
|
+
#
|
1321
|
+
# @param query [String] The user's search query string. The query string cannot
|
1322
|
+
# be empty. The query string may contain [Bing Advanced
|
1323
|
+
# Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to
|
1324
|
+
# limit videos to a specific domain, use the
|
1325
|
+
# [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this
|
1326
|
+
# parameter only with the Video Search API. Do not specify this parameter when
|
1327
|
+
# calling the Trending Videos API.
|
1328
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
1329
|
+
# languages to use for user interface strings. The list is in decreasing order
|
1330
|
+
# of preference. For additional information, including expected format, see
|
1331
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
1332
|
+
# header and the
|
1333
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1334
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
1335
|
+
# header, you must also specify the
|
1336
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1337
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
1338
|
+
# first supported language it finds from the list and combines it with the cc
|
1339
|
+
# parameter value. If the list does not include a supported language, Bing
|
1340
|
+
# finds the closest language and market that supports the request or it uses an
|
1341
|
+
# aggregated or default market for the results. To determine the market that
|
1342
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
1343
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
1344
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
1345
|
+
# and
|
1346
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1347
|
+
# query parameters. A user interface string is a string that's used as a label
|
1348
|
+
# in a user interface. There are few user interface strings in the JSON
|
1349
|
+
# response objects. Any links to Bing.com properties in the response objects
|
1350
|
+
# apply the specified language.
|
1351
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
1352
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
1353
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
1354
|
+
# should be the same string that any commonly used browser sends. For
|
1355
|
+
# information about user agents, see [RFC
|
1356
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
1357
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
1358
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
1359
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
1360
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
1361
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
1362
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
1363
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
1364
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
1365
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
1366
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
1367
|
+
# @param client_id [String] Bing uses this header to provide users with
|
1368
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
1369
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
1370
|
+
# different flights. If you do not use the same client ID for a user across
|
1371
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
1372
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
1373
|
+
# inconsistent user experience. For example, if the second request has a
|
1374
|
+
# different flight assignment than the first, the experience may be unexpected.
|
1375
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
1376
|
+
# search history, providing a richer experience for the user. Bing also uses
|
1377
|
+
# this header to help improve result rankings by analyzing the activity
|
1378
|
+
# generated by a client ID. The relevance improvements help with better quality
|
1379
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
1380
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
1381
|
+
# this header required. Persisting the client ID across multiple requests for
|
1382
|
+
# the same end user and device combination enables 1) the API consumer to
|
1383
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
1384
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
1385
|
+
# application on the device must have a unique, Bing generated client ID. If
|
1386
|
+
# you do not include this header in the request, Bing generates an ID and
|
1387
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
1388
|
+
# should NOT include this header in a request is the first time the user uses
|
1389
|
+
# your app on that device. Use the client ID for each Bing API request that
|
1390
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
1391
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
1392
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
1393
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
1394
|
+
# time the user uses your app on that device, get the client ID that you
|
1395
|
+
# persisted. Bing responses may or may not include this header. If the response
|
1396
|
+
# includes this header, capture the client ID and use it for all subsequent
|
1397
|
+
# Bing requests for the user on that device. If you include the
|
1398
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
1399
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
1400
|
+
# IP address is used to discover the user's location. Bing uses the location
|
1401
|
+
# information to determine safe search behavior. Although optional, you are
|
1402
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
1403
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
1404
|
+
# Obfuscating the address results in the location not being anywhere near the
|
1405
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
1406
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
1407
|
+
# describe the client's geographical location. Bing uses the location
|
1408
|
+
# information to determine safe search behavior and to return relevant local
|
1409
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
1410
|
+
# keys that you use to specify the user's location. lat (required): The
|
1411
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
1412
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
1413
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
1414
|
+
# long (required): The longitude of the client's location, in degrees. The
|
1415
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
1416
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
1417
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
1418
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
1419
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
1420
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
1421
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
1422
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
1423
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
1424
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
1425
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
1426
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
1427
|
+
# client device is traveling. alt (optional): The altitude of the client
|
1428
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
1429
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
1430
|
+
# the alt key. Although many of the keys are optional, the more information
|
1431
|
+
# that you provide, the more accurate the location results are. Although
|
1432
|
+
# optional, you are encouraged to always specify the user's geographical
|
1433
|
+
# location. Providing the location is especially important if the client's IP
|
1434
|
+
# address does not accurately reflect the user's physical location (for
|
1435
|
+
# example, if the client uses VPN). For optimal results, you should include
|
1436
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
1437
|
+
# include this header.
|
1438
|
+
# @param country_code [String] A 2-character country code of the country where
|
1439
|
+
# the results come from. This API supports only the United States market. If
|
1440
|
+
# you specify this query parameter, it must be set to us. If you set this
|
1441
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
1442
|
+
# first supported language it finds from the languages list, and combine that
|
1443
|
+
# language with the country code that you specify to determine the market to
|
1444
|
+
# return results for. If the languages list does not include a supported
|
1445
|
+
# language, Bing finds the closest language and market that supports the
|
1446
|
+
# request, or it may use an aggregated or default market for the results
|
1447
|
+
# instead of a specified one. You should use this query parameter and the
|
1448
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
1449
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
1450
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
1451
|
+
# both.
|
1452
|
+
# @param id [String] An ID that uniquely identifies a video. The
|
1453
|
+
# [Video](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#video)
|
1454
|
+
# object's videoId field contains the ID that you set this parameter to. You
|
1455
|
+
# use this parameter to identify the video to get insights of.
|
1456
|
+
# @param modules [Array<VideoInsightModule>] A comma-delimited list of insights
|
1457
|
+
# to request. The following are the possible case-insensitive values. All:
|
1458
|
+
# Return all available insights. RelatedVideos: Return a list of videos that
|
1459
|
+
# are similar to the video specified by the id query parameter. VideoResult:
|
1460
|
+
# Return the video that you're requesting insights of (this is the video that
|
1461
|
+
# you set the id query parameter to in your insights request). If you specify
|
1462
|
+
# an insight and there is no data for it, the response object does not include
|
1463
|
+
# the related field. For example, if you specify RelatedVideos and none exist,
|
1464
|
+
# the response does not include the relatedVideos field. Although the user's
|
1465
|
+
# query term is not required, you should always include it because it helps to
|
1466
|
+
# improve relevance and the results.
|
1467
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
1468
|
+
# is the country where the user is making the request from. However, it could
|
1469
|
+
# be a different country if the user is not located in a country where Bing
|
1470
|
+
# delivers results. The market must be in the form <language code>-<country
|
1471
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
1472
|
+
# possible market values, see [Market
|
1473
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
1474
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
1475
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
1476
|
+
# response. If you specify a market that is not listed in [Market
|
1477
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
1478
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
1479
|
+
# to change. This parameter and the
|
1480
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1481
|
+
# query parameter are mutually exclusive—do not specify both.
|
1482
|
+
# @param resolution [VideoResolution] Filter videos by the following
|
1483
|
+
# resolutions: SD480p: Return videos with a 480p or higher resolution. HD720p:
|
1484
|
+
# Return videos with a 720p or higher resolution. HD1080p: Return videos with a
|
1485
|
+
# 1080p or higher resolution. All: Do not filter by resolution.Specifying this
|
1486
|
+
# value is the same as not specifying the resolution parameter. Possible values
|
1487
|
+
# include: 'All', 'SD480p', 'HD720p', 'HD1080p'
|
1488
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
1489
|
+
# following are the possible filter values. Off: If the request is through the
|
1490
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
1491
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
1492
|
+
# API, the response includes adult videos but the thumbnail images of the
|
1493
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
1494
|
+
# Search API, the response does not include videos with adult content. If the
|
1495
|
+
# request is through the Web Search API, the response may include videos with
|
1496
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
1497
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
1498
|
+
# If the request comes from a market that Bing's adult policy requires that
|
1499
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
1500
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
1501
|
+
# response may contain adult content regardless of what the safeSearch query
|
1502
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
1503
|
+
# site and your scenario supports the possibility of adult content. Possible
|
1504
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
1505
|
+
# @param set_lang [String] The language to use for user interface strings.
|
1506
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
1507
|
+
# the language code for English is EN. The default is EN (English). Although
|
1508
|
+
# optional, you should always specify the language. Typically, you set setLang
|
1509
|
+
# to the same language specified by mkt unless the user wants the user
|
1510
|
+
# interface strings displayed in a different language. This parameter and the
|
1511
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
1512
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
1513
|
+
# is a string that's used as a label in a user interface. There are few user
|
1514
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
1515
|
+
# properties in the response objects apply the specified language.
|
1516
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
1517
|
+
# display strings contain decoration markers such as hit highlighting
|
1518
|
+
# characters. If true, the strings may include markers. The default is false.
|
1519
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
1520
|
+
# the
|
1521
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
1522
|
+
# query parameter. For information about hit highlighting, see [Hit
|
1523
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
1524
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
1525
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
1526
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
1527
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
1528
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
1529
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
1530
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
1531
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
1532
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
1533
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
1534
|
+
# values include: 'Raw', 'Html'
|
1535
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
1536
|
+
# to the HTTP request.
|
1537
|
+
#
|
1538
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
1539
|
+
#
|
1540
|
+
def details_async(query, accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, id:nil, modules:nil, market:nil, resolution:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
1541
|
+
x_bing_apis_sdk = 'true'
|
1542
|
+
fail ArgumentError, 'query is nil' if query.nil?
|
1543
|
+
|
1544
|
+
|
1545
|
+
request_headers = {}
|
1546
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1547
|
+
|
1548
|
+
# Set Headers
|
1549
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1550
|
+
request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
|
1551
|
+
request_headers['Accept-Language'] = accept_language unless accept_language.nil?
|
1552
|
+
request_headers['User-Agent'] = user_agent unless user_agent.nil?
|
1553
|
+
request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
|
1554
|
+
request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
|
1555
|
+
request_headers['X-Search-Location'] = location unless location.nil?
|
1556
|
+
path_template = 'videos/details'
|
1557
|
+
|
1558
|
+
request_url = @base_url || @client.base_url
|
1559
|
+
|
1560
|
+
options = {
|
1561
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1562
|
+
query_params: {'cc' => country_code,'id' => id,'modules' => modules.nil? ? nil : modules.join(','),'mkt' => market,'q' => query,'resolution' => resolution,'safeSearch' => safe_search,'setLang' => set_lang,'textDecorations' => text_decorations,'textFormat' => text_format},
|
1563
|
+
headers: request_headers.merge(custom_headers || {}),
|
1564
|
+
base_url: request_url
|
1565
|
+
}
|
1566
|
+
promise = @client.make_request_async(:get, path_template, options)
|
1567
|
+
|
1568
|
+
promise = promise.then do |result|
|
1569
|
+
http_response = result.response
|
1570
|
+
status_code = http_response.status
|
1571
|
+
response_content = http_response.body
|
1572
|
+
unless status_code == 200
|
1573
|
+
error_model = JSON.load(response_content)
|
1574
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
1575
|
+
end
|
1576
|
+
|
1577
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1578
|
+
# Deserialize Response
|
1579
|
+
if status_code == 200
|
1580
|
+
begin
|
1581
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1582
|
+
result_mapper = Azure::CognitiveServices::VideoSearch::V1_0::Models::VideoDetails.mapper()
|
1583
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
1584
|
+
rescue Exception => e
|
1585
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1586
|
+
end
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
result
|
1590
|
+
end
|
1591
|
+
|
1592
|
+
promise.execute
|
1593
|
+
end
|
1594
|
+
|
1595
|
+
#
|
1596
|
+
# The Video Trending Search API lets you search on Bing and get back a list of
|
1597
|
+
# videos that are trending based on search requests made by others. The videos
|
1598
|
+
# are broken out into different categories. For example, Top Music Videos. For
|
1599
|
+
# a list of markets that support trending videos, see [Trending
|
1600
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/trending-videos).
|
1601
|
+
#
|
1602
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
1603
|
+
# languages to use for user interface strings. The list is in decreasing order
|
1604
|
+
# of preference. For additional information, including expected format, see
|
1605
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
1606
|
+
# header and the
|
1607
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1608
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
1609
|
+
# header, you must also specify the
|
1610
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1611
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
1612
|
+
# first supported language it finds from the list and combines it with the cc
|
1613
|
+
# parameter value. If the list does not include a supported language, Bing
|
1614
|
+
# finds the closest language and market that supports the request or it uses an
|
1615
|
+
# aggregated or default market for the results. To determine the market that
|
1616
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
1617
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
1618
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
1619
|
+
# and
|
1620
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1621
|
+
# query parameters. A user interface string is a string that's used as a label
|
1622
|
+
# in a user interface. There are few user interface strings in the JSON
|
1623
|
+
# response objects. Any links to Bing.com properties in the response objects
|
1624
|
+
# apply the specified language.
|
1625
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
1626
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
1627
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
1628
|
+
# should be the same string that any commonly used browser sends. For
|
1629
|
+
# information about user agents, see [RFC
|
1630
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
1631
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
1632
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
1633
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
1634
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
1635
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
1636
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
1637
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
1638
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
1639
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
1640
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
1641
|
+
# @param client_id [String] Bing uses this header to provide users with
|
1642
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
1643
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
1644
|
+
# different flights. If you do not use the same client ID for a user across
|
1645
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
1646
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
1647
|
+
# inconsistent user experience. For example, if the second request has a
|
1648
|
+
# different flight assignment than the first, the experience may be unexpected.
|
1649
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
1650
|
+
# search history, providing a richer experience for the user. Bing also uses
|
1651
|
+
# this header to help improve result rankings by analyzing the activity
|
1652
|
+
# generated by a client ID. The relevance improvements help with better quality
|
1653
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
1654
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
1655
|
+
# this header required. Persisting the client ID across multiple requests for
|
1656
|
+
# the same end user and device combination enables 1) the API consumer to
|
1657
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
1658
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
1659
|
+
# application on the device must have a unique, Bing generated client ID. If
|
1660
|
+
# you do not include this header in the request, Bing generates an ID and
|
1661
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
1662
|
+
# should NOT include this header in a request is the first time the user uses
|
1663
|
+
# your app on that device. Use the client ID for each Bing API request that
|
1664
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
1665
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
1666
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
1667
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
1668
|
+
# time the user uses your app on that device, get the client ID that you
|
1669
|
+
# persisted. Bing responses may or may not include this header. If the response
|
1670
|
+
# includes this header, capture the client ID and use it for all subsequent
|
1671
|
+
# Bing requests for the user on that device. If you include the
|
1672
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
1673
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
1674
|
+
# IP address is used to discover the user's location. Bing uses the location
|
1675
|
+
# information to determine safe search behavior. Although optional, you are
|
1676
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
1677
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
1678
|
+
# Obfuscating the address results in the location not being anywhere near the
|
1679
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
1680
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
1681
|
+
# describe the client's geographical location. Bing uses the location
|
1682
|
+
# information to determine safe search behavior and to return relevant local
|
1683
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
1684
|
+
# keys that you use to specify the user's location. lat (required): The
|
1685
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
1686
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
1687
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
1688
|
+
# long (required): The longitude of the client's location, in degrees. The
|
1689
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
1690
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
1691
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
1692
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
1693
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
1694
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
1695
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
1696
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
1697
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
1698
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
1699
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
1700
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
1701
|
+
# client device is traveling. alt (optional): The altitude of the client
|
1702
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
1703
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
1704
|
+
# the alt key. Although many of the keys are optional, the more information
|
1705
|
+
# that you provide, the more accurate the location results are. Although
|
1706
|
+
# optional, you are encouraged to always specify the user's geographical
|
1707
|
+
# location. Providing the location is especially important if the client's IP
|
1708
|
+
# address does not accurately reflect the user's physical location (for
|
1709
|
+
# example, if the client uses VPN). For optimal results, you should include
|
1710
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
1711
|
+
# include this header.
|
1712
|
+
# @param country_code [String] A 2-character country code of the country where
|
1713
|
+
# the results come from. This API supports only the United States market. If
|
1714
|
+
# you specify this query parameter, it must be set to us. If you set this
|
1715
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
1716
|
+
# first supported language it finds from the languages list, and combine that
|
1717
|
+
# language with the country code that you specify to determine the market to
|
1718
|
+
# return results for. If the languages list does not include a supported
|
1719
|
+
# language, Bing finds the closest language and market that supports the
|
1720
|
+
# request, or it may use an aggregated or default market for the results
|
1721
|
+
# instead of a specified one. You should use this query parameter and the
|
1722
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
1723
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
1724
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
1725
|
+
# both.
|
1726
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
1727
|
+
# is the country where the user is making the request from. However, it could
|
1728
|
+
# be a different country if the user is not located in a country where Bing
|
1729
|
+
# delivers results. The market must be in the form <language code>-<country
|
1730
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
1731
|
+
# possible market values, see [Market
|
1732
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
1733
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
1734
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
1735
|
+
# response. If you specify a market that is not listed in [Market
|
1736
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
1737
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
1738
|
+
# to change. This parameter and the
|
1739
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1740
|
+
# query parameter are mutually exclusive—do not specify both.
|
1741
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
1742
|
+
# following are the possible filter values. Off: If the request is through the
|
1743
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
1744
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
1745
|
+
# API, the response includes adult videos but the thumbnail images of the
|
1746
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
1747
|
+
# Search API, the response does not include videos with adult content. If the
|
1748
|
+
# request is through the Web Search API, the response may include videos with
|
1749
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
1750
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
1751
|
+
# If the request comes from a market that Bing's adult policy requires that
|
1752
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
1753
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
1754
|
+
# response may contain adult content regardless of what the safeSearch query
|
1755
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
1756
|
+
# site and your scenario supports the possibility of adult content. Possible
|
1757
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
1758
|
+
# @param set_lang [String] The language to use for user interface strings.
|
1759
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
1760
|
+
# the language code for English is EN. The default is EN (English). Although
|
1761
|
+
# optional, you should always specify the language. Typically, you set setLang
|
1762
|
+
# to the same language specified by mkt unless the user wants the user
|
1763
|
+
# interface strings displayed in a different language. This parameter and the
|
1764
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
1765
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
1766
|
+
# is a string that's used as a label in a user interface. There are few user
|
1767
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
1768
|
+
# properties in the response objects apply the specified language.
|
1769
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
1770
|
+
# display strings contain decoration markers such as hit highlighting
|
1771
|
+
# characters. If true, the strings may include markers. The default is false.
|
1772
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
1773
|
+
# the
|
1774
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
1775
|
+
# query parameter. For information about hit highlighting, see [Hit
|
1776
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
1777
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
1778
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
1779
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
1780
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
1781
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
1782
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
1783
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
1784
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
1785
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
1786
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
1787
|
+
# values include: 'Raw', 'Html'
|
1788
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1789
|
+
# will be added to the HTTP request.
|
1790
|
+
#
|
1791
|
+
# @return [TrendingVideos] operation results.
|
1792
|
+
#
|
1793
|
+
def trending(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
1794
|
+
response = trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
1795
|
+
response.body unless response.nil?
|
1796
|
+
end
|
1797
|
+
|
1798
|
+
#
|
1799
|
+
# The Video Trending Search API lets you search on Bing and get back a list of
|
1800
|
+
# videos that are trending based on search requests made by others. The videos
|
1801
|
+
# are broken out into different categories. For example, Top Music Videos. For
|
1802
|
+
# a list of markets that support trending videos, see [Trending
|
1803
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/trending-videos).
|
1804
|
+
#
|
1805
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
1806
|
+
# languages to use for user interface strings. The list is in decreasing order
|
1807
|
+
# of preference. For additional information, including expected format, see
|
1808
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
1809
|
+
# header and the
|
1810
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1811
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
1812
|
+
# header, you must also specify the
|
1813
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1814
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
1815
|
+
# first supported language it finds from the list and combines it with the cc
|
1816
|
+
# parameter value. If the list does not include a supported language, Bing
|
1817
|
+
# finds the closest language and market that supports the request or it uses an
|
1818
|
+
# aggregated or default market for the results. To determine the market that
|
1819
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
1820
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
1821
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
1822
|
+
# and
|
1823
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
1824
|
+
# query parameters. A user interface string is a string that's used as a label
|
1825
|
+
# in a user interface. There are few user interface strings in the JSON
|
1826
|
+
# response objects. Any links to Bing.com properties in the response objects
|
1827
|
+
# apply the specified language.
|
1828
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
1829
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
1830
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
1831
|
+
# should be the same string that any commonly used browser sends. For
|
1832
|
+
# information about user agents, see [RFC
|
1833
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
1834
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
1835
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
1836
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
1837
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
1838
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
1839
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
1840
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
1841
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
1842
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
1843
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
1844
|
+
# @param client_id [String] Bing uses this header to provide users with
|
1845
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
1846
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
1847
|
+
# different flights. If you do not use the same client ID for a user across
|
1848
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
1849
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
1850
|
+
# inconsistent user experience. For example, if the second request has a
|
1851
|
+
# different flight assignment than the first, the experience may be unexpected.
|
1852
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
1853
|
+
# search history, providing a richer experience for the user. Bing also uses
|
1854
|
+
# this header to help improve result rankings by analyzing the activity
|
1855
|
+
# generated by a client ID. The relevance improvements help with better quality
|
1856
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
1857
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
1858
|
+
# this header required. Persisting the client ID across multiple requests for
|
1859
|
+
# the same end user and device combination enables 1) the API consumer to
|
1860
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
1861
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
1862
|
+
# application on the device must have a unique, Bing generated client ID. If
|
1863
|
+
# you do not include this header in the request, Bing generates an ID and
|
1864
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
1865
|
+
# should NOT include this header in a request is the first time the user uses
|
1866
|
+
# your app on that device. Use the client ID for each Bing API request that
|
1867
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
1868
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
1869
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
1870
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
1871
|
+
# time the user uses your app on that device, get the client ID that you
|
1872
|
+
# persisted. Bing responses may or may not include this header. If the response
|
1873
|
+
# includes this header, capture the client ID and use it for all subsequent
|
1874
|
+
# Bing requests for the user on that device. If you include the
|
1875
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
1876
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
1877
|
+
# IP address is used to discover the user's location. Bing uses the location
|
1878
|
+
# information to determine safe search behavior. Although optional, you are
|
1879
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
1880
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
1881
|
+
# Obfuscating the address results in the location not being anywhere near the
|
1882
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
1883
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
1884
|
+
# describe the client's geographical location. Bing uses the location
|
1885
|
+
# information to determine safe search behavior and to return relevant local
|
1886
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
1887
|
+
# keys that you use to specify the user's location. lat (required): The
|
1888
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
1889
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
1890
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
1891
|
+
# long (required): The longitude of the client's location, in degrees. The
|
1892
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
1893
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
1894
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
1895
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
1896
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
1897
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
1898
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
1899
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
1900
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
1901
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
1902
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
1903
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
1904
|
+
# client device is traveling. alt (optional): The altitude of the client
|
1905
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
1906
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
1907
|
+
# the alt key. Although many of the keys are optional, the more information
|
1908
|
+
# that you provide, the more accurate the location results are. Although
|
1909
|
+
# optional, you are encouraged to always specify the user's geographical
|
1910
|
+
# location. Providing the location is especially important if the client's IP
|
1911
|
+
# address does not accurately reflect the user's physical location (for
|
1912
|
+
# example, if the client uses VPN). For optimal results, you should include
|
1913
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
1914
|
+
# include this header.
|
1915
|
+
# @param country_code [String] A 2-character country code of the country where
|
1916
|
+
# the results come from. This API supports only the United States market. If
|
1917
|
+
# you specify this query parameter, it must be set to us. If you set this
|
1918
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
1919
|
+
# first supported language it finds from the languages list, and combine that
|
1920
|
+
# language with the country code that you specify to determine the market to
|
1921
|
+
# return results for. If the languages list does not include a supported
|
1922
|
+
# language, Bing finds the closest language and market that supports the
|
1923
|
+
# request, or it may use an aggregated or default market for the results
|
1924
|
+
# instead of a specified one. You should use this query parameter and the
|
1925
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
1926
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
1927
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
1928
|
+
# both.
|
1929
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
1930
|
+
# is the country where the user is making the request from. However, it could
|
1931
|
+
# be a different country if the user is not located in a country where Bing
|
1932
|
+
# delivers results. The market must be in the form <language code>-<country
|
1933
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
1934
|
+
# possible market values, see [Market
|
1935
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
1936
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
1937
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
1938
|
+
# response. If you specify a market that is not listed in [Market
|
1939
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
1940
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
1941
|
+
# to change. This parameter and the
|
1942
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
1943
|
+
# query parameter are mutually exclusive—do not specify both.
|
1944
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
1945
|
+
# following are the possible filter values. Off: If the request is through the
|
1946
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
1947
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
1948
|
+
# API, the response includes adult videos but the thumbnail images of the
|
1949
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
1950
|
+
# Search API, the response does not include videos with adult content. If the
|
1951
|
+
# request is through the Web Search API, the response may include videos with
|
1952
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
1953
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
1954
|
+
# If the request comes from a market that Bing's adult policy requires that
|
1955
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
1956
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
1957
|
+
# response may contain adult content regardless of what the safeSearch query
|
1958
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
1959
|
+
# site and your scenario supports the possibility of adult content. Possible
|
1960
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
1961
|
+
# @param set_lang [String] The language to use for user interface strings.
|
1962
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
1963
|
+
# the language code for English is EN. The default is EN (English). Although
|
1964
|
+
# optional, you should always specify the language. Typically, you set setLang
|
1965
|
+
# to the same language specified by mkt unless the user wants the user
|
1966
|
+
# interface strings displayed in a different language. This parameter and the
|
1967
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
1968
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
1969
|
+
# is a string that's used as a label in a user interface. There are few user
|
1970
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
1971
|
+
# properties in the response objects apply the specified language.
|
1972
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
1973
|
+
# display strings contain decoration markers such as hit highlighting
|
1974
|
+
# characters. If true, the strings may include markers. The default is false.
|
1975
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
1976
|
+
# the
|
1977
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
1978
|
+
# query parameter. For information about hit highlighting, see [Hit
|
1979
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
1980
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
1981
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
1982
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
1983
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
1984
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
1985
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
1986
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
1987
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
1988
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
1989
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
1990
|
+
# values include: 'Raw', 'Html'
|
1991
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
1992
|
+
# will be added to the HTTP request.
|
1993
|
+
#
|
1994
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
1995
|
+
#
|
1996
|
+
def trending_with_http_info(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
1997
|
+
trending_async(accept_language:accept_language, user_agent:user_agent, client_id:client_id, client_ip:client_ip, location:location, country_code:country_code, market:market, safe_search:safe_search, set_lang:set_lang, text_decorations:text_decorations, text_format:text_format, custom_headers:custom_headers).value!
|
1998
|
+
end
|
1999
|
+
|
2000
|
+
#
|
2001
|
+
# The Video Trending Search API lets you search on Bing and get back a list of
|
2002
|
+
# videos that are trending based on search requests made by others. The videos
|
2003
|
+
# are broken out into different categories. For example, Top Music Videos. For
|
2004
|
+
# a list of markets that support trending videos, see [Trending
|
2005
|
+
# Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/trending-videos).
|
2006
|
+
#
|
2007
|
+
# @param accept_language [String] A comma-delimited list of one or more
|
2008
|
+
# languages to use for user interface strings. The list is in decreasing order
|
2009
|
+
# of preference. For additional information, including expected format, see
|
2010
|
+
# [RFC2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). This
|
2011
|
+
# header and the
|
2012
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
2013
|
+
# query parameter are mutually exclusive; do not specify both. If you set this
|
2014
|
+
# header, you must also specify the
|
2015
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
2016
|
+
# query parameter. To determine the market to return results for, Bing uses the
|
2017
|
+
# first supported language it finds from the list and combines it with the cc
|
2018
|
+
# parameter value. If the list does not include a supported language, Bing
|
2019
|
+
# finds the closest language and market that supports the request or it uses an
|
2020
|
+
# aggregated or default market for the results. To determine the market that
|
2021
|
+
# Bing used, see the BingAPIs-Market header. Use this header and the cc query
|
2022
|
+
# parameter only if you specify multiple languages. Otherwise, use the
|
2023
|
+
# [mkt](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#mkt)
|
2024
|
+
# and
|
2025
|
+
# [setLang](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#setlang)
|
2026
|
+
# query parameters. A user interface string is a string that's used as a label
|
2027
|
+
# in a user interface. There are few user interface strings in the JSON
|
2028
|
+
# response objects. Any links to Bing.com properties in the response objects
|
2029
|
+
# apply the specified language.
|
2030
|
+
# @param user_agent [String] The user agent originating the request. Bing uses
|
2031
|
+
# the user agent to provide mobile users with an optimized experience. Although
|
2032
|
+
# optional, you are encouraged to always specify this header. The user-agent
|
2033
|
+
# should be the same string that any commonly used browser sends. For
|
2034
|
+
# information about user agents, see [RFC
|
2035
|
+
# 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). The following
|
2036
|
+
# are examples of user-agent strings. Windows Phone: Mozilla/5.0 (compatible;
|
2037
|
+
# MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA;
|
2038
|
+
# Lumia 822). Android: Mozilla / 5.0 (Linux; U; Android 2.3.5; en - us; SCH -
|
2039
|
+
# I500 Build / GINGERBREAD) AppleWebKit / 533.1 (KHTML; like Gecko) Version /
|
2040
|
+
# 4.0 Mobile Safari / 533.1. iPhone: Mozilla / 5.0 (iPhone; CPU iPhone OS 6_1
|
2041
|
+
# like Mac OS X) AppleWebKit / 536.26 (KHTML; like Gecko) Mobile / 10B142
|
2042
|
+
# iPhone4; 1 BingWeb / 3.03.1428.20120423. PC: Mozilla / 5.0 (Windows NT 6.3;
|
2043
|
+
# WOW64; Trident / 7.0; Touch; rv:11.0) like Gecko. iPad: Mozilla / 5.0 (iPad;
|
2044
|
+
# CPU OS 7_0 like Mac OS X) AppleWebKit / 537.51.1 (KHTML, like Gecko) Version
|
2045
|
+
# / 7.0 Mobile / 11A465 Safari / 9537.53
|
2046
|
+
# @param client_id [String] Bing uses this header to provide users with
|
2047
|
+
# consistent behavior across Bing API calls. Bing often flights new features
|
2048
|
+
# and improvements, and it uses the client ID as a key for assigning traffic on
|
2049
|
+
# different flights. If you do not use the same client ID for a user across
|
2050
|
+
# multiple requests, then Bing may assign the user to multiple conflicting
|
2051
|
+
# flights. Being assigned to multiple conflicting flights can lead to an
|
2052
|
+
# inconsistent user experience. For example, if the second request has a
|
2053
|
+
# different flight assignment than the first, the experience may be unexpected.
|
2054
|
+
# Also, Bing can use the client ID to tailor web results to that client ID’s
|
2055
|
+
# search history, providing a richer experience for the user. Bing also uses
|
2056
|
+
# this header to help improve result rankings by analyzing the activity
|
2057
|
+
# generated by a client ID. The relevance improvements help with better quality
|
2058
|
+
# of results delivered by Bing APIs and in turn enables higher click-through
|
2059
|
+
# rates for the API consumer. IMPORTANT: Although optional, you should consider
|
2060
|
+
# this header required. Persisting the client ID across multiple requests for
|
2061
|
+
# the same end user and device combination enables 1) the API consumer to
|
2062
|
+
# receive a consistent user experience, and 2) higher click-through rates via
|
2063
|
+
# better quality of results from the Bing APIs. Each user that uses your
|
2064
|
+
# application on the device must have a unique, Bing generated client ID. If
|
2065
|
+
# you do not include this header in the request, Bing generates an ID and
|
2066
|
+
# returns it in the X-MSEdge-ClientID response header. The only time that you
|
2067
|
+
# should NOT include this header in a request is the first time the user uses
|
2068
|
+
# your app on that device. Use the client ID for each Bing API request that
|
2069
|
+
# your app makes for this user on the device. Persist the client ID. To persist
|
2070
|
+
# the ID in a browser app, use a persistent HTTP cookie to ensure the ID is
|
2071
|
+
# used across all sessions. Do not use a session cookie. For other apps such as
|
2072
|
+
# mobile apps, use the device's persistent storage to persist the ID. The next
|
2073
|
+
# time the user uses your app on that device, get the client ID that you
|
2074
|
+
# persisted. Bing responses may or may not include this header. If the response
|
2075
|
+
# includes this header, capture the client ID and use it for all subsequent
|
2076
|
+
# Bing requests for the user on that device. If you include the
|
2077
|
+
# X-MSEdge-ClientID, you must not include cookies in the request.
|
2078
|
+
# @param client_ip [String] The IPv4 or IPv6 address of the client device. The
|
2079
|
+
# IP address is used to discover the user's location. Bing uses the location
|
2080
|
+
# information to determine safe search behavior. Although optional, you are
|
2081
|
+
# encouraged to always specify this header and the X-Search-Location header. Do
|
2082
|
+
# not obfuscate the address (for example, by changing the last octet to 0).
|
2083
|
+
# Obfuscating the address results in the location not being anywhere near the
|
2084
|
+
# device's actual location, which may result in Bing serving erroneous results.
|
2085
|
+
# @param location [String] A semicolon-delimited list of key/value pairs that
|
2086
|
+
# describe the client's geographical location. Bing uses the location
|
2087
|
+
# information to determine safe search behavior and to return relevant local
|
2088
|
+
# content. Specify the key/value pair as <key>:<value>. The following are the
|
2089
|
+
# keys that you use to specify the user's location. lat (required): The
|
2090
|
+
# latitude of the client's location, in degrees. The latitude must be greater
|
2091
|
+
# than or equal to -90.0 and less than or equal to +90.0. Negative values
|
2092
|
+
# indicate southern latitudes and positive values indicate northern latitudes.
|
2093
|
+
# long (required): The longitude of the client's location, in degrees. The
|
2094
|
+
# longitude must be greater than or equal to -180.0 and less than or equal to
|
2095
|
+
# +180.0. Negative values indicate western longitudes and positive values
|
2096
|
+
# indicate eastern longitudes. re (required): The radius, in meters, which
|
2097
|
+
# specifies the horizontal accuracy of the coordinates. Pass the value returned
|
2098
|
+
# by the device's location service. Typical values might be 22m for GPS/Wi-Fi,
|
2099
|
+
# 380m for cell tower triangulation, and 18,000m for reverse IP lookup. ts
|
2100
|
+
# (optional): The UTC UNIX timestamp of when the client was at the location.
|
2101
|
+
# (The UNIX timestamp is the number of seconds since January 1, 1970.) head
|
2102
|
+
# (optional): The client's relative heading or direction of travel. Specify the
|
2103
|
+
# direction of travel as degrees from 0 through 360, counting clockwise
|
2104
|
+
# relative to true north. Specify this key only if the sp key is nonzero. sp
|
2105
|
+
# (optional): The horizontal velocity (speed), in meters per second, that the
|
2106
|
+
# client device is traveling. alt (optional): The altitude of the client
|
2107
|
+
# device, in meters. are (optional): The radius, in meters, that specifies the
|
2108
|
+
# vertical accuracy of the coordinates. Specify this key only if you specify
|
2109
|
+
# the alt key. Although many of the keys are optional, the more information
|
2110
|
+
# that you provide, the more accurate the location results are. Although
|
2111
|
+
# optional, you are encouraged to always specify the user's geographical
|
2112
|
+
# location. Providing the location is especially important if the client's IP
|
2113
|
+
# address does not accurately reflect the user's physical location (for
|
2114
|
+
# example, if the client uses VPN). For optimal results, you should include
|
2115
|
+
# this header and the X-MSEdge-ClientIP header, but at a minimum, you should
|
2116
|
+
# include this header.
|
2117
|
+
# @param country_code [String] A 2-character country code of the country where
|
2118
|
+
# the results come from. This API supports only the United States market. If
|
2119
|
+
# you specify this query parameter, it must be set to us. If you set this
|
2120
|
+
# parameter, you must also specify the Accept-Language header. Bing uses the
|
2121
|
+
# first supported language it finds from the languages list, and combine that
|
2122
|
+
# language with the country code that you specify to determine the market to
|
2123
|
+
# return results for. If the languages list does not include a supported
|
2124
|
+
# language, Bing finds the closest language and market that supports the
|
2125
|
+
# request, or it may use an aggregated or default market for the results
|
2126
|
+
# instead of a specified one. You should use this query parameter and the
|
2127
|
+
# Accept-Language query parameter only if you specify multiple languages;
|
2128
|
+
# otherwise, you should use the mkt and setLang query parameters. This
|
2129
|
+
# parameter and the mkt query parameter are mutually exclusive—do not specify
|
2130
|
+
# both.
|
2131
|
+
# @param market [String] The market where the results come from. Typically, mkt
|
2132
|
+
# is the country where the user is making the request from. However, it could
|
2133
|
+
# be a different country if the user is not located in a country where Bing
|
2134
|
+
# delivers results. The market must be in the form <language code>-<country
|
2135
|
+
# code>. For example, en-US. The string is case insensitive. For a list of
|
2136
|
+
# possible market values, see [Market
|
2137
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes).
|
2138
|
+
# NOTE: If known, you are encouraged to always specify the market. Specifying
|
2139
|
+
# the market helps Bing route the request and return an appropriate and optimal
|
2140
|
+
# response. If you specify a market that is not listed in [Market
|
2141
|
+
# Codes](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#market-codes),
|
2142
|
+
# Bing uses a best fit market code based on an internal mapping that is subject
|
2143
|
+
# to change. This parameter and the
|
2144
|
+
# [cc](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#cc)
|
2145
|
+
# query parameter are mutually exclusive—do not specify both.
|
2146
|
+
# @param safe_search [SafeSearch] Filter videos for adult content. The
|
2147
|
+
# following are the possible filter values. Off: If the request is through the
|
2148
|
+
# Video Search API, the response includes adult videos and the thumbnail images
|
2149
|
+
# of the videos are clear (non-fuzzy). If the request is through the Web Search
|
2150
|
+
# API, the response includes adult videos but the thumbnail images of the
|
2151
|
+
# videos are pixelated (fuzzy). Moderate: If the request is through the Video
|
2152
|
+
# Search API, the response does not include videos with adult content. If the
|
2153
|
+
# request is through the Web Search API, the response may include videos with
|
2154
|
+
# adult content but the thumbnail images of the videos are pixelated (fuzzy).
|
2155
|
+
# Strict: Does not return videos with adult content. The default is Moderate.
|
2156
|
+
# If the request comes from a market that Bing's adult policy requires that
|
2157
|
+
# safeSearch is set to Strict, Bing ignores the safeSearch value and uses
|
2158
|
+
# Strict. If you use the site: query operator, there is the chance that the
|
2159
|
+
# response may contain adult content regardless of what the safeSearch query
|
2160
|
+
# parameter is set to. Use site: only if you are aware of the content on the
|
2161
|
+
# site and your scenario supports the possibility of adult content. Possible
|
2162
|
+
# values include: 'Off', 'Moderate', 'Strict'
|
2163
|
+
# @param set_lang [String] The language to use for user interface strings.
|
2164
|
+
# Specify the language using the ISO 639-1 2-letter language code. For example,
|
2165
|
+
# the language code for English is EN. The default is EN (English). Although
|
2166
|
+
# optional, you should always specify the language. Typically, you set setLang
|
2167
|
+
# to the same language specified by mkt unless the user wants the user
|
2168
|
+
# interface strings displayed in a different language. This parameter and the
|
2169
|
+
# [Accept-Language](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#acceptlanguage)
|
2170
|
+
# header are mutually exclusive; do not specify both. A user interface string
|
2171
|
+
# is a string that's used as a label in a user interface. There are few user
|
2172
|
+
# interface strings in the JSON response objects. Also, any links to Bing.com
|
2173
|
+
# properties in the response objects apply the specified language.
|
2174
|
+
# @param text_decorations [Boolean] A Boolean value that determines whether
|
2175
|
+
# display strings contain decoration markers such as hit highlighting
|
2176
|
+
# characters. If true, the strings may include markers. The default is false.
|
2177
|
+
# To specify whether to use Unicode characters or HTML tags as the markers, see
|
2178
|
+
# the
|
2179
|
+
# [textFormat](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-video-api-v7-reference#textformat)
|
2180
|
+
# query parameter. For information about hit highlighting, see [Hit
|
2181
|
+
# Highlighting](https://docs.microsoft.com/azure/cognitive-services/bing-news-search/hit-highlighting).
|
2182
|
+
# @param text_format [TextFormat] The type of markers to use for text
|
2183
|
+
# decorations (see the textDecorations query parameter). Possible values are
|
2184
|
+
# Raw—Use Unicode characters to mark content that needs special formatting. The
|
2185
|
+
# Unicode characters are in the range E000 through E019. For example, Bing uses
|
2186
|
+
# E000 and E001 to mark the beginning and end of query terms for hit
|
2187
|
+
# highlighting. HTML—Use HTML tags to mark content that needs special
|
2188
|
+
# formatting. For example, use <b> tags to highlight query terms in display
|
2189
|
+
# strings. The default is Raw. For display strings that contain escapable HTML
|
2190
|
+
# characters such as <, >, and &, if textFormat is set to HTML, Bing escapes
|
2191
|
+
# the characters as appropriate (for example, < is escaped to <). Possible
|
2192
|
+
# values include: 'Raw', 'Html'
|
2193
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
2194
|
+
# to the HTTP request.
|
2195
|
+
#
|
2196
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
2197
|
+
#
|
2198
|
+
def trending_async(accept_language:nil, user_agent:nil, client_id:nil, client_ip:nil, location:nil, country_code:nil, market:nil, safe_search:nil, set_lang:nil, text_decorations:nil, text_format:nil, custom_headers:nil)
|
2199
|
+
x_bing_apis_sdk = 'true'
|
2200
|
+
|
2201
|
+
|
2202
|
+
request_headers = {}
|
2203
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
2204
|
+
|
2205
|
+
# Set Headers
|
2206
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
2207
|
+
request_headers['X-BingApis-SDK'] = x_bing_apis_sdk unless x_bing_apis_sdk.nil?
|
2208
|
+
request_headers['Accept-Language'] = accept_language unless accept_language.nil?
|
2209
|
+
request_headers['User-Agent'] = user_agent unless user_agent.nil?
|
2210
|
+
request_headers['X-MSEdge-ClientID'] = client_id unless client_id.nil?
|
2211
|
+
request_headers['X-MSEdge-ClientIP'] = client_ip unless client_ip.nil?
|
2212
|
+
request_headers['X-Search-Location'] = location unless location.nil?
|
2213
|
+
path_template = 'videos/trending'
|
2214
|
+
|
2215
|
+
request_url = @base_url || @client.base_url
|
2216
|
+
|
2217
|
+
options = {
|
2218
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
2219
|
+
query_params: {'cc' => country_code,'mkt' => market,'safeSearch' => safe_search,'setLang' => set_lang,'textDecorations' => text_decorations,'textFormat' => text_format},
|
2220
|
+
headers: request_headers.merge(custom_headers || {}),
|
2221
|
+
base_url: request_url
|
2222
|
+
}
|
2223
|
+
promise = @client.make_request_async(:get, path_template, options)
|
2224
|
+
|
2225
|
+
promise = promise.then do |result|
|
2226
|
+
http_response = result.response
|
2227
|
+
status_code = http_response.status
|
2228
|
+
response_content = http_response.body
|
2229
|
+
unless status_code == 200
|
2230
|
+
error_model = JSON.load(response_content)
|
2231
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
2232
|
+
end
|
2233
|
+
|
2234
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
2235
|
+
# Deserialize Response
|
2236
|
+
if status_code == 200
|
2237
|
+
begin
|
2238
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
2239
|
+
result_mapper = Azure::CognitiveServices::VideoSearch::V1_0::Models::TrendingVideos.mapper()
|
2240
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
2241
|
+
rescue Exception => e
|
2242
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
2243
|
+
end
|
2244
|
+
end
|
2245
|
+
|
2246
|
+
result
|
2247
|
+
end
|
2248
|
+
|
2249
|
+
promise.execute
|
2250
|
+
end
|
2251
|
+
|
2252
|
+
end
|
2253
|
+
end
|