-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaccounts_default.go
42 lines (34 loc) · 1.49 KB
/
accounts_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
36
37
38
39
40
41
42
// Code generated by go generate; DO NOT EDIT.
package brightbox
import "context"
import "path"
const (
// accountAPIPath returns the relative URL path to the Account endpoint
accountAPIPath = "accounts"
)
// Accounts returns the collection view for Account
func (c *Client) Accounts(ctx context.Context) ([]Account, error) {
return apiGetCollection[[]Account](ctx, c, accountAPIPath)
}
// Account retrieves a detailed view of one resource
func (c *Client) Account(ctx context.Context, identifier string) (*Account, error) {
return apiGet[Account](ctx, c, path.Join(accountAPIPath, identifier))
}
// UpdateAccount updates an existing resources's attributes. Not all
// attributes can be changed (such as ID).
//
// It takes an instance of AccountOptions. Specify the resource you
// want to update using the ID field.
func (c *Client) UpdateAccount(ctx context.Context, updateAccount AccountOptions) (*Account, error) {
return apiPut[Account](ctx, c, path.Join(accountAPIPath, updateAccount.ID), updateAccount)
}
// CreatedAt implements the CreateDated interface for Account
func (s Account) CreatedAtUnix() int64 {
return s.CreatedAt.Unix()
}
// ResetAccountPassword resets the password in Account, returning it
// in the returned resource. This is the only time the new password is
// available in plaintext.
func (c *Client) ResetAccountPassword(ctx context.Context, identifier string) (*Account, error) {
return apiPost[Account](ctx, c, path.Join(accountAPIPath, identifier, "reset_ftp_password"), nil)
}