ibm_watson 1.0.0.rc2 → 1.0.0.rc3

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -27
  3. data/lib/ibm_watson/assistant_v1.rb +6 -80
  4. data/lib/ibm_watson/assistant_v2.rb +6 -38
  5. data/lib/ibm_watson/compare_comply_v1.rb +6 -47
  6. data/lib/ibm_watson/discovery_v1.rb +12 -297
  7. data/lib/ibm_watson/language_translator_v3.rb +6 -41
  8. data/lib/ibm_watson/natural_language_classifier_v1.rb +6 -35
  9. data/lib/ibm_watson/natural_language_understanding_v1.rb +6 -38
  10. data/lib/ibm_watson/personality_insights_v3.rb +6 -30
  11. data/lib/ibm_watson/speech_to_text_v1.rb +9 -130
  12. data/lib/ibm_watson/text_to_speech_v1.rb +6 -50
  13. data/lib/ibm_watson/tone_analyzer_v3.rb +6 -31
  14. data/lib/ibm_watson/version.rb +1 -1
  15. data/lib/ibm_watson/visual_recognition_v3.rb +8 -103
  16. data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +5 -5
  17. data/lib/ibm_watson.rb +9 -0
  18. data/test/integration/test_assistant_v1.rb +1 -1
  19. data/test/integration/test_assistant_v2.rb +1 -1
  20. data/test/integration/test_compare_comply_v1.rb +1 -1
  21. data/test/integration/test_discovery_v1.rb +1 -4
  22. data/test/integration/test_language_translator_v3.rb +1 -1
  23. data/test/integration/test_natural_language_classifier_v1.rb +1 -1
  24. data/test/integration/test_natural_language_understanding_v1.rb +1 -1
  25. data/test/integration/test_personality_insights_v3.rb +1 -1
  26. data/test/integration/test_speech_to_text_v1.rb +2 -2
  27. data/test/integration/test_text_to_speech_v1.rb +1 -1
  28. data/test/integration/test_tone_analyzer_v3.rb +1 -1
  29. data/test/integration/test_visual_recognition_v3.rb +1 -8
  30. data/test/unit/test_assistant_v1.rb +45 -45
  31. data/test/unit/test_assistant_v2.rb +3 -3
  32. data/test/unit/test_compare_comply_v1.rb +12 -12
  33. data/test/unit/test_configure_http_client.rb +37 -13
  34. data/test/unit/test_discovery_v1.rb +47 -139
  35. data/test/unit/test_language_translator_v3.rb +13 -26
  36. data/test/unit/test_natural_language_classifier_v1.rb +2 -2
  37. data/test/unit/test_natural_language_understanding_v1.rb +5 -5
  38. data/test/unit/test_personality_insights_v3.rb +8 -8
  39. data/test/unit/test_speech_to_text_v1.rb +21 -21
  40. data/test/unit/test_text_to_speech_v1.rb +5 -5
  41. data/test/unit/test_tone_analyzer_v3.rb +9 -9
  42. data/test/unit/test_vcap_using_personality_insights.rb +8 -8
  43. data/test/unit/test_visual_recognition_v3.rb +8 -75
  44. metadata +4 -4
@@ -47,50 +47,21 @@ module IBMWatson
47
47
  # Instead, specify a version date that is compatible with your
48
48
  # application, and don't change it until your application is
49
49
  # ready for a later version.
