fix(todos): use completed=true for completed filters

Merged
RO
7mo ago
+111-12

Summary

  • fix the Go TodosService.List wrapper so Status: "completed" sends completed=true
  • preserve Status: "pending" as the API default instead of sending status=pending
  • add a red/green request-level test that locks the query mapping down

Problem

basecamp-cli issue #445 reported that completed to-do filtering returned zero results.

The API behavior is correct:

  • completed=true filters to completed to-dos
  • status is for recording lifecycle (active|archived|trashed)

The generated Go client already models those as separate query params. The bug lived in the handwritten Go SDK wrapper, which treated TodoListOptions.Status as a completion filter and forwarded values like completed and pending through status=....

That produced requests like ?status=completed, which the API ignores.

Why this PR is focused

This only fixes the Go SDK wrapper/query mapping that caused the bad request shape.

It does not broaden the SDK surface area or change CLI behavior directly. That keeps the review scoped to the bug reported in #445 and leaves any follow-up API/CLI ergonomics changes for separate PRs.

Testing

  • added a failing-then-passing wrapper test for todo list query params
  • make check

Summary by cubic

Expose a Completed filter for todos and send completed=true when set; restrict Status to lifecycle (archived|trashed) and reject unsupported values so both filters can be combined reliably. Fixes completed filtering returning 0 results.

  • Bug Fixes

    • Send completed=true when Completed is true; pass through Status="archived"|"trashed" and allow combinations.
    • Omit status for defaults (incomplete todos with inherited status); stop sending status=pending.
    • Reject unsupported Status values (e.g., "completed", "pending", "active") with a usage error; add request-level tests for query params and invalid statuses; fixes basecamp-cli issue #445.
  • Migration

    • Breaking (pre-1.0): TodoListOptions.Status now only accepts "archived" or "trashed" (no "completed", "pending", or "active").
    • Migrate: Status: "completed" → Completed: true; Status: "pending" → omit Status.