-
Notifications
You must be signed in to change notification settings - Fork 1
/
account.go
49 lines (39 loc) · 1.15 KB
/
account.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
43
44
45
46
47
48
49
package vscale
type AccountService interface {
Get() (*Account, *Response, error)
}
type AccountServiceOp struct {
client *Client
}
var _ AccountService = &AccountServiceOp{}
// https://developers.vscale.io/documentation/api/v1/#api-Account-GetAccount
type Account struct {
ActivateDate string `json:"actdate,omitempty"`
Country string `json:"country,omitempty"`
FaceID int `json:"face_id,string,omitempty"`
ID int `json:"id,string,omitempty"`
State int `json:"state,string,omitempty"`
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
MiddleName string `json:"middlename,omitempty"`
SurName string `json:"surname,omitempty"`
}
type accountInfo struct {
Info *Account `json:"info,omitempty"`
}
func (r Account) String() string {
return Stringify(r)
}
func (s *AccountServiceOp) Get() (*Account, *Response, error) {
path := "/v1/account"
req, err := s.client.NewRequest("GET", path, nil)
if err != nil {
return nil, nil, err
}
info := new(accountInfo)
resp, err := s.client.Do(req, info)
if err != nil {
return nil, nil, err
}
return info.Info, resp, err
}