Add methods to report, un/ignore reports

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-20 16:25:23 -04:00
parent f86a559d76
commit b89df0b64f
5 changed files with 128 additions and 0 deletions
+18
View File
@@ -162,3 +162,21 @@ func (s *postAndCommentService) Downvote(ctx context.Context, id string) (*Respo
func (s *postAndCommentService) RemoveVote(ctx context.Context, id string) (*Response, error) {
return s.vote(ctx, id, novote)
}
// Report reports a post or comment.
// The reason must not be longer than 100 characters.
func (s *postAndCommentService) Report(ctx context.Context, id string, reason string) (*Response, error) {
path := "api/report"
form := url.Values{}
form.Set("api_type", "json")
form.Set("thing_id", id)
form.Set("reason", reason)
req, err := s.client.NewRequestWithForm(http.MethodPost, path, form)
if err != nil {
return nil, err
}
return s.client.Do(ctx, req, nil)
}