Skip to content

feat(calendar): add RSVP and color-coding operations #99

@rianjs

Description

@rianjs

Context

Following the Gmail organizational operations (#98), this adds non-destructive organizational operations for Google Calendar: RSVP-ing to events and color-coding them. These are single-event operations (no bulk needed — bulk calendar operations are unusual).

Depends on #98 for: architecture test allowlist, scope migration infrastructure, documentation patterns.


Scope Change

internal/auth/auth.go: Add calendar.CalendarEventsScope (read/write events only, NOT calendar settings). Keep CalendarReadonlyScope since CalendarEventsScope is not a full superset of it (events scope doesn't cover calendar list metadata).

New API Client Methods

internal/calendar/client.go:

func (c *Client) RSVPEvent(ctx context.Context, calendarID, eventID, response string) error
func (c *Client) SetEventColor(ctx context.Context, calendarID, eventID, colorID string) error

Both use c.service.Events.Patch() — partial update, only modifying the relevant field.

For RSVP: Patch with Attendees field updated to set the current user's ResponseStatus. Requires finding the current user's attendee entry in the event's attendee list (need user's email from profile).

For Color: Patch with ColorId field.

New Interface Methods

Add to CalendarClient in internal/cmd/calendar/output.go:

RSVPEvent(ctx context.Context, calendarID, eventID, response string) error
SetEventColor(ctx context.Context, calendarID, eventID, colorID string) error

New Commands

Command Description
gro calendar rsvp <event-id> <accept|decline|tentative> Update your RSVP status
gro calendar color <event-id> <color> Set event color (by name or ID 1-11)

Both support --calendar <cal-id> (defaults to primary), --json, --dry-run. Single-event operations — no --stdin/--query.

Color names: lavender, sage, grape, flamingo, banana, tangerine, peacock, graphite, blueberry, basil, tomato (Google Calendar's 11 event colors, IDs 1-11).

Files to Create

File Purpose
internal/cmd/calendar/rsvp.go RSVP command
internal/cmd/calendar/rsvp_test.go Tests
internal/cmd/calendar/color.go Color command
internal/cmd/calendar/color_test.go Tests

Files to Modify

File Change
internal/auth/auth.go Add calendar.CalendarEventsScope to AllScopes
internal/auth/auth_test.go Update scope count/assertions
internal/architecture/architecture_test.go Add CalendarEventsScope to allowlist (already present from #98)
internal/calendar/client.go Add RSVPEvent, SetEventColor methods
internal/cmd/calendar/output.go Extend CalendarClient interface
internal/cmd/calendar/mock_test.go Add mock function fields
internal/cmd/calendar/calendar.go Register new subcommands
internal/cmd/calendar/handlers_test.go Add handler tests
integration-tests.md Add calendar organizational test section
README.md Add calendar organizational operations examples

Integration Tests

Calendar RSVP

Test Case Command Expected
Accept event EVENT=$(gro cal events --max 1 --json | jq -r '.[0].id'); gro cal rsvp "$EVENT" accept "RSVP'd 'accepted' to event."
Decline dry run gro cal rsvp <event-id> decline --dry-run "[dry-run] Would RSVP 'declined' to event."
Tentative gro cal rsvp <event-id> tentative "RSVP'd 'tentative' to event."
Invalid response gro cal rsvp <event-id> maybe Error: invalid response (must be accept/decline/tentative)
With calendar flag gro cal rsvp <event-id> accept --calendar <cal-id> RSVP on specified calendar
JSON output gro cal rsvp <event-id> accept --json Valid JSON result

Calendar Color

Test Case Command Expected
Set color by name gro cal color <event-id> tomato "Set event color to tomato."
Set color by ID gro cal color <event-id> 11 "Set event color to tomato."
Dry run gro cal color <event-id> sage --dry-run "[dry-run] Would set event color to sage."
Invalid color gro cal color <event-id> purple Error: invalid color name
JSON output gro cal color <event-id> flamingo --json Valid JSON result

Key Risks

  • RSVP requires user email — need to find the current user's attendee entry in the event's attendee list to update responseStatus. Requires the user's email from the Calendar API or Gmail profile.
  • Events not owned by user — RSVP should work on events the user is invited to, but color-coding may only work on events in the user's calendar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions