ibm_watson 1.3.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -5
  3. data/lib/ibm_watson/assistant_v1.rb +225 -199
  4. data/lib/ibm_watson/assistant_v2.rb +228 -21
  5. data/lib/ibm_watson/compare_comply_v1.rb +43 -24
  6. data/lib/ibm_watson/discovery_v1.rb +144 -19
  7. data/lib/ibm_watson/discovery_v2.rb +742 -23
  8. data/lib/ibm_watson/language_translator_v3.rb +216 -64
  9. data/lib/ibm_watson/natural_language_classifier_v1.rb +11 -3
  10. data/lib/ibm_watson/natural_language_understanding_v1.rb +32 -26
  11. data/lib/ibm_watson/personality_insights_v3.rb +34 -19
  12. data/lib/ibm_watson/speech_to_text_v1.rb +239 -106
  13. data/lib/ibm_watson/text_to_speech_v1.rb +139 -146
  14. data/lib/ibm_watson/tone_analyzer_v3.rb +19 -14
  15. data/lib/ibm_watson/version.rb +1 -1
  16. data/lib/ibm_watson/visual_recognition_v3.rb +40 -17
  17. data/lib/ibm_watson/visual_recognition_v4.rb +110 -18
  18. data/test/integration/test_assistant_v1.rb +9 -0
  19. data/test/integration/test_assistant_v2.rb +34 -0
  20. data/test/integration/test_compare_comply_v1.rb +1 -12
  21. data/test/integration/test_discovery_v2.rb +132 -6
  22. data/test/integration/test_language_translator_v3.rb +5 -0
  23. data/test/integration/test_text_to_speech_v1.rb +3 -3
  24. data/test/integration/test_visual_recognition_v4.rb +9 -0
  25. data/test/unit/test_assistant_v1.rb +149 -98
  26. data/test/unit/test_assistant_v2.rb +153 -8
  27. data/test/unit/test_compare_comply_v1.rb +20 -20
  28. data/test/unit/test_discovery_v1.rb +125 -125
  29. data/test/unit/test_discovery_v2.rb +262 -29
  30. data/test/unit/test_language_translator_v3.rb +85 -24
  31. data/test/unit/test_natural_language_classifier_v1.rb +17 -17
  32. data/test/unit/test_natural_language_understanding_v1.rb +10 -10
  33. data/test/unit/test_personality_insights_v3.rb +14 -14
  34. data/test/unit/test_speech_to_text_v1.rb +97 -97
  35. data/test/unit/test_text_to_speech_v1.rb +48 -48
  36. data/test/unit/test_tone_analyzer_v3.rb +12 -12
  37. data/test/unit/test_visual_recognition_v3.rb +16 -16
  38. data/test/unit/test_visual_recognition_v4.rb +56 -38
  39. metadata +3 -3
@@ -13,7 +13,9 @@
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
-
16
+ #
17
+ # IBM OpenAPI SDK Code Generator Version: 3.19.0-be3b4618-20201113-200858
18
+ #
17
19
  # The IBM Watson™ Tone Analyzer service uses linguistic analysis to detect
18
20
  # emotional and language tones in written text. The service can analyze tone at both the
19
21
  # document and sentence levels. You can use the service to understand how your written
@@ -38,37 +40,36 @@ module IBMWatson
38
40
  # The Tone Analyzer V3 service.
39
41
  class ToneAnalyzerV3 < IBMCloudSdkCore::BaseService
40
42
  include Concurrent::Async
43
+ DEFAULT_SERVICE_NAME = "tone_analyzer"
44
+ DEFAULT_SERVICE_URL = "https://api.us-south.tone-analyzer.watson.cloud.ibm.com"
45
+ attr_accessor :version
41
46
  ##
42
47
  # @!method initialize(args)
43
48
  # Construct a new client for the Tone Analyzer service.
44
49
  #
45
50
  # @param args [Hash] The args to initialize with
46
- # @option args version [String] The API version date to use with the service, in
47
- # "YYYY-MM-DD" format. Whenever the API is changed in a backwards
48
- # incompatible way, a new minor version of the API is released.
49
- # The service uses the API version for the date you specify, or
50
- # the most recent version before that date. Note that you should
51
- # not programmatically specify the current date at runtime, in
52
- # case the API has been updated since your application's release.
53
- # Instead, specify a version date that is compatible with your
54
- # application, and don't change it until your application is
55
- # ready for a later version.
51
+ # @option args version [String] Release date of the version of the API you want to use. Specify dates in
52
+ # YYYY-MM-DD format. The current version is `2017-09-21`.
56
53
  # @option args service_url [String] The base service URL to use when contacting the service.
