nylas / nylas-nodejs

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

Bad Request when update the event #470

Closed ianzone closed 11 months ago

ianzone commented 1 year ago

Source code

import { getConnection } from '../client';

const nylas = getConnection()

async function update(id:string) {
  const event = await nylas.events.find(id)
  event.title='new title'
  const res = await event.save()
  console.log(res)
}

update('et0kr6fovbr5syanag4f7pf7w')

Error msg Bad Request: Visibility cannot have the value ''

ianzone commented 1 year ago

the sdk should omit the event.visibility when sending the update request.

relaxedtomato commented 1 year ago

@ianzone have you tried specifying 'null' as default, does that work for you?

ianzone commented 1 year ago

@ianzone have you tried specifying 'null' as default, does that work for you?

There is always a remedial measure, but my point is the SDK should do the job as the docs described. image

mrashed-dev commented 1 year ago

Thanks for raising this point @ianzone. I have just reproduced the issue and we'll be looking to fix this. Thank you for reporting it!

relaxedtomato commented 1 year ago

approach to fix: Need to ensure to nullify visibility before sending the payload if visibility is an empty string