From d6a995b9090ca35190e59e765d5c14daf887e9d8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 19 May 2026 20:46:23 -0400 Subject: feat(calendar-sync): add Python helper for Google Calendar API sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Google's .ics export drops per-occurrence response statuses on recurring events. When OOO auto-declines a meeting, the master event keeps PARTSTAT=ACCEPTED and declined instances inherit it. The .ics path can't filter the declines out. The API path expands recurrences server-side via singleEvents=True, and each occurrence carries its own attendees[].self.responseStatus. scripts/calendar_sync_api.py fetches events and renders them as org entries. OAuth is one-time per account. The refresh token lives at ~/.config/calendar-sync/token-.json under 0600. Output matches the existing .ics shape: heading sanitization, LOCATION/ORGANIZER/STATUS/URL property drawer, HTML-stripped descriptions, org timestamps with weekday abbreviations. I wrote 30 stdlib-unittest tests against fixture JSON, covering rendering, filtering, timestamp formatting, and HTML cleanup. I left auth and HTTP uncovered — they're thin wrappers around the Google client libraries, best checked by running the script once after OAuth setup. docs/calendar-sync-api-setup.org walks through the Google Cloud OAuth client setup and the per-account auth bootstrap. .gitignore picks up Python bytecode now that the project has a Python helper. The Elisp dispatch (:fetcher 'api routing in calendar-sync.el) lands in a follow-up commit. --- tests/fixtures/calendar-sync-api/declined-recurring.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/fixtures/calendar-sync-api/declined-recurring.json (limited to 'tests/fixtures/calendar-sync-api/declined-recurring.json') diff --git a/tests/fixtures/calendar-sync-api/declined-recurring.json b/tests/fixtures/calendar-sync-api/declined-recurring.json new file mode 100644 index 000000000..fad6a8625 --- /dev/null +++ b/tests/fixtures/calendar-sync-api/declined-recurring.json @@ -0,0 +1,15 @@ +{ + "id": "4lu91bb3spgmru2bfndh0a4rrk_20260519T160000Z", + "summary": "STRATFI/FR Standup/IPM/Grooming", + "start": {"dateTime": "2026-05-19T12:00:00-04:00", "timeZone": "America/Los_Angeles"}, + "end": {"dateTime": "2026-05-19T13:00:00-04:00", "timeZone": "America/Los_Angeles"}, + "status": "confirmed", + "organizer": {"email": "ryan@deepsat.com"}, + "attendees": [ + {"email": "nerses@deepsat.com", "responseStatus": "accepted"}, + {"email": "ryan@deepsat.com", "responseStatus": "declined", "organizer": true}, + {"email": "craig.jennings@deepsat.com", "responseStatus": "declined", "self": true, + "comment": "Out of office for SOFWeek (Tampa) through Friday 5/22."} + ], + "hangoutLink": "https://meet.google.com/suw-ornf-iuv" +} -- cgit v1.2.3