55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"go.etztech.xyz/go-mcm/model/django"
|
|
)
|
|
|
|
type Results int64
|
|
|
|
const (
|
|
Results10 Results = 10
|
|
Results25 Results = 25
|
|
Results50 Results = 50
|
|
Results100 Results = 100
|
|
ResultsAll Results = -1
|
|
)
|
|
|
|
type Theme string
|
|
|
|
const (
|
|
ThemesDefault Theme = "DE"
|
|
ThemesDark Theme = "DA"
|
|
ThemesSolar Theme = "SO"
|
|
ThemesSlate Theme = "SL"
|
|
)
|
|
|
|
type UserSettings struct {
|
|
ID int64 `json:"id"`
|
|
AuthUserID int64 `json:"auth_user_id"`
|
|
DefaultResults Results `json:"default_results"`
|
|
DefaultTheme Theme `json:"default_theme"`
|
|
DefaultTimezone string `json:"default_timezone"`
|
|
SearchPlayerIP bool `json:"search_player_ip"`
|
|
ShowTimestampChat bool `json:"show_timestamp_chat"`
|
|
LastIP string `json:"last_ip"`
|
|
Link string `json:"link"`
|
|
}
|
|
|
|
func (q *Query) UserSettings(builder *django.Builder) ([]*UserSettings, error) {
|
|
endpoint := q.endpoint("usersettings", builder.QueryString())
|
|
userSettingss := make([]*UserSettings, 0)
|
|
|
|
resp, err := response(endpoint)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
err = json.Unmarshal(resp, &userSettingss)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return userSettingss, nil
|
|
}
|