aboutsummaryrefslogtreecommitdiff
path: root/mastodon
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-15 17:37:58 +0000
committerr <r@freesoftwareextremist.com>2019-12-15 17:37:58 +0000
commitf68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f (patch)
tree301e89bb8ebb56b9756fe322eb9ad953bac2661e /mastodon
parent51a4b16af518fde883df50f7f627fda21c18065e (diff)
downloadbloat-f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f.tar.gz
bloat-f68d72ae0eb2eb6c15cd225c1a3b9185aaa20e3f.zip
Add notification support
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/notification.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/mastodon/notification.go b/mastodon/notification.go
index 236fcbf..d793905 100644
--- a/mastodon/notification.go
+++ b/mastodon/notification.go
@@ -4,16 +4,22 @@ import (
"context"
"fmt"
"net/http"
+ "net/url"
"time"
)
+type NotificationPleroma struct {
+ IsSeen bool `json:"is_seen"`
+}
+
// Notification hold information for mastodon notification.
type Notification struct {
- ID string `json:"id"`
- Type string `json:"type"`
- CreatedAt time.Time `json:"created_at"`
- Account Account `json:"account"`
- Status *Status `json:"status"`
+ ID string `json:"id"`
+ Type string `json:"type"`
+ CreatedAt time.Time `json:"created_at"`
+ Account Account `json:"account"`
+ Status *Status `json:"status"`
+ Pleroma *NotificationPleroma `json:"pleroma"`
}
// GetNotifications return notifications.
@@ -40,3 +46,11 @@ func (c *Client) GetNotification(ctx context.Context, id string) (*Notification,
func (c *Client) ClearNotifications(ctx context.Context) error {
return c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/clear", nil, nil, nil)
}
+
+// ReadNotifications marks notifications as read
+// Currenly only works for Pleroma
+func (c *Client) ReadNotifications(ctx context.Context, maxID string) error {
+ params := url.Values{}
+ params.Set("max_id", maxID)
+ return c.doAPI(ctx, http.MethodPost, "/api/v1/pleroma/notifications/read", params, nil, nil)
+}