Add reports API

This commit is contained in:
chansuke 2017-04-17 04:51:16 +09:00
parent 5d72d54344
commit c5dbf39053
2 changed files with 31 additions and 2 deletions

View File

@ -50,8 +50,8 @@ if err != nil {
* [x] GET /api/v1/notifications * [x] GET /api/v1/notifications
* [x] GET /api/v1/notifications/:id * [x] GET /api/v1/notifications/:id
* [x] POST /api/v1/notifications/clear * [x] POST /api/v1/notifications/clear
* [ ] GET /api/v1/reports * [x] GET /api/v1/reports
* [ ] POST /api/v1/reports * [x] POST /api/v1/reports
* [ ] GET /api/v1/search * [ ] GET /api/v1/search
* [x] GET /api/v1/statuses/:id * [x] GET /api/v1/statuses/:id
* [x] GET /api/v1/statuses/:id/context * [x] GET /api/v1/statuses/:id/context

29
report.go Normal file
View File

@ -0,0 +1,29 @@
package mastodon
import "net/http"
// Report hold information for mastodon report.
type Report struct {
ID int64 `json:"id"`
ActionTaken bool `json:"action_taken"`
}
// GetReport return report of the current user.
func (c *Client) GetReport() (*Report, error) {
var reports Report
err := c.doAPI(http.MethodGet, "/api/v1/reports", nil, &reports)
if err != nil {
return nil, err
}
return reports, nil
}
// Report reports the report
func (c *Client) Report(id int64) (*Report, error) {
var report Report
err := c.doAPI(http.MethodPost, "/api/v1/reports", nil, &report)
if err != nil {
return nil, err
}
return &relationship, nil
}