-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount.go
More file actions
33 lines (29 loc) · 999 Bytes
/
account.go
File metadata and controls
33 lines (29 loc) · 999 Bytes
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
package flashduty
import (
"context"
"fmt"
)
// AccountInfo contains account details returned by the account info API.
type AccountInfo struct {
AccountID uint64 `json:"account_id"`
AccountName string `json:"account_name"`
Domain string `json:"domain"`
Email string `json:"email"`
Phone string `json:"phone,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Avatar string `json:"avatar,omitempty"`
Locale string `json:"locale,omitempty"`
TimeZone string `json:"time_zone,omitempty"`
CreatedAt int64 `json:"created_at"`
}
// GetAccountInfo retrieves the account information for the authenticated app key.
func (c *Client) GetAccountInfo(ctx context.Context) (*AccountInfo, error) {
data, err := postOptionalData[AccountInfo](c, ctx, "/account/info", map[string]any{}, "unable to get account info")
if err != nil {
return nil, err
}
if data == nil {
return nil, fmt.Errorf("empty account info in response")
}
return data, nil
}