Clone the twdehands SDK into mrktplaats and retarget naming and defaults for app.marktplaats.nl while keeping the same request/response bodies and endpoint behavior.
32 lines
951 B
Go
32 lines
951 B
Go
package mrktplaats
|
|
|
|
import "context"
|
|
|
|
// NotificationService handles notification counts.
|
|
type NotificationService struct {
|
|
t *transport
|
|
}
|
|
|
|
// NotificationEvent is an analytics event associated with notifications.
|
|
type NotificationEvent struct {
|
|
EventType string `json:"eventType"`
|
|
Category string `json:"category"`
|
|
Action string `json:"action"`
|
|
Label string `json:"label"`
|
|
}
|
|
|
|
// UnreadCountResponse contains the unread notification count.
|
|
type UnreadCountResponse struct {
|
|
UnreadNotificationsCount int `json:"unreadNotificationsCount"`
|
|
Events []NotificationEvent `json:"events"`
|
|
}
|
|
|
|
// UnreadCount returns the number of unread notifications.
|
|
func (s *NotificationService) UnreadCount(ctx context.Context) (*UnreadCountResponse, error) {
|
|
var resp UnreadCountResponse
|
|
if err := s.t.get(ctx, "/app/notification-center/v1/unreadCount", nil, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|