github nylas/nylas-nodejs v6.1.0

latest releases: v7.7.0, v7.6.2, v7.6.1...
2 years ago

This new release of the Nylas Node SDK brings a couple of features as well as a couple of enhancements.

New Features

  • Add support for Event to ICS
  • Add support for calendars field in free-busy, availability, and consecutive availability queries

Enhancements

  • Add comment and phoneNumber fields to EventParticipant
  • Fix issue where properties of Model type were sending read-only attributes to the API

Using New Features

Generate an ICS from an Event

Nylas.config({clientId: 'clientId', clientSecret: 'clientSecret'});
const nylas = Nylas.with('access_token');

const exampleEvent = await nylas.events.find('{id}');

// Generate an ICS from an event
let ics = await exampleEvent.generateICS();

// You can also pass ICS Options for more configuration
ics = await exampleEvent.generateICS({
  iCalUID="test_uuid",
  method="add",
  prodId="test_prodid"
})

New calendars field in free-busy/availability queries

Nylas.config({clientId: 'clientId', clientSecret: 'clientSecret'});
const nylas = Nylas.with('access_token');

// To check free-busy with calendars:
const freeBusy = nylas.calendars.freeBusy({
  startTime: 1590454800,
  endTime: 1590780800,
  calendars: [{
    accountId: "test_account_id",
    calendarIds: [
      "example_calendar_id_A",
       "example_calendar_id_B",
    ],
  }],
});

// To check availability with calendars:
const availability = nylas.calendars.availability({
  startTime: 1590454800,
  endTime: 1590780800,
  interval: 5,
  duration: 30,
  calendars: [{
    accountId: "test_account_id",
    calendarIds: [
      "example_calendar_id_A",
       "example_calendar_id_B",
    ],
  }],
});

// To check consecutive availability with calendars:
const availability = nylas.calendars.consecutiveAvailability({
  startTime: 1590454800,
  endTime: 1590780800,
  interval: 5,
  duration: 30,
  calendars: [{
    accountId: "test_account_id",
    calendarIds: [
      "example_calendar_id_A",
       "example_calendar_id_B",
    ],
  }],
});

Don't miss a new nylas-nodejs release

NewReleases is sending notifications on new releases.