Skip to content

v5.0.0-rc1

Pre-release
Pre-release
Compare
Choose a tag to compare
@lpatino10 lpatino10 released this 29 Aug 19:08
· 191 commits to master since this release

Breaking changes

There are some small breaking changes present, like some methods dropping a parameter or two or some parameters being renamed, but below are the big changes throughout the SDK.

Authentication methods

Authentication methods have changed to make things more extensible for the future. 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 implementation.

Basic

You can authenticate with basic auth using the IBMWatsonBasicAuthenticator. This allows you to pass in a username and password.

IBMWatsonAuthenticator auth = new IBMWatsonBasicAuthenticator("<username>", "<password>");

Bearer token

Use the IBMWatsonBearerTokenAuthenticator. This one accepts just the bearer token.

IBMWatsonAuthenticator auth = new IBMWatsonBearerTokenAuthenticator("<bearer_token>");

Cloud Pak for Data

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 disable SSL verification or send request headers on the token exchange.

IAM

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 options to disable SSL verification and send headers.

None

Finally, there's the IBMWatsonNoAuthAuthenticator, which is pretty self-explanatory. Pass this when you don't need any authentication to happen.

Assistant service = new Assistant("2019-02-28", new IBMWatsonNoAuthAuthenticator());

More model builders

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.