gpt4 book ai didi

javascript - Google 日历 API 空闲/忙碌 : query does not retun events separatly

转载 作者:行者123 更新时间:2023-12-02 20:59:02 28 4
gpt4 key购买 nike

在我的 Google 日历中,我有连续的事件:

  • 事件 1 上午 9 点 - 上午 11 点
  • 事件 2 上午 11 点至下午 13 点
  • 事件 3 下午 13 点至 15 点

当我查询 Freebusy api 时,它会重新运行一个事件:上午 9 点 - 上午 15 点,而不是单独的事件,为什么?

客户发帖请求:

$.post(
"url",
function (result) {
var events = [];
result.map((event, i) => {
item = {};
item["title"] = "SameTextToDisplay";
item["start"] = event.start;
item["end"] = event.end;
events.push(item);
});
}
);

我的nodejs服务器功能:

calendar.freebusy.query({
resource: {
timeMin: TimeMin,
timeMax: TimeMax,
timeZone: "America/New_York",
items: [
{
id: "MyCalendarID"
}
]
}}, (err, resp) => {
if (err) return console.log('The API returned an error: ' + err);
res.send(resp.data.calendars[id]);
});

最佳答案

如果您想要事件列表,请使用端点 event.list相反。

the official documentation 中有一个关于如何将 list 端点与 javascript 库一起使用的示例。 .

关于javascript - Google 日历 API 空闲/忙碌 : query does not retun events separatly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61399218/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com