nylas / nylas-nodejs

A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
MIT License
167 stars 117 forks source link

question: threads.list "in" condition #486

Closed aanosh closed 11 months ago

aanosh commented 11 months ago

is there any possibility to request threads from a few labels? documentation says that for "in" condition you can use enum, and for "not_in" it should be string, but what is the difference in essence? I would like to have something like:

const threads = await nylas.threads.list({
      offset: offset,
      limit: limit,
      expanded: true,
      in: ['draft', 'inbox'],
      not_in: ['tresh', 'archived']
    })

how hard is to add it?

relaxedtomato commented 11 months ago

Hi @aanosh - great question, at the moment, this is actually a limitation of the Nylas API, not the Node SDK.

Will close the ticket as the SDK's approach is to essentially wrap the API. Will make a note to investigate the API limitation 👍

mrashed-dev commented 11 months ago

Hey @aanosh! As @relaxedtomato using arrays in the threads in and not_in are not supported by the API. However you can use in and not_in together in the same way. For both those fields they take in a label/folder's name, display name, or its specific id. The "enum" indication on the documentation is inaccurate. You can use it like this:

const threads = await nylas.threads.list({
      offset: offset,
      limit: limit,
      expanded: true,
      in: 'draft',
      not_in: 'trash'
    })

We will pass your feedback on to the API team, thanks!