68960144a8a3dae092c604bfa4a256efcc8a669b
[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         ModifiedByClientUUID string                 `json:"modified_by_client_uuid"`
27         Prefs                map[string]interface{} `json:"prefs"`
28         WritableBy           []string               `json:"writable_by,omitempty"`
29 }
30
31 // UserList is an arvados#userList resource.
32 type UserList struct {
33         Items          []User `json:"items"`
34         ItemsAvailable int    `json:"items_available"`
35         Offset         int    `json:"offset"`
36         Limit          int    `json:"limit"`
37 }
38
39 // CurrentUser calls arvados.v1.users.current, and returns the User
40 // record corresponding to this client's credentials.
41 func (c *Client) CurrentUser() (User, error) {
42         var u User
43         err := c.RequestAndDecode(&u, "GET", "arvados/v1/users/current", nil, nil)
44         return u, err
45 }