Initial Marktplaats SDK scaffold
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.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user