diff -r 94f139efff39 -r 5496be0e3d4f notifications.go --- a/notifications.go Wed Apr 12 23:47:52 2017 +0200 +++ b/notifications.go Wed Apr 12 23:58:34 2017 +0200 @@ -18,7 +18,6 @@ return notifications, fmt.Errorf("notifications API query: %s", err.Error()) } - println(r.Body) err = json.Unmarshal([]byte(r.Body), ¬ifications) if err != nil { var res struct { @@ -44,7 +43,6 @@ return ¬ification, fmt.Errorf("notification API query: %s", err.Error()) } - println(r.Body) err = json.Unmarshal([]byte(r.Body), ¬ification) if err != nil { var res struct { @@ -59,3 +57,16 @@ return ¬ification, nil } + +// ClearNotifications deletes all notifications from the Mastodon server for +// the authenticated user +func (g *Client) ClearNotifications() error { + req := g.prepareRequest("notifications/clear") + req.Method = rest.Post + r, err := rest.API(req) + if err != nil { + return notifications, fmt.Errorf("notifications/clear API query: %s", err.Error()) + } + + return nil // TODO: check returned object (should be empty) +}