-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuser.go
50 lines (44 loc) · 1.36 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package gonextcloud
import "strconv"
// User encapsulate the data needed to create a new Nextcloud's User
type User struct {
Username string
Email string
DisplayName string
Quota string
Language string
Groups []string
}
// UserDetails is the raw Nextcloud User response
type UserDetails struct {
Enabled bool `json:"enabled"`
ID string `json:"id"`
Quota Quota `json:"quota"`
Email string `json:"email"`
Displayname string `json:"displayname"`
Phone string `json:"phone"`
Address string `json:"address"`
Website string `json:"website"`
Twitter string `json:"twitter"`
Groups []string `json:"groups"`
Language string `json:"language,omitempty"`
StorageLocation string `json:"storageLocation,omitempty"`
LastLogin int64 `json:"lastLogin,omitempty"`
Backend string `json:"backend,omitempty"`
Subadmin []interface{} `json:"subadmin,omitempty"`
Locale string `json:"locale,omitempty"`
}
// Quota is a use storage Quota
type Quota struct {
Free int64 `json:"free"`
Used int64 `json:"used"`
Total int64 `json:"total"`
Relative float64 `json:"relative"`
Quota int64 `json:"quota"`
}
func (q *Quota) String() string {
if q.Quota < 0 {
return "none"
}
return strconv.FormatInt(q.Quota, 10)
}