SuperAPI AI 工具集

google-calendar

办公与效率

查看项目

更新于 10-14 20:31

技能介绍

用途

Google Calendar 技能用于访问 Google Calendar 和 Google Tasks API,帮助用户查看或管理日历、事件、日程以及 Google 任务。

主要能力

  • 列出日历(list-calendars)
  • 列出事件(list-events),支持按时间范围筛选
  • 搜索事件(list-events 配合 --q 参数)
  • 创建事件(create-event)
  • 更新事件(update-event)
  • 删除事件(delete-event)
  • 查询空闲/忙碌状态(freebusy)
  • 列出任务列表(list-tasklists)
  • 列出任务(list-tasks)
  • 创建任务(create-task)
  • 更新任务(update-task)
  • 删除任务(delete-task)
  • 通过 call 调用任意 Calendar API 端点

使用方式

快速开始

  1. 创建 Google Cloud OAuth 客户端(桌面应用),并将凭据 JSON 保存到 ~/.config/google-calendar/credentials.json。

  2. 安装依赖(推荐使用 venv):

python3 -m venv ~/.config/google-calendar/venv
~/.config/google-calendar/venv/bin/pip install -r <skill_dir>/scripts/requirements.txt
  1. 认证并存储令牌:

仅日历:

<skill_dir>/scripts/gcal-auth

仅任务:

<skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/tasks

日历 + 任务(单一令牌):

<skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/tasks
  1. 调用 API:
<skill_dir>/scripts/gcal list-calendars

凭据与令牌

  • 凭据默认位于 ~/.config/google-calendar/credentials.json。
  • 令牌默认位于 ~/.config/google-calendar/token.json。
  • 使用 --token 或 GCAL_TOKEN_PATH 可切换账户或隔离环境。

日期/时间规则

  • 定时事件使用 RFC3339(例如 2026-01-22T10:00:00-08:00)。
  • 全天事件使用 YYYY-MM-DD,并将结束日期设为次日(不含当日)。
  • 当日期时间没有偏移量时,需设置 --time-zone。

常用命令

列出日历:

<skill_dir>/scripts/gcal list-calendars

列出事件:

<skill_dir>/scripts/gcal list-events --calendar-id primary --time-min 2026-01-22T00:00:00-08:00 --time-max 2026-01-22T23:59:59-08:00

搜索事件:

<skill_dir>/scripts/gcal list-events --calendar-id primary --q "standup" --time-min ... --time-max ...

创建事件(简单):

<skill_dir>/scripts/gcal create-event --calendar-id primary --summary "Review" --start 2026-01-22T10:00:00-08:00 --end 2026-01-22T11:00:00-08:00

更新事件(简单):

<skill_dir>/scripts/gcal update-event --calendar-id primary --event-id <id> --summary "New title"

删除事件:

<skill_dir>/scripts/gcal delete-event --calendar-id primary --event-id <id>

空闲/忙碌:

<skill_dir>/scripts/gcal freebusy --calendars primary,team@company.com --time-min ... --time-max ...

列出任务列表:

<skill_dir>/scripts/gcal list-tasklists

列出任务:

<skill_dir>/scripts/gcal list-tasks --tasklist <tasklist_id>

创建任务:

<skill_dir>/scripts/gcal create-task --tasklist <tasklist_id> --title "Buy milk" --due 2026-01-22T10:00:00-08:00

更新任务:

<skill_dir>/scripts/gcal update-task --tasklist <tasklist_id> --task-id <id> --notes "Bring receipt"

删除任务:

<skill_dir>/scripts/gcal delete-task --tasklist <tasklist_id> --task-id <id>

高级用法

使用 call 访问任意 Calendar API 端点:

<skill_dir>/scripts/gcal call GET /users/me/calendarList
<skill_dir>/scripts/gcal call POST /calendars/primary/events --body-file /path/to/event.json

对于复杂负载(参与者、重复规则、conferenceData),使用 --body-file 或 --body(JSON 字符串)。

通过 --token 使用不同令牌文件可运行多个账户。

适用场景

  • 查看和管理个人或团队的日历与日程
  • 查询某时间段内的事件或搜索特定事件
  • 创建、更新、删除日历事件
  • 查询多个日历的空闲/忙碌状态
  • 管理 Google 任务列表与任务
  • 通过 call 直接调用任意 Calendar API 端点

限制与安全

  • 需要自行创建 Google Cloud OAuth 客户端并完成认证。
  • 创建、更新或删除事件前应确认意图。
  • 请勿将 OAuth 凭据和令牌文件提交到 git。
  • 关于收费、价格、平台支持范围等信息,资料暂未提供。