ibm_watson 0.16.1 → 0.17.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 +4 -4
- data/README.md +34 -12
- data/lib/ibm_watson/assistant_v1.rb +745 -720
- data/lib/ibm_watson/assistant_v2.rb +23 -19
- data/lib/ibm_watson/compare_comply_v1.rb +94 -89
- data/lib/ibm_watson/discovery_v1.rb +684 -687
- data/lib/ibm_watson/language_translator_v3.rb +234 -33
- data/lib/ibm_watson/natural_language_classifier_v1.rb +33 -29
- data/lib/ibm_watson/natural_language_understanding_v1.rb +33 -29
- data/lib/ibm_watson/personality_insights_v3.rb +18 -14
- data/lib/ibm_watson/speech_to_text_v1.rb +799 -725
- data/lib/ibm_watson/text_to_speech_v1.rb +201 -196
- data/lib/ibm_watson/tone_analyzer_v3.rb +15 -11
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +52 -48
- data/test/integration/test_language_translator_v3.rb +37 -1
- data/test/unit/test_language_translator_v3.rb +201 -16
- data/test/unit/test_speech_to_text_v1.rb +2 -2
- metadata +5 -5
@@ -14,11 +14,11 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
17
|
+
# IBM Watson™ Discovery is a cognitive search and content analytics engine that
|
18
|
+
# you can add to applications to identify patterns, trends and actionable insights to
|
19
|
+
# drive better decision-making. Securely unify structured and unstructured data with
|
20
|
+
# pre-enriched content, and use a simplified query language to eliminate the need for
|
21
|
+
# manual filtering of results.
|
22
22
|
|
23
23
|
require "concurrent"
|
24
24
|
require "erb"
|
@@ -49,16 +49,16 @@ module IBMWatson
|
|
49
49
|
# ready for a later version.
|
50
50
|
# @option args url [String] The base url to use when contacting the service (e.g.
|
51
51
|
# "https://gateway.watsonplatform.net/discovery/api").
|
52
|
-
# The base url may differ between
|
52
|
+
# The base url may differ between IBM Cloud regions.
|
53
53
|
# @option args username [String] The username used to authenticate with the service.
|
54
54
|
# Username and password credentials are only required to run your
|
55
|
-
# application locally or outside of
|
56
|
-
#
|
55
|
+
# application locally or outside of IBM Cloud. When running on
|
56
|
+
# IBM Cloud, the credentials will be automatically loaded from the
|
57
57
|
# `VCAP_SERVICES` environment variable.
|
58
58
|
# @option args password [String] The password used to authenticate with the service.
|
59
59
|
# Username and password credentials are only required to run your
|
60
|
-
# application locally or outside of
|
61
|
-
#
|
60
|
+
# application locally or outside of IBM Cloud. When running on
|
61
|
+
# IBM Cloud, the credentials will be automatically loaded from the
|
62
62
|
# `VCAP_SERVICES` environment variable.
|
63
63
|
# @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
|
64
64
|
# this API key is provided, the SDK will manage the token and handle the
|
@@ -68,7 +68,9 @@ module IBMWatson
|
|
68
68
|
# it expires or reactively upon receiving a 401 from the service as any requests
|
69
69
|
# made with an expired token will fail.
|
70
70
|
# @option args iam_url [String] An optional URL for the IAM service API. Defaults to
|
71
|
-
# 'https://iam.
|
71
|
+
# 'https://iam.cloud.ibm.com/identity/token'.
|
72
|
+
# @option args iam_client_id [String] An optional client id for the IAM service API.
|
73
|
+
# @option args iam_client_secret [String] An optional client secret for the IAM service API.
|
72
74
|
def initialize(args = {})
|
73
75
|
@__async_initialized__ = false
|
74
76
|
defaults = {}
|
@@ -79,6 +81,8 @@ module IBMWatson
|
|
79
81
|
defaults[:iam_apikey] = nil
|
80
82
|
defaults[:iam_access_token] = nil
|
81
83
|
defaults[:iam_url] = nil
|
84
|
+
defaults[:iam_client_id] = nil
|
85
|
+
defaults[:iam_client_secret] = nil
|
82
86
|
args = defaults.merge(args)
|
83
87
|
args[:vcap_services_name] = "discovery"
|
84
88
|
super
|
@@ -135,26 +139,26 @@ module IBMWatson
|
|
135
139
|
end
|
136
140
|
|
137
141
|
##
|
138
|
-
# @!method
|
139
|
-
#
|
140
|
-
#
|
142
|
+
# @!method list_environments(name: nil)
|
143
|
+
# List environments.
|
144
|
+
# List existing environments for the service instance.
|
145
|
+
# @param name [String] Show only the environment with the given name.
|
141
146
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
142
|
-
def
|
143
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
144
|
-
|
147
|
+
def list_environments(name: nil)
|
145
148
|
headers = {
|
146
149
|
}
|
147
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
150
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_environments")
|
148
151
|
headers.merge!(sdk_headers)
|
149
152
|
|
150
153
|
params = {
|
151
|
-
"version" => @version
|
154
|
+
"version" => @version,
|
155
|
+
"name" => name
|
152
156
|
}
|
153
157
|
|
154
|
-
method_url = "/v1/environments
|
158
|
+
method_url = "/v1/environments"
|
155
159
|
|
156
160
|
response = request(
|
157
|
-
method: "
|
161
|
+
method: "GET",
|
158
162
|
url: method_url,
|
159
163
|
headers: headers,
|
160
164
|
params: params,
|
@@ -193,61 +197,69 @@ module IBMWatson
|
|
193
197
|
end
|
194
198
|
|
195
199
|
##
|
196
|
-
# @!method
|
197
|
-
#
|
198
|
-
#
|
199
|
-
#
|
200
|
+
# @!method update_environment(environment_id:, name: nil, description: nil, size: nil)
|
201
|
+
# Update an environment.
|
202
|
+
# Updates an environment. The environment's **name** and **description** parameters
|
203
|
+
# can be changed. You must specify a **name** for the environment.
|
204
|
+
# @param environment_id [String] The ID of the environment.
|
205
|
+
# @param name [String] Name that identifies the environment.
|
206
|
+
# @param description [String] Description of the environment.
|
207
|
+
# @param size [String] Size that the environment should be increased to. Environment size cannot be
|
208
|
+
# modified when using a Lite plan. Environment size can only increased and not
|
209
|
+
# decreased.
|
200
210
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
201
|
-
def
|
211
|
+
def update_environment(environment_id:, name: nil, description: nil, size: nil)
|
212
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
213
|
+
|
202
214
|
headers = {
|
203
215
|
}
|
204
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
216
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_environment")
|
205
217
|
headers.merge!(sdk_headers)
|
206
218
|
|
207
219
|
params = {
|
208
|
-
"version" => @version
|
209
|
-
"name" => name
|
220
|
+
"version" => @version
|
210
221
|
}
|
211
222
|
|
212
|
-
|
223
|
+
data = {
|
224
|
+
"name" => name,
|
225
|
+
"description" => description,
|
226
|
+
"size" => size
|
227
|
+
}
|
228
|
+
|
229
|
+
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
213
230
|
|
214
231
|
response = request(
|
215
|
-
method: "
|
232
|
+
method: "PUT",
|
216
233
|
url: method_url,
|
217
234
|
headers: headers,
|
218
235
|
params: params,
|
236
|
+
json: data,
|
219
237
|
accept_json: true
|
220
238
|
)
|
221
239
|
response
|
222
240
|
end
|
223
241
|
|
224
242
|
##
|
225
|
-
# @!method
|
226
|
-
#
|
227
|
-
# Gets a list of the unique fields (and their types) stored in the indexes of the
|
228
|
-
# specified collections.
|
243
|
+
# @!method delete_environment(environment_id:)
|
244
|
+
# Delete environment.
|
229
245
|
# @param environment_id [String] The ID of the environment.
|
230
|
-
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
231
246
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
232
|
-
def
|
247
|
+
def delete_environment(environment_id:)
|
233
248
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
234
249
|
|
235
|
-
raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
|
236
|
-
|
237
250
|
headers = {
|
238
251
|
}
|
239
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
252
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_environment")
|
240
253
|
headers.merge!(sdk_headers)
|
241
254
|
|
242
255
|
params = {
|
243
|
-
"version" => @version
|
244
|
-
"collection_ids" => collection_ids.to_a
|
256
|
+
"version" => @version
|
245
257
|
}
|
246
258
|
|
247
|
-
method_url = "/v1/environments/%s
|
259
|
+
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
248
260
|
|
249
261
|
response = request(
|
250
|
-
method: "
|
262
|
+
method: "DELETE",
|
251
263
|
url: method_url,
|
252
264
|
headers: headers,
|
253
265
|
params: params,
|
@@ -257,43 +269,35 @@ module IBMWatson
|
|
257
269
|
end
|
258
270
|
|
259
271
|
##
|
260
|
-
# @!method
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
272
|
+
# @!method list_fields(environment_id:, collection_ids:)
|
273
|
+
# List fields across collections.
|
274
|
+
# Gets a list of the unique fields (and their types) stored in the indexes of the
|
275
|
+
# specified collections.
|
264
276
|
# @param environment_id [String] The ID of the environment.
|
265
|
-
# @param
|
266
|
-
# @param description [String] Description of the environment.
|
267
|
-
# @param size [String] Size that the environment should be increased to. Environment size cannot be
|
268
|
-
# modified when using a Lite plan. Environment size can only increased and not
|
269
|
-
# decreased.
|
277
|
+
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
270
278
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
271
|
-
def
|
279
|
+
def list_fields(environment_id:, collection_ids:)
|
272
280
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
273
281
|
|
282
|
+
raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
|
283
|
+
|
274
284
|
headers = {
|
275
285
|
}
|
276
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
286
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_fields")
|
277
287
|
headers.merge!(sdk_headers)
|
278
288
|
|
279
289
|
params = {
|
280
|
-
"version" => @version
|
281
|
-
|
282
|
-
|
283
|
-
data = {
|
284
|
-
"name" => name,
|
285
|
-
"description" => description,
|
286
|
-
"size" => size
|
290
|
+
"version" => @version,
|
291
|
+
"collection_ids" => collection_ids.to_a
|
287
292
|
}
|
288
293
|
|
289
|
-
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
294
|
+
method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
|
290
295
|
|
291
296
|
response = request(
|
292
|
-
method: "
|
297
|
+
method: "GET",
|
293
298
|
url: method_url,
|
294
299
|
headers: headers,
|
295
300
|
params: params,
|
296
|
-
json: data,
|
297
301
|
accept_json: true
|
298
302
|
)
|
299
303
|
response
|
@@ -364,35 +368,29 @@ module IBMWatson
|
|
364
368
|
end
|
365
369
|
|
366
370
|
##
|
367
|
-
# @!method
|
368
|
-
#
|
369
|
-
#
|
370
|
-
# succeeds even if the configuration is referenced by a collection or document
|
371
|
-
# ingestion. However, documents that have already been submitted for processing
|
372
|
-
# continue to use the deleted configuration. Documents are always processed with a
|
373
|
-
# snapshot of the configuration as it existed at the time the document was
|
374
|
-
# submitted.
|
371
|
+
# @!method list_configurations(environment_id:, name: nil)
|
372
|
+
# List configurations.
|
373
|
+
# Lists existing configurations for the service instance.
|
375
374
|
# @param environment_id [String] The ID of the environment.
|
376
|
-
# @param
|
375
|
+
# @param name [String] Find configurations with the given name.
|
377
376
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
378
|
-
def
|
377
|
+
def list_configurations(environment_id:, name: nil)
|
379
378
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
380
379
|
|
381
|
-
raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil?
|
382
|
-
|
383
380
|
headers = {
|
384
381
|
}
|
385
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
382
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_configurations")
|
386
383
|
headers.merge!(sdk_headers)
|
387
384
|
|
388
385
|
params = {
|
389
|
-
"version" => @version
|
386
|
+
"version" => @version,
|
387
|
+
"name" => name
|
390
388
|
}
|
391
389
|
|
392
|
-
method_url = "/v1/environments/%s/configurations
|
390
|
+
method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
|
393
391
|
|
394
392
|
response = request(
|
395
|
-
method: "
|
393
|
+
method: "GET",
|
396
394
|
url: method_url,
|
397
395
|
headers: headers,
|
398
396
|
params: params,
|
@@ -433,38 +431,6 @@ module IBMWatson
|
|
433
431
|
response
|
434
432
|
end
|
435
433
|
|
436
|
-
##
|
437
|
-
# @!method list_configurations(environment_id:, name: nil)
|
438
|
-
# List configurations.
|
439
|
-
# Lists existing configurations for the service instance.
|
440
|
-
# @param environment_id [String] The ID of the environment.
|
441
|
-
# @param name [String] Find configurations with the given name.
|
442
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
443
|
-
def list_configurations(environment_id:, name: nil)
|
444
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
445
|
-
|
446
|
-
headers = {
|
447
|
-
}
|
448
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_configurations")
|
449
|
-
headers.merge!(sdk_headers)
|
450
|
-
|
451
|
-
params = {
|
452
|
-
"version" => @version,
|
453
|
-
"name" => name
|
454
|
-
}
|
455
|
-
|
456
|
-
method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
|
457
|
-
|
458
|
-
response = request(
|
459
|
-
method: "GET",
|
460
|
-
url: method_url,
|
461
|
-
headers: headers,
|
462
|
-
params: params,
|
463
|
-
accept_json: true
|
464
|
-
)
|
465
|
-
response
|
466
|
-
end
|
467
|
-
|
468
434
|
##
|
469
435
|
# @!method update_configuration(environment_id:, configuration_id:, name:, description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil)
|
470
436
|
# Update a configuration.
|
@@ -525,6 +491,44 @@ module IBMWatson
|
|
525
491
|
)
|
526
492
|
response
|
527
493
|
end
|
494
|
+
|
495
|
+
##
|
496
|
+
# @!method delete_configuration(environment_id:, configuration_id:)
|
497
|
+
# Delete a configuration.
|
498
|
+
# The deletion is performed unconditionally. A configuration deletion request
|
499
|
+
# succeeds even if the configuration is referenced by a collection or document
|
500
|
+
# ingestion. However, documents that have already been submitted for processing
|
501
|
+
# continue to use the deleted configuration. Documents are always processed with a
|
502
|
+
# snapshot of the configuration as it existed at the time the document was
|
503
|
+
# submitted.
|
504
|
+
# @param environment_id [String] The ID of the environment.
|
505
|
+
# @param configuration_id [String] The ID of the configuration.
|
506
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
507
|
+
def delete_configuration(environment_id:, configuration_id:)
|
508
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
509
|
+
|
510
|
+
raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil?
|
511
|
+
|
512
|
+
headers = {
|
513
|
+
}
|
514
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_configuration")
|
515
|
+
headers.merge!(sdk_headers)
|
516
|
+
|
517
|
+
params = {
|
518
|
+
"version" => @version
|
519
|
+
}
|
520
|
+
|
521
|
+
method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
|
522
|
+
|
523
|
+
response = request(
|
524
|
+
method: "DELETE",
|
525
|
+
url: method_url,
|
526
|
+
headers: headers,
|
527
|
+
params: params,
|
528
|
+
accept_json: true
|
529
|
+
)
|
530
|
+
response
|
531
|
+
end
|
528
532
|
#########################
|
529
533
|
# Test your configuration on a document
|
530
534
|
#########################
|
@@ -532,7 +536,10 @@ module IBMWatson
|
|
532
536
|
##
|
533
537
|
# @!method test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
|
534
538
|
# Test configuration.
|
535
|
-
#
|
539
|
+
# **Deprecated** This method is no longer supported and is scheduled to be removed
|
540
|
+
# from service on July 31st 2019.
|
541
|
+
#
|
542
|
+
# Runs a sample document through the default or your configuration and returns
|
536
543
|
# diagnostic information designed to help you understand how the document was
|
537
544
|
# processed. The document is not added to the index.
|
538
545
|
# @param environment_id [String] The ID of the environment.
|
@@ -549,10 +556,8 @@ module IBMWatson
|
|
549
556
|
# rejected.
|
550
557
|
# @param filename [String] The filename for file.
|
551
558
|
# @param file_content_type [String] The content type of file.
|
552
|
-
# @param metadata [String]
|
553
|
-
#
|
554
|
-
# supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
|
555
|
-
# rejected.
|
559
|
+
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
560
|
+
# are rejected.
|
556
561
|
# Example: ``` {
|
557
562
|
# \"Creator\": \"Johnny Appleseed\",
|
558
563
|
# \"Subject\": \"Apples\"
|
@@ -653,29 +658,29 @@ module IBMWatson
|
|
653
658
|
end
|
654
659
|
|
655
660
|
##
|
656
|
-
# @!method
|
657
|
-
#
|
661
|
+
# @!method list_collections(environment_id:, name: nil)
|
662
|
+
# List collections.
|
663
|
+
# Lists existing collections for the service instance.
|
658
664
|
# @param environment_id [String] The ID of the environment.
|
659
|
-
# @param
|
665
|
+
# @param name [String] Find collections with the given name.
|
660
666
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
661
|
-
def
|
667
|
+
def list_collections(environment_id:, name: nil)
|
662
668
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
663
669
|
|
664
|
-
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
665
|
-
|
666
670
|
headers = {
|
667
671
|
}
|
668
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
672
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collections")
|
669
673
|
headers.merge!(sdk_headers)
|
670
674
|
|
671
675
|
params = {
|
672
|
-
"version" => @version
|
676
|
+
"version" => @version,
|
677
|
+
"name" => name
|
673
678
|
}
|
674
679
|
|
675
|
-
method_url = "/v1/environments/%s/collections
|
680
|
+
method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
|
676
681
|
|
677
682
|
response = request(
|
678
|
-
method: "
|
683
|
+
method: "GET",
|
679
684
|
url: method_url,
|
680
685
|
headers: headers,
|
681
686
|
params: params,
|
@@ -717,62 +722,71 @@ module IBMWatson
|
|
717
722
|
end
|
718
723
|
|
719
724
|
##
|
720
|
-
# @!method
|
721
|
-
#
|
722
|
-
# Gets a list of the unique fields (and their types) stored in the index.
|
725
|
+
# @!method update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
|
726
|
+
# Update a collection.
|
723
727
|
# @param environment_id [String] The ID of the environment.
|
724
728
|
# @param collection_id [String] The ID of the collection.
|
729
|
+
# @param name [String] The name of the collection.
|
730
|
+
# @param description [String] A description of the collection.
|
731
|
+
# @param configuration_id [String] The ID of the configuration in which the collection is to be updated.
|
725
732
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
726
|
-
def
|
733
|
+
def update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
|
727
734
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
728
735
|
|
729
736
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
730
737
|
|
731
738
|
headers = {
|
732
739
|
}
|
733
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
740
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_collection")
|
734
741
|
headers.merge!(sdk_headers)
|
735
742
|
|
736
743
|
params = {
|
737
744
|
"version" => @version
|
738
745
|
}
|
739
746
|
|
740
|
-
|
747
|
+
data = {
|
748
|
+
"name" => name,
|
749
|
+
"description" => description,
|
750
|
+
"configuration_id" => configuration_id
|
751
|
+
}
|
752
|
+
|
753
|
+
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
741
754
|
|
742
755
|
response = request(
|
743
|
-
method: "
|
756
|
+
method: "PUT",
|
744
757
|
url: method_url,
|
745
758
|
headers: headers,
|
746
759
|
params: params,
|
760
|
+
json: data,
|
747
761
|
accept_json: true
|
748
762
|
)
|
749
763
|
response
|
750
764
|
end
|
751
765
|
|
752
766
|
##
|
753
|
-
# @!method
|
754
|
-
#
|
755
|
-
# Lists existing collections for the service instance.
|
767
|
+
# @!method delete_collection(environment_id:, collection_id:)
|
768
|
+
# Delete a collection.
|
756
769
|
# @param environment_id [String] The ID of the environment.
|
757
|
-
# @param
|
770
|
+
# @param collection_id [String] The ID of the collection.
|
758
771
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
759
|
-
def
|
772
|
+
def delete_collection(environment_id:, collection_id:)
|
760
773
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
761
774
|
|
775
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
776
|
+
|
762
777
|
headers = {
|
763
778
|
}
|
764
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
779
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_collection")
|
765
780
|
headers.merge!(sdk_headers)
|
766
781
|
|
767
782
|
params = {
|
768
|
-
"version" => @version
|
769
|
-
"name" => name
|
783
|
+
"version" => @version
|
770
784
|
}
|
771
785
|
|
772
|
-
method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
|
786
|
+
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
773
787
|
|
774
788
|
response = request(
|
775
|
-
method: "
|
789
|
+
method: "DELETE",
|
776
790
|
url: method_url,
|
777
791
|
headers: headers,
|
778
792
|
params: params,
|
@@ -782,42 +796,33 @@ module IBMWatson
|
|
782
796
|
end
|
783
797
|
|
784
798
|
##
|
785
|
-
# @!method
|
786
|
-
#
|
799
|
+
# @!method list_collection_fields(environment_id:, collection_id:)
|
800
|
+
# List collection fields.
|
801
|
+
# Gets a list of the unique fields (and their types) stored in the index.
|
787
802
|
# @param environment_id [String] The ID of the environment.
|
788
803
|
# @param collection_id [String] The ID of the collection.
|
789
|
-
# @param name [String] The name of the collection.
|
790
|
-
# @param description [String] A description of the collection.
|
791
|
-
# @param configuration_id [String] The ID of the configuration in which the collection is to be updated.
|
792
804
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
793
|
-
def
|
805
|
+
def list_collection_fields(environment_id:, collection_id:)
|
794
806
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
795
807
|
|
796
808
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
797
809
|
|
798
810
|
headers = {
|
799
811
|
}
|
800
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
812
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collection_fields")
|
801
813
|
headers.merge!(sdk_headers)
|
802
814
|
|
803
815
|
params = {
|
804
816
|
"version" => @version
|
805
817
|
}
|
806
818
|
|
807
|
-
|
808
|
-
"name" => name,
|
809
|
-
"description" => description,
|
810
|
-
"configuration_id" => configuration_id
|
811
|
-
}
|
812
|
-
|
813
|
-
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
819
|
+
method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
814
820
|
|
815
821
|
response = request(
|
816
|
-
method: "
|
822
|
+
method: "GET",
|
817
823
|
url: method_url,
|
818
824
|
headers: headers,
|
819
825
|
params: params,
|
820
|
-
json: data,
|
821
826
|
accept_json: true
|
822
827
|
)
|
823
828
|
response
|
@@ -826,6 +831,40 @@ module IBMWatson
|
|
826
831
|
# Query modifications
|
827
832
|
#########################
|
828
833
|
|
834
|
+
##
|
835
|
+
# @!method list_expansions(environment_id:, collection_id:)
|
836
|
+
# Get the expansion list.
|
837
|
+
# Returns the current expansion list for the specified collection. If an expansion
|
838
|
+
# list is not specified, an object with empty expansion arrays is returned.
|
839
|
+
# @param environment_id [String] The ID of the environment.
|
840
|
+
# @param collection_id [String] The ID of the collection.
|
841
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
842
|
+
def list_expansions(environment_id:, collection_id:)
|
843
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
844
|
+
|
845
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
846
|
+
|
847
|
+
headers = {
|
848
|
+
}
|
849
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_expansions")
|
850
|
+
headers.merge!(sdk_headers)
|
851
|
+
|
852
|
+
params = {
|
853
|
+
"version" => @version
|
854
|
+
}
|
855
|
+
|
856
|
+
method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
857
|
+
|
858
|
+
response = request(
|
859
|
+
method: "GET",
|
860
|
+
url: method_url,
|
861
|
+
headers: headers,
|
862
|
+
params: params,
|
863
|
+
accept_json: true
|
864
|
+
)
|
865
|
+
response
|
866
|
+
end
|
867
|
+
|
829
868
|
##
|
830
869
|
# @!method create_expansions(environment_id:, collection_id:, expansions:)
|
831
870
|
# Create or update expansion list.
|
@@ -885,158 +924,112 @@ module IBMWatson
|
|
885
924
|
end
|
886
925
|
|
887
926
|
##
|
888
|
-
# @!method
|
889
|
-
#
|
890
|
-
#
|
927
|
+
# @!method delete_expansions(environment_id:, collection_id:)
|
928
|
+
# Delete the expansion list.
|
929
|
+
# Remove the expansion information for this collection. The expansion list must be
|
930
|
+
# deleted to disable query expansion for a collection.
|
891
931
|
# @param environment_id [String] The ID of the environment.
|
892
932
|
# @param collection_id [String] The ID of the collection.
|
893
|
-
# @
|
894
|
-
|
895
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
896
|
-
def create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
|
933
|
+
# @return [nil]
|
934
|
+
def delete_expansions(environment_id:, collection_id:)
|
897
935
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
898
936
|
|
899
937
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
900
938
|
|
901
|
-
raise ArgumentError.new("stopword_file must be provided") if stopword_file.nil?
|
902
|
-
|
903
939
|
headers = {
|
904
940
|
}
|
905
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
941
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_expansions")
|
906
942
|
headers.merge!(sdk_headers)
|
907
943
|
|
908
944
|
params = {
|
909
945
|
"version" => @version
|
910
946
|
}
|
911
947
|
|
912
|
-
|
913
|
-
|
914
|
-
unless stopword_file.instance_of?(StringIO) || stopword_file.instance_of?(File)
|
915
|
-
stopword_file = stopword_file.respond_to?(:to_json) ? StringIO.new(stopword_file.to_json) : StringIO.new(stopword_file)
|
916
|
-
end
|
917
|
-
stopword_filename = stopword_file.path if stopword_filename.nil? && stopword_file.respond_to?(:path)
|
918
|
-
form_data[:stopword_file] = HTTP::FormData::File.new(stopword_file, content_type: "application/octet-stream", filename: stopword_filename)
|
919
|
-
|
920
|
-
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
948
|
+
method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
921
949
|
|
922
|
-
|
923
|
-
method: "
|
950
|
+
request(
|
951
|
+
method: "DELETE",
|
924
952
|
url: method_url,
|
925
953
|
headers: headers,
|
926
954
|
params: params,
|
927
|
-
|
928
|
-
accept_json: true
|
955
|
+
accept_json: false
|
929
956
|
)
|
930
|
-
|
957
|
+
nil
|
931
958
|
end
|
932
959
|
|
933
960
|
##
|
934
|
-
# @!method
|
935
|
-
#
|
936
|
-
#
|
961
|
+
# @!method get_tokenization_dictionary_status(environment_id:, collection_id:)
|
962
|
+
# Get tokenization dictionary status.
|
963
|
+
# Returns the current status of the tokenization dictionary for the specified
|
964
|
+
# collection.
|
937
965
|
# @param environment_id [String] The ID of the environment.
|
938
966
|
# @param collection_id [String] The ID of the collection.
|
939
|
-
# @param tokenization_rules [Array[TokenDictRule]] An array of tokenization rules. Each rule contains, the original `text` string,
|
940
|
-
# component `tokens`, any alternate character set `readings`, and which
|
941
|
-
# `part_of_speech` the text is from.
|
942
967
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
943
|
-
def
|
968
|
+
def get_tokenization_dictionary_status(environment_id:, collection_id:)
|
944
969
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
945
970
|
|
946
971
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
947
972
|
|
948
973
|
headers = {
|
949
974
|
}
|
950
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
975
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_tokenization_dictionary_status")
|
951
976
|
headers.merge!(sdk_headers)
|
952
977
|
|
953
978
|
params = {
|
954
979
|
"version" => @version
|
955
980
|
}
|
956
981
|
|
957
|
-
data = {
|
958
|
-
"tokenization_rules" => tokenization_rules
|
959
|
-
}
|
960
|
-
|
961
982
|
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
962
983
|
|
963
984
|
response = request(
|
964
|
-
method: "
|
985
|
+
method: "GET",
|
965
986
|
url: method_url,
|
966
987
|
headers: headers,
|
967
988
|
params: params,
|
968
|
-
json: data,
|
969
989
|
accept_json: true
|
970
990
|
)
|
971
991
|
response
|
972
992
|
end
|
973
993
|
|
974
994
|
##
|
975
|
-
# @!method
|
976
|
-
#
|
977
|
-
#
|
978
|
-
# deleted to disable query expansion for a collection.
|
995
|
+
# @!method create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
|
996
|
+
# Create tokenization dictionary.
|
997
|
+
# Upload a custom tokenization dictionary to use with the specified collection.
|
979
998
|
# @param environment_id [String] The ID of the environment.
|
980
999
|
# @param collection_id [String] The ID of the collection.
|
981
|
-
# @
|
982
|
-
|
1000
|
+
# @param tokenization_rules [Array[TokenDictRule]] An array of tokenization rules. Each rule contains, the original `text` string,
|
1001
|
+
# component `tokens`, any alternate character set `readings`, and which
|
1002
|
+
# `part_of_speech` the text is from.
|
1003
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1004
|
+
def create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
|
983
1005
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
984
1006
|
|
985
1007
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
986
1008
|
|
987
1009
|
headers = {
|
988
1010
|
}
|
989
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1011
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_tokenization_dictionary")
|
990
1012
|
headers.merge!(sdk_headers)
|
991
1013
|
|
992
1014
|
params = {
|
993
1015
|
"version" => @version
|
994
1016
|
}
|
995
1017
|
|
996
|
-
|
997
|
-
|
998
|
-
request(
|
999
|
-
method: "DELETE",
|
1000
|
-
url: method_url,
|
1001
|
-
headers: headers,
|
1002
|
-
params: params,
|
1003
|
-
accept_json: false
|
1004
|
-
)
|
1005
|
-
nil
|
1006
|
-
end
|
1007
|
-
|
1008
|
-
##
|
1009
|
-
# @!method delete_stopword_list(environment_id:, collection_id:)
|
1010
|
-
# Delete a custom stopword list.
|
1011
|
-
# Delete a custom stopword list from the collection. After a custom stopword list is
|
1012
|
-
# deleted, the default list is used for the collection.
|
1013
|
-
# @param environment_id [String] The ID of the environment.
|
1014
|
-
# @param collection_id [String] The ID of the collection.
|
1015
|
-
# @return [nil]
|
1016
|
-
def delete_stopword_list(environment_id:, collection_id:)
|
1017
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1018
|
-
|
1019
|
-
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1020
|
-
|
1021
|
-
headers = {
|
1022
|
-
}
|
1023
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_stopword_list")
|
1024
|
-
headers.merge!(sdk_headers)
|
1025
|
-
|
1026
|
-
params = {
|
1027
|
-
"version" => @version
|
1018
|
+
data = {
|
1019
|
+
"tokenization_rules" => tokenization_rules
|
1028
1020
|
}
|
1029
1021
|
|
1030
|
-
method_url = "/v1/environments/%s/collections/%s/word_lists/
|
1022
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1031
1023
|
|
1032
|
-
request(
|
1033
|
-
method: "
|
1024
|
+
response = request(
|
1025
|
+
method: "POST",
|
1034
1026
|
url: method_url,
|
1035
1027
|
headers: headers,
|
1036
1028
|
params: params,
|
1037
|
-
|
1029
|
+
json: data,
|
1030
|
+
accept_json: true
|
1038
1031
|
)
|
1039
|
-
|
1032
|
+
response
|
1040
1033
|
end
|
1041
1034
|
|
1042
1035
|
##
|
@@ -1106,71 +1099,83 @@ module IBMWatson
|
|
1106
1099
|
end
|
1107
1100
|
|
1108
1101
|
##
|
1109
|
-
# @!method
|
1110
|
-
#
|
1111
|
-
#
|
1112
|
-
# collection.
|
1102
|
+
# @!method create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
|
1103
|
+
# Create stopword list.
|
1104
|
+
# Upload a custom stopword list to use with the specified collection.
|
1113
1105
|
# @param environment_id [String] The ID of the environment.
|
1114
1106
|
# @param collection_id [String] The ID of the collection.
|
1107
|
+
# @param stopword_file [File] The content of the stopword list to ingest.
|
1108
|
+
# @param stopword_filename [String] The filename for stopword_file.
|
1115
1109
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1116
|
-
def
|
1110
|
+
def create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
|
1117
1111
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1118
1112
|
|
1119
1113
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1120
1114
|
|
1115
|
+
raise ArgumentError.new("stopword_file must be provided") if stopword_file.nil?
|
1116
|
+
|
1121
1117
|
headers = {
|
1122
1118
|
}
|
1123
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1119
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_stopword_list")
|
1124
1120
|
headers.merge!(sdk_headers)
|
1125
1121
|
|
1126
1122
|
params = {
|
1127
1123
|
"version" => @version
|
1128
1124
|
}
|
1129
1125
|
|
1130
|
-
|
1126
|
+
form_data = {}
|
1127
|
+
|
1128
|
+
unless stopword_file.instance_of?(StringIO) || stopword_file.instance_of?(File)
|
1129
|
+
stopword_file = stopword_file.respond_to?(:to_json) ? StringIO.new(stopword_file.to_json) : StringIO.new(stopword_file)
|
1130
|
+
end
|
1131
|
+
stopword_filename = stopword_file.path if stopword_filename.nil? && stopword_file.respond_to?(:path)
|
1132
|
+
form_data[:stopword_file] = HTTP::FormData::File.new(stopword_file, content_type: "application/octet-stream", filename: stopword_filename)
|
1133
|
+
|
1134
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1131
1135
|
|
1132
1136
|
response = request(
|
1133
|
-
method: "
|
1137
|
+
method: "POST",
|
1134
1138
|
url: method_url,
|
1135
1139
|
headers: headers,
|
1136
1140
|
params: params,
|
1141
|
+
form: form_data,
|
1137
1142
|
accept_json: true
|
1138
1143
|
)
|
1139
1144
|
response
|
1140
1145
|
end
|
1141
1146
|
|
1142
1147
|
##
|
1143
|
-
# @!method
|
1144
|
-
#
|
1145
|
-
#
|
1146
|
-
#
|
1148
|
+
# @!method delete_stopword_list(environment_id:, collection_id:)
|
1149
|
+
# Delete a custom stopword list.
|
1150
|
+
# Delete a custom stopword list from the collection. After a custom stopword list is
|
1151
|
+
# deleted, the default list is used for the collection.
|
1147
1152
|
# @param environment_id [String] The ID of the environment.
|
1148
1153
|
# @param collection_id [String] The ID of the collection.
|
1149
|
-
# @return [
|
1150
|
-
def
|
1154
|
+
# @return [nil]
|
1155
|
+
def delete_stopword_list(environment_id:, collection_id:)
|
1151
1156
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1152
1157
|
|
1153
1158
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1154
1159
|
|
1155
1160
|
headers = {
|
1156
1161
|
}
|
1157
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1162
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_stopword_list")
|
1158
1163
|
headers.merge!(sdk_headers)
|
1159
1164
|
|
1160
1165
|
params = {
|
1161
1166
|
"version" => @version
|
1162
1167
|
}
|
1163
1168
|
|
1164
|
-
method_url = "/v1/environments/%s/collections/%s/
|
1169
|
+
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1165
1170
|
|
1166
|
-
|
1167
|
-
method: "
|
1171
|
+
request(
|
1172
|
+
method: "DELETE",
|
1168
1173
|
url: method_url,
|
1169
1174
|
headers: headers,
|
1170
1175
|
params: params,
|
1171
|
-
accept_json:
|
1176
|
+
accept_json: false
|
1172
1177
|
)
|
1173
|
-
|
1178
|
+
nil
|
1174
1179
|
end
|
1175
1180
|
#########################
|
1176
1181
|
# Documents
|
@@ -1215,10 +1220,8 @@ module IBMWatson
|
|
1215
1220
|
# rejected.
|
1216
1221
|
# @param filename [String] The filename for file.
|
1217
1222
|
# @param file_content_type [String] The content type of file.
|
1218
|
-
# @param metadata [String]
|
1219
|
-
#
|
1220
|
-
# supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
|
1221
|
-
# rejected.
|
1223
|
+
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
1224
|
+
# are rejected.
|
1222
1225
|
# Example: ``` {
|
1223
1226
|
# \"Creator\": \"Johnny Appleseed\",
|
1224
1227
|
# \"Subject\": \"Apples\"
|
@@ -1263,44 +1266,6 @@ module IBMWatson
|
|
1263
1266
|
response
|
1264
1267
|
end
|
1265
1268
|
|
1266
|
-
##
|
1267
|
-
# @!method delete_document(environment_id:, collection_id:, document_id:)
|
1268
|
-
# Delete a document.
|
1269
|
-
# If the given document ID is invalid, or if the document is not found, then the a
|
1270
|
-
# success response is returned (HTTP status code `200`) with the status set to
|
1271
|
-
# 'deleted'.
|
1272
|
-
# @param environment_id [String] The ID of the environment.
|
1273
|
-
# @param collection_id [String] The ID of the collection.
|
1274
|
-
# @param document_id [String] The ID of the document.
|
1275
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1276
|
-
def delete_document(environment_id:, collection_id:, document_id:)
|
1277
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1278
|
-
|
1279
|
-
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1280
|
-
|
1281
|
-
raise ArgumentError.new("document_id must be provided") if document_id.nil?
|
1282
|
-
|
1283
|
-
headers = {
|
1284
|
-
}
|
1285
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_document")
|
1286
|
-
headers.merge!(sdk_headers)
|
1287
|
-
|
1288
|
-
params = {
|
1289
|
-
"version" => @version
|
1290
|
-
}
|
1291
|
-
|
1292
|
-
method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)]
|
1293
|
-
|
1294
|
-
response = request(
|
1295
|
-
method: "DELETE",
|
1296
|
-
url: method_url,
|
1297
|
-
headers: headers,
|
1298
|
-
params: params,
|
1299
|
-
accept_json: true
|
1300
|
-
)
|
1301
|
-
response
|
1302
|
-
end
|
1303
|
-
|
1304
1269
|
##
|
1305
1270
|
# @!method get_document_status(environment_id:, collection_id:, document_id:)
|
1306
1271
|
# Get document details.
|
@@ -1357,10 +1322,8 @@ module IBMWatson
|
|
1357
1322
|
# rejected.
|
1358
1323
|
# @param filename [String] The filename for file.
|
1359
1324
|
# @param file_content_type [String] The content type of file.
|
1360
|
-
# @param metadata [String]
|
1361
|
-
#
|
1362
|
-
# supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
|
1363
|
-
# rejected.
|
1325
|
+
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
1326
|
+
# are rejected.
|
1364
1327
|
# Example: ``` {
|
1365
1328
|
# \"Creator\": \"Johnny Appleseed\",
|
1366
1329
|
# \"Subject\": \"Apples\"
|
@@ -1406,28 +1369,64 @@ module IBMWatson
|
|
1406
1369
|
)
|
1407
1370
|
response
|
1408
1371
|
end
|
1372
|
+
|
1373
|
+
##
|
1374
|
+
# @!method delete_document(environment_id:, collection_id:, document_id:)
|
1375
|
+
# Delete a document.
|
1376
|
+
# If the given document ID is invalid, or if the document is not found, then the a
|
1377
|
+
# success response is returned (HTTP status code `200`) with the status set to
|
1378
|
+
# 'deleted'.
|
1379
|
+
# @param environment_id [String] The ID of the environment.
|
1380
|
+
# @param collection_id [String] The ID of the collection.
|
1381
|
+
# @param document_id [String] The ID of the document.
|
1382
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1383
|
+
def delete_document(environment_id:, collection_id:, document_id:)
|
1384
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1385
|
+
|
1386
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1387
|
+
|
1388
|
+
raise ArgumentError.new("document_id must be provided") if document_id.nil?
|
1389
|
+
|
1390
|
+
headers = {
|
1391
|
+
}
|
1392
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_document")
|
1393
|
+
headers.merge!(sdk_headers)
|
1394
|
+
|
1395
|
+
params = {
|
1396
|
+
"version" => @version
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)]
|
1400
|
+
|
1401
|
+
response = request(
|
1402
|
+
method: "DELETE",
|
1403
|
+
url: method_url,
|
1404
|
+
headers: headers,
|
1405
|
+
params: params,
|
1406
|
+
accept_json: true
|
1407
|
+
)
|
1408
|
+
response
|
1409
|
+
end
|
1409
1410
|
#########################
|
1410
1411
|
# Queries
|
1411
1412
|
#########################
|
1412
1413
|
|
1413
1414
|
##
|
1414
|
-
# @!method
|
1415
|
-
#
|
1416
|
-
#
|
1417
|
-
#
|
1418
|
-
# to complete than the standard method. For details, see the [Discovery service
|
1415
|
+
# @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, logging_opt_out: nil)
|
1416
|
+
# Query a collection.
|
1417
|
+
# By using this method, you can construct long queries. For details, see the
|
1418
|
+
# [Discovery
|
1419
1419
|
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
|
1420
1420
|
# @param environment_id [String] The ID of the environment.
|
1421
|
+
# @param collection_id [String] The ID of the collection.
|
1421
1422
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
1422
1423
|
# Filter searches are better for metadata-type searches and for assessing the
|
1423
1424
|
# concepts in the data set.
|
1424
1425
|
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
1425
1426
|
# full text, but with the most relevant documents listed first. Use a query search
|
1426
|
-
# when you want to find the most relevant search results.
|
1427
|
-
# **natural_language_query** and **query** at the same time.
|
1427
|
+
# when you want to find the most relevant search results.
|
1428
1428
|
# @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
|
1429
|
-
# data and natural language understanding.
|
1430
|
-
# and **query** at the same time.
|
1429
|
+
# data and natural language understanding.
|
1431
1430
|
# @param passages [Boolean] A passages query that returns the most relevant passages from the results.
|
1432
1431
|
# @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
|
1433
1432
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
@@ -1476,13 +1475,15 @@ module IBMWatson
|
|
1476
1475
|
# parameter.
|
1477
1476
|
# @param logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
|
1478
1477
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1479
|
-
def
|
1478
|
+
def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, logging_opt_out: nil)
|
1480
1479
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1481
1480
|
|
1481
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1482
|
+
|
1482
1483
|
headers = {
|
1483
1484
|
"X-Watson-Logging-Opt-Out" => logging_opt_out
|
1484
1485
|
}
|
1485
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1486
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query")
|
1486
1487
|
headers.merge!(sdk_headers)
|
1487
1488
|
|
1488
1489
|
params = {
|
@@ -1512,7 +1513,7 @@ module IBMWatson
|
|
1512
1513
|
"bias" => bias
|
1513
1514
|
}
|
1514
1515
|
|
1515
|
-
method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
|
1516
|
+
method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1516
1517
|
|
1517
1518
|
response = request(
|
1518
1519
|
method: "POST",
|
@@ -1526,25 +1527,23 @@ module IBMWatson
|
|
1526
1527
|
end
|
1527
1528
|
|
1528
1529
|
##
|
1529
|
-
# @!method
|
1530
|
-
# Query
|
1530
|
+
# @!method query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1531
|
+
# Query system notices.
|
1531
1532
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1532
1533
|
# system. Notices are generated when ingesting documents and performing relevance
|
1533
|
-
# training. See the [Discovery
|
1534
|
+
# training. See the [Discovery
|
1534
1535
|
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts)
|
1535
1536
|
# for more details on the query language.
|
1536
1537
|
# @param environment_id [String] The ID of the environment.
|
1537
|
-
# @param
|
1538
|
+
# @param collection_id [String] The ID of the collection.
|
1538
1539
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
1539
1540
|
# Filter searches are better for metadata-type searches and for assessing the
|
1540
1541
|
# concepts in the data set.
|
1541
1542
|
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
1542
|
-
# full text, but with the most relevant documents listed first.
|
1543
|
-
# when you want to find the most relevant search results. You cannot use
|
1544
|
-
# **natural_language_query** and **query** at the same time.
|
1543
|
+
# full text, but with the most relevant documents listed first.
|
1545
1544
|
# @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
|
1546
|
-
# data and natural language understanding.
|
1547
|
-
#
|
1545
|
+
# data and natural language understanding.
|
1546
|
+
# @param passages [Boolean] A passages query that returns the most relevant passages from the results.
|
1548
1547
|
# @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
|
1549
1548
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
1550
1549
|
# full list of possible aggregations, see the Query reference.
|
@@ -1560,6 +1559,11 @@ module IBMWatson
|
|
1560
1559
|
# ascending. Ascending is the default sort direction if no prefix is specified.
|
1561
1560
|
# @param highlight [Boolean] When true, a highlight field is returned for each result which contains the fields
|
1562
1561
|
# which match the query with `<em></em>` tags around the matching query terms.
|
1562
|
+
# @param passages_fields [Array[String]] A comma-separated list of fields that passages are drawn from. If this parameter
|
1563
|
+
# not specified, then all top-level fields are included.
|
1564
|
+
# @param passages_count [Fixnum] The maximum number of passages to return. The search returns fewer passages if the
|
1565
|
+
# requested total is not found.
|
1566
|
+
# @param passages_characters [Fixnum] The approximate number of characters that any one passage will have.
|
1563
1567
|
# @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
|
1564
1568
|
# the returned results. Duplicate comparison is limited to the current query only,
|
1565
1569
|
# **offset** is not considered. This parameter is currently Beta functionality.
|
@@ -1575,35 +1579,38 @@ module IBMWatson
|
|
1575
1579
|
# identify similar documents. If not specified, the entire document is used for
|
1576
1580
|
# comparison.
|
1577
1581
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1578
|
-
def
|
1582
|
+
def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1579
1583
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1580
1584
|
|
1581
|
-
raise ArgumentError.new("
|
1585
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1582
1586
|
|
1583
1587
|
headers = {
|
1584
1588
|
}
|
1585
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1589
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_notices")
|
1586
1590
|
headers.merge!(sdk_headers)
|
1587
1591
|
|
1588
1592
|
params = {
|
1589
1593
|
"version" => @version,
|
1590
|
-
"collection_ids" => collection_ids.to_a,
|
1591
1594
|
"filter" => filter,
|
1592
1595
|
"query" => query,
|
1593
1596
|
"natural_language_query" => natural_language_query,
|
1597
|
+
"passages" => passages,
|
1594
1598
|
"aggregation" => aggregation,
|
1595
1599
|
"count" => count,
|
1596
1600
|
"return" => return_fields.to_a,
|
1597
1601
|
"offset" => offset,
|
1598
1602
|
"sort" => sort.to_a,
|
1599
1603
|
"highlight" => highlight,
|
1604
|
+
"passages.fields" => passages_fields.to_a,
|
1605
|
+
"passages.count" => passages_count,
|
1606
|
+
"passages.characters" => passages_characters,
|
1600
1607
|
"deduplicate.field" => deduplicate_field,
|
1601
1608
|
"similar" => similar,
|
1602
1609
|
"similar.document_ids" => similar_document_ids.to_a,
|
1603
1610
|
"similar.fields" => similar_fields.to_a
|
1604
1611
|
}
|
1605
1612
|
|
1606
|
-
method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
|
1613
|
+
method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1607
1614
|
|
1608
1615
|
response = request(
|
1609
1616
|
method: "GET",
|
@@ -1616,24 +1623,20 @@ module IBMWatson
|
|
1616
1623
|
end
|
1617
1624
|
|
1618
1625
|
##
|
1619
|
-
# @!method
|
1620
|
-
#
|
1621
|
-
#
|
1622
|
-
#
|
1623
|
-
# to complete than the standard method. For details, see the [Discovery service
|
1626
|
+
# @!method federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, logging_opt_out: nil)
|
1627
|
+
# Query multiple collections.
|
1628
|
+
# By using this method, you can construct long queries that search multiple
|
1629
|
+
# collection. For details, see the [Discovery
|
1624
1630
|
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
|
1625
1631
|
# @param environment_id [String] The ID of the environment.
|
1626
|
-
# @param collection_id [String] The ID of the collection.
|
1627
1632
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
1628
1633
|
# Filter searches are better for metadata-type searches and for assessing the
|
1629
1634
|
# concepts in the data set.
|
1630
1635
|
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
1631
1636
|
# full text, but with the most relevant documents listed first. Use a query search
|
1632
|
-
# when you want to find the most relevant search results.
|
1633
|
-
# **natural_language_query** and **query** at the same time.
|
1637
|
+
# when you want to find the most relevant search results.
|
1634
1638
|
# @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
|
1635
|
-
# data and natural language understanding.
|
1636
|
-
# and **query** at the same time.
|
1639
|
+
# data and natural language understanding.
|
1637
1640
|
# @param passages [Boolean] A passages query that returns the most relevant passages from the results.
|
1638
1641
|
# @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
|
1639
1642
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
@@ -1682,15 +1685,13 @@ module IBMWatson
|
|
1682
1685
|
# parameter.
|
1683
1686
|
# @param logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
|
1684
1687
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1685
|
-
def
|
1688
|
+
def federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, logging_opt_out: nil)
|
1686
1689
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1687
1690
|
|
1688
|
-
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1689
|
-
|
1690
1691
|
headers = {
|
1691
1692
|
"X-Watson-Logging-Opt-Out" => logging_opt_out
|
1692
1693
|
}
|
1693
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1694
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query")
|
1694
1695
|
headers.merge!(sdk_headers)
|
1695
1696
|
|
1696
1697
|
params = {
|
@@ -1720,60 +1721,7 @@ module IBMWatson
|
|
1720
1721
|
"bias" => bias
|
1721
1722
|
}
|
1722
1723
|
|
1723
|
-
method_url = "/v1/environments/%s/
|
1724
|
-
|
1725
|
-
response = request(
|
1726
|
-
method: "POST",
|
1727
|
-
url: method_url,
|
1728
|
-
headers: headers,
|
1729
|
-
params: params,
|
1730
|
-
json: data,
|
1731
|
-
accept_json: true
|
1732
|
-
)
|
1733
|
-
response
|
1734
|
-
end
|
1735
|
-
|
1736
|
-
##
|
1737
|
-
# @!method query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
|
1738
|
-
# Knowledge Graph entity query.
|
1739
|
-
# See the [Knowledge Graph
|
1740
|
-
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
|
1741
|
-
# for more details.
|
1742
|
-
# @param environment_id [String] The ID of the environment.
|
1743
|
-
# @param collection_id [String] The ID of the collection.
|
1744
|
-
# @param feature [String] The entity query feature to perform. Supported features are `disambiguate` and
|
1745
|
-
# `similar_entities`.
|
1746
|
-
# @param entity [QueryEntitiesEntity] A text string that appears within the entity text field.
|
1747
|
-
# @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
|
1748
|
-
# association. For example, if you wanted to query the city of London in England
|
1749
|
-
# your query would look for `London` with the context of `England`.
|
1750
|
-
# @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
|
1751
|
-
# @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
|
1752
|
-
# maximum number of evidence items per query is 10,000.
|
1753
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1754
|
-
def query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
|
1755
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1756
|
-
|
1757
|
-
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1758
|
-
|
1759
|
-
headers = {
|
1760
|
-
}
|
1761
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_entities")
|
1762
|
-
headers.merge!(sdk_headers)
|
1763
|
-
|
1764
|
-
params = {
|
1765
|
-
"version" => @version
|
1766
|
-
}
|
1767
|
-
|
1768
|
-
data = {
|
1769
|
-
"feature" => feature,
|
1770
|
-
"entity" => entity,
|
1771
|
-
"context" => context,
|
1772
|
-
"count" => count,
|
1773
|
-
"evidence_count" => evidence_count
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
method_url = "/v1/environments/%s/collections/%s/query_entities" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1724
|
+
method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
|
1777
1725
|
|
1778
1726
|
response = request(
|
1779
1727
|
method: "POST",
|
@@ -1787,26 +1735,22 @@ module IBMWatson
|
|
1787
1735
|
end
|
1788
1736
|
|
1789
1737
|
##
|
1790
|
-
# @!method
|
1791
|
-
# Query system notices.
|
1738
|
+
# @!method federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1739
|
+
# Query multiple collection system notices.
|
1792
1740
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1793
1741
|
# system. Notices are generated when ingesting documents and performing relevance
|
1794
|
-
# training. See the [Discovery
|
1742
|
+
# training. See the [Discovery
|
1795
1743
|
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts)
|
1796
1744
|
# for more details on the query language.
|
1797
1745
|
# @param environment_id [String] The ID of the environment.
|
1798
|
-
# @param
|
1746
|
+
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
1799
1747
|
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
1800
1748
|
# Filter searches are better for metadata-type searches and for assessing the
|
1801
1749
|
# concepts in the data set.
|
1802
1750
|
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
1803
|
-
# full text, but with the most relevant documents listed first.
|
1804
|
-
# when you want to find the most relevant search results. You cannot use
|
1805
|
-
# **natural_language_query** and **query** at the same time.
|
1751
|
+
# full text, but with the most relevant documents listed first.
|
1806
1752
|
# @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
|
1807
|
-
# data and natural language understanding.
|
1808
|
-
# and **query** at the same time.
|
1809
|
-
# @param passages [Boolean] A passages query that returns the most relevant passages from the results.
|
1753
|
+
# data and natural language understanding.
|
1810
1754
|
# @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
|
1811
1755
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
1812
1756
|
# full list of possible aggregations, see the Query reference.
|
@@ -1822,11 +1766,6 @@ module IBMWatson
|
|
1822
1766
|
# ascending. Ascending is the default sort direction if no prefix is specified.
|
1823
1767
|
# @param highlight [Boolean] When true, a highlight field is returned for each result which contains the fields
|
1824
1768
|
# which match the query with `<em></em>` tags around the matching query terms.
|
1825
|
-
# @param passages_fields [Array[String]] A comma-separated list of fields that passages are drawn from. If this parameter
|
1826
|
-
# not specified, then all top-level fields are included.
|
1827
|
-
# @param passages_count [Fixnum] The maximum number of passages to return. The search returns fewer passages if the
|
1828
|
-
# requested total is not found.
|
1829
|
-
# @param passages_characters [Fixnum] The approximate number of characters that any one passage will have.
|
1830
1769
|
# @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
|
1831
1770
|
# the returned results. Duplicate comparison is limited to the current query only,
|
1832
1771
|
# **offset** is not considered. This parameter is currently Beta functionality.
|
@@ -1842,44 +1781,94 @@ module IBMWatson
|
|
1842
1781
|
# identify similar documents. If not specified, the entire document is used for
|
1843
1782
|
# comparison.
|
1844
1783
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1845
|
-
def
|
1784
|
+
def federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, return_fields: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1846
1785
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1847
1786
|
|
1848
|
-
raise ArgumentError.new("
|
1787
|
+
raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
|
1849
1788
|
|
1850
1789
|
headers = {
|
1851
1790
|
}
|
1852
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1791
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query_notices")
|
1853
1792
|
headers.merge!(sdk_headers)
|
1854
1793
|
|
1855
1794
|
params = {
|
1856
1795
|
"version" => @version,
|
1796
|
+
"collection_ids" => collection_ids.to_a,
|
1857
1797
|
"filter" => filter,
|
1858
1798
|
"query" => query,
|
1859
1799
|
"natural_language_query" => natural_language_query,
|
1860
|
-
"passages" => passages,
|
1861
1800
|
"aggregation" => aggregation,
|
1862
1801
|
"count" => count,
|
1863
|
-
"return" => return_fields.to_a,
|
1864
|
-
"offset" => offset,
|
1865
|
-
"sort" => sort.to_a,
|
1866
|
-
"highlight" => highlight,
|
1867
|
-
"
|
1868
|
-
"
|
1869
|
-
"
|
1870
|
-
"
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1802
|
+
"return" => return_fields.to_a,
|
1803
|
+
"offset" => offset,
|
1804
|
+
"sort" => sort.to_a,
|
1805
|
+
"highlight" => highlight,
|
1806
|
+
"deduplicate.field" => deduplicate_field,
|
1807
|
+
"similar" => similar,
|
1808
|
+
"similar.document_ids" => similar_document_ids.to_a,
|
1809
|
+
"similar.fields" => similar_fields.to_a
|
1810
|
+
}
|
1811
|
+
|
1812
|
+
method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
|
1813
|
+
|
1814
|
+
response = request(
|
1815
|
+
method: "GET",
|
1816
|
+
url: method_url,
|
1817
|
+
headers: headers,
|
1818
|
+
params: params,
|
1819
|
+
accept_json: true
|
1820
|
+
)
|
1821
|
+
response
|
1822
|
+
end
|
1823
|
+
|
1824
|
+
##
|
1825
|
+
# @!method query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
|
1826
|
+
# Knowledge Graph entity query.
|
1827
|
+
# See the [Knowledge Graph
|
1828
|
+
# documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
|
1829
|
+
# for more details.
|
1830
|
+
# @param environment_id [String] The ID of the environment.
|
1831
|
+
# @param collection_id [String] The ID of the collection.
|
1832
|
+
# @param feature [String] The entity query feature to perform. Supported features are `disambiguate` and
|
1833
|
+
# `similar_entities`.
|
1834
|
+
# @param entity [QueryEntitiesEntity] A text string that appears within the entity text field.
|
1835
|
+
# @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
|
1836
|
+
# association. For example, if you wanted to query the city of London in England
|
1837
|
+
# your query would look for `London` with the context of `England`.
|
1838
|
+
# @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
|
1839
|
+
# @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
|
1840
|
+
# maximum number of evidence items per query is 10,000.
|
1841
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1842
|
+
def query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
|
1843
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1844
|
+
|
1845
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1846
|
+
|
1847
|
+
headers = {
|
1848
|
+
}
|
1849
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_entities")
|
1850
|
+
headers.merge!(sdk_headers)
|
1851
|
+
|
1852
|
+
params = {
|
1853
|
+
"version" => @version
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
data = {
|
1857
|
+
"feature" => feature,
|
1858
|
+
"entity" => entity,
|
1859
|
+
"context" => context,
|
1860
|
+
"count" => count,
|
1861
|
+
"evidence_count" => evidence_count
|
1874
1862
|
}
|
1875
1863
|
|
1876
|
-
method_url = "/v1/environments/%s/collections/%s/
|
1864
|
+
method_url = "/v1/environments/%s/collections/%s/query_entities" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1877
1865
|
|
1878
1866
|
response = request(
|
1879
|
-
method: "
|
1867
|
+
method: "POST",
|
1880
1868
|
url: method_url,
|
1881
1869
|
headers: headers,
|
1882
1870
|
params: params,
|
1871
|
+
json: data,
|
1883
1872
|
accept_json: true
|
1884
1873
|
)
|
1885
1874
|
response
|
@@ -1946,71 +1935,58 @@ module IBMWatson
|
|
1946
1935
|
#########################
|
1947
1936
|
|
1948
1937
|
##
|
1949
|
-
# @!method
|
1950
|
-
#
|
1951
|
-
#
|
1952
|
-
# filter and natural language query.
|
1938
|
+
# @!method list_training_data(environment_id:, collection_id:)
|
1939
|
+
# List training data.
|
1940
|
+
# Lists the training data for the specified collection.
|
1953
1941
|
# @param environment_id [String] The ID of the environment.
|
1954
1942
|
# @param collection_id [String] The ID of the collection.
|
1955
|
-
# @param natural_language_query [String] The natural text query for the new training query.
|
1956
|
-
# @param filter [String] The filter used on the collection before the **natural_language_query** is
|
1957
|
-
# applied.
|
1958
|
-
# @param examples [Array[TrainingExample]] Array of training examples.
|
1959
1943
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1960
|
-
def
|
1944
|
+
def list_training_data(environment_id:, collection_id:)
|
1961
1945
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1962
1946
|
|
1963
1947
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1964
1948
|
|
1965
1949
|
headers = {
|
1966
1950
|
}
|
1967
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1951
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_data")
|
1968
1952
|
headers.merge!(sdk_headers)
|
1969
1953
|
|
1970
1954
|
params = {
|
1971
1955
|
"version" => @version
|
1972
1956
|
}
|
1973
1957
|
|
1974
|
-
data = {
|
1975
|
-
"natural_language_query" => natural_language_query,
|
1976
|
-
"filter" => filter,
|
1977
|
-
"examples" => examples
|
1978
|
-
}
|
1979
|
-
|
1980
1958
|
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1981
1959
|
|
1982
1960
|
response = request(
|
1983
|
-
method: "
|
1961
|
+
method: "GET",
|
1984
1962
|
url: method_url,
|
1985
1963
|
headers: headers,
|
1986
1964
|
params: params,
|
1987
|
-
json: data,
|
1988
1965
|
accept_json: true
|
1989
1966
|
)
|
1990
1967
|
response
|
1991
1968
|
end
|
1992
1969
|
|
1993
1970
|
##
|
1994
|
-
# @!method
|
1995
|
-
# Add
|
1996
|
-
# Adds a
|
1971
|
+
# @!method add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
|
1972
|
+
# Add query to training data.
|
1973
|
+
# Adds a query to the training data for this collection. The query can contain a
|
1974
|
+
# filter and natural language query.
|
1997
1975
|
# @param environment_id [String] The ID of the environment.
|
1998
1976
|
# @param collection_id [String] The ID of the collection.
|
1999
|
-
# @param
|
2000
|
-
# @param
|
2001
|
-
#
|
2002
|
-
# @param
|
1977
|
+
# @param natural_language_query [String] The natural text query for the new training query.
|
1978
|
+
# @param filter [String] The filter used on the collection before the **natural_language_query** is
|
1979
|
+
# applied.
|
1980
|
+
# @param examples [Array[TrainingExample]] Array of training examples.
|
2003
1981
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2004
|
-
def
|
1982
|
+
def add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
|
2005
1983
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2006
1984
|
|
2007
1985
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
2008
1986
|
|
2009
|
-
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
2010
|
-
|
2011
1987
|
headers = {
|
2012
1988
|
}
|
2013
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
1989
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "add_training_data")
|
2014
1990
|
headers.merge!(sdk_headers)
|
2015
1991
|
|
2016
1992
|
params = {
|
@@ -2018,12 +1994,12 @@ module IBMWatson
|
|
2018
1994
|
}
|
2019
1995
|
|
2020
1996
|
data = {
|
2021
|
-
"
|
2022
|
-
"
|
2023
|
-
"
|
1997
|
+
"natural_language_query" => natural_language_query,
|
1998
|
+
"filter" => filter,
|
1999
|
+
"examples" => examples
|
2024
2000
|
}
|
2025
2001
|
|
2026
|
-
method_url = "/v1/environments/%s/collections/%s/training_data
|
2002
|
+
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
2027
2003
|
|
2028
2004
|
response = request(
|
2029
2005
|
method: "POST",
|
@@ -2070,15 +2046,15 @@ module IBMWatson
|
|
2070
2046
|
end
|
2071
2047
|
|
2072
2048
|
##
|
2073
|
-
# @!method
|
2074
|
-
#
|
2075
|
-
#
|
2076
|
-
#
|
2049
|
+
# @!method get_training_data(environment_id:, collection_id:, query_id:)
|
2050
|
+
# Get details about a query.
|
2051
|
+
# Gets details for a specific training data query, including the query string and
|
2052
|
+
# all examples.
|
2077
2053
|
# @param environment_id [String] The ID of the environment.
|
2078
2054
|
# @param collection_id [String] The ID of the collection.
|
2079
2055
|
# @param query_id [String] The ID of the query used for training.
|
2080
|
-
# @return [
|
2081
|
-
def
|
2056
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2057
|
+
def get_training_data(environment_id:, collection_id:, query_id:)
|
2082
2058
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2083
2059
|
|
2084
2060
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -2087,7 +2063,7 @@ module IBMWatson
|
|
2087
2063
|
|
2088
2064
|
headers = {
|
2089
2065
|
}
|
2090
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2066
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_data")
|
2091
2067
|
headers.merge!(sdk_headers)
|
2092
2068
|
|
2093
2069
|
params = {
|
@@ -2096,44 +2072,42 @@ module IBMWatson
|
|
2096
2072
|
|
2097
2073
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2098
2074
|
|
2099
|
-
request(
|
2100
|
-
method: "
|
2075
|
+
response = request(
|
2076
|
+
method: "GET",
|
2101
2077
|
url: method_url,
|
2102
2078
|
headers: headers,
|
2103
2079
|
params: params,
|
2104
|
-
accept_json:
|
2080
|
+
accept_json: true
|
2105
2081
|
)
|
2106
|
-
|
2082
|
+
response
|
2107
2083
|
end
|
2108
2084
|
|
2109
2085
|
##
|
2110
|
-
# @!method
|
2111
|
-
# Delete
|
2112
|
-
#
|
2086
|
+
# @!method delete_training_data(environment_id:, collection_id:, query_id:)
|
2087
|
+
# Delete a training data query.
|
2088
|
+
# Removes the training data query and all associated examples from the training data
|
2089
|
+
# set.
|
2113
2090
|
# @param environment_id [String] The ID of the environment.
|
2114
2091
|
# @param collection_id [String] The ID of the collection.
|
2115
2092
|
# @param query_id [String] The ID of the query used for training.
|
2116
|
-
# @param example_id [String] The ID of the document as it is indexed.
|
2117
2093
|
# @return [nil]
|
2118
|
-
def
|
2094
|
+
def delete_training_data(environment_id:, collection_id:, query_id:)
|
2119
2095
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2120
2096
|
|
2121
2097
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
2122
2098
|
|
2123
2099
|
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
2124
2100
|
|
2125
|
-
raise ArgumentError.new("example_id must be provided") if example_id.nil?
|
2126
|
-
|
2127
2101
|
headers = {
|
2128
2102
|
}
|
2129
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2103
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_data")
|
2130
2104
|
headers.merge!(sdk_headers)
|
2131
2105
|
|
2132
2106
|
params = {
|
2133
2107
|
"version" => @version
|
2134
2108
|
}
|
2135
2109
|
|
2136
|
-
method_url = "/v1/environments/%s/collections/%s/training_data/%s
|
2110
|
+
method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2137
2111
|
|
2138
2112
|
request(
|
2139
2113
|
method: "DELETE",
|
@@ -2146,15 +2120,14 @@ module IBMWatson
|
|
2146
2120
|
end
|
2147
2121
|
|
2148
2122
|
##
|
2149
|
-
# @!method
|
2150
|
-
#
|
2151
|
-
#
|
2152
|
-
# all examples.
|
2123
|
+
# @!method list_training_examples(environment_id:, collection_id:, query_id:)
|
2124
|
+
# List examples for a training data query.
|
2125
|
+
# List all examples for this training data query.
|
2153
2126
|
# @param environment_id [String] The ID of the environment.
|
2154
2127
|
# @param collection_id [String] The ID of the collection.
|
2155
2128
|
# @param query_id [String] The ID of the query used for training.
|
2156
2129
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2157
|
-
def
|
2130
|
+
def list_training_examples(environment_id:, collection_id:, query_id:)
|
2158
2131
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2159
2132
|
|
2160
2133
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -2163,14 +2136,14 @@ module IBMWatson
|
|
2163
2136
|
|
2164
2137
|
headers = {
|
2165
2138
|
}
|
2166
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2139
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_examples")
|
2167
2140
|
headers.merge!(sdk_headers)
|
2168
2141
|
|
2169
2142
|
params = {
|
2170
2143
|
"version" => @version
|
2171
2144
|
}
|
2172
2145
|
|
2173
|
-
method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2146
|
+
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2174
2147
|
|
2175
2148
|
response = request(
|
2176
2149
|
method: "GET",
|
@@ -2183,125 +2156,147 @@ module IBMWatson
|
|
2183
2156
|
end
|
2184
2157
|
|
2185
2158
|
##
|
2186
|
-
# @!method
|
2187
|
-
#
|
2188
|
-
#
|
2159
|
+
# @!method create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
|
2160
|
+
# Add example to training data query.
|
2161
|
+
# Adds a example to this training data query.
|
2189
2162
|
# @param environment_id [String] The ID of the environment.
|
2190
2163
|
# @param collection_id [String] The ID of the collection.
|
2191
2164
|
# @param query_id [String] The ID of the query used for training.
|
2192
|
-
# @param
|
2165
|
+
# @param document_id [String] The document ID associated with this training example.
|
2166
|
+
# @param cross_reference [String] The cross reference associated with this training example.
|
2167
|
+
# @param relevance [Fixnum] The relevance of the training example.
|
2193
2168
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2194
|
-
def
|
2169
|
+
def create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
|
2195
2170
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2196
2171
|
|
2197
2172
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
2198
2173
|
|
2199
2174
|
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
2200
2175
|
|
2201
|
-
raise ArgumentError.new("example_id must be provided") if example_id.nil?
|
2202
|
-
|
2203
2176
|
headers = {
|
2204
2177
|
}
|
2205
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2178
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_training_example")
|
2206
2179
|
headers.merge!(sdk_headers)
|
2207
2180
|
|
2208
2181
|
params = {
|
2209
2182
|
"version" => @version
|
2210
2183
|
}
|
2211
2184
|
|
2212
|
-
|
2185
|
+
data = {
|
2186
|
+
"document_id" => document_id,
|
2187
|
+
"cross_reference" => cross_reference,
|
2188
|
+
"relevance" => relevance
|
2189
|
+
}
|
2190
|
+
|
2191
|
+
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2213
2192
|
|
2214
2193
|
response = request(
|
2215
|
-
method: "
|
2194
|
+
method: "POST",
|
2216
2195
|
url: method_url,
|
2217
2196
|
headers: headers,
|
2218
2197
|
params: params,
|
2198
|
+
json: data,
|
2219
2199
|
accept_json: true
|
2220
2200
|
)
|
2221
2201
|
response
|
2222
2202
|
end
|
2223
2203
|
|
2224
2204
|
##
|
2225
|
-
# @!method
|
2226
|
-
#
|
2227
|
-
#
|
2205
|
+
# @!method delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
|
2206
|
+
# Delete example for training data query.
|
2207
|
+
# Deletes the example document with the given ID from the training data query.
|
2228
2208
|
# @param environment_id [String] The ID of the environment.
|
2229
2209
|
# @param collection_id [String] The ID of the collection.
|
2230
|
-
# @
|
2231
|
-
|
2210
|
+
# @param query_id [String] The ID of the query used for training.
|
2211
|
+
# @param example_id [String] The ID of the document as it is indexed.
|
2212
|
+
# @return [nil]
|
2213
|
+
def delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
|
2232
2214
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2233
2215
|
|
2234
2216
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
2235
2217
|
|
2218
|
+
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
2219
|
+
|
2220
|
+
raise ArgumentError.new("example_id must be provided") if example_id.nil?
|
2221
|
+
|
2236
2222
|
headers = {
|
2237
2223
|
}
|
2238
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2224
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_example")
|
2239
2225
|
headers.merge!(sdk_headers)
|
2240
2226
|
|
2241
2227
|
params = {
|
2242
2228
|
"version" => @version
|
2243
2229
|
}
|
2244
2230
|
|
2245
|
-
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
2231
|
+
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2246
2232
|
|
2247
|
-
|
2248
|
-
method: "
|
2233
|
+
request(
|
2234
|
+
method: "DELETE",
|
2249
2235
|
url: method_url,
|
2250
2236
|
headers: headers,
|
2251
2237
|
params: params,
|
2252
|
-
accept_json:
|
2238
|
+
accept_json: false
|
2253
2239
|
)
|
2254
|
-
|
2240
|
+
nil
|
2255
2241
|
end
|
2256
2242
|
|
2257
2243
|
##
|
2258
|
-
# @!method
|
2259
|
-
#
|
2260
|
-
#
|
2244
|
+
# @!method update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
|
2245
|
+
# Change label or cross reference for example.
|
2246
|
+
# Changes the label or cross reference query for this training data example.
|
2261
2247
|
# @param environment_id [String] The ID of the environment.
|
2262
2248
|
# @param collection_id [String] The ID of the collection.
|
2263
2249
|
# @param query_id [String] The ID of the query used for training.
|
2250
|
+
# @param example_id [String] The ID of the document as it is indexed.
|
2251
|
+
# @param cross_reference [String] The example to add.
|
2252
|
+
# @param relevance [Fixnum] The relevance value for this example.
|
2264
2253
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2265
|
-
def
|
2254
|
+
def update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
|
2266
2255
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2267
2256
|
|
2268
2257
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
2269
2258
|
|
2270
2259
|
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
2271
2260
|
|
2261
|
+
raise ArgumentError.new("example_id must be provided") if example_id.nil?
|
2262
|
+
|
2272
2263
|
headers = {
|
2273
2264
|
}
|
2274
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2265
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_training_example")
|
2275
2266
|
headers.merge!(sdk_headers)
|
2276
2267
|
|
2277
2268
|
params = {
|
2278
2269
|
"version" => @version
|
2279
2270
|
}
|
2280
2271
|
|
2281
|
-
|
2272
|
+
data = {
|
2273
|
+
"cross_reference" => cross_reference,
|
2274
|
+
"relevance" => relevance
|
2275
|
+
}
|
2276
|
+
|
2277
|
+
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2282
2278
|
|
2283
2279
|
response = request(
|
2284
|
-
method: "
|
2280
|
+
method: "PUT",
|
2285
2281
|
url: method_url,
|
2286
2282
|
headers: headers,
|
2287
2283
|
params: params,
|
2284
|
+
json: data,
|
2288
2285
|
accept_json: true
|
2289
2286
|
)
|
2290
2287
|
response
|
2291
2288
|
end
|
2292
2289
|
|
2293
2290
|
##
|
2294
|
-
# @!method
|
2295
|
-
#
|
2296
|
-
#
|
2291
|
+
# @!method get_training_example(environment_id:, collection_id:, query_id:, example_id:)
|
2292
|
+
# Get details for training data example.
|
2293
|
+
# Gets the details for this training example.
|
2297
2294
|
# @param environment_id [String] The ID of the environment.
|
2298
2295
|
# @param collection_id [String] The ID of the collection.
|
2299
2296
|
# @param query_id [String] The ID of the query used for training.
|
2300
2297
|
# @param example_id [String] The ID of the document as it is indexed.
|
2301
|
-
# @param cross_reference [String] The example to add.
|
2302
|
-
# @param relevance [Fixnum] The relevance value for this example.
|
2303
2298
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2304
|
-
def
|
2299
|
+
def get_training_example(environment_id:, collection_id:, query_id:, example_id:)
|
2305
2300
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2306
2301
|
|
2307
2302
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -2312,26 +2307,20 @@ module IBMWatson
|
|
2312
2307
|
|
2313
2308
|
headers = {
|
2314
2309
|
}
|
2315
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2310
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_example")
|
2316
2311
|
headers.merge!(sdk_headers)
|
2317
2312
|
|
2318
2313
|
params = {
|
2319
2314
|
"version" => @version
|
2320
2315
|
}
|
2321
2316
|
|
2322
|
-
data = {
|
2323
|
-
"cross_reference" => cross_reference,
|
2324
|
-
"relevance" => relevance
|
2325
|
-
}
|
2326
|
-
|
2327
2317
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2328
2318
|
|
2329
2319
|
response = request(
|
2330
|
-
method: "
|
2320
|
+
method: "GET",
|
2331
2321
|
url: method_url,
|
2332
2322
|
headers: headers,
|
2333
2323
|
params: params,
|
2334
|
-
json: data,
|
2335
2324
|
accept_json: true
|
2336
2325
|
)
|
2337
2326
|
response
|
@@ -2422,32 +2411,42 @@ module IBMWatson
|
|
2422
2411
|
end
|
2423
2412
|
|
2424
2413
|
##
|
2425
|
-
# @!method
|
2426
|
-
#
|
2427
|
-
#
|
2428
|
-
#
|
2429
|
-
#
|
2430
|
-
#
|
2431
|
-
#
|
2432
|
-
#
|
2433
|
-
# @param
|
2434
|
-
#
|
2435
|
-
# @param
|
2414
|
+
# @!method query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
|
2415
|
+
# Search the query and event log.
|
2416
|
+
# Searches the query and event log to find query sessions that match the specified
|
2417
|
+
# criteria. Searching the **logs** endpoint uses the standard Discovery query syntax
|
2418
|
+
# for the parameters that are supported.
|
2419
|
+
# @param filter [String] A cacheable query that excludes documents that don't mention the query content.
|
2420
|
+
# Filter searches are better for metadata-type searches and for assessing the
|
2421
|
+
# concepts in the data set.
|
2422
|
+
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
2423
|
+
# full text, but with the most relevant documents listed first.
|
2424
|
+
# @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
|
2425
|
+
# together in any one query is **10000**.
|
2426
|
+
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
2427
|
+
# number of results that are returned is 10 and the offset is 8, it returns the last
|
2428
|
+
# two results. The maximum for the **count** and **offset** values together in any
|
2429
|
+
# one query is **10000**.
|
2430
|
+
# @param sort [Array[String]] A comma-separated list of fields in the document to sort on. You can optionally
|
2431
|
+
# specify a sort direction by prefixing the field with `-` for descending or `+` for
|
2432
|
+
# ascending. Ascending is the default sort direction if no prefix is specified.
|
2436
2433
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2437
|
-
def
|
2434
|
+
def query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
|
2438
2435
|
headers = {
|
2439
2436
|
}
|
2440
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2437
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_log")
|
2441
2438
|
headers.merge!(sdk_headers)
|
2442
2439
|
|
2443
2440
|
params = {
|
2444
2441
|
"version" => @version,
|
2445
|
-
"
|
2446
|
-
"
|
2447
|
-
"
|
2442
|
+
"filter" => filter,
|
2443
|
+
"query" => query,
|
2444
|
+
"count" => count,
|
2445
|
+
"offset" => offset,
|
2446
|
+
"sort" => sort.to_a
|
2448
2447
|
}
|
2449
2448
|
|
2450
|
-
method_url = "/v1/
|
2449
|
+
method_url = "/v1/logs"
|
2451
2450
|
|
2452
2451
|
response = request(
|
2453
2452
|
method: "GET",
|
@@ -2568,6 +2567,44 @@ module IBMWatson
|
|
2568
2567
|
response
|
2569
2568
|
end
|
2570
2569
|
|
2570
|
+
##
|
2571
|
+
# @!method get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
|
2572
|
+
# Percentage of queries with an associated event.
|
2573
|
+
# The percentage of queries using the **natural_language_query** parameter that have
|
2574
|
+
# a corresponding \"click\" event over a specified time window. This metric
|
2575
|
+
# requires having integrated event tracking in your application using the **Events**
|
2576
|
+
# API.
|
2577
|
+
# @param start_time [Time] Metric is computed from data recorded after this timestamp; must be in
|
2578
|
+
# `YYYY-MM-DDThh:mm:ssZ` format.
|
2579
|
+
# @param end_time [Time] Metric is computed from data recorded before this timestamp; must be in
|
2580
|
+
# `YYYY-MM-DDThh:mm:ssZ` format.
|
2581
|
+
# @param result_type [String] The type of result to consider when calculating the metric.
|
2582
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2583
|
+
def get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
|
2584
|
+
headers = {
|
2585
|
+
}
|
2586
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_event_rate")
|
2587
|
+
headers.merge!(sdk_headers)
|
2588
|
+
|
2589
|
+
params = {
|
2590
|
+
"version" => @version,
|
2591
|
+
"start_time" => start_time,
|
2592
|
+
"end_time" => end_time,
|
2593
|
+
"result_type" => result_type
|
2594
|
+
}
|
2595
|
+
|
2596
|
+
method_url = "/v1/metrics/event_rate"
|
2597
|
+
|
2598
|
+
response = request(
|
2599
|
+
method: "GET",
|
2600
|
+
url: method_url,
|
2601
|
+
headers: headers,
|
2602
|
+
params: params,
|
2603
|
+
accept_json: true
|
2604
|
+
)
|
2605
|
+
response
|
2606
|
+
end
|
2607
|
+
|
2571
2608
|
##
|
2572
2609
|
# @!method get_metrics_query_token_event(count: nil)
|
2573
2610
|
# Most frequent query tokens with an event.
|
@@ -2600,46 +2637,32 @@ module IBMWatson
|
|
2600
2637
|
)
|
2601
2638
|
response
|
2602
2639
|
end
|
2640
|
+
#########################
|
2641
|
+
# Credentials
|
2642
|
+
#########################
|
2603
2643
|
|
2604
2644
|
##
|
2605
|
-
# @!method
|
2606
|
-
#
|
2607
|
-
#
|
2608
|
-
#
|
2609
|
-
#
|
2610
|
-
#
|
2611
|
-
#
|
2612
|
-
# concepts in the data set.
|
2613
|
-
# @param query [String] A query search returns all documents in your data set with full enrichments and
|
2614
|
-
# full text, but with the most relevant documents listed first. Use a query search
|
2615
|
-
# when you want to find the most relevant search results. You cannot use
|
2616
|
-
# **natural_language_query** and **query** at the same time.
|
2617
|
-
# @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
|
2618
|
-
# together in any one query is **10000**.
|
2619
|
-
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
2620
|
-
# number of results that are returned is 10 and the offset is 8, it returns the last
|
2621
|
-
# two results. The maximum for the **count** and **offset** values together in any
|
2622
|
-
# one query is **10000**.
|
2623
|
-
# @param sort [Array[String]] A comma-separated list of fields in the document to sort on. You can optionally
|
2624
|
-
# specify a sort direction by prefixing the field with `-` for descending or `+` for
|
2625
|
-
# ascending. Ascending is the default sort direction if no prefix is specified.
|
2645
|
+
# @!method list_credentials(environment_id:)
|
2646
|
+
# List credentials.
|
2647
|
+
# List all the source credentials that have been created for this service instance.
|
2648
|
+
#
|
2649
|
+
# **Note:** All credentials are sent over an encrypted connection and encrypted at
|
2650
|
+
# rest.
|
2651
|
+
# @param environment_id [String] The ID of the environment.
|
2626
2652
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2627
|
-
def
|
2653
|
+
def list_credentials(environment_id:)
|
2654
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2655
|
+
|
2628
2656
|
headers = {
|
2629
2657
|
}
|
2630
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2658
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_credentials")
|
2631
2659
|
headers.merge!(sdk_headers)
|
2632
2660
|
|
2633
2661
|
params = {
|
2634
|
-
"version" => @version
|
2635
|
-
"filter" => filter,
|
2636
|
-
"query" => query,
|
2637
|
-
"count" => count,
|
2638
|
-
"offset" => offset,
|
2639
|
-
"sort" => sort.to_a
|
2662
|
+
"version" => @version
|
2640
2663
|
}
|
2641
2664
|
|
2642
|
-
method_url = "/v1/
|
2665
|
+
method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
|
2643
2666
|
|
2644
2667
|
response = request(
|
2645
2668
|
method: "GET",
|
@@ -2650,12 +2673,9 @@ module IBMWatson
|
|
2650
2673
|
)
|
2651
2674
|
response
|
2652
2675
|
end
|
2653
|
-
#########################
|
2654
|
-
# Credentials
|
2655
|
-
#########################
|
2656
2676
|
|
2657
2677
|
##
|
2658
|
-
# @!method create_credentials(environment_id:, source_type: nil, credential_details: nil)
|
2678
|
+
# @!method create_credentials(environment_id:, source_type: nil, credential_details: nil, status: nil)
|
2659
2679
|
# Create credentials.
|
2660
2680
|
# Creates a set of credentials to connect to a remote source. Created credentials
|
2661
2681
|
# are used in a configuration to associate a collection with the remote source.
|
@@ -2675,8 +2695,12 @@ module IBMWatson
|
|
2675
2695
|
# @param credential_details [CredentialDetails] Object containing details of the stored credentials.
|
2676
2696
|
#
|
2677
2697
|
# Obtain credentials for your source from the administrator of the source.
|
2698
|
+
# @param status [String] The current status of this set of credentials. `connected` indicates that the
|
2699
|
+
# credentials are available to use with the source configuration of a collection.
|
2700
|
+
# `invalid` refers to the credentials (for example, the password provided has
|
2701
|
+
# expired) and must be corrected before they can be used with a collection.
|
2678
2702
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2679
|
-
def create_credentials(environment_id:, source_type: nil, credential_details: nil)
|
2703
|
+
def create_credentials(environment_id:, source_type: nil, credential_details: nil, status: nil)
|
2680
2704
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2681
2705
|
|
2682
2706
|
headers = {
|
@@ -2690,7 +2714,8 @@ module IBMWatson
|
|
2690
2714
|
|
2691
2715
|
data = {
|
2692
2716
|
"source_type" => source_type,
|
2693
|
-
"credential_details" => credential_details
|
2717
|
+
"credential_details" => credential_details,
|
2718
|
+
"status" => status
|
2694
2719
|
}
|
2695
2720
|
|
2696
2721
|
method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
|
@@ -2706,39 +2731,6 @@ module IBMWatson
|
|
2706
2731
|
response
|
2707
2732
|
end
|
2708
2733
|
|
2709
|
-
##
|
2710
|
-
# @!method delete_credentials(environment_id:, credential_id:)
|
2711
|
-
# Delete credentials.
|
2712
|
-
# Deletes a set of stored credentials from your Discovery instance.
|
2713
|
-
# @param environment_id [String] The ID of the environment.
|
2714
|
-
# @param credential_id [String] The unique identifier for a set of source credentials.
|
2715
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2716
|
-
def delete_credentials(environment_id:, credential_id:)
|
2717
|
-
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2718
|
-
|
2719
|
-
raise ArgumentError.new("credential_id must be provided") if credential_id.nil?
|
2720
|
-
|
2721
|
-
headers = {
|
2722
|
-
}
|
2723
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_credentials")
|
2724
|
-
headers.merge!(sdk_headers)
|
2725
|
-
|
2726
|
-
params = {
|
2727
|
-
"version" => @version
|
2728
|
-
}
|
2729
|
-
|
2730
|
-
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2731
|
-
|
2732
|
-
response = request(
|
2733
|
-
method: "DELETE",
|
2734
|
-
url: method_url,
|
2735
|
-
headers: headers,
|
2736
|
-
params: params,
|
2737
|
-
accept_json: true
|
2738
|
-
)
|
2739
|
-
response
|
2740
|
-
end
|
2741
|
-
|
2742
2734
|
##
|
2743
2735
|
# @!method get_credentials(environment_id:, credential_id:)
|
2744
2736
|
# View Credentials.
|
@@ -2776,87 +2768,92 @@ module IBMWatson
|
|
2776
2768
|
end
|
2777
2769
|
|
2778
2770
|
##
|
2779
|
-
# @!method
|
2780
|
-
#
|
2781
|
-
#
|
2771
|
+
# @!method update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil, status: nil)
|
2772
|
+
# Update credentials.
|
2773
|
+
# Updates an existing set of source credentials.
|
2782
2774
|
#
|
2783
|
-
#
|
2775
|
+
# **Note:** All credentials are sent over an encrypted connection and encrypted at
|
2784
2776
|
# rest.
|
2785
2777
|
# @param environment_id [String] The ID of the environment.
|
2778
|
+
# @param credential_id [String] The unique identifier for a set of source credentials.
|
2779
|
+
# @param source_type [String] The source that this credentials object connects to.
|
2780
|
+
# - `box` indicates the credentials are used to connect an instance of Enterprise
|
2781
|
+
# Box.
|
2782
|
+
# - `salesforce` indicates the credentials are used to connect to Salesforce.
|
2783
|
+
# - `sharepoint` indicates the credentials are used to connect to Microsoft
|
2784
|
+
# SharePoint Online.
|
2785
|
+
# - `web_crawl` indicates the credentials are used to perform a web crawl.
|
2786
|
+
# = `cloud_object_storage` indicates the credentials are used to connect to an IBM
|
2787
|
+
# Cloud Object Store.
|
2788
|
+
# @param credential_details [CredentialDetails] Object containing details of the stored credentials.
|
2789
|
+
#
|
2790
|
+
# Obtain credentials for your source from the administrator of the source.
|
2791
|
+
# @param status [String] The current status of this set of credentials. `connected` indicates that the
|
2792
|
+
# credentials are available to use with the source configuration of a collection.
|
2793
|
+
# `invalid` refers to the credentials (for example, the password provided has
|
2794
|
+
# expired) and must be corrected before they can be used with a collection.
|
2786
2795
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2787
|
-
def
|
2796
|
+
def update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil, status: nil)
|
2788
2797
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2789
2798
|
|
2799
|
+
raise ArgumentError.new("credential_id must be provided") if credential_id.nil?
|
2800
|
+
|
2790
2801
|
headers = {
|
2791
2802
|
}
|
2792
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2803
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_credentials")
|
2793
2804
|
headers.merge!(sdk_headers)
|
2794
2805
|
|
2795
2806
|
params = {
|
2796
2807
|
"version" => @version
|
2797
2808
|
}
|
2798
2809
|
|
2799
|
-
|
2810
|
+
data = {
|
2811
|
+
"source_type" => source_type,
|
2812
|
+
"credential_details" => credential_details,
|
2813
|
+
"status" => status
|
2814
|
+
}
|
2815
|
+
|
2816
|
+
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2800
2817
|
|
2801
2818
|
response = request(
|
2802
|
-
method: "
|
2819
|
+
method: "PUT",
|
2803
2820
|
url: method_url,
|
2804
2821
|
headers: headers,
|
2805
2822
|
params: params,
|
2823
|
+
json: data,
|
2806
2824
|
accept_json: true
|
2807
2825
|
)
|
2808
2826
|
response
|
2809
2827
|
end
|
2810
2828
|
|
2811
2829
|
##
|
2812
|
-
# @!method
|
2813
|
-
#
|
2814
|
-
#
|
2815
|
-
#
|
2816
|
-
# **Note:** All credentials are sent over an encrypted connection and encrypted at
|
2817
|
-
# rest.
|
2830
|
+
# @!method delete_credentials(environment_id:, credential_id:)
|
2831
|
+
# Delete credentials.
|
2832
|
+
# Deletes a set of stored credentials from your Discovery instance.
|
2818
2833
|
# @param environment_id [String] The ID of the environment.
|
2819
2834
|
# @param credential_id [String] The unique identifier for a set of source credentials.
|
2820
|
-
# @param source_type [String] The source that this credentials object connects to.
|
2821
|
-
# - `box` indicates the credentials are used to connect an instance of Enterprise
|
2822
|
-
# Box.
|
2823
|
-
# - `salesforce` indicates the credentials are used to connect to Salesforce.
|
2824
|
-
# - `sharepoint` indicates the credentials are used to connect to Microsoft
|
2825
|
-
# SharePoint Online.
|
2826
|
-
# - `web_crawl` indicates the credentials are used to perform a web crawl.
|
2827
|
-
# = `cloud_object_storage` indicates the credentials are used to connect to an IBM
|
2828
|
-
# Cloud Object Store.
|
2829
|
-
# @param credential_details [CredentialDetails] Object containing details of the stored credentials.
|
2830
|
-
#
|
2831
|
-
# Obtain credentials for your source from the administrator of the source.
|
2832
2835
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2833
|
-
def
|
2836
|
+
def delete_credentials(environment_id:, credential_id:)
|
2834
2837
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2835
2838
|
|
2836
2839
|
raise ArgumentError.new("credential_id must be provided") if credential_id.nil?
|
2837
2840
|
|
2838
2841
|
headers = {
|
2839
2842
|
}
|
2840
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2843
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_credentials")
|
2841
2844
|
headers.merge!(sdk_headers)
|
2842
2845
|
|
2843
2846
|
params = {
|
2844
2847
|
"version" => @version
|
2845
2848
|
}
|
2846
2849
|
|
2847
|
-
data = {
|
2848
|
-
"source_type" => source_type,
|
2849
|
-
"credential_details" => credential_details
|
2850
|
-
}
|
2851
|
-
|
2852
2850
|
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2853
2851
|
|
2854
2852
|
response = request(
|
2855
|
-
method: "
|
2853
|
+
method: "DELETE",
|
2856
2854
|
url: method_url,
|
2857
2855
|
headers: headers,
|
2858
2856
|
params: params,
|
2859
|
-
json: data,
|
2860
2857
|
accept_json: true
|
2861
2858
|
)
|
2862
2859
|
response
|
@@ -2866,69 +2863,66 @@ module IBMWatson
|
|
2866
2863
|
#########################
|
2867
2864
|
|
2868
2865
|
##
|
2869
|
-
# @!method
|
2870
|
-
#
|
2871
|
-
#
|
2866
|
+
# @!method list_gateways(environment_id:)
|
2867
|
+
# List Gateways.
|
2868
|
+
# List the currently configured gateways.
|
2872
2869
|
# @param environment_id [String] The ID of the environment.
|
2873
|
-
# @param name [String] User-defined name.
|
2874
2870
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2875
|
-
def
|
2871
|
+
def list_gateways(environment_id:)
|
2876
2872
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2877
2873
|
|
2878
2874
|
headers = {
|
2879
2875
|
}
|
2880
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2876
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_gateways")
|
2881
2877
|
headers.merge!(sdk_headers)
|
2882
2878
|
|
2883
2879
|
params = {
|
2884
2880
|
"version" => @version
|
2885
2881
|
}
|
2886
2882
|
|
2887
|
-
data = {
|
2888
|
-
"name" => name
|
2889
|
-
}
|
2890
|
-
|
2891
2883
|
method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
|
2892
2884
|
|
2893
2885
|
response = request(
|
2894
|
-
method: "
|
2886
|
+
method: "GET",
|
2895
2887
|
url: method_url,
|
2896
2888
|
headers: headers,
|
2897
2889
|
params: params,
|
2898
|
-
json: data,
|
2899
2890
|
accept_json: true
|
2900
2891
|
)
|
2901
2892
|
response
|
2902
2893
|
end
|
2903
2894
|
|
2904
2895
|
##
|
2905
|
-
# @!method
|
2906
|
-
#
|
2907
|
-
#
|
2896
|
+
# @!method create_gateway(environment_id:, name: nil)
|
2897
|
+
# Create Gateway.
|
2898
|
+
# Create a gateway configuration to use with a remotely installed gateway.
|
2908
2899
|
# @param environment_id [String] The ID of the environment.
|
2909
|
-
# @param
|
2900
|
+
# @param name [String] User-defined name.
|
2910
2901
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2911
|
-
def
|
2902
|
+
def create_gateway(environment_id:, name: nil)
|
2912
2903
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2913
2904
|
|
2914
|
-
raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil?
|
2915
|
-
|
2916
2905
|
headers = {
|
2917
2906
|
}
|
2918
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2907
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_gateway")
|
2919
2908
|
headers.merge!(sdk_headers)
|
2920
2909
|
|
2921
2910
|
params = {
|
2922
2911
|
"version" => @version
|
2923
2912
|
}
|
2924
2913
|
|
2925
|
-
|
2914
|
+
data = {
|
2915
|
+
"name" => name
|
2916
|
+
}
|
2917
|
+
|
2918
|
+
method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
|
2926
2919
|
|
2927
2920
|
response = request(
|
2928
|
-
method: "
|
2921
|
+
method: "POST",
|
2929
2922
|
url: method_url,
|
2930
2923
|
headers: headers,
|
2931
2924
|
params: params,
|
2925
|
+
json: data,
|
2932
2926
|
accept_json: true
|
2933
2927
|
)
|
2934
2928
|
response
|
@@ -2968,27 +2962,30 @@ module IBMWatson
|
|
2968
2962
|
end
|
2969
2963
|
|
2970
2964
|
##
|
2971
|
-
# @!method
|
2972
|
-
#
|
2973
|
-
#
|
2965
|
+
# @!method delete_gateway(environment_id:, gateway_id:)
|
2966
|
+
# Delete Gateway.
|
2967
|
+
# Delete the specified gateway configuration.
|
2974
2968
|
# @param environment_id [String] The ID of the environment.
|
2969
|
+
# @param gateway_id [String] The requested gateway ID.
|
2975
2970
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2976
|
-
def
|
2971
|
+
def delete_gateway(environment_id:, gateway_id:)
|
2977
2972
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
2978
2973
|
|
2974
|
+
raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil?
|
2975
|
+
|
2979
2976
|
headers = {
|
2980
2977
|
}
|
2981
|
-
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "
|
2978
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_gateway")
|
2982
2979
|
headers.merge!(sdk_headers)
|
2983
2980
|
|
2984
2981
|
params = {
|
2985
2982
|
"version" => @version
|
2986
2983
|
}
|
2987
2984
|
|
2988
|
-
method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
|
2985
|
+
method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
|
2989
2986
|
|
2990
2987
|
response = request(
|
2991
|
-
method: "
|
2988
|
+
method: "DELETE",
|
2992
2989
|
url: method_url,
|
2993
2990
|
headers: headers,
|
2994
2991
|
params: params,
|