-
Notifications
You must be signed in to change notification settings - Fork 2
/
users_default.go
35 lines (28 loc) · 1.05 KB
/
users_default.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Code generated by go generate; DO NOT EDIT.
package brightbox
import "context"
import "path"
const (
// userAPIPath returns the relative URL path to the User endpoint
userAPIPath = "users"
)
// Users returns the collection view for User
func (c *Client) Users(ctx context.Context) ([]User, error) {
return apiGetCollection[[]User](ctx, c, userAPIPath)
}
// User retrieves a detailed view of one resource
func (c *Client) User(ctx context.Context, identifier string) (*User, error) {
return apiGet[User](ctx, c, path.Join(userAPIPath, identifier))
}
// UpdateUser updates an existing resources's attributes. Not all
// attributes can be changed (such as ID).
//
// It takes an instance of UserOptions. Specify the resource you
// want to update using the ID field.
func (c *Client) UpdateUser(ctx context.Context, updateUser UserOptions) (*User, error) {
return apiPut[User](ctx, c, path.Join(userAPIPath, updateUser.ID), updateUser)
}
// CreatedAt implements the CreateDated interface for User
func (s User) CreatedAtUnix() int64 {
return s.CreatedAt.Unix()
}