ibm_watson 0.14.0 → 0.15.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ibm_watson/assistant_v1.rb +791 -736
  3. data/lib/ibm_watson/assistant_v2.rb +12 -8
  4. data/lib/ibm_watson/common.rb +2 -1
  5. data/lib/ibm_watson/compare_comply_v1.rb +171 -169
  6. data/lib/ibm_watson/discovery_v1.rb +778 -689
  7. data/lib/ibm_watson/language_translator_v3.rb +65 -63
  8. data/lib/ibm_watson/natural_language_classifier_v1.rb +36 -35
  9. data/lib/ibm_watson/natural_language_understanding_v1.rb +28 -25
  10. data/lib/ibm_watson/personality_insights_v3.rb +10 -10
  11. data/lib/ibm_watson/speech_to_text_v1.rb +764 -702
  12. data/lib/ibm_watson/text_to_speech_v1.rb +215 -200
  13. data/lib/ibm_watson/tone_analyzer_v3.rb +10 -9
  14. data/lib/ibm_watson/version.rb +1 -1
  15. data/lib/ibm_watson/visual_recognition_v3.rb +94 -95
  16. data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +1 -1
  17. data/test/integration/test_assistant_v1.rb +18 -289
  18. data/test/integration/test_assistant_v2.rb +21 -31
  19. data/test/integration/test_discovery_v1.rb +21 -18
  20. data/test/integration/test_language_translator_v3.rb +3 -3
  21. data/test/integration/test_natural_language_classifier_v1.rb +3 -3
  22. data/test/integration/test_natural_language_understanding_v1.rb +16 -20
  23. data/test/integration/test_personality_insights_v3.rb +12 -40
  24. data/test/integration/test_speech_to_text_v1.rb +3 -3
  25. data/test/integration/test_text_to_speech_v1.rb +3 -3
  26. data/test/integration/test_tone_analyzer_v3.rb +14 -31
  27. data/test/integration/test_visual_recognition_v3.rb +3 -3
  28. data/test/unit/test_compare_comply_v1.rb +3 -7
  29. data/test/unit/test_discovery_v1.rb +21 -7
  30. data/test/unit/test_language_translator_v3.rb +1 -3
  31. data/test/unit/test_natural_language_classifier_v1.rb +1 -3
  32. data/test/unit/test_speech_to_text_v1.rb +25 -7
  33. data/test/unit/test_text_to_speech_v1.rb +0 -4
  34. data/test/unit/test_visual_recognition_v3.rb +2 -6
  35. metadata +2 -2
@@ -23,7 +23,6 @@
23
23
  require "concurrent"
24
24
  require "erb"
25
25
  require "json"
26
-
27
26
  require "ibm_cloud_sdk_core"
28
27
  require_relative "./common.rb"
29
28
 
@@ -109,7 +108,8 @@ module IBMWatson
109
108
 
110
109
  headers = {
111
110
  }
112
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_environment")
111
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_environment")
112
+ headers.merge!(sdk_headers)
113
113
 
