shithub: hell

ref: 6bc49eaa4e79a09e0adf12006162374b3fc48c62
dir: /notifications.go/

View raw version
package main

import (
	"context"

	"github.com/mattn/go-mastodon"
)

func (hc *Hellclient) GetUnreadNotifications() (notifications []*mastodon.Notification, err error) {
	markers, err := hc.client.GetTimelineMarkers(context.Background(), []string{"notifications"})
	if err != nil {
		return
	}

	LastID := markers["notifications"].LastID

	page := &mastodon.Pagination{SinceID: LastID}

	notifications, err = hc.client.GetNotificationsExclude(context.Background(), nil, page)

	return
}

func (hc *Hellclient) PrintNotifications(notifications []*mastodon.Notification) {

	for _, notification := range notifications {
		PrintObjectProperties(notification, hc.debugMap)
	}

	return
}