保持重复事件的实例同步

Keeping instances of a recurring event synchronized

我一整天都在尝试弄清楚如何 "rehydrate" 我的应用中的重复事件实例。

让我快速解释一下流程:

  1. 用户授权访问我的应用程序以编辑他们的日历
  2. 该应用设置了一个周期性事件
  3. 该应用订阅了该日历的 /watch 端点

到目前为止一切顺利,现在当创建者将该事件移到另一个时间时,我在 webhook url 上收到一条通知,这很好(好吧,有点),它看起来像这样:

  'x-goog-channel-id': 'my_specified_channel_id',
  'x-goog-channel-expiration': 'Thu, 29 Sep 2016 12:58:10 GMT',
  'x-goog-resource-state': 'exists',
  'x-goog-message-number': '333384',
  'x-goog-resource-id': 'some-resource-id',  // This id apparently has nothing to do with any resources I know of
  'x-goog-resource-uri': 'https://www.googleapis.com/.../resource-uri'

所以我认为我可以调用 https://www.googleapis.com/calendar/v3/calendars/primary/events/some-resource-id 并获取更新的资源,但是 resource-id 似乎与日历中的任何事件都没有任何关系,也不是日历本身的 ID(我使用 'primary' 关键字)

所以我想,作为变通方法,我可以使用 https://www.googleapis.com/calendar/v3/calendars/primary/events/recurring-event-id/instances 端点获取重复事件的所有实例,但现在移动的事件不再是该负载的一部分。我猜 google 从父事件中删除了该事件,因为它不再在一天中的同一时间发生(我无法在任何地方确认这一点)?

所以我要问的是:

  1. 我理解 x-goog-resource-id 错了吗?
  2. 有人可以确认一旦从 google 日历应用程序编辑了事件,它就会失去与重复父事件的关系吗?

回答我自己的问题:

  1. x-goog-resource-id 是日历的标识符,因为这是您放置观察者的实体
  2. 一旦属于重复集的事件被编辑,它就不再是该集的一部分