114
114
  params = {
115
115
  "version" => @version
@@ -135,25 +135,26 @@ module IBMWatson
135
135
  end
136
136
 
137
137
  ##
138
- # @!method list_environments(name: nil)
139
- # List environments.
140
- # List existing environments for the service instance.
141
- # @param name [String] Show only the environment with the given name.
138
+ # @!method delete_environment(environment_id:)
139
+ # Delete environment.
140
+ # @param environment_id [String] The ID of the environment.
142
141
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
143
- def list_environments(name: nil)
142
+ def delete_environment(environment_id:)
143
+ raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
144
+
144
145
  headers = {
145
146
  }
146
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_environments")
147
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_environment")
148
+ headers.merge!(sdk_headers)
147
149
 
148
150
  params = {
149
- "version" => @version,
150
- "name" => name
151
+ "version" => @version
151
152
  }
152
153
 
153
- method_url = "/v1/environments"
154
+ method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
154
155
 
155
156
  response = request(
156
- method: "GET",
157
+ method: "DELETE",
157
158
  url: method_url,
158
159
  headers: headers,
159
160
  params: params,
@@ -172,7 +173,8 @@ module IBMWatson
172
173
 
173
174
  headers = {
174
175
  }
175
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_environment")
176
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_environment")
177
+ headers.merge!(sdk_headers)
176
178
 
177
179
  params = {
178
180
  "version" => @version
@@ -191,67 +193,61 @@ module IBMWatson
191
193
  end
192
194
 
193
195
  ##
194
- # @!method update_environment(environment_id:, name: nil, description: nil, size: nil)
195
- # Update an environment.
196
- # Updates an environment. The environment's **name** and **description** parameters
197
- # can be changed. You must specify a **name** for the environment.
198
- # @param environment_id [String] The ID of the environment.
199
- # @param name [String] Name that identifies the environment.
200
- # @param description [String] Description of the environment.
201
- # @param size [String] Size that the environment should be increased to. Environment size cannot be
202
- # modified when using a Lite plan. Environment size can only increased and not
203
- # decreased.
196
+ # @!method list_environments(name: nil)
197
+ # List environments.
198
+ # List existing environments for the service instance.
199
+ # @param name [String] Show only the environment with the given name.
204
200
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
205
- def update_environment(environment_id:, name: nil, description: nil, size: nil)
206
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
207
-
201
+ def list_environments(name: nil)
208
202
  headers = {
209
203
  }
210
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_environment")
204
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_environments")
205
+ headers.merge!(sdk_headers)
211
206
 
212
207
  params = {
213
- "version" => @version
214
- }
215
-
216
- data = {
217
- "name" => name,
218
- "description" => description,
219
- "size" => size
208
+ "version" => @version,
209
+ "name" => name
220
210
  }
221
211
 
222
- method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
212
+ method_url = "/v1/environments"
223
213
 
224
214
  response = request(
225
- method: "PUT",
215
+ method: "GET",
226
216
  url: method_url,
227
217
  headers: headers,
228
218
  params: params,
229
- json: data,
230
219
  accept_json: true
231
220
  )
232
221
  response
233
222
  end
234
223
 
235
224
  ##
236
- # @!method delete_environment(environment_id:)
237
- # Delete environment.
225
+ # @!method list_fields(environment_id:, collection_ids:)
226
+ # List fields across collections.
227
+ # Gets a list of the unique fields (and their types) stored in the indexes of the
228
+ # specified collections.
238
229
  # @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.
239
231
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
240
- def delete_environment(environment_id:)
232
+ def list_fields(environment_id:, collection_ids:)
241
233
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
242
234
 
235
+ raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
236
+
243
237
  headers = {
244
238
  }
245
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_environment")
239
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_fields")
240
+ headers.merge!(sdk_headers)
246
241
 
247
242
  params = {
248
- "version" => @version
243
+ "version" => @version,
244
+ "collection_ids" => collection_ids.to_a
249
245
  }
250
246
 
251
- method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
247
+ method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
252
248
 
253
249
  response = request(
254
- method: "DELETE",
250
+ method: "GET",
255
251
  url: method_url,
256
252
  headers: headers,
257
253
  params: params,
@@ -261,34 +257,43 @@ module IBMWatson
261
257
  end
262
258
 
263
259
  ##
264
- # @!method list_fields(environment_id:, collection_ids:)
265
- # List fields across collections.
266
- # Gets a list of the unique fields (and their types) stored in the indexes of the
267
- # specified collections.
260
+ # @!method update_environment(environment_id:, name: nil, description: nil, size: nil)
261
+ # Update an environment.
262
+ # Updates an environment. The environment's **name** and **description** parameters
263
+ # can be changed. You must specify a **name** for the environment.
268
264
  # @param environment_id [String] The ID of the environment.
269
- # @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
265
+ # @param name [String] Name that identifies the environment.
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.
270
270
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
271
- def list_fields(environment_id:, collection_ids:)
271
+ def update_environment(environment_id:, name: nil, description: nil, size: nil)
272
272
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
273
273
 
274
- raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
275
-
276
274
  headers = {
277
275
  }
278
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_fields")
276
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_environment")
277
+ headers.merge!(sdk_headers)
279
278
 
280
279
  params = {
281
- "version" => @version,
282
- "collection_ids" => collection_ids.to_a
280
+ "version" => @version
283
281
  }
284
282
 
285
- method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
283
+ data = {
284
+ "name" => name,
285
+ "description" => description,
286
+ "size" => size
287
+ }
288
+
289
+ method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
286
290
 
287
291
  response = request(
288
- method: "GET",
292
+ method: "PUT",
289
293
  url: method_url,
290
294
  headers: headers,
291
295
  params: params,
296
+ json: data,
292
297
  accept_json: true
293
298
  )
294
299
  response
@@ -329,7 +334,8 @@ module IBMWatson
329
334
 
330
335
  headers = {
331
336
  }
332
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_configuration")
337
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_configuration")
338
+ headers.merge!(sdk_headers)
333
339
 
334
340
  params = {
335
341
  "version" => @version
@@ -358,28 +364,35 @@ module IBMWatson
358
364
  end
359
365
 
360
366
  ##
361
- # @!method list_configurations(environment_id:, name: nil)
362
- # List configurations.
363
- # Lists existing configurations for the service instance.
367
+ # @!method delete_configuration(environment_id:, configuration_id:)
368
+ # Delete a configuration.
369
+ # The deletion is performed unconditionally. A configuration deletion request
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.
364
375
  # @param environment_id [String] The ID of the environment.
365
- # @param name [String] Find configurations with the given name.
376
+ # @param configuration_id [String] The ID of the configuration.
366
377
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
367
- def list_configurations(environment_id:, name: nil)
378
+ def delete_configuration(environment_id:, configuration_id:)
368
379
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
369
380
 
381
+ raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil?
382
+
370
383
  headers = {
371
384
  }
372
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_configurations")
385
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_configuration")
386
+ headers.merge!(sdk_headers)
373
387
 
374
388
  params = {
375
- "version" => @version,
376
- "name" => name
389
+ "version" => @version
377
390
  }
378
391
 
379
- method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
392
+ method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
380
393
 
381
394
  response = request(
382
- method: "GET",
395
+ method: "DELETE",
383
396
  url: method_url,
384
397
  headers: headers,
385
398
  params: params,
@@ -401,7 +414,8 @@ module IBMWatson
401
414
 
402
415
  headers = {
403
416
  }
404
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_configuration")
417
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_configuration")
418
+ headers.merge!(sdk_headers)
405
419
 
406
420
  params = {
407
421
  "version" => @version
@@ -419,6 +433,38 @@ module IBMWatson
419
433
  response
420
434
  end
421
435
 
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
+
422
468
  ##
423
469
  # @!method update_configuration(environment_id:, configuration_id:, name:, description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil)
424
470
  # Update a configuration.
@@ -451,7 +497,8 @@ module IBMWatson
451
497
 
452
498
  headers = {
453
499
  }
454
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_configuration")
500
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_configuration")
501
+ headers.merge!(sdk_headers)
455
502
 
456
503
  params = {
457
504
  "version" => @version
@@ -478,49 +525,12 @@ module IBMWatson
478
525
  )
479
526
  response
480
527
  end
481
-
482
- ##
483
- # @!method delete_configuration(environment_id:, configuration_id:)
484
- # Delete a configuration.
485
- # The deletion is performed unconditionally. A configuration deletion request
486
- # succeeds even if the configuration is referenced by a collection or document
487
- # ingestion. However, documents that have already been submitted for processing
488
- # continue to use the deleted configuration. Documents are always processed with a
489
- # snapshot of the configuration as it existed at the time the document was
490
- # submitted.
491
- # @param environment_id [String] The ID of the environment.
492
- # @param configuration_id [String] The ID of the configuration.
493
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
494
- def delete_configuration(environment_id:, configuration_id:)
495
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
496
-
497
- raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil?
498
-
499
- headers = {
500
- }
501
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_configuration")
502
-
503
- params = {
504
- "version" => @version
505
- }
506
-
507
- method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
508
-
509
- response = request(
510
- method: "DELETE",
511
- url: method_url,
512
- headers: headers,
513
- params: params,
514
- accept_json: true
515
- )
516
- response
517
- end
518
528
  #########################
519
529
  # Test your configuration on a document
520
530
  #########################
521
531
 
522
532
  ##
523
- # @!method test_configuration_in_environment(environment_id:, configuration: nil, step: nil, configuration_id: nil, file: nil, metadata: nil, file_content_type: nil, filename: nil)
533
+ # @!method test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
524
534
  # Test configuration.
525
535
  # Runs a sample document through the default or your configuration and returns
526
536
  # diagnostic information designed to help you understand how the document was
@@ -533,14 +543,12 @@ module IBMWatson
533
543
  # Configuration parts larger than 1 MB are rejected.
534
544
  # See the `GET /configurations/{configuration_id}` operation for an example
535
545
  # configuration.
536
- # @param step [String] Specify to only run the input document through the given step instead of running
537
- # the input document through the entire ingestion workflow. Valid values are
538
- # `convert`, `enrich`, and `normalize`.
539
- # @param configuration_id [String] The ID of the configuration to use to process the document. If the
540
- # **configuration** form part is also provided (both are present at the same time),
541
- # then the request will be rejected.
542
- # @param file [File] The content of the document to ingest. The maximum supported file size is 50
543
- # megabytes. Files larger than 50 megabytes is rejected.
546
+ # @param file [File] The content of the document to ingest. The maximum supported file size when adding
547
+ # a file to a collection is 50 megabytes, the maximum supported file size when
548
+ # testing a confiruration is 1 megabyte. Files larger than the supported size are
549
+ # rejected.
550
+ # @param filename [String] The filename for file.
551
+ # @param file_content_type [String] The content type of file.
544
552
  # @param metadata [String] If you're using the Data Crawler to upload your documents, you can test a document
545
553
  # against the type of metadata that the Data Crawler might send. The maximum
546
554
  # supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
@@ -549,15 +557,20 @@ module IBMWatson
549
557
  # \"Creator\": \"Johnny Appleseed\",
550
558
  # \"Subject\": \"Apples\"
551
559
  # } ```.
552
- # @param file_content_type [String] The content type of file.
553
- # @param filename [String] The filename for file.
560
+ # @param step [String] Specify to only run the input document through the given step instead of running
561
+ # the input document through the entire ingestion workflow. Valid values are
562
+ # `convert`, `enrich`, and `normalize`.
563
+ # @param configuration_id [String] The ID of the configuration to use to process the document. If the
564
+ # **configuration** form part is also provided (both are present at the same time),
565
+ # then the request will be rejected.
554
566
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
555
- def test_configuration_in_environment(environment_id:, configuration: nil, step: nil, configuration_id: nil, file: nil, metadata: nil, file_content_type: nil, filename: nil)
567
+ def test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
556
568
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
557
569
 
558
570
  headers = {
559
571
  }
560
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "test_configuration_in_environment")
572
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "test_configuration_in_environment")
573
+ headers.merge!(sdk_headers)
561
574
 
562
575
  params = {
563
576
  "version" => @version,
@@ -612,7 +625,8 @@ module IBMWatson
612
625
 
613
626
  headers = {
614
627
  }
615
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_collection")
628
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_collection")
629
+ headers.merge!(sdk_headers)
616
630
 
617
631
  params = {
618
632
  "version" => @version
@@ -639,28 +653,29 @@ module IBMWatson
639
653
  end
640
654
 
641
655
  ##
642
- # @!method list_collections(environment_id:, name: nil)
643
- # List collections.
644
- # Lists existing collections for the service instance.
656
+ # @!method delete_collection(environment_id:, collection_id:)
657
+ # Delete a collection.
645
658
  # @param environment_id [String] The ID of the environment.
646
- # @param name [String] Find collections with the given name.
659
+ # @param collection_id [String] The ID of the collection.
647
660
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
648
- def list_collections(environment_id:, name: nil)
661
+ def delete_collection(environment_id:, collection_id:)
649
662
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
650
663
 
664
+ raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
665
+
651
666
  headers = {
652
667
  }
653
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_collections")
668
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_collection")
669
+ headers.merge!(sdk_headers)
654
670
 
655
671
  params = {
656
- "version" => @version,
657
- "name" => name
672
+ "version" => @version
658
673
  }
659
674
 
660
- method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
675
+ method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
661
676
 
662
677
  response = request(
663
- method: "GET",
678
+ method: "DELETE",
664
679
  url: method_url,
665
680
  headers: headers,
666
681
  params: params,
@@ -682,7 +697,8 @@ module IBMWatson
682
697
 
683
698
  headers = {
684
699
  }
685
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_collection")
700
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_collection")
701
+ headers.merge!(sdk_headers)
686
702
 
687
703
  params = {
688
704
  "version" => @version
@@ -701,69 +717,62 @@ module IBMWatson
701
717
  end
702
718
 
703
719
  ##
704
- # @!method update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
705
- # Update a collection.
720
+ # @!method list_collection_fields(environment_id:, collection_id:)
721
+ # List collection fields.
722
+ # Gets a list of the unique fields (and their types) stored in the index.
706
723
  # @param environment_id [String] The ID of the environment.
707
724
  # @param collection_id [String] The ID of the collection.
708
- # @param name [String] The name of the collection.
709
- # @param description [String] A description of the collection.
710
- # @param configuration_id [String] The ID of the configuration in which the collection is to be updated.
711
725
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
712
- def update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
726
+ def list_collection_fields(environment_id:, collection_id:)
713
727
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
714
728
 
715
729
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
716
730
 
717
731
  headers = {
718
732
  }
719
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_collection")
733
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collection_fields")
734
+ headers.merge!(sdk_headers)
720
735
 
721
736
  params = {
722
737
  "version" => @version
723
738
  }
724
739
 
725
- data = {
726
- "name" => name,
727
- "description" => description,
728
- "configuration_id" => configuration_id
729
- }
730
-
731
- method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
740
+ method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
732
741
 
733
742
  response = request(
734
- method: "PUT",
743
+ method: "GET",
735
744
  url: method_url,
736
745
  headers: headers,
737
746
  params: params,
738
- json: data,
739
747
  accept_json: true
740
748
  )
741
749
  response
742
750
  end
743
751
 
744
752
  ##
745
- # @!method delete_collection(environment_id:, collection_id:)
746
- # Delete a collection.
753
+ # @!method list_collections(environment_id:, name: nil)
754
+ # List collections.
755
+ # Lists existing collections for the service instance.
747
756
  # @param environment_id [String] The ID of the environment.
748
- # @param collection_id [String] The ID of the collection.
757
+ # @param name [String] Find collections with the given name.
749
758
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
750
- def delete_collection(environment_id:, collection_id:)
759
+ def list_collections(environment_id:, name: nil)
751
760
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
752
761
 
753
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
754
-
755
762
  headers = {
756
763
  }
757
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_collection")
764
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collections")
765
+ headers.merge!(sdk_headers)
758
766
 
759
767
  params = {
760
- "version" => @version
768
+ "version" => @version,
769
+ "name" => name
761
770
  }
762
771
 
763
- method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
772
+ method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
764
773
 
765
774
  response = request(
766
- method: "DELETE",
775
+ method: "GET",
767
776
  url: method_url,
768
777
  headers: headers,
769
778
  params: params,
@@ -773,32 +782,42 @@ module IBMWatson
773
782
  end
774
783
 
775
784
  ##
776
- # @!method list_collection_fields(environment_id:, collection_id:)
777
- # List collection fields.
778
- # Gets a list of the unique fields (and their types) stored in the index.
785
+ # @!method update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
786
+ # Update a collection.
779
787
  # @param environment_id [String] The ID of the environment.
780
788
  # @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.
781
792
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
782
- def list_collection_fields(environment_id:, collection_id:)
793
+ def update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil)
783
794
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
784
795
 
785
796
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
786
797
 
787
798
  headers = {
788
799
  }
789
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_collection_fields")
800
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_collection")
801
+ headers.merge!(sdk_headers)
790
802
 
791
803
  params = {
792
804
  "version" => @version
793
805
  }
794
806
 
795
- method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
807
+ data = {
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)]
796
814
 
797
815
  response = request(
798
- method: "GET",
816
+ method: "PUT",
799
817
  url: method_url,
800
818
  headers: headers,
801
819
  params: params,
820
+ json: data,
802
821
  accept_json: true
803
822
  )
804
823
  response
@@ -807,39 +826,6 @@ module IBMWatson
807
826
  # Query modifications
808
827
  #########################
809
828
 
810
- ##
811
- # @!method list_expansions(environment_id:, collection_id:)
812
- # Get the expansion list.
813
- # Returns the current expansion list for the specified collection. If an expansion
814
- # list is not specified, an object with empty expansion arrays is returned.
815
- # @param environment_id [String] The ID of the environment.
816
- # @param collection_id [String] The ID of the collection.
817
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
818
- def list_expansions(environment_id:, collection_id:)
819
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
820
-
821
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
822
-
823
- headers = {
824
- }
825
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_expansions")
826
-
827
- params = {
828
- "version" => @version
829
- }
830
-
831
- method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
832
-
833
- response = request(
834
- method: "GET",
835
- url: method_url,
836
- headers: headers,
837
- params: params,
838
- accept_json: true
839
- )
840
- response
841
- end
842
-
843
829
  ##
844
830
  # @!method create_expansions(environment_id:, collection_id:, expansions:)
845
831
  # Create or update expansion list.
@@ -874,7 +860,8 @@ module IBMWatson
874
860
 
875
861
  headers = {
876
862
  }
877
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_expansions")
863
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_expansions")
864
+ headers.merge!(sdk_headers)
878
865
 
879
866
  params = {
880
867
  "version" => @version
@@ -898,109 +885,158 @@ module IBMWatson
898
885
  end
899
886
 
900
887
  ##
901
- # @!method delete_expansions(environment_id:, collection_id:)
902
- # Delete the expansion list.
903
- # Remove the expansion information for this collection. The expansion list must be
904
- # deleted to disable query expansion for a collection.
888
+ # @!method create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
889
+ # Create stopword list.
890
+ # Upload a custom stopword list to use with the specified collection.
905
891
  # @param environment_id [String] The ID of the environment.
906
892
  # @param collection_id [String] The ID of the collection.
907
- # @return [nil]
908
- def delete_expansions(environment_id:, collection_id:)
893
+ # @param stopword_file [File] The content of the stopword list to ingest.
894
+ # @param stopword_filename [String] The filename for stopword_file.
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)
909
897
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
910
898
 
911
899
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
912
900
 
901
+ raise ArgumentError.new("stopword_file must be provided") if stopword_file.nil?
902
+
913
903
  headers = {
914
904
  }
915
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_expansions")
905
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_stopword_list")
906
+ headers.merge!(sdk_headers)
916
907
 
917
908
  params = {
918
909
  "version" => @version
919
910
  }
920
911
 
921
- method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
912
+ form_data = {}
922
913
 
923
- request(
924
- method: "DELETE",
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)]
921
+
922
+ response = request(
923
+ method: "POST",
925
924
  url: method_url,
926
925
  headers: headers,
927
926
  params: params,
927
+ form: form_data,
928
928
  accept_json: true
929
929
  )
930
- nil
930
+ response
931
931
  end
932
932
 
933
933
  ##
934
- # @!method get_tokenization_dictionary_status(environment_id:, collection_id:)
935
- # Get tokenization dictionary status.
936
- # Returns the current status of the tokenization dictionary for the specified
937
- # collection.
934
+ # @!method create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
935
+ # Create tokenization dictionary.
936
+ # Upload a custom tokenization dictionary to use with the specified collection.
938
937
  # @param environment_id [String] The ID of the environment.
939
938
  # @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.
940
942
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
941
- def get_tokenization_dictionary_status(environment_id:, collection_id:)
943
+ def create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
942
944
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
943
945
 
944
946
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
945
947
 
946
948
  headers = {
947
949
  }
948
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_tokenization_dictionary_status")
950
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_tokenization_dictionary")
951
+ headers.merge!(sdk_headers)
949
952
 
950
953
  params = {
951
954
  "version" => @version
952
955
  }
953
956
 
957
+ data = {
958
+ "tokenization_rules" => tokenization_rules
959
+ }
960
+
954
961
  method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
955
962
 
956
963
  response = request(
957
- method: "GET",
964
+ method: "POST",
958
965
  url: method_url,
959
966
  headers: headers,
960
967
  params: params,
968
+ json: data,
961
969
  accept_json: true
962
970
  )
963
971
  response
964
972
  end
965
973
 
966
974
  ##
967
- # @!method create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
968
- # Create tokenization dictionary.
969
- # Upload a custom tokenization dictionary to use with the specified collection.
975
+ # @!method delete_expansions(environment_id:, collection_id:)
976
+ # Delete the expansion list.
977
+ # Remove the expansion information for this collection. The expansion list must be
978
+ # deleted to disable query expansion for a collection.
970
979
  # @param environment_id [String] The ID of the environment.
971
980
  # @param collection_id [String] The ID of the collection.
972
- # @param tokenization_rules [Array[TokenDictRule]] An array of tokenization rules. Each rule contains, the original `text` string,
973
- # component `tokens`, any alternate character set `readings`, and which
974
- # `part_of_speech` the text is from.
975
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
976
- def create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil)
981
+ # @return [nil]
982
+ def delete_expansions(environment_id:, collection_id:)
977
983
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
978
984
 
979
985
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
980
986
 
981
987
  headers = {
982
988
  }
983
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_tokenization_dictionary")
989
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_expansions")
990
+ headers.merge!(sdk_headers)
984
991
 
985
992
  params = {
986
993
  "version" => @version
987
994
  }
988
995
 
989
- data = {
990
- "tokenization_rules" => tokenization_rules
996
+ method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
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 = {
991
1022
  }
1023
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_stopword_list")
1024
+ headers.merge!(sdk_headers)
992
1025
 
993
- method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1026
+ params = {
1027
+ "version" => @version
1028
+ }
994
1029
 
995
- response = request(
996
- method: "POST",
1030
+ method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1031
+
1032
+ request(
1033
+ method: "DELETE",
997
1034
  url: method_url,
998
1035
  headers: headers,
999
1036
  params: params,
1000
- json: data,
1001
- accept_json: true
1037
+ accept_json: false
1002
1038
  )
1003
- response
1039
+ nil
1004
1040
  end
1005
1041
 
1006
1042
  ##
@@ -1017,7 +1053,8 @@ module IBMWatson
1017
1053
 
1018
1054
  headers = {
1019
1055
  }
1020
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_tokenization_dictionary")
1056
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_tokenization_dictionary")
1057
+ headers.merge!(sdk_headers)
1021
1058
 
1022
1059
  params = {
1023
1060
  "version" => @version
@@ -1030,7 +1067,7 @@ module IBMWatson
1030
1067
  url: method_url,
1031
1068
  headers: headers,
1032
1069
  params: params,
1033
- accept_json: true
1070
+ accept_json: false
1034
1071
  )
1035
1072
  nil
1036
1073
  end
@@ -1049,7 +1086,8 @@ module IBMWatson
1049
1086
 
1050
1087
  headers = {
1051
1088
  }
1052
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_stopword_list_status")
1089
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_stopword_list_status")
1090
+ headers.merge!(sdk_headers)
1053
1091
 
1054
1092
  params = {
1055
1093
  "version" => @version
@@ -1068,88 +1106,78 @@ module IBMWatson
1068
1106
  end
1069
1107
 
1070
1108
  ##
1071
- # @!method create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
1072
- # Create stopword list.
1073
- # Upload a custom stopword list to use with the specified collection.
1109
+ # @!method get_tokenization_dictionary_status(environment_id:, collection_id:)
1110
+ # Get tokenization dictionary status.
1111
+ # Returns the current status of the tokenization dictionary for the specified
1112
+ # collection.
1074
1113
  # @param environment_id [String] The ID of the environment.
1075
1114
  # @param collection_id [String] The ID of the collection.
1076
- # @param stopword_file [File] The content of the stopword list to ingest.
1077
- # @param stopword_filename [String] The filename for stopword_file.
1078
1115
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1079
- def create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil)
1116
+ def get_tokenization_dictionary_status(environment_id:, collection_id:)
1080
1117
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1081
1118
 
1082
1119
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1083
1120
 
1084
- raise ArgumentError.new("stopword_file must be provided") if stopword_file.nil?
1085
-
1086
1121
  headers = {
1087
1122
  }
1088
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_stopword_list")
1123
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_tokenization_dictionary_status")
1124
+ headers.merge!(sdk_headers)
1089
1125
 
1090
1126
  params = {
1091
1127
  "version" => @version
1092
1128
  }
1093
1129
 
1094
- form_data = {}
1095
-
1096
- unless stopword_file.instance_of?(StringIO) || stopword_file.instance_of?(File)
1097
- stopword_file = stopword_file.respond_to?(:to_json) ? StringIO.new(stopword_file.to_json) : StringIO.new(stopword_file)
1098
- end
1099
- stopword_filename = stopword_file.path if stopword_filename.nil? && stopword_file.respond_to?(:path)
1100
- form_data[:stopword_file] = HTTP::FormData::File.new(stopword_file, content_type: "application/octet-stream", filename: stopword_filename)
1101
-
1102
- method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1130
+ method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1103
1131
 
1104
1132
  response = request(
1105
- method: "POST",
1133
+ method: "GET",
1106
1134
  url: method_url,
1107
1135
  headers: headers,
1108
1136
  params: params,
1109
- form: form_data,
1110
1137
  accept_json: true
1111
1138
  )
1112
1139
  response
1113
1140
  end
1114
1141
 
1115
1142
  ##
1116
- # @!method delete_stopword_list(environment_id:, collection_id:)
1117
- # Delete a custom stopword list.
1118
- # Delete a custom stopword list from the collection. After a custom stopword list is
1119
- # deleted, the default list is used for the collection.
1143
+ # @!method list_expansions(environment_id:, collection_id:)
1144
+ # Get the expansion list.
1145
+ # Returns the current expansion list for the specified collection. If an expansion
1146
+ # list is not specified, an object with empty expansion arrays is returned.
1120
1147
  # @param environment_id [String] The ID of the environment.
1121
1148
  # @param collection_id [String] The ID of the collection.
1122
- # @return [nil]
1123
- def delete_stopword_list(environment_id:, collection_id:)
1149
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1150
+ def list_expansions(environment_id:, collection_id:)
1124
1151
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1125
1152
 
1126
1153
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1127
1154
 
1128
1155
  headers = {
1129
1156
  }
1130
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_stopword_list")
1157
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_expansions")
1158
+ headers.merge!(sdk_headers)
1131
1159
 
1132
1160
  params = {
1133
1161
  "version" => @version
1134
1162
  }
1135
1163
 
1136
- method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1164
+ method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1137
1165
 
1138
- request(
1139
- method: "DELETE",
1166
+ response = request(
1167
+ method: "GET",
1140
1168
  url: method_url,
1141
1169
  headers: headers,
1142
1170
  params: params,
1143
1171
  accept_json: true
1144
1172
  )
1145
- nil
1173
+ response
1146
1174
  end
1147
1175
  #########################
1148
1176
  # Documents
1149
1177
  #########################
1150
1178
 
1151
1179
  ##
1152
- # @!method add_document(environment_id:, collection_id:, file: nil, metadata: nil, file_content_type: nil, filename: nil)
1180
+ # @!method add_document(environment_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
1153
1181
  # Add a document.
1154
1182
  # Add a document to a collection with optional metadata.
1155
1183
  #
@@ -1174,11 +1202,19 @@ module IBMWatson
1174
1202
  # indexing.
1175
1203
  #
1176
1204
  # * Fields containing the following characters after normalization are filtered
1177
- # out before indexing: `#` and `,`.
1205
+ # out before indexing: `#` and `,`
1206
+ #
1207
+ # **Note:** Documents can be added with a specific **document_id** by using the
1208
+ # **_/v1/environments/{environment_id}/collections/{collection_id}/documents**
1209
+ # method.
1178
1210
  # @param environment_id [String] The ID of the environment.
1179
1211
  # @param collection_id [String] The ID of the collection.
1180
- # @param file [File] The content of the document to ingest. The maximum supported file size is 50
1181
- # megabytes. Files larger than 50 megabytes is rejected.
1212
+ # @param file [File] The content of the document to ingest. The maximum supported file size when adding
1213
+ # a file to a collection is 50 megabytes, the maximum supported file size when
1214
+ # testing a confiruration is 1 megabyte. Files larger than the supported size are
1215
+ # rejected.
1216
+ # @param filename [String] The filename for file.
1217
+ # @param file_content_type [String] The content type of file.
1182
1218
  # @param metadata [String] If you're using the Data Crawler to upload your documents, you can test a document
1183
1219
  # against the type of metadata that the Data Crawler might send. The maximum
1184
1220
  # supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
@@ -1187,17 +1223,16 @@ module IBMWatson
1187
1223
  # \"Creator\": \"Johnny Appleseed\",
1188
1224
  # \"Subject\": \"Apples\"
1189
1225
  # } ```.
1190
- # @param file_content_type [String] The content type of file.
1191
- # @param filename [String] The filename for file.
1192
1226
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1193
- def add_document(environment_id:, collection_id:, file: nil, metadata: nil, file_content_type: nil, filename: nil)
1227
+ def add_document(environment_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
1194
1228
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1195
1229
 
1196
1230
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1197
1231
 
1198
1232
  headers = {
1199
1233
  }
1200
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "add_document")
1234
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "add_document")
1235
+ headers.merge!(sdk_headers)
1201
1236
 
1202
1237
  params = {
1203
1238
  "version" => @version
@@ -1229,17 +1264,16 @@ module IBMWatson
1229
1264
  end
1230
1265
 
1231
1266
  ##
1232
- # @!method get_document_status(environment_id:, collection_id:, document_id:)
1233
- # Get document details.
1234
- # Fetch status details about a submitted document. **Note:** this operation does not
1235
- # return the document itself. Instead, it returns only the document's processing
1236
- # status and any notices (warnings or errors) that were generated when the document
1237
- # was ingested. Use the query API to retrieve the actual document content.
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'.
1238
1272
  # @param environment_id [String] The ID of the environment.
1239
1273
  # @param collection_id [String] The ID of the collection.
1240
1274
  # @param document_id [String] The ID of the document.
1241
1275
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1242
- def get_document_status(environment_id:, collection_id:, document_id:)
1276
+ def delete_document(environment_id:, collection_id:, document_id:)
1243
1277
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1244
1278
 
1245
1279
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -1248,7 +1282,8 @@ module IBMWatson
1248
1282
 
1249
1283
  headers = {
1250
1284
  }
1251
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_document_status")
1285
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_document")
1286
+ headers.merge!(sdk_headers)
1252
1287
 
1253
1288
  params = {
1254
1289
  "version" => @version
@@ -1257,7 +1292,7 @@ module IBMWatson
1257
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)]
1258
1293
 
1259
1294
  response = request(
1260
- method: "GET",
1295
+ method: "DELETE",
1261
1296
  url: method_url,
1262
1297
  headers: headers,
1263
1298
  params: params,
@@ -1267,26 +1302,17 @@ module IBMWatson
1267
1302
  end
1268
1303
 
1269
1304
  ##
1270
- # @!method update_document(environment_id:, collection_id:, document_id:, file: nil, metadata: nil, file_content_type: nil, filename: nil)
1271
- # Update a document.
1272
- # Replace an existing document. Starts ingesting a document with optional metadata.
1305
+ # @!method get_document_status(environment_id:, collection_id:, document_id:)
1306
+ # Get document details.
1307
+ # Fetch status details about a submitted document. **Note:** this operation does not
1308
+ # return the document itself. Instead, it returns only the document's processing
1309
+ # status and any notices (warnings or errors) that were generated when the document
1310
+ # was ingested. Use the query API to retrieve the actual document content.
1273
1311
  # @param environment_id [String] The ID of the environment.
1274
1312
  # @param collection_id [String] The ID of the collection.
1275
1313
  # @param document_id [String] The ID of the document.
1276
- # @param file [File] The content of the document to ingest. The maximum supported file size is 50
1277
- # megabytes. Files larger than 50 megabytes is rejected.
1278
- # @param metadata [String] If you're using the Data Crawler to upload your documents, you can test a document
1279
- # against the type of metadata that the Data Crawler might send. The maximum
1280
- # supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
1281
- # rejected.
1282
- # Example: ``` {
1283
- # \"Creator\": \"Johnny Appleseed\",
1284
- # \"Subject\": \"Apples\"
1285
- # } ```.
1286
- # @param file_content_type [String] The content type of file.
1287
- # @param filename [String] The filename for file.
1288
1314
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1289
- def update_document(environment_id:, collection_id:, document_id:, file: nil, metadata: nil, file_content_type: nil, filename: nil)
1315
+ def get_document_status(environment_id:, collection_id:, document_id:)
1290
1316
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1291
1317
 
1292
1318
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -1295,48 +1321,52 @@ module IBMWatson
1295
1321
 
1296
1322
  headers = {
1297
1323
  }
1298
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_document")
1324
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_document_status")
1325
+ headers.merge!(sdk_headers)
1299
1326
 
1300
1327
  params = {
1301
1328
  "version" => @version
1302
1329
  }
1303
1330
 
1304
- form_data = {}
1305
-
1306
- unless file.nil?
1307
- unless file.instance_of?(StringIO) || file.instance_of?(File)
1308
- file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
1309
- end
1310
- filename = file.path if filename.nil? && file.respond_to?(:path)
1311
- form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
1312
- end
1313
-
1314
- form_data[:metadata] = HTTP::FormData::Part.new(metadata.to_s, content_type: "text/plain") unless metadata.nil?
1315
-
1316
- 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)]
1331
+ 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)]
1317
1332
 
1318
1333
  response = request(
1319
- method: "POST",
1334
+ method: "GET",
1320
1335
  url: method_url,
1321
1336
  headers: headers,
1322
1337
  params: params,
1323
- form: form_data,
1324
1338
  accept_json: true
1325
1339
  )
1326
1340
  response
1327
1341
  end
1328
1342
 
1329
1343
  ##
1330
- # @!method delete_document(environment_id:, collection_id:, document_id:)
1331
- # Delete a document.
1332
- # If the given document ID is invalid, or if the document is not found, then the a
1333
- # success response is returned (HTTP status code `200`) with the status set to
1334
- # 'deleted'.
1344
+ # @!method update_document(environment_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
1345
+ # Update a document.
1346
+ # Replace an existing document or add a document with a specified **document_id**.
1347
+ # Starts ingesting a document with optional metadata.
1348
+ #
1349
+ # **Note:** When uploading a new document with this method it automatically replaces
1350
+ # any document stored with the same **document_id** if it exists.
1335
1351
  # @param environment_id [String] The ID of the environment.
1336
1352
  # @param collection_id [String] The ID of the collection.
1337
1353
  # @param document_id [String] The ID of the document.
1354
+ # @param file [File] The content of the document to ingest. The maximum supported file size when adding
1355
+ # a file to a collection is 50 megabytes, the maximum supported file size when
1356
+ # testing a confiruration is 1 megabyte. Files larger than the supported size are
1357
+ # rejected.
1358
+ # @param filename [String] The filename for file.
1359
+ # @param file_content_type [String] The content type of file.
1360
+ # @param metadata [String] If you're using the Data Crawler to upload your documents, you can test a document
1361
+ # against the type of metadata that the Data Crawler might send. The maximum
1362
+ # supported metadata file size is 1 MB. Metadata parts larger than 1 MB are
1363
+ # rejected.
1364
+ # Example: ``` {
1365
+ # \"Creator\": \"Johnny Appleseed\",
1366
+ # \"Subject\": \"Apples\"
1367
+ # } ```.
1338
1368
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1339
- def delete_document(environment_id:, collection_id:, document_id:)
1369
+ def update_document(environment_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
1340
1370
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1341
1371
 
1342
1372
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -1345,19 +1375,33 @@ module IBMWatson
1345
1375
 
1346
1376
  headers = {
1347
1377
  }
1348
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_document")
1378
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_document")
1379
+ headers.merge!(sdk_headers)
1349
1380
 
1350
1381
  params = {
1351
1382
  "version" => @version
1352
1383
  }
1353
1384
 
1385
+ form_data = {}
1386
+
1387
+ unless file.nil?
1388
+ unless file.instance_of?(StringIO) || file.instance_of?(File)
1389
+ file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
1390
+ end
1391
+ filename = file.path if filename.nil? && file.respond_to?(:path)
1392
+ form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
1393
+ end
1394
+
1395
+ form_data[:metadata] = HTTP::FormData::Part.new(metadata.to_s, content_type: "text/plain") unless metadata.nil?
1396
+
1354
1397
  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)]
1355
1398
 
1356
1399
  response = request(
1357
- method: "DELETE",
1400
+ method: "POST",
1358
1401
  url: method_url,
1359
1402
  headers: headers,
1360
1403
  params: params,
1404
+ form: form_data,
1361
1405
  accept_json: true
1362
1406
  )
1363
1407
  response
@@ -1367,14 +1411,13 @@ module IBMWatson
1367
1411
  #########################
1368
1412
 
1369
1413
  ##
1370
- # @!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)
1371
- # Long collection queries.
1414
+ # @!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)
1415
+ # Long environment queries.
1372
1416
  # Complex queries might be too long for a standard method query. By using this
1373
1417
  # method, you can construct longer queries. However, these queries may take longer
1374
1418
  # to complete than the standard method. For details, see the [Discovery service
1375
- # documentation](https://console.bluemix.net/docs/services/discovery/using.html).
1419
+ # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
1376
1420
  # @param environment_id [String] The ID of the environment.
1377
- # @param collection_id [String] The ID of the collection.
1378
1421
  # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
1379
1422
  # Filter searches are better for metadata-type searches and for assessing the
1380
1423
  # concepts in the data set.
@@ -1405,7 +1448,7 @@ module IBMWatson
1405
1448
  # @param passages_count [Fixnum] The maximum number of passages to return. The search returns fewer passages if the
1406
1449
  # requested total is not found. The default is `10`. The maximum is `100`.
1407
1450
  # @param passages_characters [Fixnum] The approximate number of characters that any one passage will have.
1408
- # @param deduplicate [Boolean] When `true` and used with a Watson Discovery News collection, duplicate results
1451
+ # @param deduplicate [Boolean] When `true`, and used with a Watson Discovery News collection, duplicate results
1409
1452
  # (based on the contents of the **title** field) are removed. Duplicate comparison
1410
1453
  # is limited to the current query only; **offset** is not considered. This parameter
1411
1454
  # is currently Beta functionality.
@@ -1433,15 +1476,14 @@ module IBMWatson
1433
1476
  # parameter.
1434
1477
  # @param logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
1435
1478
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1436
- 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)
1479
+ 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)
1437
1480
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1438
1481
 
1439
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1440
-
1441
1482
  headers = {
1442
1483
  "X-Watson-Logging-Opt-Out" => logging_opt_out
1443
1484
  }
1444
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "query")
1485
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query")
1486
+ headers.merge!(sdk_headers)
1445
1487
 
1446
1488
  params = {
1447
1489
  "version" => @version
@@ -1470,7 +1512,7 @@ module IBMWatson
1470
1512
  "bias" => bias
1471
1513
  }
1472
1514
 
1473
- method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1515
+ method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
1474
1516
 
1475
1517
  response = request(
1476
1518
  method: "POST",
@@ -1484,15 +1526,15 @@ module IBMWatson
1484
1526
  end
1485
1527
 
1486
1528
  ##
1487
- # @!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)
1488
- # Query system notices.
1529
+ # @!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)
1530
+ # Query multiple collection system notices.
1489
1531
  # Queries for notices (errors or warnings) that might have been generated by the
1490
1532
  # system. Notices are generated when ingesting documents and performing relevance
1491
1533
  # training. See the [Discovery service
1492
- # documentation](https://console.bluemix.net/docs/services/discovery/using.html) for
1493
- # more details on the query language.
1534
+ # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts)
1535
+ # for more details on the query language.
1494
1536
  # @param environment_id [String] The ID of the environment.
1495
- # @param collection_id [String] The ID of the collection.
1537
+ # @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
1496
1538
  # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
1497
1539
  # Filter searches are better for metadata-type searches and for assessing the
1498
1540
  # concepts in the data set.
@@ -1503,25 +1545,21 @@ module IBMWatson
1503
1545
  # @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
1504
1546
  # data and natural language understanding. You cannot use **natural_language_query**
1505
1547
  # and **query** at the same time.
1506
- # @param passages [Boolean] A passages query that returns the most relevant passages from the results.
1507
1548
  # @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
1508
1549
  # filters. Useful for applications to build lists, tables, and time series. For a
1509
1550
  # full list of possible aggregations, see the Query reference.
1510
- # @param count [Fixnum] Number of results to return.
1551
+ # @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
1552
+ # together in any one query is **10000**.
1511
1553
  # @param return_fields [Array[String]] A comma-separated list of the portion of the document hierarchy to return.
1512
1554
  # @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
1513
1555
  # number of results that are returned is 10 and the offset is 8, it returns the last
1514
- # two results.
1556
+ # two results. The maximum for the **count** and **offset** values together in any
1557
+ # one query is **10000**.
1515
1558
  # @param sort [Array[String]] A comma-separated list of fields in the document to sort on. You can optionally
1516
1559
  # specify a sort direction by prefixing the field with `-` for descending or `+` for
1517
1560
  # ascending. Ascending is the default sort direction if no prefix is specified.
1518
1561
  # @param highlight [Boolean] When true, a highlight field is returned for each result which contains the fields
1519
1562
  # which match the query with `<em></em>` tags around the matching query terms.
1520
- # @param passages_fields [Array[String]] A comma-separated list of fields that passages are drawn from. If this parameter
1521
- # not specified, then all top-level fields are included.
1522
- # @param passages_count [Fixnum] The maximum number of passages to return. The search returns fewer passages if the
1523
- # requested total is not found.
1524
- # @param passages_characters [Fixnum] The approximate number of characters that any one passage will have.
1525
1563
  # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
1526
1564
  # the returned results. Duplicate comparison is limited to the current query only,
1527
1565
  # **offset** is not considered. This parameter is currently Beta functionality.
@@ -1537,37 +1575,35 @@ module IBMWatson
1537
1575
  # identify similar documents. If not specified, the entire document is used for
1538
1576
  # comparison.
1539
1577
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1540
- 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)
1578
+ 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)
1541
1579
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1542
1580
 
