Skip to content

Releases: nylas/nylas-java

v2.0.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 09 Feb 14:38
9bc4b02

The Nylas SDK for Kotlin & Java v2.0.0 is out of beta now Generally Available! This SDK sees a number of changes, including breaking changes, and more importantly brings full support of the new Nylas API v3 as well as full Kotlin support.

Changelog

Breaking changes

  • Renamed artifact from nylas-java-sdk to nylas.
  • Nylas SDK v2 supports the Nylas API v3 exclusively, dropping support for any endpoints that are not available in v3. See API v3 Features and Changes for more information.
  • Removed all REST calls from models and moved them directly into resources.

Added

  • Full Kotlin support.
  • Created models for all API resources and endpoints, for all HTTP methods to reduce confusion on which fields are available for each endpoint.
  • Created error classes for the different API errors as well as SDK-specific errors.

Updated

  • Now using Moshi annotations for JSON serialization/deserialization as opposed to manually writing JSON maps.
  • Removed all REST calls from models and moved them directly into resources.

Removed

  • Non-builder ways for initializing NylasClient.
  • Local Webhook development support is removed due to incompatibility with the new API version.

Docs and References

Please refer to the README.md for a quick description and getting started guide with the new SDK. Furthermore, we have an UPGRADE.md for instructions on upgrading from v1.x to v2.x, as well as a reference guide for the Kotlin & Java SDK.

v1.22.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 29 Jan 20:59

This release of the Nylas Java SDK comes with new features.

Release Notes

