Skip to content

Return Bet object from PostBet - #16

Merged
jonnyspicer merged 3 commits into
mainfrom
fix/issue-15-postbet-return-bet
Feb 16, 2026
Merged

jonnyspicer merged 3 commits into
mainfrom
fix/issue-15-postbet-return-bet

Conversation

@jonnyspicer

Copy link
Copy Markdown
Owner

Summary

  • Change PostBet signature from error to (*Bet, error) to expose the API response
  • Use existing parseResponse generic to deserialize the response body into a Bet
  • Update unit test to verify returned Bet fields (ID, shares, probAfter)
  • Update integration test to assert on returned bet ID and contractId
  • Update README example to show new return value

Breaking change

This changes the PostBet return type. Callers using err := mc.PostBet(...) will need to update to bet, err := mc.PostBet(...) (or _, err := to preserve existing behavior).

Test plan

  • go test ./... passes
  • go vet ./... clean
  • Unit test verifies Bet fields are deserialized from mock response
  • Integration test asserts on returned bet ID and contractId
  • Verify against live Manifold API with limit orders to confirm fill details are populated

Fixes #15

🤖 Generated with Claude Code

jonnyspicer and others added 3 commits February 16, 2026 17:50
PostBet now returns (*Bet, error) instead of just error, exposing the
full Bet object from the Manifold API response. This includes the bet
ID (needed for CancelBet), shares, probability impact, fees, and fill
details for limit orders.

Fixes #15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Manifold API returns "betId" (not "id") from POST /v0/bet.
Add BetId field to Bet struct and normalize to Id in PostBet so
callers can consistently use bet.Id.

Verified against live Manifold API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jonnyspicer
jonnyspicer force-pushed the fix/issue-15-postbet-return-bet branch from 2492bf6 to 2b892a1 Compare February 16, 2026 04:51
@jonnyspicer
jonnyspicer merged commit e149e42 into main Feb 16, 2026
3 checks passed
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.

PostBet discards API response body, should return Bet object

1 participant