1543
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1581
+ raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
1544
1582
 
1545
1583
  headers = {
1546
1584
  }
1547
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "query_notices")
1585
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query_notices")
1586
+ headers.merge!(sdk_headers)
1548
1587
 
1549
1588
  params = {
1550
1589
  "version" => @version,
1590
+ "collection_ids" => collection_ids.to_a,
1551
1591
  "filter" => filter,
1552
1592
  "query" => query,
1553
1593
  "natural_language_query" => natural_language_query,
1554
- "passages" => passages,
1555
1594
  "aggregation" => aggregation,
1556
1595
  "count" => count,
1557
1596
  "return" => return_fields.to_a,
1558
1597
  "offset" => offset,
1559
1598
  "sort" => sort.to_a,
1560
1599
  "highlight" => highlight,
1561
- "passages.fields" => passages_fields.to_a,
1562
- "passages.count" => passages_count,
1563
- "passages.characters" => passages_characters,
1564
1600
  "deduplicate.field" => deduplicate_field,
1565
1601
  "similar" => similar,
1566
1602
  "similar.document_ids" => similar_document_ids.to_a,
1567
1603
  "similar.fields" => similar_fields.to_a
1568
1604
  }
1569
1605
 
1570
- method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1606
+ method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
1571
1607
 
