Skip to content

Commit 4ab2b15

Browse files
authored
Merge pull request #105 from watson-developer-cloud/2.0.0.rc1
feat: Regenerate with latest generator and api defs
2 parents 279cbb5 + 76352b0 commit 4ab2b15

23 files changed

+1092
-354
lines changed

MIGRATION-V2.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
### Ruby SDK V2 Migration guide
2+
3+
#### Breaking Changes
4+
* The Text To Speech changes listed below
5+
* All services now require a version to be specified (except for stt, tts and nlu)
6+
7+
#### Service changes
8+
9+
##### Assistant v1
10+
11+
* `list_workspaces()`: `include_count` parameter added
12+
* `list_intents()`: `include_count` parameter added
13+
* `list_examples()`: `include_count` parameter added
14+
* `list_counterexamples()`: `include_count` parameter added
15+
* `list_entities()`: `include_count` parameter added
16+
* `list_values()`: `include_count` parameter added
17+
* `list_synonyms()`: `include_count` parameter added
18+
* `list_dialog_nodes()`: `include_count` parameter added
19+
* `create_workspace()`: reorder `dialog_nodes`, `counterexamples`, `webhooks` parameters
20+
* `update_workspace()`: reorder `dialog_nodes`, `counterexamples`, `webhooks` parameters
21+
* `bulk_classify()`: function added - Identify intents and entities in multiple user utterances.
22+
23+
##### Assistant v2
24+
* `bulk_classify()`: function added - Identify intents and entities in multiple user utterances.
25+
26+
##### Compare Comply v1
27+
* `list_feedback()`: `before` and `after` parameters removed
28+
29+
##### Discovery v2
30+
* `analyze_document()`: function added - Process a document using the specified collection's settings and return it for realtime use. - Currently CP4D only
31+
32+
##### Personality Insights V3
33+
* On 1 December 2021, Personality Insights will no longer be available
34+
35+
##### Text To Speech V1
36+
* `create_voice_model()`: function changed to `create_custom_model()`
37+
* `list_voice_models()`: function changed to `list_custom_models()`
38+
* `update_voice_model()`: function changed to `update_custom_model()`
39+
* `get_voice_model()`: function changed to `get_custom_model()`
40+
* `delete_voice_model()`: function changed to `delete_custom_model()`
41+
42+
##### Visual Recognition V4
43+
* `create_collection()`: `training_status` parameter added
44+
* `update_collection()`: `training_status` parameter added

lib/ibm_watson/assistant_v1.rb

Lines changed: 212 additions & 50 deletions
Large diffs are not rendered by default.

lib/ibm_watson/assistant_v2.rb

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
16+
#
17+
# IBM OpenAPI SDK Code Generator Version: 3.19.0-be3b4618-20201113-200858
18+
#
1719
# The IBM Watson™ Assistant service combines machine learning, natural language
1820
# understanding, and an integrated dialog editor to create conversation flows between your
1921
# apps and your users.
@@ -35,21 +37,14 @@ class AssistantV2 < IBMCloudSdkCore::BaseService
3537
include Concurrent::Async
3638
DEFAULT_SERVICE_NAME = "assistant"
3739
DEFAULT_SERVICE_URL = "https://api.us-south.assistant.watson.cloud.ibm.com"
40+
attr_accessor :version
3841
##
3942
# @!method initialize(args)
4043
# Construct a new client for the Assistant service.
4144
#
4245
# @param args [Hash] The args to initialize with
43-
# @option args version [String] The API version date to use with the service, in
44-
# "YYYY-MM-DD" format. Whenever the API is changed in a backwards
45-
# incompatible way, a new minor version of the API is released.
46-
# The service uses the API version for the date you specify, or
47-
# the most recent version before that date. Note that you should
48-
# not programmatically specify the current date at runtime, in
49-
# case the API has been updated since your application's release.
50-
# Instead, specify a version date that is compatible with your
51-
# application, and don't change it until your application is
52-
# ready for a later version.
46+
# @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
47+
# format. The current version is `2020-04-01`.
5348
# @option args service_url [String] The base service URL to use when contacting the service.
5449
# The base service_url may differ between IBM Cloud regions.
5550
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
@@ -58,10 +53,10 @@ class AssistantV2 < IBMCloudSdkCore::BaseService
5853
def initialize(args = {})
5954
@__async_initialized__ = false
6055
defaults = {}
61-
defaults[:version] = nil
6256
defaults[:service_url] = DEFAULT_SERVICE_URL
6357
defaults[:service_name] = DEFAULT_SERVICE_NAME
6458
defaults[:authenticator] = nil
59+
defaults[:version] = nil
6560
user_service_url = args[:service_url] unless args[:service_url].nil?
6661
args = defaults.merge(args)
6762
@version = args[:version]
@@ -94,6 +89,8 @@ def initialize(args = {})
9489
def create_session(assistant_id:)
9590
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
9691

