【问题标题】:Return more than one calendar at a time一次返回多个日历
【发布时间】:2020-05-16 13:39:29
【问题描述】:

我在 google 日历帐户中有单独的日历,当我调用日历 API 时,我目前需要在每次要拨打电话时迭代每组日历。我有 5 个日历组,我只想从中“读取”,大约需要 4 秒来分别询问每组日历。

当我调用 calendar-api 时,有没有办法同时传递所有日历?

// Look for the calendars we need to check
$queryCalendars = $dbase->prepare('SELECT `calendar` FROM `googleCalanders`');
$queryCalendars->execute();

while ($row = $queryCalendars->fetch(PDO::FETCH_OBJ)) {
    $checkCalandars[] = $row->calendar; // Give me an Array of all the calandars we need
}

// Check to see if we need to collect the data from the cloud or if we can use the cached version
$foundEvents=[];

foreach ($checkCalandars as $checkThisCalendar){
    // Print the next 7 events on the specific calendars.
    $calendarId = $checkThisCalendar;
    $optParams = array(
        'maxResults' => 7,
        'orderBy' => 'startTime',
        'singleEvents' => TRUE,
        'timeMin' => $checkTime
    );

    $results = $service->events->listEvents($calendarId, $optParams);

我只想将 $calendarId 传递给 API 一次,让它告诉我这些日历中的所有事件,而不是一次一个地执行每个事件。这可能吗?

【问题讨论】:

    标签: php google-calendar-api


    【解决方案1】:

    正如Events: list 文档所说,不可能按照您想要的方式进行:

    返回指定日历上的事件。

    如果您愿意,您可以在Issue Tracker 上填写功能请求,指定您想要什么以及它将对您或您的组织产生的业务影响。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-30
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多