Skip to content

Add ListAnswersByPerson to CheckinsService#276

Merged
jeremy merged 3 commits into
basecamp:mainfrom
robzolkos:feature/checkins-answers-by-person
Apr 29, 2026
Merged

Add ListAnswersByPerson to CheckinsService#276
jeremy merged 3 commits into
basecamp:mainfrom
robzolkos:feature/checkins-answers-by-person

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Apr 21, 2026

Summary

The BC3 API supports GET /questions/{id}/answers/by/{personId}.json to fetch a specific person's answers to a check-in question, and the generated Go client already exposes GetAnswersByPersonWithResponse. However, the CheckinsService had no service-layer wrapper for it.

This PR adds ListAnswersByPerson(ctx, questionID, personID int64, opts *AnswerListOptions) (*AnswerListResult, error) to CheckinsService, following the same pagination pattern as the existing ListAnswers method.

Changes

  • go/pkg/basecamp/checkins.go — new ListAnswersByPerson method on CheckinsService
  • go/pkg/basecamp/checkins_test.goTestCheckinsService_ListAnswersByPerson verifies path/method, plus a table-driven _Pagination test exercising multi-page collect, Page short-circuit, and limit truncation on both first page and mid-second-page (also retroactively covers ListAnswers's shared pagination path)
  • spec/fixtures/checkins/answers_by_person.json — fixture for the answers-by-person list response
  • scripts/check-service-drift.sh — drop the now-stale GetAnswersByPerson entry from EXCLUDED_OPS (this PR wraps it)

Naming

The method is ListAnswersByPerson rather than ListAnswersByUser to match upstream conventions: the Smithy spec defines GetAnswersByPerson, the Go generated client exposes GetAnswersByPersonWithResponse, the URL path is /by/{personId}, the parameter type is PersonId, and Ruby, Python, TypeScript, Kotlin, and Swift all use by_person/byPerson. "Person" is also the correct Basecamp domain term — it covers users, clients, employees, and vendors, all of whom can submit check-in answers.

Other languages

Ruby, Python, TypeScript, Kotlin, and Swift all already expose this endpoint — their SDKs are fully generated from the OpenAPI spec so byPerson/by_person was included from the start. The Go SDK is unique in having a hand-written service layer on top of the generated client, which is why only Go needed this change.

Context

This unblocks basecamp/basecamp-cli#443, which requests a --by filter on basecamp checkins answers. The CLI PR depends on this SDK method being available.

@github-actions github-actions Bot added go spec Changes to the Smithy spec or OpenAPI labels Apr 21, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Spec Change Impact

  • Added operation: ListAnswersByUser in CheckinsService.
  • Modified resources/types: None.
  • Removed operations/types/resources: None.
  • Breaking API change: No, this is a non-breaking change.

SDKs requiring updates:

  • Go
  • TypeScript
  • Ruby
  • Kotlin
  • Swift

All SDKs need regeneration to incorporate the added operation.

@robzolkos robzolkos changed the title feat(checkins): add ListAnswersByUser to CheckinsService Add ListAnswersByUser to CheckinsService Apr 21, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Wraps the existing GetAnswersByPersonWithResponse generated endpoint with
a proper service method, following the same pagination pattern as ListAnswers.

The BC3 API has supported GET /questions/{id}/answers/by/{personId}.json
but the Go SDK had no service-layer wrapper for it.
@robzolkos robzolkos force-pushed the feature/checkins-answers-by-person branch from 15fed52 to 2fe5be2 Compare April 21, 2026 14:26
Match the Basecamp domain term (Person, not User), the personID
parameter, and the URL path /by/{personId}. Other SDKs (TS, Ruby,
Python, Kotlin, Swift) all use byPerson/by_person.

Also drop the now-stale GetAnswersByPerson entry from EXCLUDED_OPS
in the drift check (this PR wraps it), tighten the test to assert
exact HTTP method and path including the account prefix, and align
the ListAnswers / ListAnswersByPerson godoc.
@github-actions github-actions Bot added the enhancement New feature or request label Apr 29, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="go/pkg/basecamp/checkins.go">

<violation number="1" location="go/pkg/basecamp/checkins.go:521">
P1: Export the wrapper as `ListAnswersByUser` to match the requested SDK API; `ListAnswersByPerson` is the wrong public method name.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread go/pkg/basecamp/checkins.go
@jeremy jeremy marked this pull request as ready for review April 29, 2026 19:27
Copilot AI review requested due to automatic review settings April 29, 2026 19:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Go CheckinsService wrapper for the “answers by person” check-in endpoint so callers can list a specific person’s answers using the same pagination/limit pattern as existing answer listing helpers.

Changes:

  • Add CheckinsService.ListAnswersByPerson(...) wrapper around the generated GetAnswersByPersonWithResponse operation, including limit + Link-header pagination handling.
  • Add a service-level test and a new fixture for the single-person answers response.
  • Update the service-drift script exclusions so GetAnswersByPerson is no longer treated as intentionally unwrapped.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
go/pkg/basecamp/checkins.go Adds ListAnswersByPerson service wrapper with pagination/limit behavior and updates pagination docs.
go/pkg/basecamp/checkins_test.go Adds a test verifying the correct endpoint path is called and the response is parsed.
spec/fixtures/checkins/answers_by_person.json Adds fixture data for the “answers by person” list response.
scripts/check-service-drift.sh Removes GetAnswersByPerson from the intentionally-unwrapped operation exclusions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/pkg/basecamp/checkins_test.go
Comment thread go/pkg/basecamp/checkins.go
Comment thread go/pkg/basecamp/checkins.go
Adds a table-driven multi-page test exercising the four distinct
branches of the answer-listing pagination flow:

  - multi-page collect across Link headers (no limit)
  - Page option returns first page only and skips Link follow
  - Limit smaller than first page triggers service-level truncation
  - Limit straddling the page boundary trims inside followPagination

ListAnswers shares the same followPagination helper, so this also
retroactively covers its (previously untested) pagination path.
@jeremy jeremy changed the title Add ListAnswersByUser to CheckinsService Add ListAnswersByPerson to CheckinsService Apr 29, 2026
@jeremy jeremy added this to the v0.8.0 milestone Apr 29, 2026
@jeremy jeremy merged commit 395dfe2 into basecamp:main Apr 29, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go spec Changes to the Smithy spec or OpenAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants