更新 Google 日历事件会删除我未使用 NodeJS API 更新的每个字段

Updating a Google Calendar event deletes every field I don't update using the NodeJS API

我正在以这种方式使用 Google API Nodejs client 库更新 google 日历事件:

calendar.events.update(
  {
    auth: jwtClient,
    calendarId: bookingCalendarId,
    eventId: booking.googleCalendarEventId,
    resource: {
      start: { dateTime: booking.startDate };
      end: { dateTime: endDate };
    },
  }
);

这正在更新事件的开始和结束日期,并且正在运行 但是我没有更新的摘要、描述、位置和所有其他字段都被删除了在日历事件中。

这是正常行为吗?我想这不是我对 "update" 函数的期望。

谢谢

documentation's example 中,事件首先使用 get 返回,然后修改,然后重新提交到 update 函数。这将避免您之前设置的属性被删除。