57
54
  # The base service_url may differ between IBM Cloud regions.
58
55
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
56
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
57
+ # any external configuration, if applicable.
59
58
  def initialize(args = {})
60
59
  @__async_initialized__ = false
61
60
  defaults = {}
62
- defaults[:version] = nil
63
- defaults[:service_url] = "https://gateway.watsonplatform.net/tone-analyzer/api"
61
+ defaults[:service_url] = DEFAULT_SERVICE_URL
62
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
64
63
  defaults[:authenticator] = nil
64
+ defaults[:version] = nil
65
+ user_service_url = args[:service_url] unless args[:service_url].nil?
65
66
  args = defaults.merge(args)
66
67
  @version = args[:version]
67
68
  raise ArgumentError.new("version must be provided") if @version.nil?
68
69
 
69
- args[:service_name] = "tone_analyzer"
70
70
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
71
71
  super
72
+ @service_url = user_service_url unless user_service_url.nil?
72
73
  end
73
74
 
74
75
  #########################
@@ -125,6 +126,8 @@ module IBMWatson
125
126
  # **Accept-Language**.
126
127
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
127
128
  def tone(tone_input:, content_type: nil, sentences: nil, tones: nil, content_language: nil, accept_language: nil)
129
+ raise ArgumentError.new("version must be provided") if version.nil?
130
+
128
131
  raise ArgumentError.new("tone_input must be provided") if tone_input.nil?
129
132
 
130
133
  headers = {
@@ -193,6 +196,8 @@ module IBMWatson
193
196
  # **Accept-Language**.
194
197
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
195
198
  def tone_chat(utterances:, content_language: nil, accept_language: nil)
199
+ raise ArgumentError.new("version must be provided") if version.nil?
200
+
196
201
  raise ArgumentError.new("utterances must be provided") if utterances.nil?
197
202
 
198
203
  headers = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMWatson
4
- VERSION = "1.3.1"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -13,10 +13,17 @@
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
-
17
- # The IBM Watson&trade; Visual Recognition service uses deep learning algorithms to
18
- # identify scenes and objects in images that you upload to the service. You can create and
19
- # train a custom classifier to identify subjects that suit your needs.
16
+ #
17
+ # IBM OpenAPI SDK Code Generator Version: 3.19.0-be3b4618-20201113-200858
18
+ #
19
+ # IBM Watson&trade; Visual Recognition is discontinued. Existing instances are supported
20
+ # until 1 December 2021, but as of 7 January 2021, you can't create instances. Any
21
+ # instance that is provisioned on 1 December 2021 will be deleted.
22
+ # {: deprecated}
23
+ #
24
+ # The IBM Watson Visual Recognition service uses deep learning algorithms to identify
25
+ # scenes and objects in images that you upload to the service. You can create and train a
26
+ # custom classifier to identify subjects that suit your needs.
20
27
 
21
28
  require "concurrent"
22
29
  require "erb"
@@ -30,37 +37,37 @@ module IBMWatson
30
37
  # The Visual Recognition V3 service.
31
38
  class VisualRecognitionV3 < IBMCloudSdkCore::BaseService
32
39
  include Concurrent::Async
40
+ DEFAULT_SERVICE_NAME = "visual_recognition"
41
+ DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
42
+ attr_accessor :version
33
43
  ##
34
44
  # @!method initialize(args)
35
45
  # Construct a new client for the Visual Recognition service.
36
46
  #
37
47
  # @param args [Hash] The args to initialize with
38
- # @option args version [String] The API version date to use with the service, in
39
- # "YYYY-MM-DD" format. Whenever the API is changed in a backwards
40
- # incompatible way, a new minor version of the API is released.
41
- # The service uses the API version for the date you specify, or
42
- # the most recent version before that date. Note that you should
43
- # not programmatically specify the current date at runtime, in
44
- # case the API has been updated since your application's release.
45
- # Instead, specify a version date that is compatible with your
46
- # application, and don't change it until your application is
47
- # ready for a later version.
48
+ # @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
49
+ # format. The current version is `2018-03-19`.
48
50
  # @option args service_url [String] The base service URL to use when contacting the service.
49
51
  # The base service_url may differ between IBM Cloud regions.
50
52
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
53
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
54
+ # any external configuration, if applicable.
51
55
  def initialize(args = {})
56
+ warn "On 1 December 2021, Visual Recognition will no longer be available. For more information, see https://github.com/watson-developer-cloud/ruby-sdk/tree/master#visual-recognition-deprecation."
52
57
  @__async_initialized__ = false
53
58
  defaults = {}
54
- defaults[:version] = nil
55
- defaults[:service_url] = "https://gateway.watsonplatform.net/visual-recognition/api"
59
+ defaults[:service_url] = DEFAULT_SERVICE_URL
60
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
56
61
  defaults[:authenticator] = nil
62
+ defaults[:version] = nil
63
+ user_service_url = args[:service_url] unless args[:service_url].nil?
57
64
  args = defaults.merge(args)
58
65
  @version = args[:version]
59
66
  raise ArgumentError.new("version must be provided") if @version.nil?
60
67
 
61
- args[:service_name] = "visual_recognition"
62
68
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
63
69
  super
70
+ @service_url = user_service_url unless user_service_url.nil?
64
71
  end
65
72
 
66
73
  #########################
@@ -106,6 +113,8 @@ module IBMWatson
106
113
  # @param accept_language [String] The desired language of parts of the response. See the response for details.
107
114
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
108
115
  def classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
116
+ raise ArgumentError.new("version must be provided") if version.nil?
117
+
109
118
  headers = {
110
119
  "Accept-Language" => accept_language
111
120
  }
@@ -192,6 +201,8 @@ module IBMWatson
192
201
  # @param negative_examples_filename [String] The filename for negative_examples.
193
202
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
194
203
  def create_classifier(name:, positive_examples:, negative_examples: nil, negative_examples_filename: nil)
204
+ raise ArgumentError.new("version must be provided") if version.nil?
205
+
195
206
  raise ArgumentError.new("name must be provided") if name.nil?
196
207
 
197
208
  raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.is_a?(Hash)
@@ -247,6 +258,8 @@ module IBMWatson
247
258
  # return a brief list of classifiers.
248
259
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
249
260
  def list_classifiers(verbose: nil)
261
+ raise ArgumentError.new("version must be provided") if version.nil?
262
+
250
263
  headers = {
251
264
  }
252
265
  sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "list_classifiers")
