nylas/nylas-nodejs

nylas.scheduler.create is not a function

riccardogiorato opened this issue · 2 comments

Describe the bug
When trying to use "nylas.scheduler.create" I get the error:
nylas.scheduler.create is not a function

To Reproduce
Some steps involved to reproduce the bug and any code samples you can share.

      const user_nylas_access_token = 'token'
      const nylas = Nylas.with(user_nylas_access_token)

      const scheduler = await nylas.scheduler.create({
        access_tokens: [user_nylas_access_token],
        config: {
          timezone: 'America/Los_Angeles',
        },
        name: 'Test',
        slug: 'test-slug',
      })

Expected behavior
Being able to get the "create" function for the scheduler using the Node.js SDK

SDK Version:
6.6.1

I am also having issues with nylas.scheduler.list() always giving me back an empty list.
If I try to do the same thing with Rest API directly it's working.

@riccardogiorato Thanks for opening the issue! The docs are currently out of date, nylas.scheduler.create is not a function anymore and the way to create a scheduler object is to do the following:

const { default: Scheduler } = require("nylas/lib/models/scheduler");

const scheduler = new Scheduler(nylas, {..});
// set the appropriate fields
scheduler.save();

Regarding nylas.scheduler.list() not working, can you give a little bit more detail? A code snippet or any details can help, thanks!