manticore-client 1.0.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/.gitignore +39 -0
- data/.openapi-generator/FILES +149 -0
- data/.openapi-generator/VERSION +1 -0
- data/.openapi-generator-ignore +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +160 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +103 -0
- data/LICENSE.txt +21 -0
- data/README.md +136 -0
- data/Rakefile +10 -0
- data/docs/AggComposite.md +20 -0
- data/docs/AggCompositeSource.md +18 -0
- data/docs/AggCompositeTerm.md +18 -0
- data/docs/AggTerms.md +20 -0
- data/docs/Aggregation.md +22 -0
- data/docs/AutocompleteRequest.md +22 -0
- data/docs/BoolFilter.md +22 -0
- data/docs/BulkResponse.md +26 -0
- data/docs/DeleteDocumentRequest.md +24 -0
- data/docs/DeleteResponse.md +26 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/FulltextFilter.md +24 -0
- data/docs/GeoDistance.md +24 -0
- data/docs/GeoDistanceLocationAnchor.md +20 -0
- data/docs/Highlight.md +62 -0
- data/docs/HighlightAllOfFields.md +15 -0
- data/docs/HighlightFieldOption.md +26 -0
- data/docs/HitsHits.md +22 -0
- data/docs/IndexApi.md +401 -0
- data/docs/InsertDocumentRequest.md +24 -0
- data/docs/Join.md +24 -0
- data/docs/JoinCond.md +22 -0
- data/docs/JoinOn.md +22 -0
- data/docs/KnnQuery.md +28 -0
- data/docs/Match.md +22 -0
- data/docs/MatchAll.md +18 -0
- data/docs/PercolateRequest.md +18 -0
- data/docs/PercolateRequestQuery.md +18 -0
- data/docs/QueryFilter.md +34 -0
- data/docs/Range.md +24 -0
- data/docs/ReplaceDocumentRequest.md +18 -0
- data/docs/ResponseError.md +49 -0
- data/docs/ResponseErrorDetails.md +22 -0
- data/docs/SearchApi.md +204 -0
- data/docs/SearchQuery.md +36 -0
- data/docs/SearchRequest.md +46 -0
- data/docs/SearchResponse.md +30 -0
- data/docs/SearchResponseHits.md +24 -0
- data/docs/SourceRules.md +20 -0
- data/docs/SqlResponse.md +49 -0
- data/docs/SuccessResponse.md +28 -0
- data/docs/UpdateDocumentRequest.md +26 -0
- data/docs/UpdateResponse.md +24 -0
- data/docs/UtilsApi.md +76 -0
- data/lib/manticore/client/api/index_api.rb +442 -0
- data/lib/manticore/client/api/search_api.rb +232 -0
- data/lib/manticore/client/api/utils_api.rb +93 -0
- data/lib/manticore/client/api_client.rb +437 -0
- data/lib/manticore/client/api_error.rb +58 -0
- data/lib/manticore/client/configuration.rb +385 -0
- data/lib/manticore/client/models/agg_composite.rb +233 -0
- data/lib/manticore/client/models/agg_composite_source.rb +238 -0
- data/lib/manticore/client/models/agg_composite_term.rb +239 -0
- data/lib/manticore/client/models/agg_terms.rb +249 -0
- data/lib/manticore/client/models/aggregation.rb +240 -0
- data/lib/manticore/client/models/autocomplete_request.rb +276 -0
- data/lib/manticore/client/models/bool_filter.rb +247 -0
- data/lib/manticore/client/models/bulk_response.rb +264 -0
- data/lib/manticore/client/models/delete_document_request.rb +269 -0
- data/lib/manticore/client/models/delete_response.rb +262 -0
- data/lib/manticore/client/models/error_response.rb +250 -0
- data/lib/manticore/client/models/fulltext_filter.rb +252 -0
- data/lib/manticore/client/models/geo_distance.rb +306 -0
- data/lib/manticore/client/models/geo_distance_location_anchor.rb +232 -0
- data/lib/manticore/client/models/highlight.rb +525 -0
- data/lib/manticore/client/models/highlight_all_of_fields.rb +105 -0
- data/lib/manticore/client/models/highlight_field_option.rb +262 -0
- data/lib/manticore/client/models/hits_hits.rb +242 -0
- data/lib/manticore/client/models/insert_document_request.rb +286 -0
- data/lib/manticore/client/models/join.rb +327 -0
- data/lib/manticore/client/models/join_cond.rb +276 -0
- data/lib/manticore/client/models/join_on.rb +272 -0
- data/lib/manticore/client/models/knn_query.rb +307 -0
- data/lib/manticore/client/models/match.rb +290 -0
- data/lib/manticore/client/models/match_all.rb +262 -0
- data/lib/manticore/client/models/percolate_request.rb +238 -0
- data/lib/manticore/client/models/percolate_request_query.rb +238 -0
- data/lib/manticore/client/models/query_filter.rb +307 -0
- data/lib/manticore/client/models/range.rb +252 -0
- data/lib/manticore/client/models/replace_document_request.rb +239 -0
- data/lib/manticore/client/models/response_error.rb +105 -0
- data/lib/manticore/client/models/response_error_details.rb +261 -0
- data/lib/manticore/client/models/search_query.rb +316 -0
- data/lib/manticore/client/models/search_request.rb +382 -0
- data/lib/manticore/client/models/search_response.rb +281 -0
- data/lib/manticore/client/models/search_response_hits.rb +254 -0
- data/lib/manticore/client/models/source_rules.rb +236 -0
- data/lib/manticore/client/models/sql_response.rb +106 -0
- data/lib/manticore/client/models/success_response.rb +272 -0
- data/lib/manticore/client/models/update_document_request.rb +296 -0
- data/lib/manticore/client/models/update_response.rb +252 -0
- data/lib/manticore/client/version.rb +7 -0
- data/lib/manticore/client.rb +32 -0
- data/lib/manticore-client.rb +3 -0
- data/manticore-client.gemspec +34 -0
- data/spec/api/index_api_spec.rb +179 -0
- data/spec/api/search_api_spec.rb +94 -0
- data/spec/api/utils_api_spec.rb +100 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/manticore_sql_helper.rb +33 -0
- metadata +218 -0
@@ -0,0 +1,232 @@
|
|
1
|
+
=begin
|
2
|
+
#Manticore Search Client
|
3
|
+
|
4
|
+
#Сlient for Manticore Search.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 5.0.0
|
7
|
+
Contact: info@manticoresearch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.13.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Manticore::Client
|
16
|
+
class SearchApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Performs an autocomplete search on a table
|
23
|
+
# The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [**Autocomplete**](Autocomplete.md) An example: ``` { \"table\":\"table_name\", \"query\":\"query_beginning\" } ``` An example of the method's response: ``` [ { \"total\": 3, \"error\": \"\", \"warning\": \"\", \"columns\": [ { \"query\": { \"type\": \"string\" } } ], \"data\": [ { \"query\": \"hello\" }, { \"query\": \"helio\" }, { \"query\": \"hell\" } ] } ] ``` For more detailed information about the autocomplete queries, please refer to the documentation [here](https://manual.manticoresearch.com/Searching/Autocomplete).
|
24
|
+
# @param autocomplete_request [AutocompleteRequest]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Array<Object>]
|
27
|
+
def autocomplete(autocomplete_request, opts = {})
|
28
|
+
data, _status_code, _headers = autocomplete_with_http_info(autocomplete_request, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Performs an autocomplete search on a table
|
33
|
+
# The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [**Autocomplete**](Autocomplete.md) An example: ``` { \"table\":\"table_name\", \"query\":\"query_beginning\" } ``` An example of the method's response: ``` [ { \"total\": 3, \"error\": \"\", \"warning\": \"\", \"columns\": [ { \"query\": { \"type\": \"string\" } } ], \"data\": [ { \"query\": \"hello\" }, { \"query\": \"helio\" }, { \"query\": \"hell\" } ] } ] ``` For more detailed information about the autocomplete queries, please refer to the documentation [here](https://manual.manticoresearch.com/Searching/Autocomplete).
|
34
|
+
# @param autocomplete_request [AutocompleteRequest]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Array<Object>, Integer, Hash)>] Array<Object> data, response status code and response headers
|
37
|
+
def autocomplete_with_http_info(autocomplete_request, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: SearchApi.autocomplete ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'autocomplete_request' is set
|
42
|
+
if @api_client.config.client_side_validation && autocomplete_request.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'autocomplete_request' when calling SearchApi.autocomplete"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/autocomplete'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
57
|
+
if !content_type.nil?
|
58
|
+
header_params['Content-Type'] = content_type
|
59
|
+
end
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(autocomplete_request)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'Array<Object>'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || []
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"SearchApi.autocomplete",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: SearchApi#autocomplete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# Perform reverse search on a percolate table
|
91
|
+
# Performs a percolate search. This method must be used only on percolate tables. Expects two parameters: the table name and an object with array of documents to be tested. An example of the documents object: ``` { \"query\" { \"percolate\": { \"document\": { \"content\":\"sample content\" } } } } ``` Responds with an object with matched stored queries: ``` { 'timed_out':false, 'hits': { 'total':2, 'max_score':1, 'hits': [ { 'table':'idx_pq_1', '_type':'doc', '_id':'2', '_score':'1', '_source': { 'query': { 'match':{'title':'some'} } } }, { 'table':'idx_pq_1', '_type':'doc', '_id':'5', '_score':'1', '_source': { 'query': { 'ql':'some | none' } } } ] } } ```
|
92
|
+
# @param table [String] Name of the percolate table
|
93
|
+
# @param percolate_request [PercolateRequest]
|
94
|
+
# @param [Hash] opts the optional parameters
|
95
|
+
# @return [SearchResponse]
|
96
|
+
def percolate(table, percolate_request, opts = {})
|
97
|
+
data, _status_code, _headers = percolate_with_http_info(table, percolate_request, opts)
|
98
|
+
data
|
99
|
+
end
|
100
|
+
|
101
|
+
# Perform reverse search on a percolate table
|
102
|
+
# Performs a percolate search. This method must be used only on percolate tables. Expects two parameters: the table name and an object with array of documents to be tested. An example of the documents object: ``` { \"query\" { \"percolate\": { \"document\": { \"content\":\"sample content\" } } } } ``` Responds with an object with matched stored queries: ``` { 'timed_out':false, 'hits': { 'total':2, 'max_score':1, 'hits': [ { 'table':'idx_pq_1', '_type':'doc', '_id':'2', '_score':'1', '_source': { 'query': { 'match':{'title':'some'} } } }, { 'table':'idx_pq_1', '_type':'doc', '_id':'5', '_score':'1', '_source': { 'query': { 'ql':'some | none' } } } ] } } ```
|
103
|
+
# @param table [String] Name of the percolate table
|
104
|
+
# @param percolate_request [PercolateRequest]
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @return [Array<(SearchResponse, Integer, Hash)>] SearchResponse data, response status code and response headers
|
107
|
+
def percolate_with_http_info(table, percolate_request, opts = {})
|
108
|
+
if @api_client.config.debugging
|
109
|
+
@api_client.config.logger.debug 'Calling API: SearchApi.percolate ...'
|
110
|
+
end
|
111
|
+
# verify the required parameter 'table' is set
|
112
|
+
if @api_client.config.client_side_validation && table.nil?
|
113
|
+
fail ArgumentError, "Missing the required parameter 'table' when calling SearchApi.percolate"
|
114
|
+
end
|
115
|
+
# verify the required parameter 'percolate_request' is set
|
116
|
+
if @api_client.config.client_side_validation && percolate_request.nil?
|
117
|
+
fail ArgumentError, "Missing the required parameter 'percolate_request' when calling SearchApi.percolate"
|
118
|
+
end
|
119
|
+
# resource path
|
120
|
+
local_var_path = '/pq/{table}/search'.sub('{' + 'table' + '}', CGI.escape(table.to_s))
|
121
|
+
|
122
|
+
# query parameters
|
123
|
+
query_params = opts[:query_params] || {}
|
124
|
+
|
125
|
+
# header parameters
|
126
|
+
header_params = opts[:header_params] || {}
|
127
|
+
# HTTP header 'Accept' (if needed)
|
128
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
129
|
+
# HTTP header 'Content-Type'
|
130
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
131
|
+
if !content_type.nil?
|
132
|
+
header_params['Content-Type'] = content_type
|
133
|
+
end
|
134
|
+
|
135
|
+
# form parameters
|
136
|
+
form_params = opts[:form_params] || {}
|
137
|
+
|
138
|
+
# http body (model)
|
139
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(percolate_request)
|
140
|
+
|
141
|
+
# return_type
|
142
|
+
return_type = opts[:debug_return_type] || 'SearchResponse'
|
143
|
+
|
144
|
+
# auth_names
|
145
|
+
auth_names = opts[:debug_auth_names] || []
|
146
|
+
|
147
|
+
new_options = opts.merge(
|
148
|
+
:operation => :"SearchApi.percolate",
|
149
|
+
:header_params => header_params,
|
150
|
+
:query_params => query_params,
|
151
|
+
:form_params => form_params,
|
152
|
+
:body => post_body,
|
153
|
+
:auth_names => auth_names,
|
154
|
+
:return_type => return_type
|
155
|
+
)
|
156
|
+
|
157
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
158
|
+
if @api_client.config.debugging
|
159
|
+
@api_client.config.logger.debug "API called: SearchApi#percolate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
160
|
+
end
|
161
|
+
return data, status_code, headers
|
162
|
+
end
|
163
|
+
|
164
|
+
# Performs a search on a table
|
165
|
+
# The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Also, if pagination is enabled, the response will include an additional 'scroll' property with a scroll token to use for pagination Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).
|
166
|
+
# @param search_request [SearchRequest]
|
167
|
+
# @param [Hash] opts the optional parameters
|
168
|
+
# @return [SearchResponse]
|
169
|
+
def search(search_request, opts = {})
|
170
|
+
data, _status_code, _headers = search_with_http_info(search_request, opts)
|
171
|
+
data
|
172
|
+
end
|
173
|
+
|
174
|
+
# Performs a search on a table
|
175
|
+
# The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Also, if pagination is enabled, the response will include an additional 'scroll' property with a scroll token to use for pagination Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).
|
176
|
+
# @param search_request [SearchRequest]
|
177
|
+
# @param [Hash] opts the optional parameters
|
178
|
+
# @return [Array<(SearchResponse, Integer, Hash)>] SearchResponse data, response status code and response headers
|
179
|
+
def search_with_http_info(search_request, opts = {})
|
180
|
+
if @api_client.config.debugging
|
181
|
+
@api_client.config.logger.debug 'Calling API: SearchApi.search ...'
|
182
|
+
end
|
183
|
+
# verify the required parameter 'search_request' is set
|
184
|
+
if @api_client.config.client_side_validation && search_request.nil?
|
185
|
+
fail ArgumentError, "Missing the required parameter 'search_request' when calling SearchApi.search"
|
186
|
+
end
|
187
|
+
# resource path
|
188
|
+
local_var_path = '/search'
|
189
|
+
|
190
|
+
# query parameters
|
191
|
+
query_params = opts[:query_params] || {}
|
192
|
+
|
193
|
+
# header parameters
|
194
|
+
header_params = opts[:header_params] || {}
|
195
|
+
# HTTP header 'Accept' (if needed)
|
196
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
197
|
+
# HTTP header 'Content-Type'
|
198
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
199
|
+
if !content_type.nil?
|
200
|
+
header_params['Content-Type'] = content_type
|
201
|
+
end
|
202
|
+
|
203
|
+
# form parameters
|
204
|
+
form_params = opts[:form_params] || {}
|
205
|
+
|
206
|
+
# http body (model)
|
207
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(search_request)
|
208
|
+
|
209
|
+
# return_type
|
210
|
+
return_type = opts[:debug_return_type] || 'SearchResponse'
|
211
|
+
|
212
|
+
# auth_names
|
213
|
+
auth_names = opts[:debug_auth_names] || []
|
214
|
+
|
215
|
+
new_options = opts.merge(
|
216
|
+
:operation => :"SearchApi.search",
|
217
|
+
:header_params => header_params,
|
218
|
+
:query_params => query_params,
|
219
|
+
:form_params => form_params,
|
220
|
+
:body => post_body,
|
221
|
+
:auth_names => auth_names,
|
222
|
+
:return_type => return_type
|
223
|
+
)
|
224
|
+
|
225
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
226
|
+
if @api_client.config.debugging
|
227
|
+
@api_client.config.logger.debug "API called: SearchApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
228
|
+
end
|
229
|
+
return data, status_code, headers
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
=begin
|
2
|
+
#Manticore Search Client
|
3
|
+
|
4
|
+
#Сlient for Manticore Search.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 5.0.0
|
7
|
+
Contact: info@manticoresearch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.13.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Manticore::Client
|
16
|
+
class UtilsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Perform SQL requests
|
23
|
+
# Run a query in SQL format. Expects a query string passed through `body` parameter and optional `raw_response` parameter that defines a format of response. `raw_response` can be set to `False` for Select queries only, e.g., `SELECT * FROM mytable` The query string must stay as it is, no URL encoding is needed. The response object depends on the query executed. In select mode the response has same format as `/search` operation.
|
24
|
+
# @param body [String] A query parameter string.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [Boolean] :raw_response Optional parameter, defines a format of response. Can be set to `False` for Select only queries and set to `True` for any type of queries. Default value is 'True'. (default to true)
|
27
|
+
# @return [SqlResponse]
|
28
|
+
def sql(body, opts = {})
|
29
|
+
data, _status_code, _headers = sql_with_http_info(body, opts)
|
30
|
+
data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Perform SQL requests
|
34
|
+
# Run a query in SQL format. Expects a query string passed through `body` parameter and optional `raw_response` parameter that defines a format of response. `raw_response` can be set to `False` for Select queries only, e.g., `SELECT * FROM mytable` The query string must stay as it is, no URL encoding is needed. The response object depends on the query executed. In select mode the response has same format as `/search` operation.
|
35
|
+
# @param body [String] A query parameter string.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @option opts [Boolean] :raw_response Optional parameter, defines a format of response. Can be set to `False` for Select only queries and set to `True` for any type of queries. Default value is 'True'. (default to true)
|
38
|
+
# @return [Array<(SqlResponse, Integer, Hash)>] SqlResponse data, response status code and response headers
|
39
|
+
def sql_with_http_info(body, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug 'Calling API: UtilsApi.sql ...'
|
42
|
+
end
|
43
|
+
# verify the required parameter 'body' is set
|
44
|
+
if @api_client.config.client_side_validation && body.nil?
|
45
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling UtilsApi.sql"
|
46
|
+
end
|
47
|
+
# resource path
|
48
|
+
local_var_path = '/sql'
|
49
|
+
|
50
|
+
# query parameters
|
51
|
+
query_params = opts[:query_params] || {}
|
52
|
+
query_params[:'raw_response'] = opts[:'raw_response'] if !opts[:'raw_response'].nil?
|
53
|
+
|
54
|
+
# header parameters
|
55
|
+
header_params = opts[:header_params] || {}
|
56
|
+
# HTTP header 'Accept' (if needed)
|
57
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
58
|
+
# HTTP header 'Content-Type'
|
59
|
+
content_type = @api_client.select_header_content_type(['text/plain'])
|
60
|
+
if !content_type.nil?
|
61
|
+
header_params['Content-Type'] = content_type
|
62
|
+
end
|
63
|
+
|
64
|
+
# form parameters
|
65
|
+
form_params = opts[:form_params] || {}
|
66
|
+
|
67
|
+
# http body (model)
|
68
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
|
69
|
+
|
70
|
+
# return_type
|
71
|
+
return_type = opts[:debug_return_type] || 'SqlResponse'
|
72
|
+
|
73
|
+
# auth_names
|
74
|
+
auth_names = opts[:debug_auth_names] || []
|
75
|
+
|
76
|
+
new_options = opts.merge(
|
77
|
+
:operation => :"UtilsApi.sql",
|
78
|
+
:header_params => header_params,
|
79
|
+
:query_params => query_params,
|
80
|
+
:form_params => form_params,
|
81
|
+
:body => post_body,
|
82
|
+
:auth_names => auth_names,
|
83
|
+
:return_type => return_type
|
84
|
+
)
|
85
|
+
|
86
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
87
|
+
if @api_client.config.debugging
|
88
|
+
@api_client.config.logger.debug "API called: UtilsApi#sql\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
89
|
+
end
|
90
|
+
return data, status_code, headers
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|