@@ -276,6 +289,8 @@ module IBMWatson
276
289
  # @param classifier_id [String] The ID of the classifier.
277
290
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
278
291
  def get_classifier(classifier_id:)
292
+ raise ArgumentError.new("version must be provided") if version.nil?
293
+
279
294
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
280
295
 
281
296
  headers = {
@@ -344,6 +359,8 @@ module IBMWatson
344
359
  # @param negative_examples_filename [String] The filename for negative_examples.
345
360
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
346
361
  def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
362
+ raise ArgumentError.new("version must be provided") if version.nil?
363
+
347
364
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
348
365
 
349
366
  raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.nil? || positive_examples.is_a?(Hash)
@@ -395,6 +412,8 @@ module IBMWatson
395
412
  # @param classifier_id [String] The ID of the classifier.
396
413
  # @return [nil]
397
414
  def delete_classifier(classifier_id:)
415
+ raise ArgumentError.new("version must be provided") if version.nil?
416
+
398
417
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
399
418
 
400
419
  headers = {
@@ -429,6 +448,8 @@ module IBMWatson
429
448
  # @param classifier_id [String] The ID of the classifier.
430
449
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
431
450
  def get_core_ml_model(classifier_id:)
451
+ raise ArgumentError.new("version must be provided") if version.nil?
452
+
432
453
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
433
454
 
434
455
  headers = {
@@ -468,6 +489,8 @@ module IBMWatson
468
489
  # @param customer_id [String] The customer ID for which all data is to be deleted.
469
490
  # @return [nil]
470
491
  def delete_user_data(customer_id:)
492
+ raise ArgumentError.new("version must be provided") if version.nil?
493
+
471
494
  raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
472
495
 
473
496
  headers = {
@@ -13,9 +13,16 @@
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
-
17
- # Provide images to the IBM Watson&trade; Visual Recognition service for analysis. The
18
- # service detects objects based on a set of images with training data.
16
+ #
17
+ # IBM OpenAPI SDK Code Generator Version: 3.19.0-be3b4618-20201113-200858
18
+ #
19
+ # IBM Watson&trade; Visual Recognition is discontinued. Existing instances are supported
20
+ # until 1 December 2021, but as of 7 January 2021, you can't create instances. Any
21
+ # instance that is provisioned on 1 December 2021 will be deleted.
22
+ # {: deprecated}
23
+ #
24
+ # Provide images to the IBM Watson Visual Recognition service for analysis. The service
25
+ # detects objects based on a set of images with training data.
19
26
 
20
27
  require "concurrent"
21
28
  require "erb"
@@ -29,37 +36,37 @@ module IBMWatson
29
36
  # The Visual Recognition V4 service.
30
37
  class VisualRecognitionV4 < IBMCloudSdkCore::BaseService
31
38
  include Concurrent::Async
39
+ DEFAULT_SERVICE_NAME = "visual_recognition"
40
+ DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
41
+ attr_accessor :version
32
42
  ##
33
43
  # @!method initialize(args)
34
44
  # Construct a new client for the Visual Recognition service.
35
45
  #
36
46
  # @param args [Hash] The args to initialize with
37
- # @option args version [String] The API version date to use with the service, in
38
- # "YYYY-MM-DD" format. Whenever the API is changed in a backwards
39
- # incompatible way, a new minor version of the API is released.
40
- # The service uses the API version for the date you specify, or
41
- # the most recent version before that date. Note that you should
42
- # not programmatically specify the current date at runtime, in
43
- # case the API has been updated since your application's release.
44
- # Instead, specify a version date that is compatible with your
45
- # application, and don't change it until your application is
46
- # ready for a later version.
47
+ # @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
48
+ # format. The current version is `2019-02-11`.
47
49
  # @option args service_url [String] The base service URL to use when contacting the service.
48
50
  # The base service_url may differ between IBM Cloud regions.
49
51
  # @option args authenticator [Object] The Authenticator instance to be configured for this service.
52
+ # @option args service_name [String] The name of the service to configure. Will be used as the key to load
53
+ # any external configuration, if applicable.
50
54
  def initialize(args = {})
55
+ warn "On 1 December 2021, Visual Recognition will no longer be available. For more information, see https://github.com/watson-developer-cloud/ruby-sdk/tree/master#visual-recognition-deprecation."
51
56
  @__async_initialized__ = false
52
57
  defaults = {}
53
- defaults[:version] = nil
54
- defaults[:service_url] = "https://gateway.watsonplatform.net/visual-recognition/api"
58
+ defaults[:service_url] = DEFAULT_SERVICE_URL
59
+ defaults[:service_name] = DEFAULT_SERVICE_NAME
55
60
  defaults[:authenticator] = nil
61
+ defaults[:version] = nil
62
+ user_service_url = args[:service_url] unless args[:service_url].nil?
56
63
  args = defaults.merge(args)
57
64
  @version = args[:version]
58
65
  raise ArgumentError.new("version must be provided") if @version.nil?
59
66
 
60
- args[:service_name] = "visual_recognition"
61
67
  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
62
68
  super
69
+ @service_url = user_service_url unless user_service_url.nil?
63
70
  end
64
71
 
65
72
  #########################
@@ -95,6 +102,8 @@ module IBMWatson
95
102
  # @param threshold [Float] The minimum score a feature must have to be returned.
96
103
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
97
104
  def analyze(collection_ids:, features:, images_file: nil, image_url: nil, threshold: nil)
105
+ raise ArgumentError.new("version must be provided") if version.nil?
106
+
98
107
  raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
99
108
 
100
109
  raise ArgumentError.new("features must be provided") if features.nil?
@@ -164,6 +173,8 @@ module IBMWatson
164
173
  # @param description [String] The description of the collection.
165
174
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
166
175
  def create_collection(name: nil, description: nil)
176
+ raise ArgumentError.new("version must be provided") if version.nil?
177
+
167
178
  headers = {
168
179
  }
169
180
  sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "create_collection")
@@ -197,6 +208,8 @@ module IBMWatson
197
208
  # Retrieves a list of collections for the service instance.
198
209
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
199
210
  def list_collections
211
+ raise ArgumentError.new("version must be provided") if version.nil?
212
+
200
213
  headers = {
201
214
  }
202
215
  sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "list_collections")
@@ -225,6 +238,8 @@ module IBMWatson
225
238
  # @param collection_id [String] The identifier of the collection.
226
239
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
227
240
  def get_collection(collection_id:)
241
+ raise ArgumentError.new("version must be provided") if version.nil?
242
+
228
243
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
229
244
 
230
245
  headers = {
@@ -261,6 +276,8 @@ module IBMWatson
261
276
  # @param description [String] The description of the collection.
262
277
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
263
278
  def update_collection(collection_id:, name: nil, description: nil)
279
+ raise ArgumentError.new("version must be provided") if version.nil?
280
+
264
281
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
265
282
 
266
283
  headers = {
@@ -297,6 +314,8 @@ module IBMWatson
297
314
  # @param collection_id [String] The identifier of the collection.
298
315
  # @return [nil]
299
316
  def delete_collection(collection_id:)
317
+ raise ArgumentError.new("version must be provided") if version.nil?
318
+
300
319
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
301
320
 
302
321
  headers = {
@@ -319,6 +338,53 @@ module IBMWatson
319
338
  )
320
339
  nil
321
340
  end
341
+
342
+ ##
343
+ # @!method get_model_file(collection_id:, feature:, model_format:)
344
+ # Get a model.
345
+ # Download a model that you can deploy to detect objects in images. The collection
346
+ # must include a generated model, which is indicated in the response for the
347
+ # collection details as `"rscnn_ready": true`. If the value is `false`, train or
348
+ # retrain the collection to generate the model.
349
+ #
350
+ # Currently, the model format is specific to Android apps. For more information
351
+ # about how to deploy the model to your app, see the [Watson Visual Recognition on
352
+ # Android](https://github.com/matt-ny/rscnn) project in GitHub.
353
+ # @param collection_id [String] The identifier of the collection.
354
+ # @param feature [String] The feature for the model.
355
+ # @param model_format [String] The format of the returned model.
356
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
357
+ def get_model_file(collection_id:, feature:, model_format:)
358
+ raise ArgumentError.new("version must be provided") if version.nil?
359
+
360
+ raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
361
+
362
+ raise ArgumentError.new("feature must be provided") if feature.nil?
363
+
364
+ raise ArgumentError.new("model_format must be provided") if model_format.nil?
365
+
366
+ headers = {
367
+ }
368
+ sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_model_file")
369
+ headers.merge!(sdk_headers)
370
+
371
+ params = {
372
+ "version" => @version,
373
+ "feature" => feature,
374
+ "model_format" => model_format
375
+ }
376
+
377
+ method_url = "/v4/collections/%s/model" % [ERB::Util.url_encode(collection_id)]
378
+
379
+ response = request(
380
+ method: "GET",
381
+ url: method_url,
382
+ headers: headers,
383
+ params: params,
384
+ accept_json: false
385
+ )
386
+ response
387
+ end
322
388
  #########################
323
389
  # Images
324
390
  #########################
@@ -354,6 +420,8 @@ module IBMWatson
354
420
  # than 32 characters.
355
421
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
356
422
  def add_images(collection_id:, images_file: nil, image_url: nil, training_data: nil)
423
+ raise ArgumentError.new("version must be provided") if version.nil?
424
+
357
425
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
358
426
 
359
427
  headers = {
@@ -403,6 +471,8 @@ module IBMWatson
403
471
  # @param collection_id [String] The identifier of the collection.
404
472
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
405
473
  def list_images(collection_id:)
474
+ raise ArgumentError.new("version must be provided") if version.nil?
475
+
406
476
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
407
477
 
408
478
  headers = {
@@ -434,6 +504,8 @@ module IBMWatson
434
504
  # @param image_id [String] The identifier of the image.
435
505
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
436
506
  def get_image_details(collection_id:, image_id:)
507
+ raise ArgumentError.new("version must be provided") if version.nil?
508
+
437
509
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
438
510
 
439
511
  raise ArgumentError.new("image_id must be provided") if image_id.nil?
@@ -467,6 +539,8 @@ module IBMWatson
467
539
  # @param image_id [String] The identifier of the image.
468
540
  # @return [nil]
469
541
  def delete_image(collection_id:, image_id:)
542
+ raise ArgumentError.new("version must be provided") if version.nil?
543
+
470
544
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
471
545
 
472
546
  raise ArgumentError.new("image_id must be provided") if image_id.nil?
@@ -503,6 +577,8 @@ module IBMWatson
503
577
  # For example, an original 800 x 1000 image is resized to 160 x 200 pixels.
504
578
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
505
579
  def get_jpeg_image(collection_id:, image_id:, size: nil)
580
+ raise ArgumentError.new("version must be provided") if version.nil?
581
+
506
582
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
507
583
 
508
584
  raise ArgumentError.new("image_id must be provided") if image_id.nil?
@@ -539,6 +615,8 @@ module IBMWatson
539
615
  # @param collection_id [String] The identifier of the collection.
540
616
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
541
617
  def list_object_metadata(collection_id:)
618
+ raise ArgumentError.new("version must be provided") if version.nil?
619
+
542
620
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
543
621
 
544
622
  headers = {
@@ -574,6 +652,8 @@ module IBMWatson
574
652
  # `sys-`.
575
653
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
576
654
  def update_object_metadata(collection_id:, object:, new_object:)
655
+ raise ArgumentError.new("version must be provided") if version.nil?
656
+
577
657
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
578
658
 
579
659
  raise ArgumentError.new("object must be provided") if object.nil?
@@ -614,6 +694,8 @@ module IBMWatson
614
694
  # @param object [String] The name of the object.
615
695
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
616
696
  def get_object_metadata(collection_id:, object:)
697
+ raise ArgumentError.new("version must be provided") if version.nil?
698
+
617
699
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
618
700
 
619
701
  raise ArgumentError.new("object must be provided") if object.nil?
@@ -648,6 +730,8 @@ module IBMWatson
648
730
  # @param object [String] The name of the object.
649
731
  # @return [nil]
650
732
  def delete_object(collection_id:, object:)
733
+ raise ArgumentError.new("version must be provided") if version.nil?
734
+
651
735
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
652
736
 
653
737
  raise ArgumentError.new("object must be provided") if object.nil?
@@ -685,6 +769,8 @@ module IBMWatson
685
769
  # @param collection_id [String] The identifier of the collection.
686
770
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
687
771
  def train(collection_id:)
772
+ raise ArgumentError.new("version must be provided") if version.nil?
773
+
688
774
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
689
775
 
690
776
  headers = {
@@ -726,6 +812,8 @@ module IBMWatson
726
812
  # @param objects [Array[TrainingDataObject]] Training data for specific objects.
727
813
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
728
814
  def add_image_training_data(collection_id:, image_id:, objects: nil)
815
+ raise ArgumentError.new("version must be provided") if version.nil?
816
+
729
817
  raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
730
818
 
731
819
  raise ArgumentError.new("image_id must be provided") if image_id.nil?
@@ -761,14 +849,16 @@ module IBMWatson
761
849
  # Get training usage.
762
850
  # Information about the completed training events. You can use this information to
763
851
  # determine how close you are to the training limits for the month.
764
- # @param start_time [String] The earliest day to include training events. Specify dates in YYYY-MM-DD format.
852
+ # @param start_time [Time] The earliest day to include training events. Specify dates in YYYY-MM-DD format.
765
853
  # If empty or not specified, the earliest training event is included.
766
- # @param end_time [String] The most recent day to include training events. Specify dates in YYYY-MM-DD
854
+ # @param end_time [Time] The most recent day to include training events. Specify dates in YYYY-MM-DD
767
855
  # format. All events for the day are included. If empty or not specified, the
768
856
  # current day is used. Specify the same value as `start_time` to request events for
769
857
  # a single day.
770
858
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
771
859
  def get_training_usage(start_time: nil, end_time: nil)
860
+ raise ArgumentError.new("version must be provided") if version.nil?
861
+
772
862
  headers = {
773
863
  }
774
864
  sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_training_usage")
@@ -808,6 +898,8 @@ module IBMWatson
808
898
  # @param customer_id [String] The customer ID for which all data is to be deleted.
809
899
  # @return [nil]
810
900
  def delete_user_data(customer_id:)
901
+ raise ArgumentError.new("version must be provided") if version.nil?
902
+
811
903
  raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
812
904
 
813
905
  headers = {