Skip to content

Commit

Permalink
Add GetContentReplies
Browse files Browse the repository at this point in the history
  • Loading branch information
tchap committed Jun 28, 2016
1 parent 358a53e commit e85e5ec
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |

Expand Down
13 changes: 11 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
54 changes: 27 additions & 27 deletions data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e85e5ec

Please sign in to comment.