-
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 nowlistExamples
getEntities
-
getEntities
is nowlistEntities
getValues
-
getValues
is nowlistValues
getSynonyms
-
getSynonyms
is nowlistSynonyms
getDialogNodes
-
getDialogNodes
is nowlistDialogNodes
getLogs
-
getLogs
is nowlistLogs
getCounterExamples
-
getCounterExamples
is nowlistCounterExamples
updateIntent
- parameter
old_intent
is nowintent
- parameter
intent
is nownew_intent
- parameter
description
is nownew_description
- parameter
examples
is nownew_examples
updateEntity
- parameter
old_entity
is nowentity
- parameter
entity
is nownew_entity
- parameter
description
is nownew_description
- parameter
metadata
is nownew_metadata
- parameter
fuzzy_match
is nownew_fuzzy_match
- parameter
values
is nownew_values
updateValue
- parameter
old_value
is nowvalue
- parameter
value
is nownew value
- parameter
metadata
is nownew_metadata
- parameter
synonyms
is nownew_synonyms
updateSynonym
- parameter
old_synonym
is nowsynonym
- parameter
synonym
is nownew_synonym
updateDialogNode
- parameter
old_dialog_node
is nowdialog_node
- parameter
dialog_node
is nownew_dialog_node
- parameter
description
is nownew_description
- parameter
conditions
is nownew_conditions
- parameter
parent
is nownew_parent
- parameter
previous_sibling
is nownew_previous_sibling
- parameter
output
is nownew_output
- parameter
context
is nownew_context
- parameter
metadata
is nownew_metadata
- parameter
next_step
is nownew_next_step
- parameter
title
is nownew_title
- parameter
type
is nownew_type
- parameter
event_name
is nownew_event_name
- parameter
variable
is nownew_variable
- parameter
actions
is nownew_action
- parameter
old_text
is nowtext
- parameter
text
is nownew_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
- optional parameter added
description
-
file
is now decomposed into three top-level parameters, namely,conversions
,enrichments
, andnormalizations
.
updateConfiguration
- required parameter added
name
- optional parameter added
description
-
file
is now decomposed into three top-level parameters, namely,conversions
,enrichments
, andnormalizations
.
createCollection
- parameter
language_code
is nowlanguage
updateCollection
- parameter
collection_name
is nowname
- parameter
language_code
is removed
addDocument
- new optional parameter
file_content_type
queryNotices
- new supported method
queryNotices
federatedQueryNotices
- new supported method
federatedQueryNotices
federatedQuery
- new supported method
federatedQuery
trainingData
- new supported method
addTrainingData
- new supported method
createTrainingExample
- new supported method
deleteAllTrainingData
- new supported method
deleteTrainingData
- new supported method
deleteTrainingExample
- new supported method
getTrainingData
- new supported method
getTrainingExample
- new supported method
listTrainingData
- new supported method
listTrainingExamples
- new supported method
updateTrainingExample
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