-
Notifications
You must be signed in to change notification settings - Fork 9
/
TaobaoTopSecretGetAPIRequest.go
110 lines (93 loc) · 2.92 KB
/
TaobaoTopSecretGetAPIRequest.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
package util
import (
"net/url"
"sync"
"github.com/bububa/opentaobao/model"
)
// TaobaoTopSecretGetAPIRequest 获取TOP通道解密秘钥 API请求
// taobao.top.secret.get
//
// top sdk通过api获取对应解密秘钥
type TaobaoTopSecretGetAPIRequest struct {
model.Params
// 伪随机数
_randomNum string
// 秘钥版本号
_secretVersion int64
// 自定义用户id
_customerUserId int64
}
// NewTaobaoTopSecretGetRequest 初始化TaobaoTopSecretGetAPIRequest对象
func NewTaobaoTopSecretGetRequest() *TaobaoTopSecretGetAPIRequest {
return &TaobaoTopSecretGetAPIRequest{
Params: model.NewParams(3),
}
}
// Reset IRequest interface 方法, 清空结构体
func (r *TaobaoTopSecretGetAPIRequest) Reset() {
r._randomNum = ""
r._secretVersion = 0
r._customerUserId = 0
r.Params.ToZero()
}
// GetApiMethodName IRequest interface 方法, 获取Api method
func (r TaobaoTopSecretGetAPIRequest) GetApiMethodName() string {
return "taobao.top.secret.get"
}
// GetApiParams IRequest interface 方法, 获取API参数
func (r TaobaoTopSecretGetAPIRequest) GetApiParams(params url.Values) {
for k, v := range r.Params {
params.Set(k, v.String())
}
}
// GetRawParams IRequest interface 方法, 获取API原始参数
func (r TaobaoTopSecretGetAPIRequest) GetRawParams() model.Params {
return r.Params
}
// SetRandomNum is RandomNum Setter
// 伪随机数
func (r *TaobaoTopSecretGetAPIRequest) SetRandomNum(_randomNum string) error {
r._randomNum = _randomNum
r.Set("random_num", _randomNum)
return nil
}
// GetRandomNum RandomNum Getter
func (r TaobaoTopSecretGetAPIRequest) GetRandomNum() string {
return r._randomNum
}
// SetSecretVersion is SecretVersion Setter
// 秘钥版本号
func (r *TaobaoTopSecretGetAPIRequest) SetSecretVersion(_secretVersion int64) error {
r._secretVersion = _secretVersion
r.Set("secret_version", _secretVersion)
return nil
}
// GetSecretVersion SecretVersion Getter
func (r TaobaoTopSecretGetAPIRequest) GetSecretVersion() int64 {
return r._secretVersion
}
// SetCustomerUserId is CustomerUserId Setter
// 自定义用户id
func (r *TaobaoTopSecretGetAPIRequest) SetCustomerUserId(_customerUserId int64) error {
r._customerUserId = _customerUserId
r.Set("customer_user_id", _customerUserId)
return nil
}
// GetCustomerUserId CustomerUserId Getter
func (r TaobaoTopSecretGetAPIRequest) GetCustomerUserId() int64 {
return r._customerUserId
}
var poolTaobaoTopSecretGetAPIRequest = sync.Pool{
New: func() any {
return NewTaobaoTopSecretGetRequest()
},
}
// GetTaobaoTopSecretGetRequest 从 sync.Pool 获取 TaobaoTopSecretGetAPIRequest
func GetTaobaoTopSecretGetAPIRequest() *TaobaoTopSecretGetAPIRequest {
return poolTaobaoTopSecretGetAPIRequest.Get().(*TaobaoTopSecretGetAPIRequest)
}
// ReleaseTaobaoTopSecretGetAPIRequest 将 TaobaoTopSecretGetAPIRequest 放入 sync.Pool
func ReleaseTaobaoTopSecretGetAPIRequest(v *TaobaoTopSecretGetAPIRequest) {
v.Reset()
poolTaobaoTopSecretGetAPIRequest.Put(v)
}