-
Notifications
You must be signed in to change notification settings - Fork 4
/
api-wohome.go
202 lines (189 loc) · 6.3 KB
/
api-wohome.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
package wopan
type FCloudProductOrdListQryCtxData struct {
FcloudProductOrds []struct {
ActiviteCode string `json:"activiteCode"`
AppStorePackageDesc string `json:"appStorePackageDesc"`
AppStorePackageFee string `json:"appStorePackageFee"`
AppStoreProductId string `json:"appStoreProductId"`
ApplyTime string `json:"applyTime"`
ApplyTimeFormate string `json:"applyTimeFormate"`
CbssOrderId string `json:"cbssOrderId"`
City string `json:"city"`
ClientId string `json:"clientId"`
Days string `json:"days"`
DescUrl string `json:"descUrl"`
EffectState string `json:"effectState"`
EffectiveDays int `json:"effectiveDays"`
ExpireTime string `json:"expireTime"`
ExpireTimeFormate string `json:"expireTimeFormate"`
Fee string `json:"fee"`
IsAppStorePay string `json:"isAppStorePay"`
IsAutoSub string `json:"isAutoSub"`
IsExpire string `json:"isExpire"`
IsNewPackage string `json:"isNewPackage"`
IsOnline string `json:"isOnline"`
IsPlus string `json:"isPlus"`
IsShowExpireTips string `json:"isShowExpireTips"`
OrderId string `json:"orderId"`
OrderState string `json:"orderState"`
OrderStatus string `json:"orderStatus"`
PackageDesc string `json:"packageDesc"`
PackageProductCode string `json:"packageProductCode"`
PackageProductId string `json:"packageProductId"`
PayMethod string `json:"payMethod"`
PayTransactionId string `json:"payTransactionId"`
PayType string `json:"payType"`
Province string `json:"province"`
RemainDays string `json:"remainDays"`
SignStatus string `json:"signStatus"`
Source string `json:"source"`
SubTime string `json:"subTime"`
SubTimeFormate string `json:"subTimeFormate"`
SubType string `json:"subType"`
UserId string `json:"userId"`
VipDesc string `json:"vipDesc"`
VipDescNew string `json:"vipDescNew"`
VipExpireTimeLabel string `json:"vipExpireTimeLabel"`
VipLevel string `json:"vipLevel"`
} `json:"fcloudProductOrds"`
MaxVipLevel string `json:"maxVipLevel"`
IsShowInlet string `json:"isShowInlet"`
}
func (w *WoClient) FCloudProductOrdListQry(opts ...RestyOption) (*FCloudProductOrdListQryCtxData, error) {
var resp FCloudProductOrdListQryCtxData
_, err := w.RequestWoHome(KeyFCloudProductOrdListQry, nil, Json{
"qryType": "1",
"clientId": DefaultClientID,
}, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}
type QueryCloudUsageInfoData struct {
Code string `json:"code"`
UsageInfo struct {
TotalSize string `json:"totalSize"`
UsedSize int64 `json:"usedSize"`
ImageSize int64 `json:"imageSize"`
VideoSize int64 `json:"videoSize"`
AudioSize int64 `json:"audioSize"`
TextSize int64 `json:"textSize"`
OtherSize int64 `json:"otherSize"`
ByteUsedSize int64 `json:"byteUsedSize"`
ByteTotalSize string `json:"byteTotalSize"`
} `json:"usageInfo"`
VipLevel string `json:"vipLevel"`
ExpireTime string `json:"expireTime"`
ApplyTime string `json:"applyTime"`
PayType string `json:"payType"`
Source string `json:"source"`
OrderState string `json:"orderState"`
Status string `json:"status"`
}
func (w *WoClient) QueryCloudUsageInfo(opts ...RestyOption) (*QueryCloudUsageInfoData, error) {
err := w.InitPhone()
if err != nil {
return nil, err
}
var resp QueryCloudUsageInfoData
_, err = w.RequestWoHome(KeyQueryCloudUsageInfo, Json{
"phoneNum": w.Phone,
"clientId": DefaultClientID,
}, JsonSecret, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}
// FCloudProductPackage is not required
type ClassifyRuleData struct {
FileTypes map[string]struct {
SubType string `json:"subType"`
Ability string `json:"ability"`
Type string `json:"type"`
} `json:"fileTypes"`
FileIcons struct {
App struct {
Zip string `json:"zip"`
Image string `json:"image"`
Other string `json:"other"`
Xmind string `json:"xmind"`
Gif string `json:"gif"`
Csv string `json:"csv"`
Video string `json:"video"`
Excel string `json:"excel"`
Pdf string `json:"pdf"`
Ppt string `json:"ppt"`
Doc string `json:"doc"`
Audio string `json:"audio"`
Text string `json:"text"`
Word string `json:"word"`
} `json:"app"`
H5 struct {
} `json:"h5"`
} `json:"fileIcons"`
}
func (w *WoClient) ClassifyRule(opts ...RestyOption) (*ClassifyRuleData, error) {
var resp ClassifyRuleData
_, err := w.RequestWoHome(KeyClassifyRule, Json{}, Json{
"key": true,
}, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}
type GetZoneInfoData struct {
Url string `json:"url"`
}
func (w *WoClient) GetZoneInfo(opts ...RestyOption) (*GetZoneInfoData, error) {
var resp GetZoneInfoData
_, err := w.RequestWoHome(KeyGetZoneInfo, Json{
"appId": DefaultAppID,
}, Json{
"key": true,
}, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}
type FamilyUserCurrentEncodeData struct {
Count string `json:"count"`
DefaultHomeId int `json:"defaultHomeId"`
DefaultHomeName string `json:"defaultHomeName"`
GroupHeadUrl string `json:"groupHeadUrl"`
GroupName string `json:"groupName"`
Id int `json:"id"`
MemberRole string `json:"memberRole"`
OwnerId string `json:"owner Id"`
UnreadFlag string `json:"unreadFlag"`
}
func (w *WoClient) FamilyUserCurrentEncode(opts ...RestyOption) (*FamilyUserCurrentEncodeData, error) {
var resp FamilyUserCurrentEncodeData
_, err := w.RequestWoHome(KeyFamilyUserCurrentEncode, Json{
"clientId": DefaultClientID,
}, JsonSecret, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}
type PrivateSpaceLoginData struct {
PsToken string `json:"psToken"`
IsPass string `json:"isPass"`
Desc string `json:"desc"`
}
func (w *WoClient) PrivateSpaceLogin(pwd string, opts ...RestyOption) error {
var resp PrivateSpaceLoginData
_, err := w.RequestWoHome(KeyPrivateSpaceLogin, Json{
"pwd": pwd,
"clientId": DefaultClientID,
}, JsonSecret, &resp, opts...)
if err != nil {
return err
}
w.SetPsToken(resp.PsToken)
return nil
}