1572
1608
  response = request(
1573
1609
  method: "GET",
@@ -1580,13 +1616,14 @@ module IBMWatson
1580
1616
  end
1581
1617
 
1582
1618
  ##
1583
- # @!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)
1584
- # Long environment queries.
1619
+ # @!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)
1620
+ # Long collection queries.
1585
1621
  # Complex queries might be too long for a standard method query. By using this
1586
1622
  # method, you can construct longer queries. However, these queries may take longer
1587
1623
  # to complete than the standard method. For details, see the [Discovery service
1588
- # documentation](https://console.bluemix.net/docs/services/discovery/using.html).
1624
+ # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
1589
1625
  # @param environment_id [String] The ID of the environment.
1626
+ # @param collection_id [String] The ID of the collection.
1590
1627
  # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
1591
1628
  # Filter searches are better for metadata-type searches and for assessing the
1592
1629
  # concepts in the data set.
@@ -1617,7 +1654,7 @@ module IBMWatson
1617
1654
  # @param passages_count [Fixnum] The maximum number of passages to return. The search returns fewer passages if the
1618
1655
  # requested total is not found. The default is `10`. The maximum is `100`.
1619
1656
  # @param passages_characters [Fixnum] The approximate number of characters that any one passage will have.
1620
- # @param deduplicate [Boolean] When `true` and used with a Watson Discovery News collection, duplicate results
1657
+ # @param deduplicate [Boolean] When `true`, and used with a Watson Discovery News collection, duplicate results
1621
1658
  # (based on the contents of the **title** field) are removed. Duplicate comparison
1622
1659
  # is limited to the current query only; **offset** is not considered. This parameter
1623
1660
  # is currently Beta functionality.
@@ -1645,13 +1682,16 @@ module IBMWatson
1645
1682
  # parameter.
1646
1683
  # @param logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
1647
1684
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1648
- 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)
1685
+ 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)
1649
1686
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1650
1687
 
