Repository navigation
athletes.getFuelingProfile, the fueling-profile types and the two sharing webhook types - #28
Open
DrAlexHarrison wants to merge 2 commits into
Open
DrAlexHarrison wants to merge 2 commits into
DrAlexHarrison wants to merge 2 commits into
Conversation
…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>
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.
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_sharingonAthlete, no types for webhook bodies, and an unexportedWebhookEventTypenaming two events registration rejects.After.
athletes.getFuelingProfile(athleteId)→FuelingProfile(GET /v1/athletes/{id}/fueling-profile). A union to narrow onsharing:ongivesprofile(FuelingProfileAnswers:sex,age,athlete_weight_kg,sweat_level,saltiness,satiety_level,fitness_level,carb_experience,usual_carb_consumption,concerns, each aFuelingProfileFieldwithvalueandcalculations_use) andupdated_at;offandnot_linkedgivemessage, and TypeScript refusesprofilethere.Athlete.profile_sharing?: ProfileSharing(on|off|not_linked).WebhookEvent,ProfileSharingChangedEvent,FuelingProfileUpdatedEvent(data = the athlete record; the second addschanged_fields: FuelingProfileFieldName[]).WebhookEventTypeexported, matching what registration accepts: addsathlete.profile_completed, the two sharing events andwebhook.test; dropsprescription.updatedandpartner.rate_limit_exceeded, which registration rejects (one bad name fails the whole registration).readme.test.ts), CHANGELOG under Unreleased.Tests
test/fixtures/generate.go: GET athlete withprofile_sharing, the fueling profile in its three states (answers parsed bypartner.ParseAppProfile, one perpartner.SharedProfileFields), both webhook envelopes. The existing fixtures are byte-identical; only_metaand 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.tstype-checks the new fixtures against the declarations, narrows the union, and rejectsprofilewhen 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 --noEmitclean;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