92+
raise ArgumentError.new("version must be provided") if version.nil?
93+
9794
headers = {
9895
}
9996
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "create_session")
@@ -132,6 +129,8 @@ def create_session(assistant_id:)
132129
def delete_session(assistant_id:, session_id:)
133130
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
134131

132+
raise ArgumentError.new("version must be provided") if version.nil?
133+
135134
raise ArgumentError.new("session_id must be provided") if session_id.nil?
136135

137136
headers = {
@@ -184,6 +183,8 @@ def message(assistant_id:, session_id:, input: nil, context: nil)
184183

185184
raise ArgumentError.new("session_id must be provided") if session_id.nil?
186185

186+
raise ArgumentError.new("version must be provided") if version.nil?
187+
187188
headers = {
188189
}
189190
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "message")
@@ -234,6 +235,8 @@ def message(assistant_id:, session_id:, input: nil, context: nil)
234235
def message_stateless(assistant_id:, input: nil, context: nil)
235236
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
236237

238+
raise ArgumentError.new("version must be provided") if version.nil?
239+
237240
headers = {
238241
}
239242
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "message_stateless")
@@ -287,6 +290,8 @@ def message_stateless(assistant_id:, input: nil, context: nil)
287290
def list_logs(assistant_id:, sort: nil, filter: nil, page_limit: nil, cursor: nil)
288291
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
289292

293+
raise ArgumentError.new("version must be provided") if version.nil?
294+
290295
headers = {
291296
}
292297
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "list_logs")
@@ -331,6 +336,8 @@ def list_logs(assistant_id:, sort: nil, filter: nil, page_limit: nil, cursor: ni
331336
# @param customer_id [String] The customer ID for which all data is to be deleted.
332337
# @return [nil]
333338
def delete_user_data(customer_id:)
339+
raise ArgumentError.new("version must be provided") if version.nil?
340+
334341
raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
335342

336343
headers = {
@@ -354,5 +361,52 @@ def delete_user_data(customer_id:)
354361
)
355362
nil
356363
end
364+
#########################
365+
# bulkClassify
366+
#########################
367+
368+
##
369+
# @!method bulk_classify(skill_id:, input: nil)
370+
# Identify intents and entities in multiple user utterances.
371+
# Send multiple user inputs to a dialog skill in a single request and receive
372+
# information about the intents and entities recognized in each input. This method
373+
# is useful for testing and comparing the performance of different skills or skill
374+
# versions.
375+
#
376+
# This method is available only with Premium plans.
377+
# @param skill_id [String] Unique identifier of the skill. To find the skill ID in the Watson Assistant user
378+
# interface, open the skill settings and click **API Details**.
379+
# @param input [Array[BulkClassifyUtterance]] An array of input utterances to classify.
380+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
381+
def bulk_classify(skill_id:, input: nil)
382+
raise ArgumentError.new("skill_id must be provided") if skill_id.nil?
383+
384+
raise ArgumentError.new("version must be provided") if version.nil?
385+
386+
headers = {
387+
}
388+
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "bulk_classify")
389+
headers.merge!(sdk_headers)
390+
391+
params = {
392+
"version" => @version
393+
}
394+
395+
data = {
396+
"input" => input
397+
}
398+
399+
method_url = "/v2/skills/%s/workspace/bulk_classify" % [ERB::Util.url_encode(skill_id)]
400+
401+
response = request(
402+
method: "POST",
403+
url: method_url,
404+
headers: headers,
405+
params: params,
406+
json: data,
407+
accept_json: true
408+
)
409+
response
410+
end
357411
end
358412
end

lib/ibm_watson/compare_comply_v1.rb

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
16+
#
17+
# IBM OpenAPI SDK Code Generator Version: 3.19.0-be3b4618-20201113-200858
18+
#
1719
# IBM Watson&trade; Compare and Comply analyzes governing documents to provide details
1820
# about critical aspects of the documents.
1921