1688
+ raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1689
+
1651
1690
  headers = {
1652
1691
  "X-Watson-Logging-Opt-Out" => logging_opt_out
1653
1692
  }
1654
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "federated_query")
1693
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query")
1694
+ headers.merge!(sdk_headers)
1655
1695
 
1656
1696
  params = {
1657
1697
  "version" => @version
@@ -1680,7 +1720,7 @@ module IBMWatson
1680
1720
  "bias" => bias
1681
1721
  }
1682
1722
 
1683
- method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
1723
+ method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1684
1724
 
1685
1725
  response = request(
1686
1726
  method: "POST",
@@ -1694,15 +1734,68 @@ module IBMWatson
1694
1734
  end
1695
1735
 
1696
1736
  ##
1697
- # @!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)
1698
- # Query multiple collection system notices.
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)]
1777
+
1778
+ response = request(
1779
+ method: "POST",
1780
+ url: method_url,
1781
+ headers: headers,
1782
+ params: params,
1783
+ json: data,
1784
+ accept_json: true
1785
+ )
1786
+ response
1787
+ end
1788
+
1789
+ ##
1790
+ # @!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)
1791
+ # Query system notices.
1699
1792
  # Queries for notices (errors or warnings) that might have been generated by the
1700
1793
  # system. Notices are generated when ingesting documents and performing relevance
1701
1794
  # training. See the [Discovery service
1702
- # documentation](https://console.bluemix.net/docs/services/discovery/using.html) for
1703
- # more details on the query language.
1795
+ # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts)
1796
+ # for more details on the query language.
1704
1797
  # @param environment_id [String] The ID of the environment.
1705
- # @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
1798
+ # @param collection_id [String] The ID of the collection.
1706
1799
  # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
1707
1800
  # Filter searches are better for metadata-type searches and for assessing the
1708
1801
  # concepts in the data set.
@@ -1713,19 +1806,27 @@ module IBMWatson
1713
1806
  # @param natural_language_query [String] A natural language query that returns relevant documents by utilizing training
1714
1807
  # data and natural language understanding. You cannot use **natural_language_query**
1715
1808
  # and **query** at the same time.
1809
+ # @param passages [Boolean] A passages query that returns the most relevant passages from the results.
1716
1810
  # @param aggregation [String] An aggregation search that returns an exact answer by combining query search with
1717
1811
  # filters. Useful for applications to build lists, tables, and time series. For a
1718
1812
  # full list of possible aggregations, see the Query reference.
1719
- # @param count [Fixnum] Number of results to return.
1813
+ # @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
1814
+ # together in any one query is **10000**.
1720
1815
  # @param return_fields [Array[String]] A comma-separated list of the portion of the document hierarchy to return.
1721
1816
  # @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
1722
1817
  # number of results that are returned is 10 and the offset is 8, it returns the last
1723
- # two results.
1818
+ # two results. The maximum for the **count** and **offset** values together in any
1819
+ # one query is **10000**.
1724
1820
  # @param sort [Array[String]] A comma-separated list of fields in the document to sort on. You can optionally
1725
1821
  # specify a sort direction by prefixing the field with `-` for descending or `+` for
1726
1822
  # ascending. Ascending is the default sort direction if no prefix is specified.
1727
1823
  # @param highlight [Boolean] When true, a highlight field is returned for each result which contains the fields
1728
1824
  # 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.
1729
1830
  # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
1730
1831
  # the returned results. Duplicate comparison is limited to the current query only,
1731
1832
  # **offset** is not considered. This parameter is currently Beta functionality.
@@ -1741,34 +1842,38 @@ module IBMWatson
1741
1842
  # identify similar documents. If not specified, the entire document is used for
1742
1843
  # comparison.
1743
1844
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1744
- 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)
1845
+ 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)
1745
1846
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1746
1847
 
1747
- raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
1848
+ raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1748
1849
 
1749
1850
  headers = {
1750
1851
  }
1751
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "federated_query_notices")
1852
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_notices")
1853
+ headers.merge!(sdk_headers)
1752
1854
 
1753
1855
  params = {
1754
1856
  "version" => @version,
1755
- "collection_ids" => collection_ids.to_a,
1756
1857
  "filter" => filter,
1757
1858
  "query" => query,
1758
1859
  "natural_language_query" => natural_language_query,
1860
+ "passages" => passages,
1759
1861
  "aggregation" => aggregation,
1760
1862
  "count" => count,
1761
1863
  "return" => return_fields.to_a,
1762
1864
  "offset" => offset,
1763
1865
  "sort" => sort.to_a,
1764
1866
  "highlight" => highlight,
1867
+ "passages.fields" => passages_fields.to_a,
1868
+ "passages.count" => passages_count,
1869
+ "passages.characters" => passages_characters,
1765
1870
  "deduplicate.field" => deduplicate_field,
1766
1871
  "similar" => similar,
1767
1872
  "similar.document_ids" => similar_document_ids.to_a,
1768
1873
  "similar.fields" => similar_fields.to_a
1769
1874
  }
1770
1875
 
1771
- method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
1876
+ method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1772
1877
 
1773
1878
  response = request(
1774
1879
  method: "GET",
@@ -1780,63 +1885,11 @@ module IBMWatson
1780
1885
  response
1781
1886
  end
1782
1887
 
1783
- ##
1784
- # @!method query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
1785
- # Knowledge Graph entity query.
1786
- # See the [Knowledge Graph
1787
- # documentation](https://console.bluemix.net/docs/services/discovery/building-kg.html)
1788
- # for more details.
1789
- # @param environment_id [String] The ID of the environment.
1790
- # @param collection_id [String] The ID of the collection.
1791
- # @param feature [String] The entity query feature to perform. Supported features are `disambiguate` and
1792
- # `similar_entities`.
1793
- # @param entity [QueryEntitiesEntity] A text string that appears within the entity text field.
1794
- # @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
1795
- # association. For example, if you wanted to query the city of London in England
1796
- # your query would look for `London` with the context of `England`.
1797
- # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1798
- # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1799
- # maximum number of evidence items per query is 10,000.
1800
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1801
- def query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
1802
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1803
-
1804
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1805
-
1806
- headers = {
1807
- }
1808
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "query_entities")
1809
-
1810
- params = {
1811
- "version" => @version
1812
- }
1813
-
1814
- data = {
1815
- "feature" => feature,
1816
- "entity" => entity,
1817
- "context" => context,
1818
- "count" => count,
1819
- "evidence_count" => evidence_count
1820
- }
1821
-
1822
- method_url = "/v1/environments/%s/collections/%s/query_entities" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1823
-
1824
- response = request(
1825
- method: "POST",
1826
- url: method_url,
1827
- headers: headers,
1828
- params: params,
1829
- json: data,
1830
- accept_json: true
1831
- )
1832
- response
1833
- end
1834
-
1835
1888
  ##
1836
1889
  # @!method query_relations(environment_id:, collection_id:, entities: nil, context: nil, sort: nil, filter: nil, count: nil, evidence_count: nil)
1837
1890
  # Knowledge Graph relationship query.
1838
1891
  # See the [Knowledge Graph
1839
- # documentation](https://console.bluemix.net/docs/services/discovery/building-kg.html)
1892
+ # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
1840
1893
  # for more details.
1841
1894
  # @param environment_id [String] The ID of the environment.
1842
1895
  # @param collection_id [String] The ID of the collection.
@@ -1848,7 +1901,7 @@ module IBMWatson
1848
1901
  # `frequency` is the number of unique times each entity is identified. The default
1849
1902
  # is `score`. This parameter cannot be used in the same query as the **bias**
1850
1903
  # parameter.
1851
- # @param filter [QueryRelationsFilter] Filters to apply to the relationship query.
1904
+ # @param filter [QueryRelationsFilter]
1852
1905
  # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1853
1906
  # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1854
1907
  # maximum number of evidence items per query is 10,000.
@@ -1860,7 +1913,8 @@ module IBMWatson
1860
1913
 
1861
1914
  headers = {
1862
1915
  }
1863
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "query_relations")
1916
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_relations")
1917
+ headers.merge!(sdk_headers)
1864
1918
 
1865
1919
  params = {
1866
1920
  "version" => @version
@@ -1892,68 +1946,84 @@ module IBMWatson
1892
1946
  #########################
1893
1947
 
1894
1948
  ##
1895
- # @!method list_training_data(environment_id:, collection_id:)
1896
- # List training data.
1897
- # Lists the training data for the specified collection.
1949
+ # @!method add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
1950
+ # Add query to training data.
1951
+ # Adds a query to the training data for this collection. The query can contain a
1952
+ # filter and natural language query.
1898
1953
  # @param environment_id [String] The ID of the environment.
1899
1954
  # @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.
1900
1959
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1901
- def list_training_data(environment_id:, collection_id:)
1960
+ def add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
1902
1961
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1903
1962
 
1904
1963
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1905
1964
 
1906
1965
  headers = {
1907
1966
  }
1908
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_training_data")
1967
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "add_training_data")
1968
+ headers.merge!(sdk_headers)
1909
1969
 
1910
1970
  params = {
1911
1971
  "version" => @version
1912
1972
  }
1913
1973
 
1974
+ data = {
1975
+ "natural_language_query" => natural_language_query,
1976
+ "filter" => filter,
1977
+ "examples" => examples
1978
+ }
1979
+
1914
1980
  method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1915
1981
 
1916
1982
  response = request(
1917
- method: "GET",
1983
+ method: "POST",
1918
1984
  url: method_url,
1919
1985
  headers: headers,
1920
1986
  params: params,
1987
+ json: data,
1921
1988
  accept_json: true
1922
1989
  )
1923
1990
  response
1924
1991
  end
1925
1992
 
1926
1993
  ##
1927
- # @!method add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
1928
- # Add query to training data.
1929
- # Adds a query to the training data for this collection. The query can contain a
1930
- # filter and natural language query.
1994
+ # @!method create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
1995
+ # Add example to training data query.
1996
+ # Adds a example to this training data query.
1931
1997
  # @param environment_id [String] The ID of the environment.
1932
1998
  # @param collection_id [String] The ID of the collection.
1933
- # @param natural_language_query [String]
1934
- # @param filter [String]
1935
- # @param examples [Array[TrainingExample]]
1999
+ # @param query_id [String] The ID of the query used for training.
2000
+ # @param document_id [String] The document ID associated with this training example.
2001
+ # @param cross_reference [String] The cross reference associated with this training example.
2002
+ # @param relevance [Fixnum] The relevance of the training example.
1936
2003
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1937
- def add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil)
2004
+ def create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
1938
2005
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1939
2006
 
1940
2007
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1941
2008
 
2009
+ raise ArgumentError.new("query_id must be provided") if query_id.nil?
2010
+
1942
2011
  headers = {
1943
2012
  }
1944
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "add_training_data")
2013
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_training_example")
2014
+ headers.merge!(sdk_headers)
1945
2015
 
1946
2016
  params = {
1947
2017
  "version" => @version
1948
2018
  }
1949
2019
 
1950
2020
  data = {
1951
- "natural_language_query" => natural_language_query,
1952
- "filter" => filter,
1953
- "examples" => examples
1954
- }
1955
-
1956
- method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
2021
+ "document_id" => document_id,
2022
+ "cross_reference" => cross_reference,
2023
+ "relevance" => relevance
2024
+ }
2025
+
2026
+ 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)]
1957
2027
 
1958
2028
  response = request(
1959
2029
  method: "POST",
@@ -1980,7 +2050,8 @@ module IBMWatson
1980
2050
 
1981
2051
  headers = {
1982
2052
  }
1983
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_all_training_data")
2053
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_all_training_data")
2054
+ headers.merge!(sdk_headers)
1984
2055
 
1985
2056
  params = {
1986
2057
  "version" => @version
@@ -1993,21 +2064,21 @@ module IBMWatson
1993
2064
  url: method_url,
1994
2065
  headers: headers,
1995
2066
  params: params,
1996
- accept_json: true
2067
+ accept_json: false
1997
2068
  )
1998
2069
  nil
1999
2070
  end
2000
2071
 
2001
2072
  ##
2002
- # @!method get_training_data(environment_id:, collection_id:, query_id:)
2003
- # Get details about a query.
2004
- # Gets details for a specific training data query, including the query string and
2005
- # all examples.
2073
+ # @!method delete_training_data(environment_id:, collection_id:, query_id:)
2074
+ # Delete a training data query.
2075
+ # Removes the training data query and all associated examples from the training data
2076
+ # set.
2006
2077
  # @param environment_id [String] The ID of the environment.
2007
2078
  # @param collection_id [String] The ID of the collection.
2008
2079
  # @param query_id [String] The ID of the query used for training.
2009
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2010
- def get_training_data(environment_id:, collection_id:, query_id:)
2080
+ # @return [nil]
2081
+ def delete_training_data(environment_id:, collection_id:, query_id:)
2011
2082
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2012
2083
 
2013
2084
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -2016,7 +2087,8 @@ module IBMWatson
2016
2087
 
2017
2088
  headers = {
2018
2089
  }
2019
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_training_data")
2090
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_data")
2091
+ headers.merge!(sdk_headers)
2020
2092
 
2021
2093
  params = {
2022
2094
  "version" => @version
@@ -2024,61 +2096,65 @@ module IBMWatson
2024
2096
 
2025
2097
  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)]
2026
2098
 
2027
- response = request(
2028
- method: "GET",
2099
+ request(
2100
+ method: "DELETE",
2029
2101
  url: method_url,
2030
2102
  headers: headers,
2031
2103
  params: params,
2032
- accept_json: true
2104
+ accept_json: false
2033
2105
  )
2034
- response
2106
+ nil
2035
2107
  end
2036
2108
 
2037
2109
  ##
2038
- # @!method delete_training_data(environment_id:, collection_id:, query_id:)
2039
- # Delete a training data query.
2040
- # Removes the training data query and all associated examples from the training data
2041
- # set.
2110
+ # @!method delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
2111
+ # Delete example for training data query.
2112
+ # Deletes the example document with the given ID from the training data query.
2042
2113
  # @param environment_id [String] The ID of the environment.
2043
2114
  # @param collection_id [String] The ID of the collection.
2044
2115
  # @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.
2045
2117
  # @return [nil]
2046
- def delete_training_data(environment_id:, collection_id:, query_id:)
2118
+ def delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
2047
2119
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2048
2120
 
2049
2121
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
2050
2122
 
2051
2123
  raise ArgumentError.new("query_id must be provided") if query_id.nil?
2052
2124
 
2125
+ raise ArgumentError.new("example_id must be provided") if example_id.nil?
2126
+
2053
2127
  headers = {
2054
2128
  }
2055
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_training_data")
2129
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_example")
2130
+ headers.merge!(sdk_headers)
2056
2131
 
2057
2132
  params = {
2058
2133
  "version" => @version
2059
2134
  }
2060
2135
 
2061
- 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)]
2136
+ 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)]
2062
2137
 
2063
2138
  request(
2064
2139
  method: "DELETE",
2065
2140
  url: method_url,
2066
2141
  headers: headers,
2067
2142
  params: params,
2068
- accept_json: true
2143
+ accept_json: false
2069
2144
  )
2070
2145
  nil
2071
2146
  end
2072
2147
 
2073
2148
  ##
2074
- # @!method list_training_examples(environment_id:, collection_id:, query_id:)
2075
- # List examples for a training data query.
2076
- # List all examples for this training data query.
2149
+ # @!method get_training_data(environment_id:, collection_id:, query_id:)
2150
+ # Get details about a query.
2151
+ # Gets details for a specific training data query, including the query string and
2152
+ # all examples.
2077
2153
  # @param environment_id [String] The ID of the environment.
2078
2154
  # @param collection_id [String] The ID of the collection.
2079
2155
  # @param query_id [String] The ID of the query used for training.
2080
2156
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2081
- def list_training_examples(environment_id:, collection_id:, query_id:)
2157
+ def get_training_data(environment_id:, collection_id:, query_id:)
2082
2158
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2083
2159
 
2084
2160
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -2087,13 +2163,14 @@ module IBMWatson
2087
2163
 
2088
2164
  headers = {
2089
2165
  }
2090
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_training_examples")
2166
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_data")
2167
+ headers.merge!(sdk_headers)
2091
2168
 
2092
2169
  params = {
2093
2170
  "version" => @version
2094
2171
  }
2095
2172
 
2096
- 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)]
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)]
2097
2174
 
2098
2175
  response = request(
2099
2176
  method: "GET",
@@ -2106,144 +2183,125 @@ module IBMWatson
2106
2183
  end
2107
2184
 
2108
2185
  ##
2109
- # @!method create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
2110
- # Add example to training data query.
2111
- # Adds a example to this training data query.
2186
+ # @!method get_training_example(environment_id:, collection_id:, query_id:, example_id:)
2187
+ # Get details for training data example.
2188
+ # Gets the details for this training example.
2112
2189
  # @param environment_id [String] The ID of the environment.
2113
2190
  # @param collection_id [String] The ID of the collection.
2114
2191
  # @param query_id [String] The ID of the query used for training.
2115
- # @param document_id [String]
2116
- # @param cross_reference [String]
2117
- # @param relevance [Fixnum]
2192
+ # @param example_id [String] The ID of the document as it is indexed.
2118
2193
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2119
- def create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil)
2194
+ def get_training_example(environment_id:, collection_id:, query_id:, example_id:)
2120
2195
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2121
2196
 
2122
2197
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
2123
2198
 
2124
2199
  raise ArgumentError.new("query_id must be provided") if query_id.nil?
2125
2200
 
2201
+ raise ArgumentError.new("example_id must be provided") if example_id.nil?
2202
+
2126
2203
  headers = {
2127
2204
  }
2128
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_training_example")
2205
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_example")
2206
+ headers.merge!(sdk_headers)
2129
2207
 
2130
2208
  params = {
2131
2209
  "version" => @version
2132
2210
  }
2133
2211
 
2134
- data = {
2135
- "document_id" => document_id,
2136
- "cross_reference" => cross_reference,
2137
- "relevance" => relevance
2138
- }
2139
-
2140
- 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)]
2212
+ 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)]
2141
2213
 
2142
2214
  response = request(
2143
- method: "POST",
2215
+ method: "GET",
2144
2216
  url: method_url,
2145
2217
  headers: headers,
2146
2218
  params: params,
2147
- json: data,
2148
2219
  accept_json: true
2149
2220
  )
2150
2221
  response
2151
2222
  end
2152
2223
 
2153
2224
  ##
2154
- # @!method delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
2155
- # Delete example for training data query.
2156
- # Deletes the example document with the given ID from the training data query.
2225
+ # @!method list_training_data(environment_id:, collection_id:)
2226
+ # List training data.
2227
+ # Lists the training data for the specified collection.
2157
2228
  # @param environment_id [String] The ID of the environment.
2158
2229
  # @param collection_id [String] The ID of the collection.
2159
- # @param query_id [String] The ID of the query used for training.
2160
- # @param example_id [String] The ID of the document as it is indexed.
2161
- # @return [nil]
2162
- def delete_training_example(environment_id:, collection_id:, query_id:, example_id:)
2230
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2231
+ def list_training_data(environment_id:, collection_id:)
2163
2232
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2164
2233
 
2165
2234
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
2166
2235
 
2167
- raise ArgumentError.new("query_id must be provided") if query_id.nil?
2168
-
2169
- raise ArgumentError.new("example_id must be provided") if example_id.nil?
2170
-
2171
2236
  headers = {
2172
2237
  }
2173
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_training_example")
2238
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_data")
2239
+ headers.merge!(sdk_headers)
2174
2240
 
2175
2241
  params = {
2176
2242
  "version" => @version
2177
2243
  }
2178
2244
 
2179
- 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)]
2245
+ method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
2180
2246
 
2181
- request(
2182
- method: "DELETE",
2247
+ response = request(
2248
+ method: "GET",
2183
2249
  url: method_url,
2184
2250
  headers: headers,
2185
2251
  params: params,
2186
2252
  accept_json: true
2187
2253
  )
2188
- nil
2254
+ response
2189
2255
  end
2190
2256
 
2191
2257
  ##
2192
- # @!method update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
2193
- # Change label or cross reference for example.
2194
- # Changes the label or cross reference query for this training data example.
2258
+ # @!method list_training_examples(environment_id:, collection_id:, query_id:)
2259
+ # List examples for a training data query.
2260
+ # List all examples for this training data query.
2195
2261
  # @param environment_id [String] The ID of the environment.
2196
2262
  # @param collection_id [String] The ID of the collection.
2197
2263
  # @param query_id [String] The ID of the query used for training.
2198
- # @param example_id [String] The ID of the document as it is indexed.
2199
- # @param cross_reference [String]
2200
- # @param relevance [Fixnum]
2201
2264
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2202
- def update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
2265
+ def list_training_examples(environment_id:, collection_id:, query_id:)
2203
2266
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2204
2267
 
2205
2268
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
2206
2269
 
2207
2270
  raise ArgumentError.new("query_id must be provided") if query_id.nil?
2208
2271
 
2209
- raise ArgumentError.new("example_id must be provided") if example_id.nil?
2210
-
2211
2272
  headers = {
2212
2273
  }
2213
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_training_example")
2274
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_examples")
2275
+ headers.merge!(sdk_headers)
2214
2276
 
2215
2277
  params = {
2216
2278
  "version" => @version
2217
2279
  }
2218
2280
 
2219
- data = {
2220
- "cross_reference" => cross_reference,
2221
- "relevance" => relevance
2222
- }
2223
-
2224
- 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)]
2281
+ 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)]
2225
2282
 
2226
2283
  response = request(
2227
- method: "PUT",
2284
+ method: "GET",
2228
2285
  url: method_url,
2229
2286
  headers: headers,
2230
2287
  params: params,
2231
- json: data,
2232
2288
  accept_json: true
2233
2289
  )
2234
2290
  response
2235
2291
  end
2236
2292
 
2237
2293
  ##
2238
- # @!method get_training_example(environment_id:, collection_id:, query_id:, example_id:)
2239
- # Get details for training data example.
2240
- # Gets the details for this training example.
2294
+ # @!method update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
2295
+ # Change label or cross reference for example.
2296
+ # Changes the label or cross reference query for this training data example.
2241
2297
  # @param environment_id [String] The ID of the environment.
2242
2298
  # @param collection_id [String] The ID of the collection.
2243
2299
  # @param query_id [String] The ID of the query used for training.
2244
2300
  # @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.
2245
2303
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2246
- def get_training_example(environment_id:, collection_id:, query_id:, example_id:)
2304
+ def update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil)
2247
2305
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2248
2306
 
2249
2307
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -2254,19 +2312,26 @@ module IBMWatson
2254
2312
 
2255
2313
  headers = {
2256
2314
  }
2257
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_training_example")
2315
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_training_example")
2316
+ headers.merge!(sdk_headers)
2258
2317
 
2259
2318
  params = {
2260
2319
  "version" => @version
2261
2320
  }
2262
2321
 
2322
+ data = {
2323
+ "cross_reference" => cross_reference,
2324
+ "relevance" => relevance
2325
+ }
2326
+
2263
2327
  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)]
2264
2328
 
2265
2329
  response = request(
2266
- method: "GET",
2330
+ method: "PUT",
2267
2331
  url: method_url,
2268
2332
  headers: headers,
2269
2333
  params: params,
2334
+ json: data,
2270
2335
  accept_json: true
2271
2336
  )
2272
2337
  response
@@ -2284,7 +2349,7 @@ module IBMWatson
2284
2349
  # You associate a customer ID with data by passing the **X-Watson-Metadata** header
2285
2350
  # with a request that passes data. For more information about personal data and
2286
2351
  # customer IDs, see [Information
2287
- # security](https://console.bluemix.net/docs/services/discovery/information-security.html).
2352
+ # security](https://cloud.ibm.com/docs/services/discovery?topic=discovery-information-security#information-security).
2288
2353
  # @param customer_id [String] The customer ID for which all data is to be deleted.
2289
2354
  # @return [nil]
2290
2355
  def delete_user_data(customer_id:)
@@ -2292,7 +2357,8 @@ module IBMWatson
2292
2357
 
2293
2358
  headers = {
2294
2359
  }
2295
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_user_data")
2360
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_user_data")
2361
+ headers.merge!(sdk_headers)
2296
2362
 
2297
2363
  params = {
2298
2364
  "version" => @version,
@@ -2306,7 +2372,7 @@ module IBMWatson
2306
2372
  url: method_url,
2307
2373
  headers: headers,
2308
2374
  params: params,
2309
- accept_json: true
2375
+ accept_json: false
2310
2376
  )
2311
2377
  nil
2312
2378
  end
@@ -2330,7 +2396,8 @@ module IBMWatson
2330
2396
 
2331
2397
  headers = {
2332
2398
  }
2333
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_event")
2399
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_event")
2400
+ headers.merge!(sdk_headers)
2334
2401
 
2335
2402
  params = {
2336
2403
  "version" => @version
@@ -2355,41 +2422,32 @@ module IBMWatson
2355
2422
  end
2356
2423
 
2357
2424
  ##
2358
- # @!method query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
2359
- # Search the query and event log.
2360
- # Searches the query and event log to find query sessions that match the specified
2361
- # criteria. Searching the **logs** endpoint uses the standard Discovery query syntax
2362
- # for the parameters that are supported.
2363
- # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
2364
- # Filter searches are better for metadata-type searches and for assessing the
2365
- # concepts in the data set.
2366
- # @param query [String] A query search returns all documents in your data set with full enrichments and
2367
- # full text, but with the most relevant documents listed first. Use a query search
2368
- # when you want to find the most relevant search results. You cannot use
2369
- # **natural_language_query** and **query** at the same time.
2370
- # @param count [Fixnum] Number of results to return.
2371
- # @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
2372
- # number of results that are returned is 10 and the offset is 8, it returns the last
2373
- # two results.
2374
- # @param sort [Array[String]] A comma-separated list of fields in the document to sort on. You can optionally
2375
- # specify a sort direction by prefixing the field with `-` for descending or `+` for
2376
- # ascending. Ascending is the default sort direction if no prefix is specified.
2425
+ # @!method get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
2426
+ # Percentage of queries with an associated event.
2427
+ # The percentage of queries using the **natural_language_query** parameter that have
2428
+ # a corresponding \"click\" event over a specified time window. This metric
2429
+ # requires having integrated event tracking in your application using the **Events**
2430
+ # API.
2431
+ # @param start_time [Time] Metric is computed from data recorded after this timestamp; must be in
2432
+ # `YYYY-MM-DDThh:mm:ssZ` format.
2433
+ # @param end_time [Time] Metric is computed from data recorded before this timestamp; must be in
2434
+ # `YYYY-MM-DDThh:mm:ssZ` format.
2435
+ # @param result_type [String] The type of result to consider when calculating the metric.
2377
2436
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2378
- def query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
2437
+ def get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
2379
2438
  headers = {
2380
2439
  }
2381
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "query_log")
2440
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_event_rate")
2441
+ headers.merge!(sdk_headers)
2382
2442
 
2383
2443
  params = {
2384
2444
  "version" => @version,
2385
- "filter" => filter,
2386
- "query" => query,
2387
- "count" => count,
2388
- "offset" => offset,
2389
- "sort" => sort.to_a
2445
+ "start_time" => start_time,
2446
+ "end_time" => end_time,
2447
+ "result_type" => result_type
2390
2448
  }
2391
2449
 
2392
- method_url = "/v1/logs"
2450
+ method_url = "/v1/metrics/event_rate"
2393
2451
 
