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.
forms responses list returns answers keyed by opaque question IDs,
so reading results meant joining them to the form's items by hand.
forms +responses does the join: one row per response, oldest first,
with submitted time, respondent email and quiz score when present,
then one column per question titled as in the form. A grid question
gives one column per row ('Question [row]'), several answers to one
question are joined with '; ', file uploads show their name and Drive
link, and duplicate titles are made unique so CSV headers are too.
It takes a form ID or edit URL (a public /forms/d/e/ link is refused
with an explanation), and --since a date (local midnight) or RFC 3339
time, sent as the API's timestamp filter. All pages are fetched.
🦋 Changeset detectedLatest commit: 4a83caf 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 |
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
Adds
forms +responses: a form's responses as one row each, with the question titles as column headers. The rawforms.responses.listoutput is keyed by question id, so reading it means a secondforms.getand a join by hand.submitted, then each question in form order, thenemailandscorewhen the form collects them, thenresponse_id.Title [row]). Several answers join with;. Uploaded files show as file name plus Drive link. Headers that repeat, or clash with the fixed columns, get a numeric suffix.--sincetakes a date (local midnight) or an RFC 3339 time and becomes the API'stimestamp >= …filter.--format csv|json|yamlwork as usual.Input validation (AGENTS.md checklist)
docs.google.com/forms/d/<id>/editURL; the id must be URL-safe characters only. The public/forms/d/e/…link (a different id that the API rejects) is refused with a hint to use the edit URL.encode_path_segment; the filter through.query().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
--sinceparsing, column building (grid rows, duplicate titles, reserved names), answer text (multiple answers, files) and row assembly.--since.cargo fmt --checkis clean.cargo test: all pass except the two ADC tests that also fail onmainon machines with gcloud ADC configured.skills/gws-forms-responses,docs/skills.md).Dry Run Output: not applicable; the helper only reads (
forms.get,forms.responses.list).Invariant review
forms.responses.list, capped at 200 pages of 5,000. Safe by construction.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.