17119: fix options and response type of the groups/shared and
[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         Kind                 string                 `json:"kind"`
20         LastName             string                 `json:"last_name"`
21         IdentityURL          string                 `json:"identity_url"`
22         IsInvited            bool                   `json:"is_invited"`
23         OwnerUUID            string                 `json:"owner_uuid"`
24         CreatedAt            time.Time              `json:"created_at"`
25         ModifiedAt           time.Time              `json:"modified_at"`
26         ModifiedByUserUUID   string                 `json:"modified_by_user_uuid"`
27         ModifiedByClientUUID string                 `json:"modified_by_client_uuid"`
28         Prefs                map[string]interface{} `json:"prefs"`
29         WritableBy           []string               `json:"writable_by,omitempty"`
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 }