Skip to content

java-sdk-3.0.0-RC1

Pre-release
Pre-release
Compare
Choose a tag to compare
@germanattanasio germanattanasio released this 22 Apr 22:51
· 3435 commits to master since this release

Breaking Changes for v3.0

The version 3.0.0-RC1 is a major release focused on simplicity and consistency. Several breaking changes were introduced.

Synchronous vs Asynchronous

Before 3.0 all the API calls were synchronous

List<Dialog> dialogs = dialogService.getDialogs();
System.out.println(dialogs);

Now to do synchronous call you need to add execute()

List<Dialog> dialogs = dialogService.getDialogs().execute();
System.out.println(dialogs);

To do asynchronous calls you need to specify a callback

service.getDialogs().enqueue(new ServiceCallback<List<Dialog>>() {
  @Override
  public void onResponse(List<Dialog> response) {
    System.out.println(response);
  }

  @Override
  public void onFailure(Exception e) {
  }}
);

For more information, take a look at the CHANGELOG.

Migration

To migrate to 3.0 from a previous version, simply add .execute() to the old methods.
For example if you previously had

List<Dialog> dialogs = dialogService.getDialogs();
System.out.println(dialogs);

Just add execute() on the end and your code will work exactly the same as before.

List<Dialog> dialogs = dialogService.getDialogs().execute();
System.out.println(dialogs);