1 | # Upgrading to watson-developer-cloud@4.0
|
2 | - [Breaking changes]
|
3 | - [Methods no longer return stream]
|
4 | - [Error Handling Compatibility]
|
5 | - [Default Methods Compatibility]
|
6 | - [Removed Services]
|
7 | - [Constructor Compatibility]
|
8 | - [Assistant V1 Compatibility]
|
9 | - [Assistant V2 Compatibility]
|
10 | - [Discovery Compatibility]
|
11 | - [Compare Comply Compatibility]
|
12 | - [Natural Language Classifier Compatibility]
|
13 | - [Personality Insights v3 Compatibility]
|
14 | - [Speech to Text Compatibility]
|
15 | - [Text to Speech Compatibility]
|
16 | - [Tone Analyzer Compatibility]
|
17 | - [Visual Recognition Compatibility]
|
18 |
|
19 |
|
20 | ## Breaking changes
|
21 | ### Methods no longer return stream
|
22 | Previously, if a callback was not provided, each service method would return a pipeable stream. Now, this will no longer happen. A Promise is returned instead. This should not affect many users, as authenticating with IAM already prevented methods from returning streams.
|
23 |
|
24 | ### Response Handling Compatibility
|
25 | The entire response is received with the third callback (if using callbacks) or when using Promises with `return_response: true` set as a parameter. This response now has a different structure for consistency with the other Watson SDKs.
|
26 |
|
27 | The object returned has the following properties:
|
28 | - `data`: The body of the response
|
29 | - `headers`: The HTTP response headers
|
30 | - `status`: The HTTP status code
|
31 | - `statusText`: The HTTP status message
|
32 | - `request`: The actual request instance sent to the service
|
33 | - `config`: The parameters used to build the request
|
34 |
|
35 |
|
36 | ### Error Handling Compatibility
|
37 | The logic that formats errors returned from a service has been changed. That means that the Error object returned now has a different structure. If there is logic in your code that parses the error returned from service methods, this will need to change. The new structure is outlined below.
|
38 |
|
39 | The object returned is of class `Error` and has the following properties:
|
40 | - `name`: Short title describing the error. Ex) 'Not Found'
|
41 | - `code`: HTTP status code. Ex) 404
|
42 | - `message`: More descriptive error message. Ex) Model not found.
|
43 | - `body`: Full error object returned by the service, stringified. If the object cannot be stringified due to a circular reference, it will be left as an object
|
44 | - `headers`: Object containing response headers returned from the service, including the transaction id
|
45 |
|
46 | If a request is made but no response is received (very rare), `error.body` will be an instance of [HTTP.ClientRequest](https://nodejs.org/api/http.html#http_class_http_clientrequest).
|
47 |
|
48 | ### Default Methods Compatibility
|
49 | - The method `getCredentials`, which formerly returned an object containing all user credentials (username, password, etc.), has been renamed to `getServiceCredentials`
|
50 |
|
51 | ### Removed Services
|
52 | The following services have been deprecated for an extended period of time and will no longer be supported in the SDK:
|
53 | - Dialog
|
54 | - Language Translator v2
|
55 | - Conversation v1
|
56 |
|
57 |
|
58 | ### Constructor Compatibility
|
59 | - Parameter name changed: `version_date` -> `version`
|
60 | - The parameter `apikey` is no longer supported
|
61 |
|
62 | ### Assistant V1 Compatibility
|
63 | - Parameter name changed: `export` -> `_export` (_All instances_)
|
64 |
|
65 | #### updateValue
|
66 | - Parameter name changed: `new_type` -> `new_value_type`
|
67 |
|
68 | #### updateDialogNode
|
69 | - Parameter name changed: `new_type` -> `new_node_type`
|
70 |
|
71 | ### Assistant V2 Compatibility
|
72 | - Interface `MessageContextSkill` removed
|
73 |
|
74 | ### Compare Comply Compatibility
|
75 | #### convertToHtml
|
76 | - Parameter name changed: `model_id` -> `model`
|
77 |
|
78 | #### classifyElements
|
79 | - Parameter name changed: `model_id` -> `model`
|
80 |
|
81 | #### extractTables
|
82 | - Parameter name changed: `model_id` -> `model`
|
83 |
|
84 | #### compareDocuments
|
85 | - Parameter name changed: `model_id` -> `model`
|
86 |
|
87 | #### deleteFeedback
|
88 | - Parameter name changed: `model_id` -> `model`
|
89 |
|
90 | #### getFeedback
|
91 | - Parameter name changed: `model_id` -> `model`
|
92 |
|
93 | #### createBatch
|
94 | - Parameter name changed: `model_id` -> `model`
|
95 |
|
96 | #### updateBatch
|
97 | - Parameter name changed: `model_id` -> `model`
|
98 |
|
99 | ### Discovery Compatibility
|
100 | #### getSourceCredentials
|
101 | - Method name changed: `getSourceCredentials` -> `getCredentials`
|
102 |
|
103 | #### createStopwordList
|
104 | - Parameter `stopword_filename` is now **required**
|
105 |
|
106 | #### getEnvironments
|
107 | - Method name changed: `getEnvironments` -> `listEnvironments`
|
108 |
|
109 | #### getCollections
|
110 | - Method name changed: `getCollections` -> `listCollections`
|
111 |
|
112 | #### getConfigurations
|
113 | - Method name changed: `getConfigurations` -> `listConfigurations`
|
114 |
|
115 | #### getCollectionFields
|
116 | - Method name changed: `getCollectionFields` -> `listFields`
|
117 | - Parameter name changed: `collection_id` -> `collection_ids` (`collection_ids` is an Array)
|
118 |
|
119 | #### addJsonDocument
|
120 | - Method name changed: `addJsonDocument` -> `addDocument`
|
121 |
|
122 | #### updateJsonDocument
|
123 | - Method name changed: `updateJsonDocument` -> `updateDocument`
|
124 |
|
125 | #### createEnvironment
|
126 | - Parameter `size` will no longer be set to `1` if not given
|
127 |
|
128 | #### createConfiguration
|
129 | - Parameter `name` is now **required**
|
130 | - Parameter `file` is now split into `conversions`, `enrichments` and `normalizations`
|
131 |
|
132 | #### updateConfiguration
|
133 | - Parameter `name` is now **required**
|
134 | - Parameter `file` is now split into `conversions`, `enrichments` and `normalizations`
|
135 |
|
136 | #### createCollection
|
137 | - Parameter name changed: `language_code` -> `language`
|
138 | - Parameter `language` will no longer be set to `'en_us'` if not given
|
139 |
|
140 | #### updateCollection
|
141 | - Parameter name changed: `collection_name` -> `name`
|
142 |
|
143 | #### query
|
144 | - Parameter name changed: `return` -> `return_fields`
|
145 | - `query` and `natural_language_query` can't both be populated - this is no longer corrected internally
|
146 | - Parameter name changed: `passages.fields` -> `passages_fields`
|
147 | - Parameter name changed: `passages.count` -> `passages_count`
|
148 | - Parameter name changed: `passages.characters` -> `passages_characters`
|
149 | - Parameter type changed from Array to String: `return_fields`, `sort`, `passages_fields`, `collection_ids`, `similar_document_ids`, `similar_fields`
|
150 |
|
151 | #### federatedQuery
|
152 | - Parameter type changed from Array to String: `return_fields`, `sort`, `passages_fields`, `collection_ids`, `similar_document_ids`, `similar_fields`
|
153 |
|
154 | #### model QueryResultResultMetadata
|
155 | - Model name changed: `QueryResultResultMetadata` -> `QueryResultMetadata`
|
156 |
|
157 | ### Natural Language Classifier Compatibility
|
158 | #### create
|
159 | - Method name changed: `create` -> `createClassifier`
|
160 | - Parameter `training_data` is now **required** to be CSV format
|
161 | - Parameter `metadata` no longer constructed internally
|
162 |
|
163 | #### classify
|
164 | - Parameter name changed: `classifier` -> `classifier_id`
|
165 |
|
166 | #### status
|
167 | - Method name changed: `status` -> `getClassifier`
|
168 | - Parameter name changed: `classifier` -> `classifier_id`
|
169 |
|
170 | #### list
|
171 | - Method name changed: `list` -> `listClassifiers`
|
172 |
|
173 | #### remove
|
174 | - Method name changed: `remove` -> `deleteClassifier`
|
175 | - Parameter name changed: `classifier` -> `classifier_id`
|
176 |
|
177 |
|
178 | ### Personality Insights v3 Compatibility
|
179 | #### profile
|
180 | - Parameters `accept_language`, `content_type`, `content_language` now belong at the top-level of the `params` object, rather than within `headers`
|
181 | - Parameter `accept` is no longer supported - use `profile()` for `application/json` and `profileAsCsv()` for `text/csv`
|
182 | - Parameters `text` and `contentItems` are no longer supported
|
183 | - Parameter `content_items` belongs within the parameter `content` and not at the top level - this is no longer internally corrected
|
184 |
|
185 | #### profile_csv
|
186 | - Method name changed: `profile_csv` -> `profileAsCsv`
|
187 |
|
188 |
|
189 | ### Speech to Text Compatibility
|
190 | #### getModels
|
191 | - Method name changed: `getModels` -> `listModels`
|
192 |
|
193 | #### getCustomization
|
194 | - Method name changed: `getCustomization` -> `getLanguageModel`
|
195 |
|
196 | #### getRecognitionJob
|
197 | - Method name changed: `getRecognitionJob` -> `checkJob`
|
198 |
|
199 | #### createCustomization
|
200 | - Method name changed: `createCustomization` -> `createLanguageModel`
|
201 |
|
202 | #### getRecognitionJobs
|
203 | - Method name changed: `getRecognitionJobs` -> `checkJobs`
|
204 |
|
205 | #### deleteRecognitionJob
|
206 | - Method name changed: `deleteRecognitionJob` -> `deleteJob`
|
207 |
|
208 | #### getCustomizations
|
209 | - Method name changed: `getCustomizations` -> `listLanguageModels`
|
210 |
|
211 | #### createRecognitionJob
|
212 | - Method name changed: `createRecognitionJob` -> `createJob`
|
213 | - The parameter `events` must be a comma-separated string, **not** an Array. This is no longer corrected internally
|
214 |
|
215 | #### addCorpus
|
216 | - Parameter name changed: `name` -> `corpus_name`
|
217 | - Parameter name changed: `corpus` -> `corpus_file`
|
218 |
|
219 | #### getCorpus
|
220 | - Parameter name changed: `name` -> `corpus_name`
|
221 |
|
222 | #### deleteCorpus
|
223 | - Parameter name changed: `name` -> `corpus_name`
|
224 |
|
225 | #### getCorpora
|
226 | - Method name changed: `getCorpora` -> `listCorpora`
|
227 |
|
228 | #### addWord
|
229 | - Parameter name changed: `name` -> `corpus_name`
|
230 |
|
231 | #### getWords
|
232 | - Method name changed: `word` -> `word_name`
|
233 |
|
234 | #### getWord
|
235 | - Method name changed: `word` -> `word_name`
|
236 |
|
237 | #### deleteWord
|
238 | - Method name changed: `word` -> `word_name`
|
239 |
|
240 | #### trainCustomization
|
241 | - Method name changed: `trainCustomization` -> `trainLanguageModel`
|
242 |
|
243 | #### resetCustomization
|
244 | - Method name changed: `resetCustomization` -> `resetLanguageModel`
|
245 |
|
246 | #### deleteCustomization
|
247 | - Method name changed: `deleteCustomization` -> `deleteLanguageModel`
|
248 |
|
249 | #### createRecognizeStream
|
250 | - Method name changed: `createRecognizeStream` -> `recognizeUsingWebSocket`
|
251 |
|
252 | #### recognizeLive
|
253 | - This method is no longer supported. Use `recognizeUsingWebSocket` instead
|
254 |
|
255 | #### observeResult
|
256 | - This method is no longer supported. Use `recognizeUsingWebSocket` instead
|
257 |
|
258 |
|
259 | ### Text to Speech Compatibility
|
260 | #### getCustomizations
|
261 | - Method name changed: `getCustomizations` -> `listVoiceModels`
|
262 |
|
263 | #### getCustomization
|
264 | - Method name changed: `getCustomization` -> `getVoiceModel`
|
265 |
|
266 | #### updateCustomization
|
267 | - Method name changed: `updateCustomization` -> `updateVoiceModel`
|
268 |
|
269 | #### deleteCustomization
|
270 | - Method name changed: `deleteCustomization` -> `deleteVoiceModel`
|
271 |
|
272 | #### createCustomization
|
273 | - Method name changed: `createCustomization` -> `createVoiceModel`
|
274 |
|
275 | #### getWords
|
276 | - Method name changed: `getWords` -> `listWords`
|
277 |
|
278 | #### voices
|
279 | - Method name changed: `voices` -> `listVoices`
|
280 |
|
281 | #### voice
|
282 | - Method name changed: `voice` -> `getVoice`
|
283 |
|
284 | #### pronunciation
|
285 | - Method name changed: `pronunciation` -> `getPronunciation`
|
286 |
|
287 |
|
288 | ### Tone Analyzer Compatibility
|
289 | #### tone
|
290 | - Parameter name changed: `text` -> `tone_input`
|
291 | - Parameter `content_type` is now **required**
|
292 | - Parameter `tones` is now **required** to be an Array
|
293 | - Parameter name changed: `language` -> `content_language`
|
294 |
|
295 | #### tone_chat
|
296 | - Method name changed: `tone_chat` -> `toneChat`
|
297 | - Parameter `utterances` is now **required** to be at the top level of the params object
|
298 |
|
299 |
|
300 | ### Visual Recognition Compatibility
|
301 | #### createClassifier
|
302 | - Parameter `{classname}_positive_examples` changed to map `positive_examples`
|
303 |
|
304 | Instead of passing in multiple parameters like `car_positive_examples` and `boat_positive_examples`, the method now takes a single map with the classnames as the keys:
|
305 | ```json
|
306 | "positive_examples": {
|
307 | "car": <car examples>,
|
308 | "boat": <boat examples>
|
309 | }
|
310 | ```
|
311 |
|
312 | #### updateClassifier
|
313 | - Parameter `{classname}_positive_examples` changed to map `positive_examples`
|
314 |
|
315 | Instead of passing in multiple parameters like `car_positive_examples` and `boat_positive_examples`, the method now takes a single map with the classnames as the keys:
|
316 | ```json
|
317 | "positive_examples": {
|
318 | "car": <car examples>,
|
319 | "boat": <boat examples>
|
320 | }
|
321 | ```
|
322 |
|
323 | #### classify
|
324 | - Parameter name changed: `image_file` -> `images_file`
|
325 | - Parameter `parameters` is no longer supported
|
326 |
|
327 | #### detectFaces
|
328 | - Parameter name changed: `image_file` -> `images_file`
|
329 | - Parameter `parameters` is no longer supported
|
330 |
|
331 | #### retrainClassifier
|
332 | - Method name changed: `retrainClassifier` -> `updateClassifier`
|
333 |
|
334 | #### recognizeText
|
335 | - This method is no longer supported
|
336 |
|
337 | #### createCollection
|
338 | - This method is no longer supported
|
339 |
|
340 | #### getCollection
|
341 | - This method is no longer supported
|
342 |
|
343 | #### listCollections
|
344 | - This method is no longer supported
|
345 |
|
346 | #### deleteCollection
|
347 | - This method is no longer supported
|
348 |
|
349 | #### addImage
|
350 | - This method is no longer supported
|
351 |
|
352 | #### listImages
|
353 | - This method is no longer supported
|
354 |
|
355 | #### getImage
|
356 | - This method is no longer supported
|
357 |
|
358 | #### deleteImage
|
359 | - This method is no longer supported
|
360 |
|
361 | #### setImageData
|
362 | - This method is no longer supported
|
363 |
|
364 | #### getImageData
|
365 | - This method is no longer supported
|
366 |
|
367 | #### deleteImageData
|
368 | - This method is no longer supported
|
369 |
|
370 | #### findSimilar
|
371 | - This method is no longer supported
|
372 |
|
373 |
|