-
Notifications
You must be signed in to change notification settings - Fork 9
/
AlibabaAiArOpenPlatformDetectAPIRequest.go
142 lines (121 loc) · 4.17 KB
/
AlibabaAiArOpenPlatformDetectAPIRequest.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
package aiar
import (
"net/url"
"sync"
"github.com/bububa/opentaobao/model"
)
// AlibabaAiArOpenPlatformDetectAPIRequest AR开发者平台marker图片检测服务 API请求
// alibaba.ai.ar.open.platform.detect
//
// AR开发者平台marker图片检测服务,给AR SDK 和 阿里火眼app使用
type AlibabaAiArOpenPlatformDetectAPIRequest struct {
model.Params
// 本地已cache的target,多个target间以|||分隔
_cachedTargets string
// map,描述所有设备相关信息,如设备ID,分辨率等
_deviceInfo string
// 版本,默认1.0
_version string
// 原始图像数据
_imgData *model.File
// 最多返回的结果数,默认为1
_num int64
}
// NewAlibabaAiArOpenPlatformDetectRequest 初始化AlibabaAiArOpenPlatformDetectAPIRequest对象
func NewAlibabaAiArOpenPlatformDetectRequest() *AlibabaAiArOpenPlatformDetectAPIRequest {
return &AlibabaAiArOpenPlatformDetectAPIRequest{
Params: model.NewParams(5),
}
}
// Reset IRequest interface 方法, 清空结构体
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) Reset() {
r._cachedTargets = ""
r._deviceInfo = ""
r._version = ""
r._imgData = nil
r._num = 0
r.Params.ToZero()
}
// GetApiMethodName IRequest interface 方法, 获取Api method
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetApiMethodName() string {
return "alibaba.ai.ar.open.platform.detect"
}
// GetApiParams IRequest interface 方法, 获取API参数
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetApiParams(params url.Values) {
for k, v := range r.Params {
params.Set(k, v.String())
}
}
// GetRawParams IRequest interface 方法, 获取API原始参数
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetRawParams() model.Params {
return r.Params
}
// SetCachedTargets is CachedTargets Setter
// 本地已cache的target,多个target间以|||分隔
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) SetCachedTargets(_cachedTargets string) error {
r._cachedTargets = _cachedTargets
r.Set("cached_targets", _cachedTargets)
return nil
}
// GetCachedTargets CachedTargets Getter
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetCachedTargets() string {
return r._cachedTargets
}
// SetDeviceInfo is DeviceInfo Setter
// map,描述所有设备相关信息,如设备ID,分辨率等
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) SetDeviceInfo(_deviceInfo string) error {
r._deviceInfo = _deviceInfo
r.Set("device_info", _deviceInfo)
return nil
}
// GetDeviceInfo DeviceInfo Getter
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetDeviceInfo() string {
return r._deviceInfo
}
// SetVersion is Version Setter
// 版本,默认1.0
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) SetVersion(_version string) error {
r._version = _version
r.Set("version", _version)
return nil
}
// GetVersion Version Getter
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetVersion() string {
return r._version
}
// SetImgData is ImgData Setter
// 原始图像数据
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) SetImgData(_imgData *model.File) error {
r._imgData = _imgData
r.Set("img_data", _imgData)
return nil
}
// GetImgData ImgData Getter
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetImgData() *model.File {
return r._imgData
}
// SetNum is Num Setter
// 最多返回的结果数,默认为1
func (r *AlibabaAiArOpenPlatformDetectAPIRequest) SetNum(_num int64) error {
r._num = _num
r.Set("num", _num)
return nil
}
// GetNum Num Getter
func (r AlibabaAiArOpenPlatformDetectAPIRequest) GetNum() int64 {
return r._num
}
var poolAlibabaAiArOpenPlatformDetectAPIRequest = sync.Pool{
New: func() any {
return NewAlibabaAiArOpenPlatformDetectRequest()
},
}
// GetAlibabaAiArOpenPlatformDetectRequest 从 sync.Pool 获取 AlibabaAiArOpenPlatformDetectAPIRequest
func GetAlibabaAiArOpenPlatformDetectAPIRequest() *AlibabaAiArOpenPlatformDetectAPIRequest {
return poolAlibabaAiArOpenPlatformDetectAPIRequest.Get().(*AlibabaAiArOpenPlatformDetectAPIRequest)
}
// ReleaseAlibabaAiArOpenPlatformDetectAPIRequest 将 AlibabaAiArOpenPlatformDetectAPIRequest 放入 sync.Pool
func ReleaseAlibabaAiArOpenPlatformDetectAPIRequest(v *AlibabaAiArOpenPlatformDetectAPIRequest) {
v.Reset()
poolAlibabaAiArOpenPlatformDetectAPIRequest.Put(v)
}