2394
2452
  response = request(
2395
2453
  method: "GET",
@@ -2415,7 +2473,8 @@ module IBMWatson
2415
2473
  def get_metrics_query(start_time: nil, end_time: nil, result_type: nil)
2416
2474
  headers = {
2417
2475
  }
2418
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_metrics_query")
2476
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query")
2477
+ headers.merge!(sdk_headers)
2419
2478
 
2420
2479
  params = {
2421
2480
  "version" => @version,
@@ -2451,7 +2510,8 @@ module IBMWatson
2451
2510
  def get_metrics_query_event(start_time: nil, end_time: nil, result_type: nil)
2452
2511
  headers = {
2453
2512
  }
2454
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_metrics_query_event")
2513
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_event")
2514
+ headers.merge!(sdk_headers)
2455
2515
 
2456
2516
  params = {
2457
2517
  "version" => @version,
@@ -2486,7 +2546,8 @@ module IBMWatson
2486
2546
  def get_metrics_query_no_results(start_time: nil, end_time: nil, result_type: nil)
2487
2547
  headers = {
2488
2548
  }
2489
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_metrics_query_no_results")
2549
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_no_results")
2550
+ headers.merge!(sdk_headers)
2490
2551
 
2491
2552
  params = {
2492
2553
  "version" => @version,
@@ -2507,43 +2568,6 @@ module IBMWatson
2507
2568
  response
2508
2569
  end
2509
2570
 
2510
- ##
2511
- # @!method get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
2512
- # Percentage of queries with an associated event.
2513
- # The percentage of queries using the **natural_language_query** parameter that have
2514
- # a corresponding \"click\" event over a specified time window. This metric
2515
- # requires having integrated event tracking in your application using the **Events**
2516
- # API.
2517
- # @param start_time [Time] Metric is computed from data recorded after this timestamp; must be in
2518
- # `YYYY-MM-DDThh:mm:ssZ` format.
2519
- # @param end_time [Time] Metric is computed from data recorded before this timestamp; must be in
2520
- # `YYYY-MM-DDThh:mm:ssZ` format.
2521
- # @param result_type [String] The type of result to consider when calculating the metric.
2522
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2523
- def get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
2524
- headers = {
2525
- }
2526
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_metrics_event_rate")
2527
-
2528
- params = {
2529
- "version" => @version,
2530
- "start_time" => start_time,
2531
- "end_time" => end_time,
2532
- "result_type" => result_type
2533
- }
2534
-
2535
- method_url = "/v1/metrics/event_rate"
2536
-
2537
- response = request(
2538
- method: "GET",
2539
- url: method_url,
2540
- headers: headers,
2541
- params: params,
2542
- accept_json: true
2543
- )
2544
- response
2545
- end
2546
-
2547
2571
  ##
2548
2572
  # @!method get_metrics_query_token_event(count: nil)
2549
2573
  # Most frequent query tokens with an event.
@@ -2551,12 +2575,14 @@ module IBMWatson
2551
2575
  # parameter and their corresponding \"click\" event rate within the recording period
2552
2576
  # (queries and events are stored for 30 days). A query token is an individual word
2553
2577
  # or unigram within the query string.
2554
- # @param count [Fixnum] Number of results to return.
2578
+ # @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
2579
+ # together in any one query is **10000**.
2555
2580
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2556
2581
  def get_metrics_query_token_event(count: nil)
2557
2582
  headers = {
2558
2583
  }
2559
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_metrics_query_token_event")
2584
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_token_event")
2585
+ headers.merge!(sdk_headers)
2560
2586
 
2561
2587
  params = {
2562
2588
  "version" => @version,
@@ -2574,31 +2600,46 @@ module IBMWatson
2574
2600
  )
2575
2601
  response
2576
2602
  end
2577
- #########################
2578
- # Credentials
2579
- #########################
2580
2603
 
2581
2604
  ##
2582
- # @!method list_credentials(environment_id:)
2583
- # List credentials.
2584
- # List all the source credentials that have been created for this service instance.
2585
- #
2586
- # **Note:** All credentials are sent over an encrypted connection and encrypted at
2587
- # rest.
2588
- # @param environment_id [String] The ID of the environment.
2605
+ # @!method query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
2606
+ # Search the query and event log.
2607
+ # Searches the query and event log to find query sessions that match the specified
2608
+ # criteria. Searching the **logs** endpoint uses the standard Discovery query syntax
2609
+ # for the parameters that are supported.
2610
+ # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
2611
+ # Filter searches are better for metadata-type searches and for assessing the
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.
2589
2626
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2590
- def list_credentials(environment_id:)
2591
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2592
-
2627
+ def query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil)
2593
2628
  headers = {
2594
2629
  }
2595
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_credentials")
2630
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_log")
2631
+ headers.merge!(sdk_headers)
2596
2632
 
2597
2633
  params = {
2598
- "version" => @version
2634
+ "version" => @version,
2635
+ "filter" => filter,
2636
+ "query" => query,
2637
+ "count" => count,
2638
+ "offset" => offset,
2639
+ "sort" => sort.to_a
2599
2640
  }
2600
2641
 
2601
- method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
2642
+ method_url = "/v1/logs"
2602
2643
 
2603
2644
  response = request(
2604
2645
  method: "GET",
@@ -2609,6 +2650,9 @@ module IBMWatson
2609
2650
  )
2610
2651
  response
2611
2652
  end
2653
+ #########################
2654
+ # Credentials
2655
+ #########################
2612
2656
 
2613
2657
  ##
2614
2658
  # @!method create_credentials(environment_id:, source_type: nil, credential_details: nil)
@@ -2626,6 +2670,8 @@ module IBMWatson
2626
2670
  # - `sharepoint` indicates the credentials are used to connect to Microsoft
2627
2671
  # SharePoint Online.
2628
2672
  # - `web_crawl` indicates the credentials are used to perform a web crawl.
2673
+ # = `cloud_object_storage` indicates the credentials are used to connect to an IBM
2674
+ # Cloud Object Store.
2629
2675
  # @param credential_details [CredentialDetails] Object containing details of the stored credentials.
2630
2676
  #
2631
2677
  # Obtain credentials for your source from the administrator of the source.
@@ -2635,7 +2681,8 @@ module IBMWatson
2635
2681
 
2636
2682
  headers = {
2637
2683
  }
2638
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_credentials")
2684
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_credentials")
2685
+ headers.merge!(sdk_headers)
2639
2686
 
2640
2687
  params = {
2641
2688
  "version" => @version
@@ -2659,6 +2706,39 @@ module IBMWatson
2659
2706
  response
2660
2707
  end
2661
2708
 
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
+
2662
2742
  ##
2663
2743
  # @!method get_credentials(environment_id:, credential_id:)
2664
2744
  # View Credentials.
@@ -2676,7 +2756,8 @@ module IBMWatson
2676
2756
 
2677
2757
  headers = {
2678
2758
  }
2679
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_credentials")
2759
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_credentials")
2760
+ headers.merge!(sdk_headers)
2680
2761
 
2681
2762
  params = {
2682
2763
  "version" => @version
@@ -2695,83 +2776,87 @@ module IBMWatson
2695
2776
  end
2696
2777
 
2697
2778
  ##
2698
- # @!method update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil)
2699
- # Update credentials.
2700
- # Updates an existing set of source credentials.
2779
+ # @!method list_credentials(environment_id:)
2780
+ # List credentials.
2781
+ # List all the source credentials that have been created for this service instance.
2701
2782
  #
2702
- # **Note:** All credentials are sent over an encrypted connection and encrypted at
2783
+ # **Note:** All credentials are sent over an encrypted connection and encrypted at
2703
2784
  # rest.
2704
2785
  # @param environment_id [String] The ID of the environment.
2705
- # @param credential_id [String] The unique identifier for a set of source credentials.
2706
- # @param source_type [String] The source that this credentials object connects to.
2707
- # - `box` indicates the credentials are used to connect an instance of Enterprise
2708
- # Box.
2709
- # - `salesforce` indicates the credentials are used to connect to Salesforce.
2710
- # - `sharepoint` indicates the credentials are used to connect to Microsoft
2711
- # SharePoint Online.
2712
- # - `web_crawl` indicates the credentials are used to perform a web crawl.
2713
- # @param credential_details [CredentialDetails] Object containing details of the stored credentials.
2714
- #
2715
- # Obtain credentials for your source from the administrator of the source.
2716
2786
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2717
- def update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil)
2787
+ def list_credentials(environment_id:)
2718
2788
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2719
2789
 
2720
- raise ArgumentError.new("credential_id must be provided") if credential_id.nil?
2721
-
2722
2790
  headers = {
2723
2791
  }
2724
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "update_credentials")
2792
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_credentials")
2793
+ headers.merge!(sdk_headers)
2725
2794
 
2726
2795
  params = {
2727
2796
  "version" => @version
2728
2797
  }
2729
2798
 
2730
- data = {
2731
- "source_type" => source_type,
2732
- "credential_details" => credential_details
2733
- }
2734
-
2735
- method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
2799
+ method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
2736
2800
 
2737
2801
  response = request(
2738
- method: "PUT",
2802
+ method: "GET",
2739
2803
  url: method_url,
2740
2804
  headers: headers,
2741
2805
  params: params,
2742
- json: data,
2743
2806
  accept_json: true
2744
2807
  )
2745
2808
  response
2746
2809
  end
2747
2810
 
2748
2811
  ##
2749
- # @!method delete_credentials(environment_id:, credential_id:)
2750
- # Delete credentials.
2751
- # Deletes a set of stored credentials from your Discovery instance.
2812
+ # @!method update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil)
2813
+ # Update credentials.
2814
+ # Updates an existing set of source credentials.
2815
+ #
2816
+ # **Note:** All credentials are sent over an encrypted connection and encrypted at
2817
+ # rest.
2752
2818
  # @param environment_id [String] The ID of the environment.
2753
2819
  # @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.
2754
2832
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2755
- def delete_credentials(environment_id:, credential_id:)
2833
+ def update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil)
2756
2834
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2757
2835
 
2758
2836
  raise ArgumentError.new("credential_id must be provided") if credential_id.nil?
2759
2837
 
2760
2838
  headers = {
2761
2839
  }
2762
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_credentials")
2840
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_credentials")
2841
+ headers.merge!(sdk_headers)
2763
2842
 
2764
2843
  params = {
2765
2844
  "version" => @version
2766
2845
  }
2767
2846
 
2847
+ data = {
2848
+ "source_type" => source_type,
2849
+ "credential_details" => credential_details
2850
+ }
2851
+
2768
2852
  method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
2769
2853
 
2770
2854
  response = request(
2771
- method: "DELETE",
2855
+ method: "PUT",
2772
2856
  url: method_url,
2773
2857
  headers: headers,
2774
2858
  params: params,
2859
+ json: data,
2775
2860
  accept_json: true
2776
2861
  )
2777
2862
  response
@@ -2781,64 +2866,69 @@ module IBMWatson
2781
2866
  #########################
2782
2867
 
2783
2868
  ##
2784
- # @!method list_gateways(environment_id:)
2785
- # List Gateways.
2786
- # List the currently configured gateways.
2869
+ # @!method create_gateway(environment_id:, name: nil)
2870
+ # Create Gateway.
2871
+ # Create a gateway configuration to use with a remotely installed gateway.
2787
2872
  # @param environment_id [String] The ID of the environment.
2873
+ # @param name [String] User-defined name.
2788
2874
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2789
- def list_gateways(environment_id:)
2875
+ def create_gateway(environment_id:, name: nil)
2790
2876
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2791
2877
 
2792
2878
  headers = {
2793
2879
  }
2794
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "list_gateways")
2880
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_gateway")
2881
+ headers.merge!(sdk_headers)
2795
2882
 
2796
2883
  params = {
2797
2884
  "version" => @version
2798
2885
  }
2799
2886
 
2887
+ data = {
2888
+ "name" => name
2889
+ }
2890
+
2800
2891
  method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
2801
2892
 
2802
2893
  response = request(
2803
- method: "GET",
2894
+ method: "POST",
2804
2895
  url: method_url,
2805
2896
  headers: headers,
2806
2897
  params: params,
2898
+ json: data,
2807
2899
  accept_json: true
2808
2900
  )
2809
2901
  response
2810
2902
  end
2811
2903
 
2812
2904
  ##
2813
- # @!method create_gateway(environment_id:, name: nil)
2814
- # Create Gateway.
2815
- # Create a gateway configuration to use with a remotely installed gateway.
2905
+ # @!method delete_gateway(environment_id:, gateway_id:)
2906
+ # Delete Gateway.
2907
+ # Delete the specified gateway configuration.
2816
2908
  # @param environment_id [String] The ID of the environment.
2817
- # @param name [String] User-defined name.
2909
+ # @param gateway_id [String] The requested gateway ID.
2818
2910
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2819
- def create_gateway(environment_id:, name: nil)
2911
+ def delete_gateway(environment_id:, gateway_id:)
2820
2912
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2821
2913
 
2914
+ raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil?
2915
+
2822
2916
  headers = {
2823
2917
  }
2824
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "create_gateway")
2918
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_gateway")
2919
+ headers.merge!(sdk_headers)
2825
2920
 
2826
2921
  params = {
2827
2922
  "version" => @version
2828
2923
  }
2829
2924
 
2830
- data = {
2831
- "name" => name
2832
- }
2833
-
2834
- method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
2925
+ method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
2835
2926
 
2836
2927
  response = request(
2837
- method: "POST",
2928
+ method: "DELETE",
2838
2929
  url: method_url,
2839
2930
  headers: headers,
2840
2931
  params: params,
2841
- json: data,
2842
2932
  accept_json: true
2843
2933
  )
2844
2934
  response
@@ -2858,7 +2948,8 @@ module IBMWatson
2858
2948
 
2859
2949
  headers = {
2860
2950
  }
2861
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "get_gateway")
2951
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_gateway")
2952
+ headers.merge!(sdk_headers)
2862
2953
 
2863
2954
  params = {
2864
2955
  "version" => @version
@@ -2877,29 +2968,27 @@ module IBMWatson
2877
2968
  end
2878
2969
 
2879
2970
  ##
2880
- # @!method delete_gateway(environment_id:, gateway_id:)
2881
- # Delete Gateway.
2882
- # Delete the specified gateway configuration.
2971
+ # @!method list_gateways(environment_id:)
2972
+ # List Gateways.
2973
+ # List the currently configured gateways.
2883
2974
  # @param environment_id [String] The ID of the environment.
2884
- # @param gateway_id [String] The requested gateway ID.
2885
2975
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
2886
- def delete_gateway(environment_id:, gateway_id:)
2976
+ def list_gateways(environment_id:)
2887
2977
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
2888
2978
 
2889
- raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil?
2890
-
2891
2979
  headers = {
2892
2980
  }
2893
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "discovery", service_version: "V1", operation_id: "delete_gateway")
2981
+ sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_gateways")
2982
+ headers.merge!(sdk_headers)
2894
2983
 
2895
2984
  params = {
2896
2985
  "version" => @version
2897
2986
  }
2898
2987
 
2899
- method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
2988
+ method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
2900
2989
 
2901
2990
  response = request(
2902
- method: "DELETE",
2991
+ method: "GET",
2903
2992
  url: method_url,
2904
2993
  headers: headers,
2905
2994
  params: params,