forked from chyroc/go-aliyundrive
-
Notifications
You must be signed in to change notification settings - Fork 4
/
sbox.go
38 lines (31 loc) · 869 Bytes
/
sbox.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
package aliyundrive
import (
"context"
"fmt"
"net/http"
)
type GetSBoxResp struct {
DriveID string `json:"drive_id"`
UsedSize int `json:"sbox_used_size"`
RealUsedSize int `json:"sbox_real_used_size"`
TotalSize int64 `json:"sbox_total_size"`
RecommendVip string `json:"recommend_vip"`
PinSetup bool `json:"pin_setup"`
Locked bool `json:"locked"`
InsuranceEnabled bool `json:"insurance_enabled"`
}
func (r *AliyunDrive) GetSBox(ctx context.Context) (*GetSBoxResp, error) {
var result GetSBoxResp
response, err := r.request(ctx, &config{
Method: http.MethodPost,
URL: "https://api.aliyundrive.com/v2/sbox/get",
Body: "{}",
}, &result)
if err != nil {
return nil, err
}
if !response.IsSuccess() {
return nil, fmt.Errorf("%s", response.Status())
}
return &result, nil
}