3 26fb88e9 2022-01-12 o import "encoding/json"
5 50558780 2022-01-06 o // User represents a User object.
6 50558780 2022-01-06 o // Note that this is different from an ApiUser.
7 6e415953 2022-01-06 o type User struct {
10 6e415953 2022-01-06 o Groups []string
13 6e415953 2022-01-06 o var testUser = User{
14 6e415953 2022-01-06 o Name: "testUser",
15 6e415953 2022-01-06 o Email: "test@example.com",
18 6e415953 2022-01-06 o func (u User) MarshalJSON() ([]byte, error) {
19 76669f9b 2022-01-11 o type attrs struct {
20 76669f9b 2022-01-11 o Email string `json:"email"`
21 76669f9b 2022-01-11 o Groups []string `json:"groups,omitempty"`
23 6e415953 2022-01-06 o return json.Marshal(&struct {
24 76669f9b 2022-01-11 o Attrs attrs `json:"attrs"`
27 76669f9b 2022-01-11 o Email: u.Email,
28 76669f9b 2022-01-11 o Groups: u.Groups,
33 76669f9b 2022-01-11 o func (u User) name() string {
37 76669f9b 2022-01-11 o func (u User) path() string {
38 76669f9b 2022-01-11 o return "/objects/users/" + u.Name