-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.go
35 lines (27 loc) · 933 Bytes
/
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
package goym
import (
"context"
"github.com/oklookat/goym/schema"
)
// Получить информацию об аккаунте.
func (c Client) AccountStatus(ctx context.Context) (schema.Response[schema.Status], error) {
// GET /account/status
endpoint := genApiPath("account", "status")
data := &schema.Response[schema.Status]{}
resp, err := c.Http.R().SetResult(data).SetError(data).Get(ctx, endpoint)
if err == nil {
err = checkResponse(resp, data)
}
return *data, err
}
// Получить настройки аккаунта.
func (c Client) AccountSettings(ctx context.Context) (schema.Response[schema.AccountSettings], error) {
// GET /account/settings
endpoint := genApiPath("account", "settings")
data := &schema.Response[schema.AccountSettings]{}
resp, err := c.Http.R().SetResult(data).SetError(data).Get(ctx, endpoint)
if err == nil {
err = checkResponse(resp, data)
}
return *data, err
}