50
- # @option args url [String] The base url to use when contacting the service (e.g.
51
- # "https://gateway.watsonplatform.net/discovery/api").
52
- # The base url may differ between IBM Cloud regions.
53
- # @option args username [String] The username used to authenticate with the service.
54
- # Username and password credentials are only required to run your
55
- # application locally or outside of IBM Cloud. When running on
56
- # IBM Cloud, the credentials will be automatically loaded from the
57
- # `VCAP_SERVICES` environment variable.
58
- # @option args password [String] The password used to authenticate with the service.
59
- # Username and password credentials are only required to run your
60
- # application locally or outside of IBM Cloud. When running on
61
- # IBM Cloud, the credentials will be automatically loaded from the
62
- # `VCAP_SERVICES` environment variable.
63
- # @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
64
- # this API key is provided, the SDK will manage the token and handle the
65
- # refreshing.
66
- # @option args iam_access_token [String] An IAM access token is fully managed by the application.
67
- # Responsibility falls on the application to refresh the token, either before
68
- # it expires or reactively upon receiving a 401 from the service as any requests
69
- # made with an expired token will fail.
70
- # @option args iam_url [String] An optional URL for the IAM service API. Defaults to
71
- # 'https://iam.cloud.ibm.com/identity/token'.
72
- # @option args iam_client_id [String] An optional client id for the IAM service API.
73
- # @option args iam_client_secret [String] An optional client secret for the IAM service API.
74
- # @option args icp4d_access_token [STRING] A ICP4D(IBM Cloud Pak for Data) access token is
75
- # fully managed by the application. Responsibility falls on the application to
76
- # refresh the token, either before it expires or reactively upon receiving a 401
77
- # from the service as any requests made with an expired token will fail.
78
- # @option args icp4d_url [STRING] In order to use an SDK-managed token with ICP4D authentication, this
79
- # URL must be passed in.
80
- # @option args authentication_type [STRING] Specifies the authentication pattern to use. Values that it
81
- # takes are basic, iam or icp4d.
50
+ # @option args service_url [String] The base service URL to use when contacting the service.
51
+ # The base service_url may differ between IBM Cloud regions.
52
+ # @option args authenticator [Object] The Authenticator instance to be configured for this service.
82
53
  def initialize(args = {})
83
54
  @__async_initialized__ = false
84
55
  defaults = {}
85
56
  defaults[:version] = nil
86
- defaults[:url] = "https://gateway.watsonplatform.net/discovery/api"
57
+ defaults[:service_url] = "https://gateway.watsonplatform.net/discovery/api"
87
58
  defaults[:authenticator] = nil
88
- defaults[:authentication_type] = nil
89
59
  args = defaults.merge(args)
90
60
  @version = args[:version]
91
61
  raise ArgumentError.new("version must be provided") if @version.nil?
92
62
 
93
- args[:display_name] = "Discovery"
63
+ args[:service_name] = "discovery"
64
+ args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
94
65
  super
95
66
  end
96
67
 
@@ -131,7 +102,6 @@ module IBMWatson
131
102
 
132
103
  method_url = "/v1/environments"
133
104
 
