azure_cognitiveservices_customsearch 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch.rb +47 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/custom_instance.rb +653 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/custom_search_client.rb +127 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/answer.rb +90 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/creative_work.rb +150 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/error.rb +116 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/error_code.rb +20 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/error_response.rb +89 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/error_sub_code.rb +25 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/identifiable.rb +62 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/query.rb +87 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/query_context.rb +94 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/response.rb +72 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/response_base.rb +56 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/safe_search.rb +17 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/search_response.rb +100 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/search_results_answer.rb +126 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/text_format.rb +16 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/thing.rb +118 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/web_meta_tag.rb +59 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/web_page.rb +228 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/models/web_web_answer.rb +149 -0
- data/lib/1.0/generated/azure_cognitiveservices_customsearch/module_definition.rb +9 -0
- data/lib/azure_cognitiveservices_customsearch.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/customsearch_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/customsearch_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/customsearch_profile_module.rb +135 -0
- data/lib/version.rb +7 -0
- metadata +149 -0
@@ -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::CustomSearch::V1_0
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class CustomSearchClient < 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 [CustomInstance] custom_instance
|
36
|
+
attr_reader :custom_instance
|
37
|
+
|
38
|
+
#
|
39
|
+
# Creates initializes a new instance of the CustomSearchClient 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/bingcustomsearch/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
|
+
@custom_instance = CustomInstance.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_customsearch'
|
123
|
+
sdk_information = "#{sdk_information}/0.16.0"
|
124
|
+
add_user_agent_information(sdk_information)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,90 @@
|
|
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::CustomSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class Answer < Response
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@_type = "Answer"
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :_type
|
22
|
+
|
23
|
+
# @return [Array<Query>]
|
24
|
+
attr_accessor :follow_up_queries
|
25
|
+
|
26
|
+
|
27
|
+
#
|
28
|
+
# Mapper for Answer class as Ruby Hash.
|
29
|
+
# This will be used for serialization/deserialization.
|
30
|
+
#
|
31
|
+
def self.mapper()
|
32
|
+
{
|
33
|
+
client_side_validation: true,
|
34
|
+
required: false,
|
35
|
+
serialized_name: 'Answer',
|
36
|
+
type: {
|
37
|
+
name: 'Composite',
|
38
|
+
class_name: 'Answer',
|
39
|
+
model_properties: {
|
40
|
+
_type: {
|
41
|
+
client_side_validation: true,
|
42
|
+
required: true,
|
43
|
+
serialized_name: '_type',
|
44
|
+
type: {
|
45
|
+
name: 'String'
|
46
|
+
}
|
47
|
+
},
|
48
|
+
id: {
|
49
|
+
client_side_validation: true,
|
50
|
+
required: false,
|
51
|
+
read_only: true,
|
52
|
+
serialized_name: 'id',
|
53
|
+
type: {
|
54
|
+
name: 'String'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
web_search_url: {
|
58
|
+
client_side_validation: true,
|
59
|
+
required: false,
|
60
|
+
read_only: true,
|
61
|
+
serialized_name: 'webSearchUrl',
|
62
|
+
type: {
|
63
|
+
name: 'String'
|
64
|
+
}
|
65
|
+
},
|
66
|
+
follow_up_queries: {
|
67
|
+
client_side_validation: true,
|
68
|
+
required: false,
|
69
|
+
read_only: true,
|
70
|
+
serialized_name: 'followUpQueries',
|
71
|
+
type: {
|
72
|
+
name: 'Sequence',
|
73
|
+
element: {
|
74
|
+
client_side_validation: true,
|
75
|
+
required: false,
|
76
|
+
serialized_name: 'QueryElementType',
|
77
|
+
type: {
|
78
|
+
name: 'Composite',
|
79
|
+
class_name: 'Query'
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,150 @@
|
|
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::CustomSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
class CreativeWork < Thing
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@_type = "CreativeWork"
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :_type
|
22
|
+
|
23
|
+
# @return [String] The URL to a thumbnail of the item.
|
24
|
+
attr_accessor :thumbnail_url
|
25
|
+
|
26
|
+
# @return [Array<Thing>] The source of the creative work.
|
27
|
+
attr_accessor :provider
|
28
|
+
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :text
|
31
|
+
|
32
|
+
|
33
|
+
#
|
34
|
+
# Mapper for CreativeWork class as Ruby Hash.
|
35
|
+
# This will be used for serialization/deserialization.
|
36
|
+
#
|
37
|
+
def self.mapper()
|
38
|
+
{
|
39
|
+
client_side_validation: true,
|
40
|
+
required: false,
|
41
|
+
serialized_name: 'CreativeWork',
|
42
|
+
type: {
|
43
|
+
name: 'Composite',
|
44
|
+
class_name: 'CreativeWork',
|
45
|
+
model_properties: {
|
46
|
+
_type: {
|
47
|
+
client_side_validation: true,
|
48
|
+
required: true,
|
49
|
+
serialized_name: '_type',
|
50
|
+
type: {
|
51
|
+
name: 'String'
|
52
|
+
}
|
53
|
+
},
|
54
|
+
id: {
|
55
|
+
client_side_validation: true,
|
56
|
+
required: false,
|
57
|
+
read_only: true,
|
58
|
+
serialized_name: 'id',
|
59
|
+
type: {
|
60
|
+
name: 'String'
|
61
|
+
}
|
62
|
+
},
|
63
|
+
web_search_url: {
|
64
|
+
client_side_validation: true,
|
65
|
+
required: false,
|
66
|
+
read_only: true,
|
67
|
+
serialized_name: 'webSearchUrl',
|
68
|
+
type: {
|
69
|
+
name: 'String'
|
70
|
+
}
|
71
|
+
},
|
72
|
+
name: {
|
73
|
+
client_side_validation: true,
|
74
|
+
required: false,
|
75
|
+
read_only: true,
|
76
|
+
serialized_name: 'name',
|
77
|
+
type: {
|
78
|
+
name: 'String'
|
79
|
+
}
|
80
|
+
},
|
81
|
+
url: {
|
82
|
+
client_side_validation: true,
|
83
|
+
required: false,
|
84
|
+
read_only: true,
|
85
|
+
serialized_name: 'url',
|
86
|
+
type: {
|
87
|
+
name: 'String'
|
88
|
+
}
|
89
|
+
},
|
90
|
+
description: {
|
91
|
+
client_side_validation: true,
|
92
|
+
required: false,
|
93
|
+
read_only: true,
|
94
|
+
serialized_name: 'description',
|
95
|
+
type: {
|
96
|
+
name: 'String'
|
97
|
+
}
|
98
|
+
},
|
99
|
+
bing_id: {
|
100
|
+
client_side_validation: true,
|
101
|
+
required: false,
|
102
|
+
read_only: true,
|
103
|
+
serialized_name: 'bingId',
|
104
|
+
type: {
|
105
|
+
name: 'String'
|
106
|
+
}
|
107
|
+
},
|
108
|
+
thumbnail_url: {
|
109
|
+
client_side_validation: true,
|
110
|
+
required: false,
|
111
|
+
read_only: true,
|
112
|
+
serialized_name: 'thumbnailUrl',
|
113
|
+
type: {
|
114
|
+
name: 'String'
|
115
|
+
}
|
116
|
+
},
|
117
|
+
provider: {
|
118
|
+
client_side_validation: true,
|
119
|
+
required: false,
|
120
|
+
read_only: true,
|
121
|
+
serialized_name: 'provider',
|
122
|
+
type: {
|
123
|
+
name: 'Sequence',
|
124
|
+
element: {
|
125
|
+
client_side_validation: true,
|
126
|
+
required: false,
|
127
|
+
serialized_name: 'ThingElementType',
|
128
|
+
type: {
|
129
|
+
name: 'Composite',
|
130
|
+
class_name: 'Thing'
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
},
|
135
|
+
text: {
|
136
|
+
client_side_validation: true,
|
137
|
+
required: false,
|
138
|
+
read_only: true,
|
139
|
+
serialized_name: 'text',
|
140
|
+
type: {
|
141
|
+
name: 'String'
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,116 @@
|
|
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::CustomSearch::V1_0
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines the error that occurred.
|
10
|
+
#
|
11
|
+
class Error
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [ErrorCode] The error code that identifies the category of
|
16
|
+
# error. Possible values include: 'None', 'ServerError',
|
17
|
+
# 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization',
|
18
|
+
# 'InsufficientAuthorization'. Default value: 'None' .
|
19
|
+
attr_accessor :code
|
20
|
+
|
21
|
+
# @return [ErrorSubCode] The error code that further helps to identify
|
22
|
+
# the error. Possible values include: 'UnexpectedError', 'ResourceError',
|
23
|
+
# 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue',
|
24
|
+
# 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
|
25
|
+
# 'AuthorizationRedundancy', 'AuthorizationDisabled',
|
26
|
+
# 'AuthorizationExpired'
|
27
|
+
attr_accessor :sub_code
|
28
|
+
|
29
|
+
# @return [String] A description of the error.
|
30
|
+
attr_accessor :message
|
31
|
+
|
32
|
+
# @return [String] A description that provides additional information
|
33
|
+
# about the error.
|
34
|
+
attr_accessor :more_details
|
35
|
+
|
36
|
+
# @return [String] The parameter in the request that caused the error.
|
37
|
+
attr_accessor :parameter
|
38
|
+
|
39
|
+
# @return [String] The parameter's value in the request that was not
|
40
|
+
# valid.
|
41
|
+
attr_accessor :value
|
42
|
+
|
43
|
+
|
44
|
+
#
|
45
|
+
# Mapper for Error class as Ruby Hash.
|
46
|
+
# This will be used for serialization/deserialization.
|
47
|
+
#
|
48
|
+
def self.mapper()
|
49
|
+
{
|
50
|
+
client_side_validation: true,
|
51
|
+
required: false,
|
52
|
+
serialized_name: 'Error',
|
53
|
+
type: {
|
54
|
+
name: 'Composite',
|
55
|
+
class_name: 'Error',
|
56
|
+
model_properties: {
|
57
|
+
code: {
|
58
|
+
client_side_validation: true,
|
59
|
+
required: true,
|
60
|
+
serialized_name: 'code',
|
61
|
+
default_value: 'None',
|
62
|
+
type: {
|
63
|
+
name: 'String'
|
64
|
+
}
|
65
|
+
},
|
66
|
+
sub_code: {
|
67
|
+
client_side_validation: true,
|
68
|
+
required: false,
|
69
|
+
read_only: true,
|
70
|
+
serialized_name: 'subCode',
|
71
|
+
type: {
|
72
|
+
name: 'String'
|
73
|
+
}
|
74
|
+
},
|
75
|
+
message: {
|
76
|
+
client_side_validation: true,
|
77
|
+
required: true,
|
78
|
+
serialized_name: 'message',
|
79
|
+
type: {
|
80
|
+
name: 'String'
|
81
|
+
}
|
82
|
+
},
|
83
|
+
more_details: {
|
84
|
+
client_side_validation: true,
|
85
|
+
required: false,
|
86
|
+
read_only: true,
|
87
|
+
serialized_name: 'moreDetails',
|
88
|
+
type: {
|
89
|
+
name: 'String'
|
90
|
+
}
|
91
|
+
},
|
92
|
+
parameter: {
|
93
|
+
client_side_validation: true,
|
94
|
+
required: false,
|
95
|
+
read_only: true,
|
96
|
+
serialized_name: 'parameter',
|
97
|
+
type: {
|
98
|
+
name: 'String'
|
99
|
+
}
|
100
|
+
},
|
101
|
+
value: {
|
102
|
+
client_side_validation: true,
|
103
|
+
required: false,
|
104
|
+
read_only: true,
|
105
|
+
serialized_name: 'value',
|
106
|
+
type: {
|
107
|
+
name: 'String'
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|