使用Google Calendar API查找空闲时间 [英] Find free time with google calendar api

查看:89
本文介绍了使用Google Calendar API查找空闲时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查Google日历上是否有一定时间的空闲时间(无事件)。有一个 freebusy Google API,但它返回一个带有日期的事件数组。

I want to check if there is a free time (without events) in some interval of time on Google Calendar. There is a freebusy Google API, but it returns an array of events with dates.

"busy": [
    {
         "start": "2015-10-08T16:00:00+02:00",
         "end": "2015-10-08T20:00:00+02:00"
    },
    {
        "start": "2015-10-09T15:00:00+02:00",
        "end": "2015-10-09T16:00:00+02:00"
    },
]

有没有简单的方法来获取有关免费的真/假信息时间(Google API的某些功能)?如果没有,也许您知道一种通过忙数组手动进行迭代并检查事件之间是否存在空白的简便方法。

Is there any simple way to get 'true/false' information about free time (some feature to google api)? If no, maybe you know some easy way to manually iterate by "busy" array and check if there is some empty space between events.

推荐答案

Freebusy.query 支持 timeMin timeMax 值。设置这两个值以包含您感兴趣的时隙,如果响应在该时隙中返回零个事件,则您将得到空闲时间的答案。

Freebusy.query supports timeMin and timeMax values. Set those two values to encompass the timeslot you are interested in and if the response returns zero events in that timeslot you have the answer of free time.

{
  "timeMin": datetime,
  "timeMax": datetime,
}

这篇关于使用Google Calendar API查找空闲时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