add GetStatusCard

pull/10/head
Yasuhiro Matsumoto 2017-04-15 00:25:35 +09:00
parent acb5a81b87
commit 52add89d1d
1 changed files with 18 additions and 0 deletions

View File

@ -37,6 +37,14 @@ type Context struct {
Descendants []*Status `descendants` Descendants []*Status `descendants`
} }
// Card hold information for mastodon card.
type Card struct {
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
Image string `json:"image"`
}
// GetStatus return status specified by id. // GetStatus return status specified by id.
func (c *Client) GetStatus(id string) (*Status, error) { func (c *Client) GetStatus(id string) (*Status, error) {
var status Status var status Status
@ -57,6 +65,16 @@ func (c *Client) GetStatusContext(id string) (*Context, error) {
return &context, nil return &context, nil
} }
// GetStatusCard return status specified by id.
func (c *Client) GetStatusCard(id string) (*Card, error) {
var card Card
err := c.doAPI(http.MethodGet, fmt.Sprintf("/api/v1/statuses/%d/card", id), nil, &card)
if err != nil {
return nil, err
}
return &card, nil
}
// GetTimelineHome return statuses from home timeline. // GetTimelineHome return statuses from home timeline.
func (c *Client) GetTimelineHome() ([]*Status, error) { func (c *Client) GetTimelineHome() ([]*Status, error) {
var statuses []*Status var statuses []*Status