ibm_watson 1.3.0 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -5
- data/lib/ibm_watson/assistant_v1.rb +225 -199
- data/lib/ibm_watson/assistant_v2.rb +228 -21
- data/lib/ibm_watson/compare_comply_v1.rb +43 -24
- data/lib/ibm_watson/discovery_v1.rb +144 -19
- data/lib/ibm_watson/discovery_v2.rb +742 -23
- data/lib/ibm_watson/language_translator_v3.rb +216 -64
- data/lib/ibm_watson/natural_language_classifier_v1.rb +11 -3
- data/lib/ibm_watson/natural_language_understanding_v1.rb +32 -26
- data/lib/ibm_watson/personality_insights_v3.rb +22 -14
- data/lib/ibm_watson/speech_to_text_v1.rb +240 -106
- data/lib/ibm_watson/text_to_speech_v1.rb +139 -146
- data/lib/ibm_watson/tone_analyzer_v3.rb +19 -14
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +31 -14
- data/lib/ibm_watson/visual_recognition_v4.rb +112 -22
- data/test/integration/test_assistant_v1.rb +9 -0
- data/test/integration/test_assistant_v2.rb +34 -0
- data/test/integration/test_compare_comply_v1.rb +1 -12
- data/test/integration/test_discovery_v2.rb +118 -6
- data/test/integration/test_language_translator_v3.rb +5 -0
- data/test/integration/test_speech_to_text_v1.rb +2 -0
- data/test/integration/test_text_to_speech_v1.rb +3 -3
- data/test/integration/test_visual_recognition_v4.rb +9 -0
- data/test/unit/test_assistant_v1.rb +149 -98
- data/test/unit/test_assistant_v2.rb +153 -8
- data/test/unit/test_compare_comply_v1.rb +20 -20
- data/test/unit/test_discovery_v1.rb +125 -125
- data/test/unit/test_discovery_v2.rb +262 -29
- data/test/unit/test_language_translator_v3.rb +85 -24
- data/test/unit/test_natural_language_classifier_v1.rb +17 -17
- data/test/unit/test_natural_language_understanding_v1.rb +10 -10
- data/test/unit/test_personality_insights_v3.rb +14 -14
- data/test/unit/test_speech_to_text_v1.rb +97 -97
- data/test/unit/test_text_to_speech_v1.rb +48 -48
- data/test/unit/test_tone_analyzer_v3.rb +12 -12
- data/test/unit/test_visual_recognition_v3.rb +16 -16
- data/test/unit/test_visual_recognition_v4.rb +56 -38
- metadata +5 -5
@@ -13,12 +13,14 @@
|
|
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
|
-
# IBM
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
16
|
+
#
|
17
|
+
# IBM OpenAPI SDK Code Generator Version: 3.17.0-8d569e8f-20201030-142059
|
18
|
+
#
|
19
|
+
# IBM Watson™ Discovery is a cognitive search and content analytics engine that
|
20
|
+
# you can add to applications to identify patterns, trends and actionable insights to
|
21
|
+
# drive better decision-making. Securely unify structured and unstructured data with
|
22
|
+
# pre-enriched content, and use a simplified query language to eliminate the need for
|
23
|
+
# manual filtering of results.
|
22
24
|
|
23
25
|
require "concurrent"
|
24
26
|
require "erb"
|
@@ -32,37 +34,36 @@ module IBMWatson
|
|
32
34
|
# The Discovery V2 service.
|
33
35
|
class DiscoveryV2 < IBMCloudSdkCore::BaseService
|
34
36
|
include Concurrent::Async
|
37
|
+
DEFAULT_SERVICE_NAME = "discovery"
|
38
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.discovery.watson.cloud.ibm.com"
|
39
|
+
attr_accessor :version
|
35
40
|
##
|
36
41
|
# @!method initialize(args)
|
37
42
|
# Construct a new client for the Discovery service.
|
38
43
|
#
|
39
44
|
# @param args [Hash] The args to initialize with
|
40
|
-
# @option args version [String]
|
41
|
-
#
|
42
|
-
# incompatible way, a new minor version of the API is released.
|
43
|
-
# The service uses the API version for the date you specify, or
|
44
|
-
# the most recent version before that date. Note that you should
|
45
|
-
# not programmatically specify the current date at runtime, in
|
46
|
-
# case the API has been updated since your application's release.
|
47
|
-
# Instead, specify a version date that is compatible with your
|
48
|
-
# application, and don't change it until your application is
|
49
|
-
# ready for a later version.
|
45
|
+
# @option args version [String] Release date of the version of the API you want to use. Specify dates in
|
46
|
+
# YYYY-MM-DD format. The current version is `2019-11-22`.
|
50
47
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
51
48
|
# The base service_url may differ between IBM Cloud regions.
|
52
49
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
50
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
51
|
+
# any external configuration, if applicable.
|
53
52
|
def initialize(args = {})
|
54
53
|
@__async_initialized__ = false
|
55
54
|
defaults = {}
|
56
|
-
defaults[:
|
57
|
-
defaults[:
|
55
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
56
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
58
57
|
defaults[:authenticator] = nil
|
58
|
+
defaults[:version] = nil
|
59
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
59
60
|
args = defaults.merge(args)
|
60
61
|
@version = args[:version]
|
61
62
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
62
63
|
|
63
|
-
args[:service_name] = "discovery"
|
64
64
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
65
65
|
super
|
66
|
+
@service_url = user_service_url unless user_service_url.nil?
|
66
67
|
end
|
67
68
|
|
68
69
|
#########################
|
@@ -79,6 +80,8 @@ module IBMWatson
|
|
79
80
|
def list_collections(project_id:)
|
80
81
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
81
82
|
|
83
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
84
|
+
|
82
85
|
headers = {
|
83
86
|
}
|
84
87
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "list_collections")
|
@@ -99,6 +102,172 @@ module IBMWatson
|
|
99
102
|
)
|
100
103
|
response
|
101
104
|
end
|
105
|
+
|
106
|
+
##
|
107
|
+
# @!method create_collection(project_id:, name:, description: nil, language: nil, enrichments: nil)
|
108
|
+
# Create a collection.
|
109
|
+
# Create a new collection in the specified project.
|
110
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
111
|
+
# Discovery administrative tooling.
|
112
|
+
# @param name [String] The name of the collection.
|
113
|
+
# @param description [String] A description of the collection.
|
114
|
+
# @param language [String] The language of the collection.
|
115
|
+
# @param enrichments [Array[CollectionEnrichment]] An array of enrichments that are applied to this collection.
|
116
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
117
|
+
def create_collection(project_id:, name:, description: nil, language: nil, enrichments: nil)
|
118
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
119
|
+
|
120
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
121
|
+
|
122
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
123
|
+
|
124
|
+
headers = {
|
125
|
+
}
|
126
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "create_collection")
|
127
|
+
headers.merge!(sdk_headers)
|
128
|
+
|
129
|
+
params = {
|
130
|
+
"version" => @version
|
131
|
+
}
|
132
|
+
|
133
|
+
data = {
|
134
|
+
"name" => name,
|
135
|
+
"description" => description,
|
136
|
+
"language" => language,
|
137
|
+
"enrichments" => enrichments
|
138
|
+
}
|
139
|
+
|
140
|
+
method_url = "/v2/projects/%s/collections" % [ERB::Util.url_encode(project_id)]
|
141
|
+
|
142
|
+
response = request(
|
143
|
+
method: "POST",
|
144
|
+
url: method_url,
|
145
|
+
headers: headers,
|
146
|
+
params: params,
|
147
|
+
json: data,
|
148
|
+
accept_json: true
|
149
|
+
)
|
150
|
+
response
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# @!method get_collection(project_id:, collection_id:)
|
155
|
+
# Get collection.
|
156
|
+
# Get details about the specified collection.
|
157
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
158
|
+
# Discovery administrative tooling.
|
159
|
+
# @param collection_id [String] The ID of the collection.
|
160
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
161
|
+
def get_collection(project_id:, collection_id:)
|
162
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
163
|
+
|
164
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
165
|
+
|
166
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
167
|
+
|
168
|
+
headers = {
|
169
|
+
}
|
170
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "get_collection")
|
171
|
+
headers.merge!(sdk_headers)
|
172
|
+
|
173
|
+
params = {
|
174
|
+
"version" => @version
|
175
|
+
}
|
176
|
+
|
177
|
+
method_url = "/v2/projects/%s/collections/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(collection_id)]
|
178
|
+
|
179
|
+
response = request(
|
180
|
+
method: "GET",
|
181
|
+
url: method_url,
|
182
|
+
headers: headers,
|
183
|
+
params: params,
|
184
|
+
accept_json: true
|
185
|
+
)
|
186
|
+
response
|
187
|
+
end
|
188
|
+
|
189
|
+
##
|
190
|
+
# @!method update_collection(project_id:, collection_id:, name: nil, description: nil, enrichments: nil)
|
191
|
+
# Update a collection.
|
192
|
+
# Updates the specified collection's name, description, and enrichments.
|
193
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
194
|
+
# Discovery administrative tooling.
|
195
|
+
# @param collection_id [String] The ID of the collection.
|
196
|
+
# @param name [String] The name of the collection.
|
197
|
+
# @param description [String] A description of the collection.
|
198
|
+
# @param enrichments [Array[CollectionEnrichment]] An array of enrichments that are applied to this collection.
|
199
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
200
|
+
def update_collection(project_id:, collection_id:, name: nil, description: nil, enrichments: nil)
|
201
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
202
|
+
|
203
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
204
|
+
|
205
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
206
|
+
|
207
|
+
headers = {
|
208
|
+
}
|
209
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "update_collection")
|
210
|
+
headers.merge!(sdk_headers)
|
211
|
+
|
212
|
+
params = {
|
213
|
+
"version" => @version
|
214
|
+
}
|
215
|
+
|
216
|
+
data = {
|
217
|
+
"name" => name,
|
218
|
+
"description" => description,
|
219
|
+
"enrichments" => enrichments
|
220
|
+
}
|
221
|
+
|
222
|
+
method_url = "/v2/projects/%s/collections/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(collection_id)]
|
223
|
+
|
224
|
+
response = request(
|
225
|
+
method: "POST",
|
226
|
+
url: method_url,
|
227
|
+
headers: headers,
|
228
|
+
params: params,
|
229
|
+
json: data,
|
230
|
+
accept_json: true
|
231
|
+
)
|
232
|
+
response
|
233
|
+
end
|
234
|
+
|
235
|
+
##
|
236
|
+
# @!method delete_collection(project_id:, collection_id:)
|
237
|
+
# Delete a collection.
|
238
|
+
# Deletes the specified collection from the project. All documents stored in the
|
239
|
+
# specified collection and not shared is also deleted.
|
240
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
241
|
+
# Discovery administrative tooling.
|
242
|
+
# @param collection_id [String] The ID of the collection.
|
243
|
+
# @return [nil]
|
244
|
+
def delete_collection(project_id:, collection_id:)
|
245
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
246
|
+
|
247
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
248
|
+
|
249
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
250
|
+
|
251
|
+
headers = {
|
252
|
+
}
|
253
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "delete_collection")
|
254
|
+
headers.merge!(sdk_headers)
|
255
|
+
|
256
|
+
params = {
|
257
|
+
"version" => @version
|
258
|
+
}
|
259
|
+
|
260
|
+
method_url = "/v2/projects/%s/collections/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(collection_id)]
|
261
|
+
|
262
|
+
request(
|
263
|
+
method: "DELETE",
|
264
|
+
url: method_url,
|
265
|
+
headers: headers,
|
266
|
+
params: params,
|
267
|
+
accept_json: false
|
268
|
+
)
|
269
|
+
nil
|
270
|
+
end
|
102
271
|
#########################
|
103
272
|
# Queries
|
104
273
|
#########################
|
@@ -107,7 +276,13 @@ module IBMWatson
|
|
107
276
|
# @!method query(project_id:, collection_ids: nil, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, spelling_suggestions: nil, table_results: nil, suggested_refinements: nil, passages: nil)
|
108
277
|
# Query a project.
|
109
278
|
# By using this method, you can construct queries. For details, see the [Discovery
|
110
|
-
# documentation](https://cloud.ibm.com/docs/
|
279
|
+
# documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts).
|
280
|
+
# The default query parameters are defined by the settings for this project, see the
|
281
|
+
# [Discovery
|
282
|
+
# documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults)
|
283
|
+
# for an overview of the standard default settings, and see [the Projects API
|
284
|
+
# documentation](#create-project) for details about how to set custom default query
|
285
|
+
# settings.
|
111
286
|
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
112
287
|
# Discovery administrative tooling.
|
113
288
|
# @param collection_ids [Array[String]] A comma-separated list of collection IDs to be queried against.
|
@@ -145,6 +320,8 @@ module IBMWatson
|
|
145
320
|
def query(project_id:, collection_ids: nil, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, spelling_suggestions: nil, table_results: nil, suggested_refinements: nil, passages: nil)
|
146
321
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
147
322
|
|
323
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
324
|
+
|
148
325
|
headers = {
|
149
326
|
}
|
150
327
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "query")
|
@@ -201,6 +378,8 @@ module IBMWatson
|
|
201
378
|
def get_autocompletion(project_id:, prefix:, collection_ids: nil, field: nil, count: nil)
|
202
379
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
203
380
|
|
381
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
382
|
+
|
204
383
|
raise ArgumentError.new("prefix must be provided") if prefix.nil?
|
205
384
|
|
206
385
|
headers = {
|
@@ -252,6 +431,8 @@ module IBMWatson
|
|
252
431
|
# one query is **10000**.
|
253
432
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
254
433
|
def query_notices(project_id:, filter: nil, query: nil, natural_language_query: nil, count: nil, offset: nil)
|
434
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
435
|
+
|
255
436
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
256
437
|
|
257
438
|
headers = {
|
@@ -291,6 +472,8 @@ module IBMWatson
|
|
291
472
|
# all collections in the project are used.
|
292
473
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
293
474
|
def list_fields(project_id:, collection_ids: nil)
|
475
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
476
|
+
|
294
477
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
295
478
|
|
296
479
|
headers = {
|
@@ -321,7 +504,7 @@ module IBMWatson
|
|
321
504
|
|
322
505
|
##
|
323
506
|
# @!method get_component_settings(project_id:)
|
324
|
-
#
|
507
|
+
# List component settings.
|
325
508
|
# Returns default configuration settings for components.
|
326
509
|
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
327
510
|
# Discovery administrative tooling.
|
@@ -329,6 +512,8 @@ module IBMWatson
|
|
329
512
|
def get_component_settings(project_id:)
|
330
513
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
331
514
|
|
515
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
516
|
+
|
332
517
|
headers = {
|
333
518
|
}
|
334
519
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "get_component_settings")
|
@@ -399,7 +584,10 @@ module IBMWatson
|
|
399
584
|
# @param filename [String] The filename for file.
|
400
585
|
# @param file_content_type [String] The content type of file.
|
401
586
|
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
402
|
-
# are rejected.
|
587
|
+
# are rejected.
|
588
|
+
#
|
589
|
+
#
|
590
|
+
# Example: ``` {
|
403
591
|
# "Creator": "Johnny Appleseed",
|
404
592
|
# "Subject": "Apples"
|
405
593
|
# } ```.
|
@@ -407,6 +595,8 @@ module IBMWatson
|
|
407
595
|
# that collection is shared with other collections.
|
408
596
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
409
597
|
def add_document(project_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil, x_watson_discovery_force: nil)
|
598
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
599
|
+
|
410
600
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
411
601
|
|
412
602
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -461,6 +651,9 @@ module IBMWatson
|
|
461
651
|
# **Note:** This operation only works on collections created to accept direct file
|
462
652
|
# uploads. It cannot be used to modify a collection that connects to an external
|
463
653
|
# source such as Microsoft SharePoint.
|
654
|
+
#
|
655
|
+
# **Note:** If an uploaded document is segmented, all segments will be overwritten,
|
656
|
+
# even if the updated version of the document has fewer segments.
|
464
657
|
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
465
658
|
# Discovery administrative tooling.
|
466
659
|
# @param collection_id [String] The ID of the collection.
|
@@ -472,7 +665,10 @@ module IBMWatson
|
|
472
665
|
# @param filename [String] The filename for file.
|
473
666
|
# @param file_content_type [String] The content type of file.
|
474
667
|
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
475
|
-
# are rejected.
|
668
|
+
# are rejected.
|
669
|
+
#
|
670
|
+
#
|
671
|
+
# Example: ``` {
|
476
672
|
# "Creator": "Johnny Appleseed",
|
477
673
|
# "Subject": "Apples"
|
478
674
|
# } ```.
|
@@ -480,6 +676,8 @@ module IBMWatson
|
|
480
676
|
# that collection is shared with other collections.
|
481
677
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
482
678
|
def update_document(project_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil, x_watson_discovery_force: nil)
|
679
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
680
|
+
|
483
681
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
484
682
|
|
485
683
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -531,6 +729,9 @@ module IBMWatson
|
|
531
729
|
# **Note:** This operation only works on collections created to accept direct file
|
532
730
|
# uploads. It cannot be used to modify a collection that connects to an external
|
533
731
|
# source such as Microsoft SharePoint.
|
732
|
+
#
|
733
|
+
# **Note:** Segments of an uploaded document cannot be deleted individually. Delete
|
734
|
+
# all segments by deleting using the `parent_document_id` of a segment result.
|
534
735
|
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
535
736
|
# Discovery administrative tooling.
|
536
737
|
# @param collection_id [String] The ID of the collection.
|
@@ -539,6 +740,8 @@ module IBMWatson
|
|
539
740
|
# that collection is shared with other collections.
|
540
741
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
541
742
|
def delete_document(project_id:, collection_id:, document_id:, x_watson_discovery_force: nil)
|
743
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
744
|
+
|
542
745
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
543
746
|
|
544
747
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -578,6 +781,8 @@ module IBMWatson
|
|
578
781
|
# Discovery administrative tooling.
|
579
782
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
580
783
|
def list_training_queries(project_id:)
|
784
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
785
|
+
|
581
786
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
582
787
|
|
583
788
|
headers = {
|
@@ -609,6 +814,8 @@ module IBMWatson
|
|
609
814
|
# Discovery administrative tooling.
|
610
815
|
# @return [nil]
|
611
816
|
def delete_training_queries(project_id:)
|
817
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
818
|
+
|
612
819
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
613
820
|
|
614
821
|
headers = {
|
@@ -645,6 +852,8 @@ module IBMWatson
|
|
645
852
|
# applied.
|
646
853
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
647
854
|
def create_training_query(project_id:, natural_language_query:, examples:, filter: nil)
|
855
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
856
|
+
|
648
857
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
649
858
|
|
650
859
|
raise ArgumentError.new("natural_language_query must be provided") if natural_language_query.nil?
|
@@ -689,6 +898,8 @@ module IBMWatson
|
|
689
898
|
# @param query_id [String] The ID of the query used for training.
|
690
899
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
691
900
|
def get_training_query(project_id:, query_id:)
|
901
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
902
|
+
|
692
903
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
693
904
|
|
694
905
|
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
@@ -727,6 +938,8 @@ module IBMWatson
|
|
727
938
|
# applied.
|
728
939
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
729
940
|
def update_training_query(project_id:, query_id:, natural_language_query:, examples:, filter: nil)
|
941
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
942
|
+
|
730
943
|
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
731
944
|
|
732
945
|
raise ArgumentError.new("query_id must be provided") if query_id.nil?
|
@@ -762,5 +975,511 @@ module IBMWatson
|
|
762
975
|
)
|
763
976
|
response
|
764
977
|
end
|
978
|
+
#########################
|
979
|
+
# analyze
|
980
|
+
#########################
|
981
|
+
|
982
|
+
##
|
983
|
+
# @!method analyze_document(project_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
|
984
|
+
# Analyze a Document.
|
985
|
+
# Process a document using the specified collection's settings and return it for
|
986
|
+
# realtime use.
|
987
|
+
#
|
988
|
+
# **Note:** Documents processed using this method are not added to the specified
|
989
|
+
# collection.
|
990
|
+
#
|
991
|
+
# **Note:** This method is only supported on IBM Cloud Pak for Data instances of
|
992
|
+
# Discovery.
|
993
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
994
|
+
# Discovery administrative tooling.
|
995
|
+
# @param collection_id [String] The ID of the collection.
|
996
|
+
# @param file [File] The content of the document to ingest. The maximum supported file size when adding
|
997
|
+
# a file to a collection is 50 megabytes, the maximum supported file size when
|
998
|
+
# testing a configuration is 1 megabyte. Files larger than the supported size are
|
999
|
+
# rejected.
|
1000
|
+
# @param filename [String] The filename for file.
|
1001
|
+
# @param file_content_type [String] The content type of file.
|
1002
|
+
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
1003
|
+
# are rejected.
|
1004
|
+
#
|
1005
|
+
#
|
1006
|
+
# Example: ``` {
|
1007
|
+
# "Creator": "Johnny Appleseed",
|
1008
|
+
# "Subject": "Apples"
|
1009
|
+
# } ```.
|
1010
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1011
|
+
def analyze_document(project_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
|
1012
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1013
|
+
|
1014
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1015
|
+
|
1016
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1017
|
+
|
1018
|
+
headers = {
|
1019
|
+
}
|
1020
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "analyze_document")
|
1021
|
+
headers.merge!(sdk_headers)
|
1022
|
+
|
1023
|
+
params = {
|
1024
|
+
"version" => @version
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
form_data = {}
|
1028
|
+
|
1029
|
+
unless file.nil?
|
1030
|
+
unless file.instance_of?(StringIO) || file.instance_of?(File)
|
1031
|
+
file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
|
1032
|
+
end
|
1033
|
+
filename = file.path if filename.nil? && file.respond_to?(:path)
|
1034
|
+
form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
|
1035
|
+
end
|
1036
|
+
|
1037
|
+
form_data[:metadata] = HTTP::FormData::Part.new(metadata.to_s, content_type: "text/plain") unless metadata.nil?
|
1038
|
+
|
1039
|
+
method_url = "/v2/projects/%s/collections/%s/analyze" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(collection_id)]
|
1040
|
+
|
1041
|
+
response = request(
|
1042
|
+
method: "POST",
|
1043
|
+
url: method_url,
|
1044
|
+
headers: headers,
|
1045
|
+
params: params,
|
1046
|
+
form: form_data,
|
1047
|
+
accept_json: true
|
1048
|
+
)
|
1049
|
+
response
|
1050
|
+
end
|
1051
|
+
#########################
|
1052
|
+
# enrichments
|
1053
|
+
#########################
|
1054
|
+
|
1055
|
+
##
|
1056
|
+
# @!method list_enrichments(project_id:)
|
1057
|
+
# List Enrichments.
|
1058
|
+
# List the enrichments available to this project.
|
1059
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1060
|
+
# Discovery administrative tooling.
|
1061
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1062
|
+
def list_enrichments(project_id:)
|
1063
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1064
|
+
|
1065
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1066
|
+
|
1067
|
+
headers = {
|
1068
|
+
}
|
1069
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "list_enrichments")
|
1070
|
+
headers.merge!(sdk_headers)
|
1071
|
+
|
1072
|
+
params = {
|
1073
|
+
"version" => @version
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
method_url = "/v2/projects/%s/enrichments" % [ERB::Util.url_encode(project_id)]
|
1077
|
+
|
1078
|
+
response = request(
|
1079
|
+
method: "GET",
|
1080
|
+
url: method_url,
|
1081
|
+
headers: headers,
|
1082
|
+
params: params,
|
1083
|
+
accept_json: true
|
1084
|
+
)
|
1085
|
+
response
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
##
|
1089
|
+
# @!method create_enrichment(project_id:, enrichment:, file: nil)
|
1090
|
+
# Create an enrichment.
|
1091
|
+
# Create an enrichment for use with the specified project/.
|
1092
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1093
|
+
# Discovery administrative tooling.
|
1094
|
+
# @param enrichment [CreateEnrichment]
|
1095
|
+
# @param file [File] The enrichment file to upload.
|
1096
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1097
|
+
def create_enrichment(project_id:, enrichment:, file: nil)
|
1098
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1099
|
+
|
1100
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1101
|
+
|
1102
|
+
raise ArgumentError.new("enrichment must be provided") if enrichment.nil?
|
1103
|
+
|
1104
|
+
headers = {
|
1105
|
+
}
|
1106
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "create_enrichment")
|
1107
|
+
headers.merge!(sdk_headers)
|
1108
|
+
|
1109
|
+
params = {
|
1110
|
+
"version" => @version
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
form_data = {}
|
1114
|
+
|
1115
|
+
form_data[:enrichment] = HTTP::FormData::Part.new(enrichment.to_s, content_type: "application/json")
|
1116
|
+
|
1117
|
+
unless file.nil?
|
1118
|
+
unless file.instance_of?(StringIO) || file.instance_of?(File)
|
1119
|
+
file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
|
1120
|
+
end
|
1121
|
+
form_data[:file] = HTTP::FormData::File.new(file, content_type: "application/octet-stream", filename: file.respond_to?(:path) ? file.path : nil)
|
1122
|
+
end
|
1123
|
+
|
1124
|
+
method_url = "/v2/projects/%s/enrichments" % [ERB::Util.url_encode(project_id)]
|
1125
|
+
|
1126
|
+
response = request(
|
1127
|
+
method: "POST",
|
1128
|
+
url: method_url,
|
1129
|
+
headers: headers,
|
1130
|
+
params: params,
|
1131
|
+
form: form_data,
|
1132
|
+
accept_json: true
|
1133
|
+
)
|
1134
|
+
response
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
##
|
1138
|
+
# @!method get_enrichment(project_id:, enrichment_id:)
|
1139
|
+
# Get enrichment.
|
1140
|
+
# Get details about a specific enrichment.
|
1141
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1142
|
+
# Discovery administrative tooling.
|
1143
|
+
# @param enrichment_id [String] The ID of the enrichment.
|
1144
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1145
|
+
def get_enrichment(project_id:, enrichment_id:)
|
1146
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1147
|
+
|
1148
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1149
|
+
|
1150
|
+
raise ArgumentError.new("enrichment_id must be provided") if enrichment_id.nil?
|
1151
|
+
|
1152
|
+
headers = {
|
1153
|
+
}
|
1154
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "get_enrichment")
|
1155
|
+
headers.merge!(sdk_headers)
|
1156
|
+
|
1157
|
+
params = {
|
1158
|
+
"version" => @version
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
method_url = "/v2/projects/%s/enrichments/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(enrichment_id)]
|
1162
|
+
|
1163
|
+
response = request(
|
1164
|
+
method: "GET",
|
1165
|
+
url: method_url,
|
1166
|
+
headers: headers,
|
1167
|
+
params: params,
|
1168
|
+
accept_json: true
|
1169
|
+
)
|
1170
|
+
response
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
##
|
1174
|
+
# @!method update_enrichment(project_id:, enrichment_id:, name:, description: nil)
|
1175
|
+
# Update an enrichment.
|
1176
|
+
# Updates an existing enrichment's name and description.
|
1177
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1178
|
+
# Discovery administrative tooling.
|
1179
|
+
# @param enrichment_id [String] The ID of the enrichment.
|
1180
|
+
# @param name [String] A new name for the enrichment.
|
1181
|
+
# @param description [String] A new description for the enrichment.
|
1182
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1183
|
+
def update_enrichment(project_id:, enrichment_id:, name:, description: nil)
|
1184
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1185
|
+
|
1186
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1187
|
+
|
1188
|
+
raise ArgumentError.new("enrichment_id must be provided") if enrichment_id.nil?
|
1189
|
+
|
1190
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
1191
|
+
|
1192
|
+
headers = {
|
1193
|
+
}
|
1194
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "update_enrichment")
|
1195
|
+
headers.merge!(sdk_headers)
|
1196
|
+
|
1197
|
+
params = {
|
1198
|
+
"version" => @version
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
data = {
|
1202
|
+
"name" => name,
|
1203
|
+
"description" => description
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
method_url = "/v2/projects/%s/enrichments/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(enrichment_id)]
|
1207
|
+
|
1208
|
+
response = request(
|
1209
|
+
method: "POST",
|
1210
|
+
url: method_url,
|
1211
|
+
headers: headers,
|
1212
|
+
params: params,
|
1213
|
+
json: data,
|
1214
|
+
accept_json: true
|
1215
|
+
)
|
1216
|
+
response
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
##
|
1220
|
+
# @!method delete_enrichment(project_id:, enrichment_id:)
|
1221
|
+
# Delete an enrichment.
|
1222
|
+
# Deletes an existing enrichment from the specified project.
|
1223
|
+
#
|
1224
|
+
# **Note:** Only enrichments that have been manually created can be deleted.
|
1225
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1226
|
+
# Discovery administrative tooling.
|
1227
|
+
# @param enrichment_id [String] The ID of the enrichment.
|
1228
|
+
# @return [nil]
|
1229
|
+
def delete_enrichment(project_id:, enrichment_id:)
|
1230
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1231
|
+
|
1232
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1233
|
+
|
1234
|
+
raise ArgumentError.new("enrichment_id must be provided") if enrichment_id.nil?
|
1235
|
+
|
1236
|
+
headers = {
|
1237
|
+
}
|
1238
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "delete_enrichment")
|
1239
|
+
headers.merge!(sdk_headers)
|
1240
|
+
|
1241
|
+
params = {
|
1242
|
+
"version" => @version
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
method_url = "/v2/projects/%s/enrichments/%s" % [ERB::Util.url_encode(project_id), ERB::Util.url_encode(enrichment_id)]
|
1246
|
+
|
1247
|
+
request(
|
1248
|
+
method: "DELETE",
|
1249
|
+
url: method_url,
|
1250
|
+
headers: headers,
|
1251
|
+
params: params,
|
1252
|
+
accept_json: false
|
1253
|
+
)
|
1254
|
+
nil
|
1255
|
+
end
|
1256
|
+
#########################
|
1257
|
+
# projects
|
1258
|
+
#########################
|
1259
|
+
|
1260
|
+
##
|
1261
|
+
# @!method list_projects
|
1262
|
+
# List projects.
|
1263
|
+
# Lists existing projects for this instance.
|
1264
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1265
|
+
def list_projects
|
1266
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1267
|
+
|
1268
|
+
headers = {
|
1269
|
+
}
|
1270
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "list_projects")
|
1271
|
+
headers.merge!(sdk_headers)
|
1272
|
+
|
1273
|
+
params = {
|
1274
|
+
"version" => @version
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
method_url = "/v2/projects"
|
1278
|
+
|
1279
|
+
response = request(
|
1280
|
+
method: "GET",
|
1281
|
+
url: method_url,
|
1282
|
+
headers: headers,
|
1283
|
+
params: params,
|
1284
|
+
accept_json: true
|
1285
|
+
)
|
1286
|
+
response
|
1287
|
+
end
|
1288
|
+
|
1289
|
+
##
|
1290
|
+
# @!method create_project(name:, type:, default_query_parameters: nil)
|
1291
|
+
# Create a Project.
|
1292
|
+
# Create a new project for this instance.
|
1293
|
+
# @param name [String] The human readable name of this project.
|
1294
|
+
# @param type [String] The project type of this project.
|
1295
|
+
# @param default_query_parameters [DefaultQueryParams] Default query parameters for this project.
|
1296
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1297
|
+
def create_project(name:, type:, default_query_parameters: nil)
|
1298
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1299
|
+
|
1300
|
+
raise ArgumentError.new("name must be provided") if name.nil?
|
1301
|
+
|
1302
|
+
raise ArgumentError.new("type must be provided") if type.nil?
|
1303
|
+
|
1304
|
+
headers = {
|
1305
|
+
}
|
1306
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "create_project")
|
1307
|
+
headers.merge!(sdk_headers)
|
1308
|
+
|
1309
|
+
params = {
|
1310
|
+
"version" => @version
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
data = {
|
1314
|
+
"name" => name,
|
1315
|
+
"type" => type,
|
1316
|
+
"default_query_parameters" => default_query_parameters
|
1317
|
+
}
|
1318
|
+
|
1319
|
+
method_url = "/v2/projects"
|
1320
|
+
|
1321
|
+
response = request(
|
1322
|
+
method: "POST",
|
1323
|
+
url: method_url,
|
1324
|
+
headers: headers,
|
1325
|
+
params: params,
|
1326
|
+
json: data,
|
1327
|
+
accept_json: true
|
1328
|
+
)
|
1329
|
+
response
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
##
|
1333
|
+
# @!method get_project(project_id:)
|
1334
|
+
# Get project.
|
1335
|
+
# Get details on the specified project.
|
1336
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1337
|
+
# Discovery administrative tooling.
|
1338
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1339
|
+
def get_project(project_id:)
|
1340
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1341
|
+
|
1342
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1343
|
+
|
1344
|
+
headers = {
|
1345
|
+
}
|
1346
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "get_project")
|
1347
|
+
headers.merge!(sdk_headers)
|
1348
|
+
|
1349
|
+
params = {
|
1350
|
+
"version" => @version
|
1351
|
+
}
|
1352
|
+
|
1353
|
+
method_url = "/v2/projects/%s" % [ERB::Util.url_encode(project_id)]
|
1354
|
+
|
1355
|
+
response = request(
|
1356
|
+
method: "GET",
|
1357
|
+
url: method_url,
|
1358
|
+
headers: headers,
|
1359
|
+
params: params,
|
1360
|
+
accept_json: true
|
1361
|
+
)
|
1362
|
+
response
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
##
|
1366
|
+
# @!method update_project(project_id:, name: nil)
|
1367
|
+
# Update a project.
|
1368
|
+
# Update the specified project's name.
|
1369
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1370
|
+
# Discovery administrative tooling.
|
1371
|
+
# @param name [String] The new name to give this project.
|
1372
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1373
|
+
def update_project(project_id:, name: nil)
|
1374
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1375
|
+
|
1376
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1377
|
+
|
1378
|
+
headers = {
|
1379
|
+
}
|
1380
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "update_project")
|
1381
|
+
headers.merge!(sdk_headers)
|
1382
|
+
|
1383
|
+
params = {
|
1384
|
+
"version" => @version
|
1385
|
+
}
|
1386
|
+
|
1387
|
+
data = {
|
1388
|
+
"name" => name
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
method_url = "/v2/projects/%s" % [ERB::Util.url_encode(project_id)]
|
1392
|
+
|
1393
|
+
response = request(
|
1394
|
+
method: "POST",
|
1395
|
+
url: method_url,
|
1396
|
+
headers: headers,
|
1397
|
+
params: params,
|
1398
|
+
json: data,
|
1399
|
+
accept_json: true
|
1400
|
+
)
|
1401
|
+
response
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
##
|
1405
|
+
# @!method delete_project(project_id:)
|
1406
|
+
# Delete a project.
|
1407
|
+
# Deletes the specified project.
|
1408
|
+
#
|
1409
|
+
# **Important:** Deleting a project deletes everything that is part of the specified
|
1410
|
+
# project, including all collections.
|
1411
|
+
# @param project_id [String] The ID of the project. This information can be found from the deploy page of the
|
1412
|
+
# Discovery administrative tooling.
|
1413
|
+
# @return [nil]
|
1414
|
+
def delete_project(project_id:)
|
1415
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1416
|
+
|
1417
|
+
raise ArgumentError.new("project_id must be provided") if project_id.nil?
|
1418
|
+
|
1419
|
+
headers = {
|
1420
|
+
}
|
1421
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "delete_project")
|
1422
|
+
headers.merge!(sdk_headers)
|
1423
|
+
|
1424
|
+
params = {
|
1425
|
+
"version" => @version
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
method_url = "/v2/projects/%s" % [ERB::Util.url_encode(project_id)]
|
1429
|
+
|
1430
|
+
request(
|
1431
|
+
method: "DELETE",
|
1432
|
+
url: method_url,
|
1433
|
+
headers: headers,
|
1434
|
+
params: params,
|
1435
|
+
accept_json: false
|
1436
|
+
)
|
1437
|
+
nil
|
1438
|
+
end
|
1439
|
+
#########################
|
1440
|
+
# userData
|
1441
|
+
#########################
|
1442
|
+
|
1443
|
+
##
|
1444
|
+
# @!method delete_user_data(customer_id:)
|
1445
|
+
# Delete labeled data.
|
1446
|
+
# Deletes all data associated with a specified customer ID. The method has no effect
|
1447
|
+
# if no data is associated with the customer ID.
|
1448
|
+
#
|
1449
|
+
# You associate a customer ID with data by passing the **X-Watson-Metadata** header
|
1450
|
+
# with a request that passes data. For more information about personal data and
|
1451
|
+
# customer IDs, see [Information
|
1452
|
+
# security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security).
|
1453
|
+
#
|
1454
|
+
#
|
1455
|
+
# **Note:** This method is only supported on IBM Cloud instances of Discovery.
|
1456
|
+
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
1457
|
+
# @return [nil]
|
1458
|
+
def delete_user_data(customer_id:)
|
1459
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
1460
|
+
|
1461
|
+
raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
|
1462
|
+
|
1463
|
+
headers = {
|
1464
|
+
}
|
1465
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V2", "delete_user_data")
|
1466
|
+
headers.merge!(sdk_headers)
|
1467
|
+
|
1468
|
+
params = {
|
1469
|
+
"version" => @version,
|
1470
|
+
"customer_id" => customer_id
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
method_url = "/v2/user_data"
|
1474
|
+
|
1475
|
+
request(
|
1476
|
+
method: "DELETE",
|
1477
|
+
url: method_url,
|
1478
|
+
headers: headers,
|
1479
|
+
params: params,
|
1480
|
+
accept_json: false
|
1481
|
+
)
|
1482
|
+
nil
|
1483
|
+
end
|
765
1484
|
end
|
766
1485
|
end
|