134
- headers = authenticator.authenticate(headers)
135
105
  response = request(
136
106
  method: "POST",
137
107
  url: method_url,
@@ -162,7 +132,6 @@ module IBMWatson
162
132
 
163
133
  method_url = "/v1/environments"
164
134
 
165
- headers = authenticator.authenticate(headers)
166
135
  response = request(
167
136
  method: "GET",
168
137
  url: method_url,
@@ -192,7 +161,6 @@ module IBMWatson
192
161
 
193
162
  method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
194
163
 
195
- headers = authenticator.authenticate(headers)
196
164
  response = request(
197
165
  method: "GET",
198
166
  url: method_url,
@@ -235,7 +203,6 @@ module IBMWatson
235
203
 
236
204
  method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
237
205
 
238
- headers = authenticator.authenticate(headers)
239
206
  response = request(
240
207
  method: "PUT",
241
208
  url: method_url,
@@ -266,7 +233,6 @@ module IBMWatson
266
233
 
267
234
  method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
268
235
 
269
- headers = authenticator.authenticate(headers)
270
236
  response = request(
271
237
  method: "DELETE",
272
238
  url: method_url,
@@ -302,7 +268,6 @@ module IBMWatson
302
268
 
303
269
  method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
304
270
 
305
- headers = authenticator.authenticate(headers)
306
271
  response = request(
307
272
  method: "GET",
308
273
  url: method_url,
@@ -366,7 +331,6 @@ module IBMWatson
366
331
 
367
332
  method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
368
333
 
369
- headers = authenticator.authenticate(headers)
370
334
  response = request(
371
335
  method: "POST",
372
336
  url: method_url,
@@ -400,7 +364,6 @@ module IBMWatson
400
364
 
401
365
  method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
402
366
 
403
- headers = authenticator.authenticate(headers)
404
367
  response = request(
405
368
  method: "GET",
406
369
  url: method_url,
@@ -433,7 +396,6 @@ module IBMWatson
433
396
 
434
397
  method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
435
398
 
436
- headers = authenticator.authenticate(headers)
437
399
  response = request(
438
400
  method: "GET",
439
401
  url: method_url,
@@ -494,7 +456,6 @@ module IBMWatson
494
456
 
495
457
  method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
496
458
 
497
- headers = authenticator.authenticate(headers)
498
459
  response = request(
499
460
  method: "PUT",
500
461
  url: method_url,
@@ -534,7 +495,6 @@ module IBMWatson
534
495
 
535
496
  method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
536
497
 
537
- headers = authenticator.authenticate(headers)
538
498
  response = request(
539
499
  method: "DELETE",
540
500
  url: method_url,
@@ -545,85 +505,6 @@ module IBMWatson
545
505
  response
546
506
  end
547
507
  #########################
548
- # Test your configuration on a document
549
- #########################
550
-
551
- ##
552
- # @!method test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
553
- # Test configuration.
554
- # **Deprecated** This method is no longer supported and is scheduled to be removed
555
- # from service on July 31st 2019.
556
- #
557
- # Runs a sample document through the default or your configuration and returns
558
- # diagnostic information designed to help you understand how the document was
559
- # processed. The document is not added to the index.
560
- # @param environment_id [String] The ID of the environment.
561
- # @param configuration [String] The configuration to use to process the document. If this part is provided, then
562
- # the provided configuration is used to process the document. If the
563
- # **configuration_id** is also provided (both are present at the same time), then
564
- # request is rejected. The maximum supported configuration size is 1 MB.
565
- # Configuration parts larger than 1 MB are rejected. See the `GET
566
- # /configurations/{configuration_id}` operation for an example configuration.
567
- # @param file [File] The content of the document to ingest. The maximum supported file size when adding
568
- # a file to a collection is 50 megabytes, the maximum supported file size when
569
- # testing a confiruration is 1 megabyte. Files larger than the supported size are
570
- # rejected.
571
- # @param filename [String] The filename for file.
572
- # @param file_content_type [String] The content type of file.
573
- # @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
574
- # are rejected. Example: ``` {
575
- # "Creator": "Johnny Appleseed",
576
- # "Subject": "Apples"
577
- # } ```.
578
- # @param step [String] Specify to only run the input document through the given step instead of running
579
- # the input document through the entire ingestion workflow. Valid values are
580
- # `convert`, `enrich`, and `normalize`.
581
- # @param configuration_id [String] The ID of the configuration to use to process the document. If the
582
- # **configuration** form part is also provided (both are present at the same time),
583
- # then the request will be rejected.
584
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
585
- def test_configuration_in_environment(environment_id:, configuration: nil, file: nil, filename: nil, file_content_type: nil, metadata: nil, step: nil, configuration_id: nil)
586
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
587
-
588
- headers = {
589
- }
590
- sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "test_configuration_in_environment")
591
- headers.merge!(sdk_headers)
592
-
593
- params = {
594
- "version" => @version,
595
- "step" => step,
596
- "configuration_id" => configuration_id
597
- }
598
-
599
- form_data = {}
600
-
601
- form_data[:configuration] = HTTP::FormData::Part.new(configuration.to_s, content_type: "text/plain") unless configuration.nil?
602
-
603
- unless file.nil?
604
- unless file.instance_of?(StringIO) || file.instance_of?(File)
605
- file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
606
- end
607
- filename = file.path if filename.nil? && file.respond_to?(:path)
608
- form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
609
- end
610
-
611
- form_data[:metadata] = HTTP::FormData::Part.new(metadata.to_s, content_type: "text/plain") unless metadata.nil?
612
-
613
- method_url = "/v1/environments/%s/preview" % [ERB::Util.url_encode(environment_id)]
614
-
615
- headers = authenticator.authenticate(headers)
616
- response = request(
617
- method: "POST",
618
- url: method_url,
619
- headers: headers,
620
- params: params,
621
- form: form_data,
622
- accept_json: true
623
- )
624
- response
625
- end
626
- #########################
627
508
  # Collections
628
509
  #########################
629
510
 
@@ -660,7 +541,6 @@ module IBMWatson
660
541
 
661
542
  method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
662
543
 
663
- headers = authenticator.authenticate(headers)
664
544
  response = request(
665
545
  method: "POST",
666
546
  url: method_url,
@@ -694,7 +574,6 @@ module IBMWatson
694
574
 
695
575
  method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
696
576
 
697
- headers = authenticator.authenticate(headers)
698
577
  response = request(
699
578
  method: "GET",
700
579
  url: method_url,
@@ -727,7 +606,6 @@ module IBMWatson
727
606
 
728
607
  method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
729
608
 
730
- headers = authenticator.authenticate(headers)
731
609
  response = request(
732
610
  method: "GET",
733
611
  url: method_url,
@@ -769,7 +647,6 @@ module IBMWatson
769
647
 
770
648
  method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
771
649
 
772
- headers = authenticator.authenticate(headers)
773
650
  response = request(
774
651
  method: "PUT",
775
652
  url: method_url,
@@ -803,7 +680,6 @@ module IBMWatson
803
680
 
804
681
  method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
805
682
 
806
- headers = authenticator.authenticate(headers)
807
683
  response = request(
808
684
  method: "DELETE",
809
685
  url: method_url,
@@ -837,7 +713,6 @@ module IBMWatson
837
713
 
838
714
  method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
839
715
 
840
- headers = authenticator.authenticate(headers)
841
716
  response = request(
842
717
  method: "GET",
843
718
  url: method_url,
@@ -875,7 +750,6 @@ module IBMWatson
875
750
 
876
751
  method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
877
752
 
878
- headers = authenticator.authenticate(headers)
879
753
  response = request(
880
754
  method: "GET",
881
755
  url: method_url,
@@ -933,7 +807,6 @@ module IBMWatson
933
807
 
934
808
  method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
935
809
 
936
- headers = authenticator.authenticate(headers)
937
810
  response = request(
938
811
  method: "POST",
939
812
  url: method_url,
@@ -969,7 +842,6 @@ module IBMWatson
969
842
 
970
843
  method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
971
844
 
972
- headers = authenticator.authenticate(headers)
973
845
  request(
974
846
  method: "DELETE",
975
847
  url: method_url,
@@ -1004,7 +876,6 @@ module IBMWatson
1004
876
 
1005
877
  method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1006
878
 
1007
- headers = authenticator.authenticate(headers)
1008
879
  response = request(
1009
880
  method: "GET",
1010
881
  url: method_url,
@@ -1045,7 +916,6 @@ module IBMWatson
1045
916
 
1046
917
  method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1047
918
 
1048
- headers = authenticator.authenticate(headers)
1049
919
  response = request(
1050
920
  method: "POST",
1051
921
  url: method_url,
@@ -1080,7 +950,6 @@ module IBMWatson
1080
950
 
1081
951
  method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1082
952
 
1083
- headers = authenticator.authenticate(headers)
1084
953
  request(
1085
954
  method: "DELETE",
1086
955
  url: method_url,
@@ -1114,7 +983,6 @@ module IBMWatson
1114
983
 
1115
984
  method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1116
985
 
1117
- headers = authenticator.authenticate(headers)
1118
986
  response = request(
1119
987
  method: "GET",
1120
988
  url: method_url,
@@ -1160,7 +1028,6 @@ module IBMWatson
1160
1028
 
1161
1029
  method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1162
1030
 
1163
- headers = authenticator.authenticate(headers)
1164
1031
  response = request(
1165
1032
  method: "POST",
1166
1033
  url: method_url,
@@ -1196,7 +1063,6 @@ module IBMWatson
1196
1063
 
1197
1064
  method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1198
1065
 
1199
- headers = authenticator.authenticate(headers)
1200
1066
  request(
1201
1067
  method: "DELETE",
1202
1068
  url: method_url,
@@ -1283,7 +1149,6 @@ module IBMWatson
1283
1149
 
1284
1150
  method_url = "/v1/environments/%s/collections/%s/documents" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1285
1151
 
1286
- headers = authenticator.authenticate(headers)
1287
1152
  response = request(
1288
1153
  method: "POST",
1289
1154
  url: method_url,
@@ -1324,7 +1189,6 @@ module IBMWatson
1324
1189
 
1325
1190
  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)]
1326
1191
 
1327
- headers = authenticator.authenticate(headers)
1328
1192
  response = request(
1329
1193
  method: "GET",
1330
1194
  url: method_url,
@@ -1388,7 +1252,6 @@ module IBMWatson
1388
1252
 
1389
1253
  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)]
1390
1254
 
1391
- headers = authenticator.authenticate(headers)
1392
1255
  response = request(
1393
1256
  method: "POST",
1394
1257
  url: method_url,
@@ -1428,7 +1291,6 @@ module IBMWatson
1428
1291
 
1429
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)]
1430
1293
 
1431
- headers = authenticator.authenticate(headers)
1432
1294
  response = request(
1433
1295
  method: "DELETE",
1434
1296
  url: method_url,
@@ -1443,7 +1305,7 @@ module IBMWatson
1443
1305
  #########################
1444
1306
 
1445
1307
  ##
1446
- # @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: 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, x_watson_logging_opt_out: nil)
1308
+ # @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1447
1309
  # Query a collection.
1448
1310
  # By using this method, you can construct long queries. For details, see the
1449
1311
  # [Discovery
@@ -1485,8 +1347,6 @@ module IBMWatson
1485
1347
  # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
1486
1348
  # the returned results. Duplicate comparison is limited to the current query only,
1487
1349
  # **offset** is not considered. This parameter is currently Beta functionality.
1488
- # @param collection_ids [String] A comma-separated list of collection IDs to be queried against. Required when
1489
- # querying multiple collections, invalid when performing a single collection query.
1490
1350
  # @param similar [Boolean] When `true`, results are returned based on their similarity to the document IDs
1491
1351
  # specified in the **similar.document_ids** parameter.
1492
1352
  # @param similar_document_ids [String] A comma-separated list of document IDs to find similar documents.
@@ -1506,7 +1366,7 @@ module IBMWatson
1506
1366
  # parameter.
1507
1367
  # @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
1508
1368
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1509
- def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: 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, x_watson_logging_opt_out: nil)
1369
+ def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1510
1370
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1511
1371
 
1512
1372
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
@@ -1537,7 +1397,6 @@ module IBMWatson
1537
1397
  "passages.characters" => passages_characters,
1538
1398
  "deduplicate" => deduplicate,
1539
1399
  "deduplicate.field" => deduplicate_field,
1540
- "collection_ids" => collection_ids,
1541
1400
  "similar" => similar,
1542
1401
  "similar.document_ids" => similar_document_ids,
1543
1402
  "similar.fields" => similar_fields,
@@ -1546,7 +1405,6 @@ module IBMWatson
1546
1405
 
1547
1406
  method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1548
1407
 
1549
- headers = authenticator.authenticate(headers)
1550
1408
  response = request(
1551
1409
  method: "POST",
1552
1410
  url: method_url,
@@ -1644,7 +1502,6 @@ module IBMWatson
1644
1502
 
1645
1503
  method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1646
1504
 
1647
- headers = authenticator.authenticate(headers)
1648
1505
  response = request(
1649
1506
  method: "GET",
1650
1507
  url: method_url,
@@ -1656,12 +1513,13 @@ module IBMWatson
1656
1513
  end
1657
1514
 
1658
1515
  ##
1659
- # @!method federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: 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, x_watson_logging_opt_out: nil)
1516
+ # @!method federated_query(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1660
1517
  # Query multiple collections.
1661
1518
  # By using this method, you can construct long queries that search multiple
1662
1519
  # collection. For details, see the [Discovery
1663
1520
  # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
1664
1521
  # @param environment_id [String] The ID of the environment.
1522
+ # @param collection_ids [String] A comma-separated list of collection IDs to be queried against.
1665
1523
  # @param filter [String] A cacheable query that excludes documents that don't mention the query content.
1666
1524
  # Filter searches are better for metadata-type searches and for assessing the
1667
1525
  # concepts in the data set.
@@ -1697,8 +1555,6 @@ module IBMWatson
1697
1555
  # @param deduplicate_field [String] When specified, duplicate results based on the field specified are removed from
1698
1556
  # the returned results. Duplicate comparison is limited to the current query only,
1699
1557
  # **offset** is not considered. This parameter is currently Beta functionality.
1700
- # @param collection_ids [String] A comma-separated list of collection IDs to be queried against. Required when
1701
- # querying multiple collections, invalid when performing a single collection query.
1702
1558
  # @param similar [Boolean] When `true`, results are returned based on their similarity to the document IDs
1703
1559
  # specified in the **similar.document_ids** parameter.
1704
1560
  # @param similar_document_ids [String] A comma-separated list of document IDs to find similar documents.
@@ -1718,7 +1574,7 @@ module IBMWatson
1718
1574
  # parameter.
1719
1575
  # @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
1720
1576
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1721
- def federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: 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, x_watson_logging_opt_out: nil)
1577
+ def federated_query(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
1722
1578
  raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1723
1579
 
1724
1580
  headers = {
@@ -1732,6 +1588,7 @@ module IBMWatson
1732
1588
  }
1733
1589
 
1734
1590
  data = {
1591
+ "collection_ids" => collection_ids,
1735
1592
  "filter" => filter,
1736
1593
  "query" => query,
1737
1594
  "natural_language_query" => natural_language_query,
@@ -1747,7 +1604,6 @@ module IBMWatson
1747
1604
  "passages.characters" => passages_characters,
1748
1605
  "deduplicate" => deduplicate,
1749
1606
  "deduplicate.field" => deduplicate_field,
1750
- "collection_ids" => collection_ids,
1751
1607
  "similar" => similar,
1752
1608
  "similar.document_ids" => similar_document_ids,
1753
1609
  "similar.fields" => similar_fields,
@@ -1756,7 +1612,6 @@ module IBMWatson
1756
1612
 
1757
1613
  method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
1758
1614
 
1759
- headers = authenticator.authenticate(headers)
1760
1615
  response = request(
1761
1616
  method: "POST",
1762
1617
  url: method_url,
@@ -1845,7 +1700,6 @@ module IBMWatson
1845
1700
 
1846
1701
  method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
1847
1702
 
1848
- headers = authenticator.authenticate(headers)
1849
1703
  response = request(
1850
1704
  method: "GET",
1851
1705
  url: method_url,
@@ -1855,118 +1709,6 @@ module IBMWatson
1855
1709
  )
1856
1710
  response
1857
1711
  end
1858
-
1859
- ##
1860
- # @!method query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
1861
- # Knowledge Graph entity query.
1862
- # See the [Knowledge Graph
1863
- # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
1864
- # for more details.
1865
- # @param environment_id [String] The ID of the environment.
1866
- # @param collection_id [String] The ID of the collection.
1867
- # @param feature [String] The entity query feature to perform. Supported features are `disambiguate` and
1868
- # `similar_entities`.
1869
- # @param entity [QueryEntitiesEntity] A text string that appears within the entity text field.
1870
- # @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
1871
- # association. For example, if you wanted to query the city of London in England
1872
- # your query would look for `London` with the context of `England`.
1873
- # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1874
- # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1875
- # maximum number of evidence items per query is 10,000.
1876
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1877
- def query_entities(environment_id:, collection_id:, feature: nil, entity: nil, context: nil, count: nil, evidence_count: nil)
1878
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1879
-
1880
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1881
-
1882
- headers = {
1883
- }
1884
- sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_entities")
1885
- headers.merge!(sdk_headers)
1886
-
1887
- params = {
1888
- "version" => @version
1889
- }
1890
-
1891
- data = {
1892
- "feature" => feature,
1893
- "entity" => entity,
1894
- "context" => context,
1895
- "count" => count,
1896
- "evidence_count" => evidence_count
1897
- }
1898
-
1899
- method_url = "/v1/environments/%s/collections/%s/query_entities" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1900
-
1901
- headers = authenticator.authenticate(headers)
1902
- response = request(
1903
- method: "POST",
1904
- url: method_url,
1905
- headers: headers,
1906
- params: params,
1907
- json: data,
1908
- accept_json: true
1909
- )
1910
- response
1911
- end
1912
-
1913
- ##
1914
- # @!method query_relations(environment_id:, collection_id:, entities: nil, context: nil, sort: nil, filter: nil, count: nil, evidence_count: nil)
1915
- # Knowledge Graph relationship query.
1916
- # See the [Knowledge Graph
1917
- # documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-kg#kg)
1918
- # for more details.
1919
- # @param environment_id [String] The ID of the environment.
1920
- # @param collection_id [String] The ID of the collection.
1921
- # @param entities [Array[QueryRelationsEntity]] An array of entities to find relationships for.
1922
- # @param context [QueryEntitiesContext] Entity text to provide context for the queried entity and rank based on that
1923
- # association. For example, if you wanted to query the city of London in England
1924
- # your query would look for `London` with the context of `England`.
1925
- # @param sort [String] The sorting method for the relationships, can be `score` or `frequency`.
1926
- # `frequency` is the number of unique times each entity is identified. The default
1927
- # is `score`. This parameter cannot be used in the same query as the **bias**
1928
- # parameter.
1929
- # @param filter [QueryRelationsFilter]
1930
- # @param count [Fixnum] The number of results to return. The default is `10`. The maximum is `1000`.
1931
- # @param evidence_count [Fixnum] The number of evidence items to return for each result. The default is `0`. The
1932
- # maximum number of evidence items per query is 10,000.
1933
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1934
- def query_relations(environment_id:, collection_id:, entities: nil, context: nil, sort: nil, filter: nil, count: nil, evidence_count: nil)
1935
- raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
1936
-
1937
- raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
1938
-
1939
- headers = {
1940
- }
1941
- sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_relations")
1942
- headers.merge!(sdk_headers)
1943
-
1944
- params = {
1945
- "version" => @version
1946
- }
1947
-
1948
- data = {
1949
- "entities" => entities,
1950
- "context" => context,
1951
- "sort" => sort,
1952
- "filter" => filter,
1953
- "count" => count,
1954
- "evidence_count" => evidence_count
1955
- }
1956
-
1957
- method_url = "/v1/environments/%s/collections/%s/query_relations" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1958
-
1959
- headers = authenticator.authenticate(headers)
1960
- response = request(
1961
- method: "POST",
1962
- url: method_url,
1963
- headers: headers,
1964
- params: params,
1965
- json: data,
1966
- accept_json: true
1967
- )
1968
- response
1969
- end
1970
1712
  #########################
1971
1713
  # Training data
1972
1714
  #########################
@@ -1994,7 +1736,6 @@ module IBMWatson
1994
1736
 
1995
1737
  method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
1996
1738
 
1997
- headers = authenticator.authenticate(headers)
1998
1739
  response = request(
1999
1740
  method: "GET",
2000
1741
  url: method_url,
@@ -2039,7 +1780,6 @@ module IBMWatson
2039
1780
 
2040
1781
  method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
2041
1782
 
2042
- headers = authenticator.authenticate(headers)
2043
1783
  response = request(
2044
1784
  method: "POST",
2045
1785
  url: method_url,
@@ -2074,7 +1814,6 @@ module IBMWatson
2074
1814
 
2075
1815
  method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
2076
1816
 
2077
- headers = authenticator.authenticate(headers)
2078
1817
  request(
2079
1818
  method: "DELETE",
2080
1819
  url: method_url,
@@ -2112,7 +1851,6 @@ module IBMWatson
2112
1851
 
2113
1852
  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)]
2114
1853
 
2115
- headers = authenticator.authenticate(headers)
2116
1854
  response = request(
2117
1855
  method: "GET",
2118
1856
  url: method_url,
@@ -2150,7 +1888,6 @@ module IBMWatson
2150
1888
 
2151
1889
  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)]
2152
1890
 
2153
- headers = authenticator.authenticate(headers)
2154
1891
  request(
2155
1892
  method: "DELETE",
2156
1893
  url: method_url,
@@ -2187,7 +1924,6 @@ module IBMWatson
2187
1924
 
2188
1925
  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)]
2189
1926
 
2190
- headers = authenticator.authenticate(headers)
2191
1927
  response = request(
2192
1928
  method: "GET",
2193
1929
  url: method_url,
@@ -2233,7 +1969,6 @@ module IBMWatson
2233
1969
 
2234
1970
  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)]
2235
1971
 
2236
- headers = authenticator.authenticate(headers)
2237
1972
  response = request(
2238
1973
  method: "POST",
2239
1974
  url: method_url,
@@ -2274,7 +2009,6 @@ module IBMWatson
2274
2009
 
2275
2010
  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)]
2276
2011
 
2277
- headers = authenticator.authenticate(headers)
2278
2012
  request(
2279
2013
  method: "DELETE",
2280
2014
  url: method_url,
@@ -2321,7 +2055,6 @@ module IBMWatson
2321
2055
 
2322
2056
  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)]
2323
2057
 
2324
- headers = authenticator.authenticate(headers)
2325
2058
  response = request(
2326
2059
  method: "PUT",
2327
2060
  url: method_url,
@@ -2362,7 +2095,6 @@ module IBMWatson
2362
2095
 
2363
2096
  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)]
2364
2097
 
2365
- headers = authenticator.authenticate(headers)
2366
2098
  response = request(
2367
2099
  method: "GET",
2368
2100
  url: method_url,
@@ -2403,7 +2135,6 @@ module IBMWatson
2403
2135
 
2404
2136
  method_url = "/v1/user_data"
2405
2137
 
2406
- headers = authenticator.authenticate(headers)
2407
2138
  request(
2408
2139
  method: "DELETE",
2409
2140
  url: method_url,
@@ -2447,7 +2178,6 @@ module IBMWatson
2447
2178
 
2448
2179
  method_url = "/v1/events"
2449
2180
 
2450
- headers = authenticator.authenticate(headers)
2451
2181
  response = request(
2452
2182
  method: "POST",
2453
2183
  url: method_url,
@@ -2497,7 +2227,6 @@ module IBMWatson
2497
2227
 
2498
2228
  method_url = "/v1/logs"
2499
2229
 
2500
- headers = authenticator.authenticate(headers)
2501
2230
  response = request(
2502
2231
  method: "GET",
2503
2232
  url: method_url,
@@ -2534,7 +2263,6 @@ module IBMWatson
2534
2263
 
2535
2264
  method_url = "/v1/metrics/number_of_queries"
2536
2265
 
2537
- headers = authenticator.authenticate(headers)
2538
2266
  response = request(
2539
2267
  method: "GET",
2540
2268
  url: method_url,
@@ -2572,7 +2300,6 @@ module IBMWatson
2572
2300
 
2573
2301
  method_url = "/v1/metrics/number_of_queries_with_event"
2574
2302
 
2575
- headers = authenticator.authenticate(headers)
2576
2303
  response = request(
2577
2304
  method: "GET",
2578
2305
  url: method_url,
@@ -2609,7 +2336,6 @@ module IBMWatson
2609
2336
 
2610
2337
  method_url = "/v1/metrics/number_of_queries_with_no_search_results"
2611
2338
 
2612
- headers = authenticator.authenticate(headers)
2613
2339
  response = request(
2614
2340
  method: "GET",
2615
2341
  url: method_url,
@@ -2647,7 +2373,6 @@ module IBMWatson
2647
2373
 
2648
2374
  method_url = "/v1/metrics/event_rate"
2649
2375
 
2650
- headers = authenticator.authenticate(headers)
2651
2376
  response = request(
2652
2377
  method: "GET",
2653
2378
  url: method_url,
@@ -2681,7 +2406,6 @@ module IBMWatson
2681
2406
 
2682
2407
  method_url = "/v1/metrics/top_query_tokens_with_event_rate"
2683
2408
 
2684
- headers = authenticator.authenticate(headers)
2685
2409
  response = request(
2686
2410
  method: "GET",
2687
2411
  url: method_url,
@@ -2718,7 +2442,6 @@ module IBMWatson
2718
2442
 
2719
2443
  method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
2720
2444
 
2721
- headers = authenticator.authenticate(headers)
2722
2445
  response = request(
2723
2446
  method: "GET",
2724
2447
  url: method_url,
@@ -2775,7 +2498,6 @@ module IBMWatson
2775
2498
 
2776
2499
  method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
2777
2500
 
2778
- headers = authenticator.authenticate(headers)
2779
2501
  response = request(
2780
2502
  method: "POST",
2781
2503
  url: method_url,
@@ -2813,7 +2535,6 @@ module IBMWatson
2813
2535
 
2814
2536
  method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
2815
2537
 
2816
- headers = authenticator.authenticate(headers)
2817
2538
  response = request(
2818
2539
  method: "GET",
2819
2540
  url: method_url,
@@ -2872,7 +2593,6 @@ module IBMWatson
2872
2593
 
2873
2594
  method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
2874
2595
 
2875
- headers = authenticator.authenticate(headers)
2876
2596
  response = request(
2877
2597
  method: "PUT",
2878
2598
  url: method_url,
@@ -2907,7 +2627,6 @@ module IBMWatson
2907
2627
 
2908
2628
  method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
2909
2629
 
2910
- headers = authenticator.authenticate(headers)
2911
2630
  response = request(
2912
2631
  method: "DELETE",
2913
2632
  url: method_url,
@@ -2941,7 +2660,6 @@ module IBMWatson
2941
2660
 
2942
2661
  method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
2943
2662
 
2944
- headers = authenticator.authenticate(headers)
2945
2663
  response = request(
2946
2664
  method: "GET",
2947
2665
  url: method_url,
@@ -2977,7 +2695,6 @@ module IBMWatson
2977
2695
 
2978
2696
  method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
2979
2697
 
2980
- headers = authenticator.authenticate(headers)
2981
2698
  response = request(
2982
2699
  method: "POST",
2983
2700
  url: method_url,
@@ -3012,7 +2729,6 @@ module IBMWatson
3012
2729
 
3013
2730
  method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
3014
2731
 
3015
- headers = authenticator.authenticate(headers)
3016
2732
  response = request(
3017
2733
  method: "GET",
3018
2734
  url: method_url,
@@ -3046,7 +2762,6 @@ module IBMWatson
3046
2762
 
3047
2763
  method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
3048
2764
 
3049
- headers = authenticator.authenticate(headers)
3050
2765
  response = request(
3051
2766
  method: "DELETE",
3052
2767
  url: method_url,