-
Notifications
You must be signed in to change notification settings - Fork 667
Migration Guide
This guide will highlight the major changes in the SDK and how to update your code accordingly. This release contains new usage patterns for a lot of service. Old usage patterns should still be functional in this release; however, in the next major release, your code will be mandated to use those new usage patterns.
In this major release, several services have been generated from the Swagger specifications of our services. Furthermore, the language has changed from NodeJS to TypeScript for these services. The change of language to TypeScript
will not have an impact on NodeJS
usage because the published public package contains NodeJS
that is the result of transpiling the TypeScript
code.
The following services are now being generated programmatically:
- Conversation
- Discovery
- Language Translator
- Natural Language Classifier
- Natural Language Understanding
- Personality Insights
- Text to Speech
- Tone Analyzer
- Speech to Text
- Visual Recognition
It's important to note that with so many of the services being moved to automated generation, there are many minor changes to method names, parameter names, etc. Therefore, this list is not exhaustive. However, we hope that this new approach will result in more consistent, maintainable code going forward.
In each specific project directory the previous structure was something like
- node-sdk/discovery
- v1.js
This has been replaced with something like
- node-sdk/discovery
- v1.ts
- v1-generated.ts
Where v1.ts is an adapter and v1-generated.ts is the new generated code. After building, there will be compiled files v1.js and v1-generated.js which are the JavaScript compilations of the TypeScript files.
Non generated code and helper methods are found in the /lib
folder.
Adapters are provided to ensure your old code will not break. These adapters follow the conventions of the v2 NodeSDK such as method names, parameters, etc. and call upon the generated code.
These are named for example for discovery: v1.ts Generated files follow the convention v1-generated.ts
These adapters should not be relied on and will not be supported for future versions and your code should be migrated to use the generated code.
getIntents
-
getIntents
is nowlistIntents
getExamples
-
getExamples
is nowlistEntities
getValues
-
getValues
is nowlistValues
getSynonym
- optional
export
parameter removed
getSynonyms
-
getSynonyms
is nowlistSynonyms
getDialogNodes
-
getDialogNodes
is nowlistDialogNodes
- optional
export
parameter removed
getLogs
-
getLogs
is nowlistLogs
getCounterExamples
-
getCounterExamples
is nowlistCounterExamples
updateIntent
- parameter
old_intent
renamed tointent
- parameter
intent
renamed tonew_intent
- parameter
description
renamed tonew_description
- parameter
examples
renamed tonew_examples
updateEntity
- parameter
old_entity
renamed toentity
- parameter
entity
renamed tonew_entity
- parameter
description
renamed tonew_description
- parameter
metadata
renamed tonew_metadata
- parameter
fuzzy_match
renamed tonew_fuzzy_match
- parameter
values
renamed tonew_values
updateValue
- parameter
old_value
renamed tovalue
- parameter
value
renamed tonew value
- parameter
metadata
renamed tonew_metadata
- parameter
synonyms
renamed tonew_synonyms
updateSynonym
- parameter
old_synonym
renamed tosynonym
- parameter
synonym
renamed tonew_synonym
updateDialogNode
- parameter
old_dialog_node
renamed todialog_node
- parameter
dialog_node
renamed tonew_dialog_node
- parameter
description
renamed tonew_description
- parameter
conditions
renamed tonew_conditions
- parameter
parent
renamed tonew_parent
- parameter
previous_sibling
renamed tonew_previous_sibling
- parameter
output
renamed tonew_output
- parameter
context
renamed tonew_context
- parameter
metadata
renamed tonew_metadata
- parameter
next_step
renamed tonew_next_step
- parameter
title
renamed tonew_title
- parameter
type
renamed tonew_type
- parameter
event_name
renamed tonew_event_name
- parameter
variable
renamed tonew_variable
- parameter
actions
renamed tonew_action
- parameter
old_text
renamed totext
- parameter
text
renamed tonew_text
getEnvironments
-
getEnvironments
is nowlistEnvironments
- parameter added
name
getConfigurations
-
getConfigurations
is nowlistConfigurations
- parameter added
name
getCollectionFields
-
getCollectionFields
is nowlistCollectionFields
getCollections
-
getCollections
is nowlistCollections
- parameter added
name
createConfiguration
- required parameter added
name
- parameter
file
removed - parameters added
description
,conversions
,enrichments
,normalizations
updateConfiguration
- required parameter added
name
- parameter
file
removed - parameters added
description
,conversions
,enrichments
,normalizations
createCollection
- parameter
language_code
renamed tolanguage
updateCollection
- parameter
collection_name
renamed toname
- parameter
language_code
removed
addDocument
- parameter
metadata
renamed tofile_content_type
query
- parameter
collection_id
changed tocollection_ids
which is a string array
getModels
-
getModels
is nowlistModels
- parameter
default
renamed todefault_models
getIdentifiableLanguages
-
getIdentifiableLanguages
is nowlistIdentifiableLanguages
create
-
create
is nowcreateClassifier
- required parameter added
metadata
status
-
status
is nowgetClassifier
list
-
list
is nowlistClassifiers
remove
-
remove
is nowdeleteClassifier
analyze
- parameter
headers
removed - optional parameters added
clean
,xpath
,fallback_to_raw
,return_analyzed_text
,language
,limit_text_characters
deleteModel
- parameter
headers
removed
profile
- required parameters have changed from either
text
orcontent_items
tocontent
- required parameter added
content_type
Method Name Changes
-
voice
renamed togetVoice
-
voices
renamed tolistVoices
-
pronunciation
renamed togetPronunciation
-
createCustomization
renamed tocreateVoiceModel
-
updateCustomization
renamed toupdateVoiceModel
-
getCustomization
renamed togetVoiceModel
-
deleteCustomization
renamed todeleteVoiceModel
-
getWords
renamed tolistWords
tone_chat
-
tone_chat
is nowtoneChat
tone
- required parameter added
content_type
- required parameter
text
renamed totone_input
createJob
-
createRecognitionJob
is nowcreateJob
getRecognitionJobs
-
getRecognitionJobs
is nowcheckJobs
getRecognitionJob
-
getRecognitionJob
is nowcheckJob
deleteRecognitionJob
-
deleteRecognitionJob
is nowdeleteJob
createSession
- parameters added
customization_id
,acoustic_customization_id
,customization_weight
retrainClassifier
-
retrainClassifier
is nowupdateClassifier
recognizeText
- method is no longer supported
classify
- parameters
url
,classifier_ids
,owners
, andthreshold
encapsulated to new JSON object parameterparameters
detectFaces
- parameter
url
encapsulated in JSON parameterparameters