gonextcloud/types/user.go

50 lines
1.3 KiB
Go
Raw Normal View History

package types
2019-01-16 14:31:22 +00:00
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"`
}
type Quota struct {
Free int64 `json:"free"`
Used int64 `json:"used"`
Total int64 `json:"total"`
Relative float64 `json:"relative"`
Quota int64 `json:"quota"`
}
2019-01-16 14:31:22 +00:00
func (q *Quota) String() string {
if q.Quota < 0 {
return "none"
}
return strconv.FormatInt(q.Quota, 10)
}