Added

  • Added support for querying events using customer event ID (#153)
  • Added support for overriding the Event ID when updating, for recurring events (#186)
  • Added support for reply_to_message_id field in Message (#194)

v1.21.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 14 Feb 17:37

This release of the Nylas Java SDK comes with new features and a fix.

Release Notes

Added

  • Added missing content_disposition field in File (#149)
  • Added toJSON() and toMap() support to account owned models (#150)
  • Added scheduler support for the EU region (#151)

Fixed

  • Fixed NullPointerException sporadically occurring when calling Message.toString() (#149)

Usage

toJSON() and toMap()

public class NylasExample {
  public static void main(String[] args) throws Exception {
    NylasClient client = new NylasClient();
    NylasApplication application = client.application("CLIENT_ID", "CLIENT_SECRET");
    Event event = application.events().get("EVENT_ID");

    // Convert Event to JSON
    String eventJSON = event.toJSON();

    // Convert Event to Map
    Map<String, Event> eventMap = event.toMap();
  }
}

EU Scheduler

public class NylasExample {
  public static void main(String[] args) throws Exception {
    // Setup Nylas client, defaulting to US region
    NylasClient client = new NylasClient();
    NylasApplication application = client.account("ACESS_TOKEN");
    Schedulers usScheduler = application.schedulers(); // Scheduler URL pointing to https://api.schedule.nylas.com/

    // Setup Nylas client for the EU region
    NylasClient euClient = new NylasClient.Builder()
        .baseUrl(NylasClient.EU_BASE_URL)
        .build();
    NylasApplication euApplication = euClient.account("ACESS_TOKEN");
    Schedulers euScheduler = euApplication.schedulers(); // Scheduler URL pointing to https://ireland.api.schedule.nylas.com/
  }
}

v1.20.1

Choose a tag to compare

@mrashed-dev mrashed-dev released this 09 Feb 19:41

This release of the Nylas Java SDK comes with a few changes/fixes regarding the local webhook implementation.

Changed

  • Provide default implementations for WebhookHandler methods onOpen, onClose, and onError (#147)

Fixed

  • Fix Tunnel.onMessage not emitting individual deltas (#147)
  • Change java-websocket dependency to api configuration (#147)

v1.20.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 06 Feb 23:47

This release of the Nylas Java SDK includes a couple of changes, most notably the release of local webhook development support built directly into the SDK. When implementing this feature in your app, the SDK will create a tunnel connection to a websocket server and registers it as a webhook callback to your Nylas account. See below for a usage example.

Release Notes

Added

  • Added local webhook testing support (#145)
  • Added new enums for Webhook.Triggers and Webhook.State (#145)

Usage

Webhook Tunnel

During the setup process you can pass in a class that implements WebhookTunnel.WebhookHandler with methods to override the websocket client's callback methods. The most important method is the onMessage method which returns a parsed delta event from the webhook server.

public class NylasWebhook {
  public static void main(String[] args) throws Exception {
    ExampleConf conf = new ExampleConf();
    NylasClient client = new NylasClient();
    NylasApplication application = client.application("CLIENT_ID", "CLIENT_SECRET");

    Tunnel webhookTunnel = new Tunnel.Builder(application, new HandleNotifications()).build();
    webhookTunnel.connect();
  }
}

class HandleNotifications implements Tunnel.WebhookHandler {
  private static final Logger log = LogManager.getLogger(HandleNotifications.class);

  @Override
  public void onOpen(short httpStatusCode) {
    log.info("OnOpen");
  }

  @Override
  public void onClose(int code, String reason, boolean remote) {
    log.info("onClose");
  }

  @Override
  public void onMessage(Notification notification) {
    log.info("onMessage");
  }

  @Override
  public void onError(Exception ex) {
    log.info("onError");
  }
}

v1.19.2

Choose a tag to compare

@mrashed-dev mrashed-dev released this 24 Jan 23:09

This release of the Nylas Java SDK comes with a few fixes.

Release Notes

Fixed

  • Fix Event.hide_participants not serializing (#143)
  • Fix Event.visibility not serializing (#143)
  • Fix FreeBusy not having a calendar_id field (#143)

v1.19.1

Choose a tag to compare

@mrashed-dev mrashed-dev released this 18 Jan 14:45

This release of the Nylas Java SDK comes with a couple of changes.

Release Notes

Changed

  • Added missing setters for FreeBusy (#140)

Fixed

  • Fixed typo in Event.hide_participants (#140)

v1.19.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 18 Nov 23:20

This release of the Nylas Java SDK comes with new features, changes, and fixes.

Release Notes

Added

  • Added support for calendar colors (for Microsoft calendars) (#107)
  • Added support for rate limit errors (#112)

Changed

  • Set Content-Type and Accept headers on outgoing calls (#113)

Fixed

  • Fixed revoke access token always throwing an error (#111)
  • Fixed participant status not serializing on Event creation (#124)

v1.18.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 06 Oct 17:34

This release of the Nylas Java SDK comes with new features and a bug fix.

Release Notes

Added

  • Added hide participants field for the Event class (#103)
  • Added support for provider detection (#100)
  • Added an enum for all known providers for native authentication (#100)
  • Improved webhook notification support with the addition of more notification attributes and event metadata fields (#102)

Changed

  • NylasAccount.revokeAccessToken() returns a boolean value now (#97)

Fixed

  • Fix error when updating occurrence of a recurring event (#93)

Using New Features

Provider Detection

// Set up your client
NylasClient client = new NylasClient();
NativeAuthentication nativeAuthentication = client.application("CLIENT_ID", "CLIENT_SECRET").nativeAuthentication();

// Detect the provider for an email address
NativeAuthentication.DetectedProvider detectedProvider = nativeAuthentication.detectProvider("test@gmail.com");
// The following fields are made available
detectedProvider.isDetected();
detectedProvider.getProviderName();
detectedProvider.getAuthName();
detectedProvider.getEmailAddress();
detectedProvider.isImap();

// You can use the result from above to get the correct provider settings
ProviderSettings detectedSettings = ProviderSettings.getProviderSettingsByProvider(provider.getAuthName());

// The enum is provided for consistency and equality
if(detectedProvider.getAuthName() == NativeAuthentication.Provider.GMAIL.getName()) {
  // do something here for a Gmail case
}

v1.17.0

Choose a tag to compare

@mrashed-dev mrashed-dev released this 22 Sep 19:28

This release of the Nylas Java SDK comes with a new feature and a bug fix.

Release Notes

Added

  • Add support for getting a single expanded message and thread (#84)

Fixed

  • Fixed issue where Event participants could never be entirely removed once set (#83)

Using New Features

Getting a single expanded message and thread

NylasClient nylas = new NylasClient();
NylasAccount account = nylas.account("{ACCESS_TOKEN}");

// Get an expanded message by passing a boolean for the second parameter, indicating an expanded view
Message expandedMessage = account.messages().get("message_id", true);

// Get an expanded thread by passing a boolean for the second parameter, indicating an expanded view
Thread expandedThread = account.threads().get("thread_id", true);