enbas/internal/client/notifications.go

33 lines
787 B
Go

// SPDX-FileCopyrightText: 2024 Dan Anglin <d.n.i.anglin@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-or-later
package client
import (
"fmt"
"net/http"
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
)
func (g *Client) GetNotifications(limit int) ([]model.Notification, error) {
path := fmt.Sprintf("/api/v1/notifications?limit=%d", limit)
url := g.Authentication.Instance + path
var notifications []model.Notification
if err := g.sendRequest(http.MethodGet, url, nil, &notifications); err != nil {
return nil, fmt.Errorf("received an error after sending the request to get your notifications: %w", err)
}
return notifications, nil
}
func (g *Client) GetNotification() error {
return nil
}
func (g *Client) DeleteAllNotifications() error {
return nil
}