Skip to content

athletes.getFuelingProfile, the fueling-profile types and the two sharing webhook types - #28

Open
DrAlexHarrison wants to merge 2 commits into
mainfrom
psharing-sdk
Open

DrAlexHarrison wants to merge 2 commits into
mainfrom
psharing-sdk

Conversation

@DrAlexHarrison

@DrAlexHarrison DrAlexHarrison commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Depends-On: SaturdayInc/fuel-backend#1759

What changes for a partner using the SDK

Before. No way to read an athlete's shared Saturday app answers, no profile_sharing on Athlete, no types for webhook bodies, and an unexported WebhookEventType naming two events registration rejects.

After.

  • athletes.getFuelingProfile(athleteId) → FuelingProfile (GET /v1/athletes/{id}/fueling-profile). A union to narrow on sharing: on gives profile (FuelingProfileAnswers: sex, age, athlete_weight_kg, sweat_level, saltiness, satiety_level, fitness_level, carb_experience, usual_carb_consumption, concerns, each a FuelingProfileField with value and calculations_use) and updated_at; off and not_linked give message, and TypeScript refuses profile there.
  • Athlete.profile_sharing?: ProfileSharing (on | off | not_linked).
  • WebhookEvent, ProfileSharingChangedEvent, FuelingProfileUpdatedEvent (data = the athlete record; the second adds changed_fields: FuelingProfileFieldName[]).
  • WebhookEventType exported, matching what registration accepts: adds athlete.profile_completed, the two sharing events and webhook.test; drops prescription.updated and partner.rate_limit_exceeded, which registration rejects (one bad name fails the whole registration).
  • README section "Athlete profile sharing" (type-checked by readme.test.ts), CHANGELOG under Unreleased.

Tests

  • Contract fixtures regenerated from fuel-backend #1759 head cbc1bcea by test/fixtures/generate.go: GET athlete with profile_sharing, the fueling profile in its three states (answers parsed by partner.ParseAppProfile, one per partner.SharedProfileFields), both webhook envelopes. The existing fixtures are byte-identical; only _meta and the new ones change. The generator is now identical to saturday-python's (node's copy had fallen behind its own fixture in Coach Connect types carry every field the billing reads return #26).
  • contracts.test.ts type-checks the new fixtures against the declarations, narrows the union, and rejects profile when not shared, an unknown changed field and a retired event name; the method test checks the route, the GET and the raw payload for all three states.
  • tsc --noEmit clean; jest: 7 suites, 139 passed, 1 skipped (pre-existing).

Not done here

📦 Publish owed: nothing goes to npm from this PR. A release (version bump, then a GitHub release, which runs publish.yml) should follow once fuel-backend #1759 is deployed to prod.

Lands after fuel-backend #1759: regenerating the fixtures needs its types.

🤖 Generated with Claude Code

DrAlexHarrison and others added 2 commits October 10, 2026 07:54
…ring webhook types

getFuelingProfile(athleteId) reads GET /v1/athletes/{id}/fueling-profile and
returns FuelingProfile, a union to narrow on sharing: on carries profile and
updated_at, off and not_linked carry message. Athlete gains profile_sharing.
ProfileSharingChangedEvent and FuelingProfileUpdatedEvent type the two
sharing webhooks, whose data is the athlete record (the second adds
changed_fields). WebhookEventType now lists the names registration accepts.

The fixture generator gains the sharing fixtures, built from fuel-backend's
types (#1759), and matches saturday-python's generator again: its billing
fixtures had been regenerated by the newer one in #26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nly _meta moves)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant