2024-05-20 19:46:05 +01:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
|
|
|
)
|
|
|
|
|
2024-06-17 18:59:20 +01:00
|
|
|
func (g *Client) GetUserPreferences() (*model.Preferences, error) {
|
2024-05-20 19:46:05 +01:00
|
|
|
url := g.Authentication.Instance + "/api/v1/preferences"
|
|
|
|
|
|
|
|
var preferences model.Preferences
|
|
|
|
|
|
|
|
if err := g.sendRequest(http.MethodGet, url, nil, &preferences); err != nil {
|
2024-06-17 18:59:20 +01:00
|
|
|
return nil, fmt.Errorf("received an error after sending the request to get the user preferences: %w", err)
|
2024-05-20 19:46:05 +01:00
|
|
|
}
|
|
|
|
|
2024-06-17 18:59:20 +01:00
|
|
|
return &preferences, nil
|
2024-05-20 19:46:05 +01:00
|
|
|
}
|