-
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 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
method renamed tolistIntents
getDialogNode
- optional
export
parameter removed
getExamples
-
getExamples
method renamed tolistEntities
getValues
-
getValues
method renamed tolistValues
getSynonym
- optional
export
parameter removed
getSynonyms
-
getSynonyms
method renamed tolistSynonyms
getDialogNodes
-
getDialogNodes
method renamed tolistDialogNodes
- optional
export
parameter removed
getLogs
-
getLogs
method renamed tolistLogs
getCounterExamples
-
getCounterExamples
method renamed tolistCounterExamples
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
method renamed tolistEnvironments
- parameter added
name
getConfigurations
-
getConfigurations
method renamed tolistConfigurations
- parameter added
name
getCollectionFields
-
getCollectionFields
method renamed tolistCollectionFields
getCollections
-
getCollections
method renamed tolistCollections
- 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
method renamed tolistModels
- parameter
default
renamed todefault_models
getIdentifiableLanguages
-
getIdentifiableLanguages
method renamed tolistIdentifiableLanguages
create
-
create
method renamed tocreateClassifier
- required parameter added
metadata
status
-
status
method renamed togetClassifier
list
-
list
method renamed tolistClassifiers
remove
-
remove
method renamed todeleteClassifier
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
- synthesize renamed to postSynthesize
- voice renamed to voicesByID
- createCustomization renamed to postCustomizations
- updateCustomization renamed to postCustomizationByID
- getCustomization renamed to getCustomizationByID
- deleteCustomization renamed to deleteCustomizationByID
- addWords renamed to postCustomizationByIDWords
- addWord renamed to putCustomizationByIDWord
- getWords renamed to getCustomizationByIDWords
- getWord renamed to getCustomizationByIDWord
- deleteWord renamed to deleteCustomizationByIDWord
tone_chat
-
tone_chat
method renamed totoneChat
tone
- required parameter added
content_type
- required parameter
text
renamed totone_input
createJob
-
createRecognitionJob
method renamed tocreateJob
getRecognitionJobs
-
getRecognitionJobs
method renamed tocheckJobs
getRecognitionJob
-
getRecognitionJob
method renamed tocheckJob
deleteRecognitionJob
-
deleteRecognitionJob
method renamed todeleteJob
createSession
- parameters added
customization_id
,acoustic_customization_id
,customization_weight
retrainClassifier
-
retrainClassifier
method renamed toupdateClassifier
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