jellyseerr: add user modification methods
addded permissions get/set before realizing it already comes as part of the User object. Split User attributes that will be templated into UserTemplate struct, which User inherits. ApplyTemplateToUser takes a UserTemplate, while ModifyUser takes a plain map with some typed fields (display name and email, for now).
This commit is contained in:
+23
-6
@@ -2,8 +2,15 @@ package jellyseerr
|
||||
|
||||
import "time"
|
||||
|
||||
type UserField string
|
||||
|
||||
const (
|
||||
FieldDisplayName UserField = "displayName"
|
||||
FieldEmail UserField = "email"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Permissions int `json:"permissions"`
|
||||
UserTemplate // Note: You can set this with User.UserTemplate = value.
|
||||
Warnings []any `json:"warnings"`
|
||||
ID int `json:"id"`
|
||||
Email string `json:"email"`
|
||||
@@ -11,23 +18,27 @@ type User struct {
|
||||
JellyfinUsername string `json:"jellyfinUsername"`
|
||||
Username string `json:"username"`
|
||||
RecoveryLinkExpirationDate any `json:"recoveryLinkExpirationDate"`
|
||||
UserType int `json:"userType"`
|
||||
PlexID string `json:"plexId"`
|
||||
JellyfinUserID string `json:"jellyfinUserId"`
|
||||
JellyfinDeviceID string `json:"jellyfinDeviceId"`
|
||||
JellyfinAuthToken string `json:"jellyfinAuthToken"`
|
||||
PlexToken string `json:"plexToken"`
|
||||
Avatar string `json:"avatar"`
|
||||
MovieQuotaLimit any `json:"movieQuotaLimit"`
|
||||
MovieQuotaDays any `json:"movieQuotaDays"`
|
||||
TvQuotaLimit any `json:"tvQuotaLimit"`
|
||||
TvQuotaDays any `json:"tvQuotaDays"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
RequestCount int `json:"requestCount"`
|
||||
DisplayName string `json:"displayName"`
|
||||
}
|
||||
|
||||
type UserTemplate struct {
|
||||
Permissions Permissions `json:"permissions"`
|
||||
UserType int `json:"userType"`
|
||||
MovieQuotaLimit any `json:"movieQuotaLimit"`
|
||||
MovieQuotaDays any `json:"movieQuotaDays"`
|
||||
TvQuotaLimit any `json:"tvQuotaLimit"`
|
||||
TvQuotaDays any `json:"tvQuotaDays"`
|
||||
}
|
||||
|
||||
type PageInfo struct {
|
||||
Pages int `json:"pages"`
|
||||
PageSize int `json:"pageSize"`
|
||||
@@ -39,3 +50,9 @@ type GetUsersDTO struct {
|
||||
Page PageInfo `json:"pageInfo"`
|
||||
Results []User `json:"results"`
|
||||
}
|
||||
|
||||
type permissionsDTO struct {
|
||||
Permissions Permissions `json:"permissions"`
|
||||
}
|
||||
|
||||
type Permissions int
|
||||
|
||||
Reference in New Issue
Block a user