@@ -31,21 +33,14 @@ class CompareComplyV1 < IBMCloudSdkCore::BaseService
3133
include Concurrent::Async
3234
DEFAULT_SERVICE_NAME = "compare_comply"
3335
DEFAULT_SERVICE_URL = "https://api.us-south.compare-comply.watson.cloud.ibm.com"
36+
attr_accessor :version
3437
##
3538
# @!method initialize(args)
3639
# Construct a new client for the Compare Comply service.
3740
#
3841
# @param args [Hash] The args to initialize with
39-
# @option args version [String] The API version date to use with the service, in
40-
# "YYYY-MM-DD" format. Whenever the API is changed in a backwards
41-
# incompatible way, a new minor version of the API is released.
42-
# The service uses the API version for the date you specify, or
43-
# the most recent version before that date. Note that you should
44-
# not programmatically specify the current date at runtime, in
45-
# case the API has been updated since your application's release.
46-
# Instead, specify a version date that is compatible with your
47-
# application, and don't change it until your application is
48-
# ready for a later version.
42+
# @option args version [String] Release date of the version of the API you want to use. Specify dates in
43+
# YYYY-MM-DD format. The current version is `2018-10-15`.
4944
# @option args service_url [String] The base service URL to use when contacting the service.
5045
# The base service_url may differ between IBM Cloud regions.
5146
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
@@ -54,10 +49,10 @@ class CompareComplyV1 < IBMCloudSdkCore::BaseService
5449
def initialize(args = {})
5550
@__async_initialized__ = false
5651
defaults = {}
57-
defaults[:version] = nil
5852
defaults[:service_url] = DEFAULT_SERVICE_URL
5953
defaults[:service_name] = DEFAULT_SERVICE_NAME
6054
defaults[:authenticator] = nil
55+
defaults[:version] = nil
6156
user_service_url = args[:service_url] unless args[:service_url].nil?
6257
args = defaults.merge(args)
6358
@version = args[:version]
@@ -84,6 +79,8 @@ def initialize(args = {})
8479
# standalone methods as well as to the methods' use in batch-processing requests.
8580
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
8681
def convert_to_html(file:, file_content_type: nil, model: nil)
82+
raise ArgumentError.new("version must be provided") if version.nil?
83+
8784
raise ArgumentError.new("file must be provided") if file.nil?
8885

