Repository navigation
Conversation
Helpers that build reports (Search Console, Analytics, Forms responses, calendar free slots) need columns in a fixed order: the dimension first, or a form's questions in form order. serde_json objects sort their keys, so format_value cannot keep that order. render_report keeps it for table and CSV, wraps rows in an envelope for JSON and YAML, and prints a clear note instead of an empty table when there are no rows. fetch_json and api_error let a helper call an API directly with the same retry and Google error parsing that execute_method uses.
+agenda showed when and where an event was but not how to join it. Each entry now carries 'meet': the event's hangoutLink, else the first video entry point of its conference data. Table and CSV keep the columns in a readable order (start, end, summary, calendar, meet, location); JSON keeps its existing shape with the new field. +free answers 'when am I free?' in one command: free gaps of at least --minutes inside --between working hours for the next --days days, in the account timezone (or --timezone), optionally weekdays only. Busy time comes from each calendar's events so that the rules match how people read their calendar: events marked free, cancelled or declined don't block; all-day events (postings, trips, reminders) don't block unless they are out-of-office or --count-all-day is set. Measured on a live calendar: a six-week all-day posting marked busy made the freeBusy API report every working hour taken. Calendars shared as free/busy only fall back to the freeBusy API. By default only calendars you own or edit count; --all-calendars and --calendar widen or narrow that.
🦋 Changeset detectedLatest commit: 40a4cc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
hallelx2
added a commit
to hallelx2/gws-cli
that referenced
this pull request
Nov 23, 2026
…for the report, YouTube, Forms and Calendar helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extends the existing Calendar helpers rather than adding new services.
calendar +agendanow shows each event's Google Meet link (hangoutLink, or the first video entry point inconferenceData). Table and CSV output keep a fixed column order (start, end, summary, calendar, meet, location), and an empty range printsNo events between X and Y.JSON keeps its existing shape (events,count,timeMin,timeMax), with a newmeetfield per event.calendar +free(new) finds open slots:events.list, notfreeBusy, so it can leave out what shouldn't block you: cancelled events, events marked "free" (transparent), events you declined, and all-day events, unless they are out-of-office or--count-all-dayis given. (freeBusycounts a weeks-long all-day "posting" event as busy and leaves no free time at all.) For a calendar the login can't list events on (403/404), it falls back tofreeBusy.--calendar(repeatable) or--all-calendarschange that.--betweenon each day, in the primary calendar's time zone or--timezone. Output: day, start, end, length.Input validation (AGENTS.md checklist)
--days(1–60),--minutes(5–1440) are range-checked;--betweenmust beHH:MM-HH:MMwith start before end;--timezonemust be an IANA zone; calendar ids go throughencode_path_segment.Shared base commit. The first commit,
feat(formatter): ordered report rendering and direct-call JSON fetch(1ab84c5), is shared by this PR and its siblings (Search Console/Analytics reports, YouTube, Forms, Calendar). It adds:formatter::render_report: prints rows in a fixed column order (serde_json has nopreserve_orderhere, soformat_valuesorts keys), with a title line, and a clear note instead of an empty table. CSV keeps its header and sends the note to stderr; JSON/YAML carrycolumns,count,rowsand anote.executor::fetch_json/api_error: one direct API call with the existingsend_with_retry, mapping errors throughhandle_error_responseso helpers keep the structuredGwsError::Apishape.Whichever of these PRs merges first brings it in; the others then rebase cleanly.
Testing
--betweenparsing, quarter-hour rounding, working windows, interval merging, slot finding, the busy rules (transparent, declined, cancelled, all-day, out-of-office),freeBusyparsing and calendar selection.+agendashowed Meet links.+freeover three days skipped a weeks-long all-day event and found the expected slots in Africa/Lagos time.cargo fmt --checkis clean.cargo test: all pass except the two ADC tests that also fail onmainon machines with gcloud ADC configured.skills/gws-calendar-free, one line inskills/gws-calendar,docs/skills.md).Dry Run Output: not applicable; both helpers only read.
Invariant review
busy_from_events: pagedevents.listper calendar, capped at 20 pages of 2,500. Safe by construction. ThefreeBusyfallback batches 50 calendars per call.events.listfalls back tofreeBusyfor that calendar; it is not swallowed. Other errors propagate.Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings (none new;mainalready fails a few lints on rustc 1.99).pnpx changeset) to document my changes.