diff --git a/README.md b/README.md index bd26a49..b923b06 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ It is a bit confusing to see `set_` prefix. Needs research. | Method Name | Raw Version | Full Version | | ------------------------------------- |:-----------:|:--------------:| | get_content | DONE | PARTIALLY DONE | -| get_content_replies | DONE | | +| get_content_replies | DONE | PARTIALLY DONE | | get_discussions_by_author_before_date | | | | get_replies_by_last_update | DONE | | diff --git a/client.go b/client.go index a34e5ac..3401a6a 100644 --- a/client.go +++ b/client.go @@ -334,8 +334,17 @@ func (client *Client) GetContent(author, permlink string) (*Content, error) { return &resp, nil } -func (client *Client) GetContentRepliesRaw(parent, parentPermlink string) (*json.RawMessage, error) { - return client.callRaw("get_content_replies", []string{parent, parentPermlink}) +func (client *Client) GetContentRepliesRaw(parentAuthor, parentPermlink string) (*json.RawMessage, error) { + return client.callRaw("get_content_replies", []string{parentAuthor, parentPermlink}) +} + +func (client *Client) GetContentReplies(parentAuthor, parentPermlink string) ([]*Content, error) { + var resp []*Content + err := client.t.Call("get_content_replies", []string{parentAuthor, parentPermlink}, &resp) + if err != nil { + return nil, err + } + return resp, nil } func (client *Client) GetRepliesByLastUpdateRaw( diff --git a/data.go b/data.go index 4804dbb..2b47104 100644 --- a/data.go +++ b/data.go @@ -131,33 +131,33 @@ func (op *CommentOperation) IsStoryOperation() bool { } type Content struct { - Id *types.ID `json:"id"` - RootTitle string `json:"root_title"` - Active *types.Time `json:"active"` - AbsRshares *types.Int `json:"abs_rshares"` - PendingPayoutValue string `json:"pending_payout_value"` - TotalPendingPayoutValue string `json:"total_pending_payout_value"` - Category string `json:"category"` - Title string `json:"title"` - LastUpdate *types.Time `json:"last_update"` - Stats string `json:"stats"` - Body string `json:"body"` - Created *types.Time `json:"created"` - Replies []map[string]interface{} `json:"replies"` - Permlink string `json:"permlink"` - JsonMetadata *ContentMetadata `json:"json_metadata"` - Children *types.Int `json:"children"` - NetRshares *types.Int `json:"net_rshares"` - URL string `json:"url"` - ActiveVotes []*Vote `json:"active_votes"` - ParentPermlink string `json:"parent_permlink"` - CashoutTime *types.Time `json:"cashout_time"` - TotalPayoutValue string `json:"total_payout_value"` - ParentAuthor string `json:"parent_author"` - ChildrenRshares2 *types.Int `json:"children_rshares2"` - Author string `json:"author"` - Depth *types.Int `json:"depth"` - TotalVoteWeight *types.Int `json:"total_vote_weight"` + Id *types.ID `json:"id"` + RootTitle string `json:"root_title"` + Active *types.Time `json:"active"` + AbsRshares *types.Int `json:"abs_rshares"` + PendingPayoutValue string `json:"pending_payout_value"` + TotalPendingPayoutValue string `json:"total_pending_payout_value"` + Category string `json:"category"` + Title string `json:"title"` + LastUpdate *types.Time `json:"last_update"` + Stats string `json:"stats"` + Body string `json:"body"` + Created *types.Time `json:"created"` + Replies []*Content `json:"replies"` + Permlink string `json:"permlink"` + JsonMetadata *ContentMetadata `json:"json_metadata"` + Children *types.Int `json:"children"` + NetRshares *types.Int `json:"net_rshares"` + URL string `json:"url"` + ActiveVotes []*Vote `json:"active_votes"` + ParentPermlink string `json:"parent_permlink"` + CashoutTime *types.Time `json:"cashout_time"` + TotalPayoutValue string `json:"total_payout_value"` + ParentAuthor string `json:"parent_author"` + ChildrenRshares2 *types.Int `json:"children_rshares2"` + Author string `json:"author"` + Depth *types.Int `json:"depth"` + TotalVoteWeight *types.Int `json:"total_vote_weight"` } func (content *Content) IsStory() bool {