8986
headers = {
@@ -131,6 +128,8 @@ def convert_to_html(file:, file_content_type: nil, model: nil)
131128
# standalone methods as well as to the methods' use in batch-processing requests.
132129
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
133130
def classify_elements(file:, file_content_type: nil, model: nil)
131+
raise ArgumentError.new("version must be provided") if version.nil?
132+
134133
raise ArgumentError.new("file must be provided") if file.nil?
135134

136135
headers = {
@@ -178,6 +177,8 @@ def classify_elements(file:, file_content_type: nil, model: nil)
178177
# standalone methods as well as to the methods' use in batch-processing requests.
179178
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
180179
def extract_tables(file:, file_content_type: nil, model: nil)
180+
raise ArgumentError.new("version must be provided") if version.nil?
181+
181182
raise ArgumentError.new("file must be provided") if file.nil?
182183

183184
headers = {
@@ -229,6 +230,8 @@ def extract_tables(file:, file_content_type: nil, model: nil)
229230
# standalone methods as well as to the methods' use in batch-processing requests.
230231
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
231232
def compare_documents(file_1:, file_2:, file_1_content_type: nil, file_2_content_type: nil, file_1_label: nil, file_2_label: nil, model: nil)
233+
raise ArgumentError.new("version must be provided") if version.nil?
234+
232235
raise ArgumentError.new("file_1 must be provided") if file_1.nil?
233236

234237
raise ArgumentError.new("file_2 must be provided") if file_2.nil?
@@ -286,6 +289,8 @@ def compare_documents(file_1:, file_2:, file_1_content_type: nil, file_2_content
286289
# @param comment [String] An optional comment on or description of the feedback.
287290
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
288291
def add_feedback(feedback_data:, user_id: nil, comment: nil)
292+
raise ArgumentError.new("version must be provided") if version.nil?
293+
289294
raise ArgumentError.new("feedback_data must be provided") if feedback_data.nil?
290295

291296
headers = {
@@ -317,15 +322,11 @@ def add_feedback(feedback_data:, user_id: nil, comment: nil)
317322
end
318323

319324
##
320-
# @!method list_feedback(feedback_type: nil, before: nil, after: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil)
325+
# @!method list_feedback(feedback_type: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil)
321326
# List the feedback in a document.
322327
# Lists the feedback in a document.
323328
# @param feedback_type [String] An optional string that filters the output to include only feedback with the
324329
# specified feedback type. The only permitted value is `element_classification`.
325-
# @param before [Time] An optional string in the format `YYYY-MM-DD` that filters the output to include
326-
# only feedback that was added before the specified date.
327-
# @param after [Time] An optional string in the format `YYYY-MM-DD` that filters the output to include
328-
# only feedback that was added after the specified date.
329330
# @param document_title [String] An optional string that filters the output to include only feedback from the
330331
# document with the specified `document_title`.
331332
# @param model_id [String] An optional string that filters the output to include only feedback with the
@@ -362,7 +363,9 @@ def add_feedback(feedback_data:, user_id: nil, comment: nil)
362363
# output includes a value called `total` that gives the total count of feedback
363364
# created.
364365
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
365-
def list_feedback(feedback_type: nil, before: nil, after: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil)
366+
def list_feedback(feedback_type: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil)
367+
raise ArgumentError.new("version must be provided") if version.nil?
368+
366369
headers = {
367370
}
368371
sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "list_feedback")
@@ -371,8 +374,6 @@ def list_feedback(feedback_type: nil, before: nil, after: nil, document_title: n
371374
params = {
372375
"version" => @version,
373376
"feedback_type" => feedback_type,
374-
"before" => before,
375-
"after" => after,
376377
"document_title" => document_title,
377378
"model_id" => model_id,
378379
"model_version" => model_version,
@@ -411,6 +412,8 @@ def list_feedback(feedback_type: nil, before: nil, after: nil, document_title: n
411412
# standalone methods as well as to the methods' use in batch-processing requests.
412413
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
413414
def get_feedback(feedback_id:, model: nil)
415+
raise ArgumentError.new("version must be provided") if version.nil?
416+
414417
raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?
415418

416419
headers = {
@@ -446,6 +449,8 @@ def get_feedback(feedback_id:, model: nil)
446449
# standalone methods as well as to the methods' use in batch-processing requests.
447450
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
448451
def delete_feedback(feedback_id:, model: nil)
452+
raise ArgumentError.new("version must be provided") if version.nil?
453+
449454
raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?
450455

451456
headers = {
@@ -504,6 +509,8 @@ def delete_feedback(feedback_id:, model: nil)
504509
# standalone methods as well as to the methods' use in batch-processing requests.
505510
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
506511
def create_batch(function:, input_credentials_file:, input_bucket_location:, input_bucket_name:, output_credentials_file:, output_bucket_location:, output_bucket_name:, model: nil)
512+
raise ArgumentError.new("version must be provided") if version.nil?
513+
507514
raise ArgumentError.new("function must be provided") if function.nil?
508515

509516
raise ArgumentError.new("input_credentials_file must be provided") if input_credentials_file.nil?
@@ -568,6 +575,8 @@ def create_batch(function:, input_credentials_file:, input_bucket_location:, inp
568575
# Lists batch-processing jobs submitted by users.
569576
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
570577
def list_batches
578+
raise ArgumentError.new("version must be provided") if version.nil?
579+
571580
headers = {
572581
}
573582
sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "list_batches")
@@ -596,6 +605,8 @@ def list_batches
596605
# @param batch_id [String] The ID of the batch-processing job whose information you want to retrieve.
597606
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
598607
def get_batch(batch_id:)
608+
raise ArgumentError.new("version must be provided") if version.nil?
609+
599610
raise ArgumentError.new("batch_id must be provided") if batch_id.nil?
600611

601612
headers = {
@@ -632,6 +643,8 @@ def get_batch(batch_id:)
632643
# standalone methods as well as to the methods' use in batch-processing requests.
633644
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
634645
def update_batch(batch_id:, action:, model: nil)
646+
raise ArgumentError.new("version must be provided") if version.nil?
647+
635648
raise ArgumentError.new("batch_id must be provided") if batch_id.nil?
636649

637650
raise ArgumentError.new("action must be provided") if action.nil?

0 commit comments

Comments
 (0)