fix: API ergonomics from dev feedback (0.2.2)#5
Merged
Conversation
…isk_points() - Remove BlockingCyclesClient::builder() that silently returned an async client builder; add CyclesClientBuilder::build_blocking() instead - Add Amount::risk_points() convenience constructor for RISK_POINTS unit - Bump version to 0.2.2
- Add usd_microcents(), tokens(), credits(), risk_points() to SignedAmount matching Amount's convenience constructors - Add BlockingCyclesClient::config() accessor for parity with async client - Add BlockingCyclesClient::create_reservation_with_metadata() for accessing response headers in blocking mode
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.
Summary
Addresses developer feedback on API ergonomics gaps:
BlockingCyclesClient::builder()— it returnedCyclesClientBuilderwhosebuild()silently produced an async client. Replaced withCyclesClientBuilder::build_blocking()which correctly returnsResult<BlockingCyclesClient, Error>Amount::risk_points()constructor —RISK_POINTSis a first-class protocol unit but was the only one missing a convenience constructorSignedAmountconstructors —usd_microcents(),tokens(),credits(),risk_points()for parity withAmountBlockingCyclesClient::config()andcreate_reservation_with_metadata()— parity methods that existed on the async client but were missing from blockingVersion bumped to 0.2.2. CHANGELOG and AUDIT.md updated.
Test plan
cargo build --all-features— cleancargo clippy --all-features -- -W clippy::all— cleancargo fmt --check— cleancargo test --all-features— 142 tests passcargo tarpaulin— 96.40% coverage (above 95% threshold)BlockingCyclesClient::builder()