feat: add GetContent + bump steemutil to v0.0.30 - #14
Merged
Conversation
Add GetContent(author, permlink) wrapping condenser_api.get_content with
the single-object return pattern (like GetFollowCount): positional params
[author, permlink], returns *protocolapi.Content (now available in
steemutil v0.0.30).
Bump steemutil require v0.0.29 -> v0.0.30.
Tests:
- TestGetContent: mock server returns a discussion with deliberately MIXED
share_type forms (net_rshares as JSON string, total_vote_weight as JSON
number; active_votes[0].rshares string vs [1].rshares number) to prove
the json.RawMessage fields decode both forms steemd emits.
- TestGetContent_ParamsShape: asserts params is [author, permlink].
- GetContent added to the TestParamsShape_IsArrayNotObject table.
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
Add
GetContent(author, permlink string) (*protocolapi.Content, error)wrappingcondenser_api.get_content, for steemdb-sync's comment rescanner (Batch 5). Uses the single-object return pattern (likeGetFollowCount): positional params[author, permlink], returns a pointer.Bumps
steemutilrequirev0.0.29→v0.0.30, which provides the newContent/VoteState/Beneficiarytypes (steemutil #18, tagv0.0.30).Why this depends on steemutil v0.0.30
The
Content/VoteStatetypes did not exist before. Critically, steemutil #18 corrected a spec error: the original requirement assumed the share_type fields were "always JSON strings", but live testing showed they are int/string-mixed (within one response,active_votes[].rshareshas both a number2125781185and a string"221646137396"). Those fields usejson.RawMessagein steemutil, so this SDK's tests deliberately exercise both forms.Tests
go build ./...+go test ./...all green.TestGetContent— mock server returns a discussion with deliberately mixed share_type forms (top-levelnet_rsharesas JSON string,total_vote_weightas JSON number;active_votes[0].rsharesstring vs[1].rsharesnumber) to prove thejson.RawMessagefields decode both forms steemd emits.TestGetContent_ParamsShape— asserts params is[author, permlink](2-element positional array).GetContentadded to theTestParamsShape_IsArrayNotObjecttable.After merge
This SDK will need its own version bump (e.g.
v0.0.30) so downstream consumers (steemdb-sync, etc.) can pick upGetContent.