This document should serve as a guide to breaking changes for users moving from code using the v4.x.x version of the SDK to v5.x.x.
Previously, there were different builder objects for authentication. For example:
// username and password
IBMWatsonBasicAuthConfig config = new IBMWatsonBasicAuthConfig.Builder()
.username('<username>')
.password('<password')
.build();
// IAM
IBMWatsonIAMOptions options = new IBMWatsonIAMOptions.Builder()
.apiKey('<iam_api_key>')
.url('<iam_url>')
.build();
This could be set multiple ways:
// in the constructor
IBMWatsonIAMOptions options = new IBMWatsonIAMOptions.Builder()
.apiKey('<iam_api_key>')
.url('<iam_url>')
.build();
IBMAssistantV1 service = new IBMAssistantV1('2019-02-28', options);
// after instantiation
service.setAuthenticator(options);
// inline in the constructor (only for username and password!)
IBMAssistantV1 service = new IBMAssistantV1('2019-02-28', '<username>', '<password>');
Overall, it was a little too open-ended and very confusing to follow. For this release, we've decided to standardize things, while developing a pattern that should be more scalable.
There are 5 authentication variants supplied in the SDK (shown below), and it's possible now to create your own authentication implementation if you need something specific by implementing the IBMWatsonAuthenticator
interface.
You can authenticate with basic auth using the IBMWatsonBasicAuthenticator
. This allows you to pass in a username and password.
IBMWatsonAuthenticator authenticator = new IBMWatsonBasicAuthenticator('<username>', '<password>');
Use the IBMWatsonBearerTokenAuthenticator
. This one accepts just the bearer token.
IBMWatsonAuthenticator authenticator = new IBMWatsonBearerTokenAuthenticator('<bearer_token>');
This class helps you authenticate with your services on (Cloud Pak for Data)[https://www.ibm.com/analytics/cloud-pak-for-data).
// constructor with required parameters
IBMWatsonAuthenticator authenticator = new IBMWatsonCloudPakForDataAuthenticator(
'<url>',
'<test_username>',
'<test_password>'
);
There's also another constructor to send request headers on the token exchange.
Like the IBMWatsonCloudPakForDataAuthenticator
, there's a basic constructor
IBMWatsonAuthenticator authenticator = new IBMWatsonIAMAuthenticator('<token>');
and another one to supply additional arguments like a particular token exchange URL, a client ID and secret, and the same option to send headers.
Finally, there's the IBMWatsonNoAuthAuthenticator
, which is pretty self-explanatory. Pass this when you don't need any authentication to happen.
IBMAssistantV1 service = new IBMAssistantV1('2019-02-28', new IBMWatsonNoAuthAuthenticator());
For a while now, we've allowed users to set the service URL with setEndPoint()
:
IBMWatsonIAMOptions options = new IBMWatsonIAMOptions.Builder()
.apiKey('<iam_api_key>')
.url('<iam_url>')
.build();
IBMAssistantV1 service = new IBMAssistantV1('2019-02-28', options);
service.setEndPoint('<service_url>');
To align with our other SDKs and be a bit more clear, that method has been renamed to setServiceURL()
:
IBMWatsonAuthenticator authenticator = new IBMWatsonIAMAuthenticator('<token>');
IBMAssistantV1 service = new IBMAssistantV1('2019-02-28', authenticator);
service.setServiceURL('<service_url>');
There was a big change to the whole SDK which finally standardized the naming convention! This means that if you dig into the code, you won't see snake cased property names with the weird _serialized_name
suffix anymore. This change shouldn't be very visible from a user's perspective, but in case it does show up, this is why.
If you've used the SDK before, you're probably familiar with the use of the builder pattern across the board. With this release, we've tweaked the generation process to capture better which are models that are being constructed to be sent to the service. These are models we'd prefer to have builders, making it easier to put them together.
There are unfortunately a decent number of models which move to this pattern, but it's one we expect to use well into the future. Here's the comprehensive list of models that now use this:
CaptureGroup
DialogNodeAction
DialogNodeNextStep
DialogNodeOutputGeneric
DialogNodeOutputModifiers
DialogNodeOutputOptionsElement
DialogNodeOutputOptionsElementValue
DialogNodeOutputTextValuesElement
DialogNodeVisitedDetails
DialogSuggestion
DialogSuggestionValue
LogMessage
Mention
MessageContextMetadata
MessageRequest
RuntimeEntity
RuntimeIntent
WorkspaceSystemSettings
WorkspaceSystemSettingsDisambiguation
WorkspaceSystemSettingsTooling
CaptureGroup
MessageContext
MessageContextGlobal
MessageContextGlobalSystem
MessageContextSkill
MessageInputOptions
RuntimeEntity
RuntimeIntent
Category
FeedbackDataInput
Label
Location
OriginalLabelsIn
ShortDoc
TypeLabel
UpdatedLabelsIn
Configuration
Conversions
CredentialDetails
Credentials
Enrichment
EventData
Expansion
Expansions
FontSetting
HtmlSettings
NluEnrichmentConcepts
NluEnrichmentRelations
NormalizationOperation
PdfHeadingDetection
PdfSettings
SegmentSettings
Source
SourceOptions
SourceOptionsBuckets
SourceOptionsFolder
SourceOptionsObject
SourceOptionsSiteColl
SourceOptionsWebCrawl
SourceSchedule
TokenDictRule
TrainingExample
WordHeadingDetection
WordSettings
WordStyle
XPathPatterns
ClassifyInput
MetadataOptions
SyntaxOptionsTokens
CustomWord
Translation
Word
Words
group_serialized_name
was renamed toxGroup
in theCaptureGroup
modelincludeCount
is no longer a parameter of thelistWorkspaces()
methodincludeCount
is no longer a parameter of thelistIntents()
methodincludeCount
is no longer a parameter of thelistExamples()
methodincludeCount
is no longer a parameter of thelistCounterexamples()
methodincludeCount
is no longer a parameter of thelistEntities()
methodincludeCount
is no longer a parameter of thelistValues()
methodincludeCount
is no longer a parameter of thelistSynonyms()
methodincludeCount
is no longer a parameter of thelistDialogNodes()
methodvalueType
was renamed totype
in thecreateValue()
methodnewValueType
was renamed tonewType
in theupdateValue()
methodnodeType
was renamed totype
in thecreateDialogNode()
methodnodeType
was renamed totype
in thecreateDialogNode()
methodnewNodeType
was renamed tonewType
in theupdateDialogNode()
methodqueryType
property was added to theDialogNodeOutputGeneric
modelquery
property was added to theDialogNodeOutputGeneric
modelfilter
property was added to theDialogNodeOutputGeneric
modeldiscoveryVersion
property was added to theDialogNodeOutputGeneric
modeloutput
property type was converted fromIBMWatsonMapModel
toDialogSuggestionOutput
in theDialogSuggestion
modelLogMessage
model no longer hasadditionalProperties
DialogRuntimeResponseGeneric
was renamed toRuntimeResponseGeneric
RuntimeEntity
model no longer hasadditionalProperties
RuntimeIntent
model no longer hasadditionalProperties
DialogRuntimeResponseGeneric
was renamed toRuntimeResponseGeneric
convertToHtml()
method does not require afilename
parameter
returnFields
was renamed toxReturn
in thequery()
methodloggingOptOut
was renamed toxWatsonLoggingOptOut
in thequery()
methodspellingSuggestions
was added to thequery()
methodcollectionIds
is no longer a parameter of thequery()
methodreturnFields
was renamed toxReturn
in theQueryNotices()
methodloggingOptOut
was renamed toxWatsonLoggingOptOut
in thefederatedQuery()
methodcollectionIds
is now required in thefederatedQuery()
methodreturnFields
was renamed toxReturn
in thefederatedQuery()
methodreturnFields
was renamed toxReturn
in thefederatedQueryNotices()
methodenrichmentName
was renamed toenrichment
in theEnrichment
modelfieldName
was renamed tofield
in theField
modeltestConfigurationInEnvironment()
method was removedqueryEntities()
method was removedqueryRelations()
method was removed
defaultModels
was renamed toxDefault
in thelistModels()
methodtranslationOutput
was renamed totranslation
in theTranslation
model
metadata
was renamed totrainingMetadata
in thecreateClassifier()
method
finalResults
was renamed toxFinal
in theSpeakerLabelsResult
modelfinalResults
was renamed toxFinal
in theSpeechRecognitionResult
model
detectFaces()
method was removedclass_serialized_name
was renamed toxClass
in theModelClass
modelclass_serialized_name
was renamed toxClass
in theClassResult
model