21910: Remove ModifiedByClientUUID from SDK & controller responses.
[arvados.git] / sdk / go / arvados / user.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import "time"
8
9 // User is an arvados#user record
10 type User struct {
11         UUID               string                 `json:"uuid"`
12         Etag               string                 `json:"etag"`
13         IsActive           bool                   `json:"is_active"`
14         IsAdmin            bool                   `json:"is_admin"`
15         Username           string                 `json:"username"`
16         Email              string                 `json:"email"`
17         FullName           string                 `json:"full_name"`
18         FirstName          string                 `json:"first_name"`
19         LastName           string                 `json:"last_name"`
20         IdentityURL        string                 `json:"identity_url"`
21         IsInvited          bool                   `json:"is_invited"`
22         OwnerUUID          string                 `json:"owner_uuid"`
23         CreatedAt          time.Time              `json:"created_at"`
24         ModifiedAt         time.Time              `json:"modified_at"`
25         ModifiedByUserUUID string                 `json:"modified_by_user_uuid"`
26         Prefs              map[string]interface{} `json:"prefs"`
27         WritableBy         []string               `json:"writable_by,omitempty"`
28         CanWrite           bool                   `json:"can_write"`
29         CanManage          bool                   `json:"can_manage"`
30 }
31
32 // UserList is an arvados#userList resource.
33 type UserList struct {
34         Items          []User `json:"items"`
35         ItemsAvailable int    `json:"items_available"`
36         Offset         int    `json:"offset"`
37         Limit          int    `json:"limit"`
38 }
39
40 // CurrentUser calls arvados.v1.users.current, and returns the User
41 // record corresponding to this client's credentials.
42 func (c *Client) CurrentUser() (User, error) {
43         var u User
44         err := c.RequestAndDecode(&u, "GET", "arvados/v1/users/current", nil, nil)
45         return u, err
46 }