使用 GTasks API 处理用户 Google 任务中的更改

发布于 2024-11-13 10:04:36 字数 522 浏览 7 评论 0原文

我们正在构建将与用户 Google Tasks 数据同步的服务,因此如果用户在 GTask 中添加/编辑/删除任务,那么它将在我们的服务中添加/编辑/删除。

并且同步存在一个大问题:据我所知 GTasks API 不提供任何 onUpdate/onChange 事件侦听器。我的意思是,完美的解决方案可能是,如果有 Google Tasks API 方法,可用于设置用户添加/编辑/删除任务时将请求的某些回调 URL。

但我在 Google Tasks API 中找不到这样的方法,所以现在只有一种非常糟糕的方法来与 Google Tasks API 同步 - 请求所有用户任务并将它们与服务任务进行比较。这是非常糟糕的同步方式,因为如果我们有 10k 个用户并且希望他们的任务列表同步最多 1 分钟,那么我们需要使 >每分钟 10k GTask API 请求 :(

我希望我错了,有某种方法可以为用户任务设置 onChange/onUpdate 回调。或者可能有其他方法来接收用户 GTask 更改的实际通知(通过电子邮件和amp) ?

有谁知道吗 谢谢。

We are building service that will synchronize with user Google Tasks data, so if user add/edit/delete task in GTask, so it will be added/edited/deleted in our service.

And there is a big problem with synchronization: as I see GTasks API does not provide any onUpdate/onChange event listeners. I mean, the perfect solution can be if there will be Google Tasks API method that can be used to set some callback URL that will be requested when user add/edit/delete tasks.

But I can't find such method in Google Tasks API, so now there is only one very bad way to sync with Google Tasks API - request all users tasks and compare them with service tasks. This is very bad way to sync, because if we have 10k users and want their tasks list be synchronizaed up to 1 minute, so we will need to make > 10k GTasks API requests per minute :(

I hope that I'm wrong and there is some way to set onChange/onUpdate callback for user tasks. Or may be there is some another way to receive actual notification of user GTasks changes(by email & etc).

Does anybody know it?
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫卆 2024-11-20 10:04:36

您可以使用 updatedMin 参数仅获取自给定时间戳以来已更新的任务,如 文档

您应该能够依赖 ETagIf-None-查询用户任务列表时匹配标头,如果列表中的任务没有更改,则获取304 Not Modified。 (并不是说在轮询单个任务时也应该有效)

这样您就可以有效地轮询自上次同步以来已更改的任务。

You could use updatedMin parameter to only get Tasks that have been updated since a given timestamp, as described in the documentation.

You should be able to rely on ETag and If-None-Match headers when querying user tasks lists to get a 304 Not Modified if the no tasks in the list have changed. (Not that should also works when polling individual tasks)

This way you can effectively poll for the tasks that have changed since the last time you synced.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文