forked from larksuite/oapi-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 2
/
model.go
767 lines (660 loc) · 20 KB
/
model.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
// Package face_detection code generated by oapi sdk gen
/*
* MIT License
*
* Copyright (c) 2022 Lark Technologies Pte. Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package larkface_detection
import (
"github.com/Yucheng123/oapi-sdk-go/v3/core"
)
type AttributeItem struct {
Type *int `json:"type,omitempty"` // 属性
Probability *float64 `json:"probability,omitempty"` // 识别置信度,[0, 1],代表判断正确的概率
}
type AttributeItemBuilder struct {
type_ int // 属性
typeFlag bool
probability float64 // 识别置信度,[0, 1],代表判断正确的概率
probabilityFlag bool
}
func NewAttributeItemBuilder() *AttributeItemBuilder {
builder := &AttributeItemBuilder{}
return builder
}
// 属性
//
// 示例值:0
func (builder *AttributeItemBuilder) Type(type_ int) *AttributeItemBuilder {
builder.type_ = type_
builder.typeFlag = true
return builder
}
// 识别置信度,[0, 1],代表判断正确的概率
//
// 示例值:0.95566
func (builder *AttributeItemBuilder) Probability(probability float64) *AttributeItemBuilder {
builder.probability = probability
builder.probabilityFlag = true
return builder
}
func (builder *AttributeItemBuilder) Build() *AttributeItem {
req := &AttributeItem{}
if builder.typeFlag {
req.Type = &builder.type_
}
if builder.probabilityFlag {
req.Probability = &builder.probability
}
return req
}
type FaceAttribute struct {
Gender *AttributeItem `json:"gender,omitempty"` // 性别信息:0 男性,1 女性
Age *int `json:"age,omitempty"` // 年龄大小
Emotion *AttributeItem `json:"emotion,omitempty"` // 情绪:0 自然, 1 高兴,2 惊讶,3 害怕,4 悲伤,5 生气, 6 厌恶
Beauty *int `json:"beauty,omitempty"` // 颜值打分:[0, 100]
Pose *FacePose `json:"pose,omitempty"` // 人脸姿态
Hat *AttributeItem `json:"hat,omitempty"` // 帽子:0 未戴帽子,1 戴帽子
Glass *AttributeItem `json:"glass,omitempty"` // 眼镜:0 未戴眼镜,1 戴眼镜
Mask *AttributeItem `json:"mask,omitempty"` // 口罩:0 未戴口罩,1 戴口罩
}
type FaceAttributeBuilder struct {
gender *AttributeItem // 性别信息:0 男性,1 女性
genderFlag bool
age int // 年龄大小
ageFlag bool
emotion *AttributeItem // 情绪:0 自然, 1 高兴,2 惊讶,3 害怕,4 悲伤,5 生气, 6 厌恶
emotionFlag bool
beauty int // 颜值打分:[0, 100]
beautyFlag bool
pose *FacePose // 人脸姿态
poseFlag bool
hat *AttributeItem // 帽子:0 未戴帽子,1 戴帽子
hatFlag bool
glass *AttributeItem // 眼镜:0 未戴眼镜,1 戴眼镜
glassFlag bool
mask *AttributeItem // 口罩:0 未戴口罩,1 戴口罩
maskFlag bool
}
func NewFaceAttributeBuilder() *FaceAttributeBuilder {
builder := &FaceAttributeBuilder{}
return builder
}
// 性别信息:0 男性,1 女性
//
// 示例值:
func (builder *FaceAttributeBuilder) Gender(gender *AttributeItem) *FaceAttributeBuilder {
builder.gender = gender
builder.genderFlag = true
return builder
}
// 年龄大小
//
// 示例值:19
func (builder *FaceAttributeBuilder) Age(age int) *FaceAttributeBuilder {
builder.age = age
builder.ageFlag = true
return builder
}
// 情绪:0 自然, 1 高兴,2 惊讶,3 害怕,4 悲伤,5 生气, 6 厌恶
//
// 示例值:
func (builder *FaceAttributeBuilder) Emotion(emotion *AttributeItem) *FaceAttributeBuilder {
builder.emotion = emotion
builder.emotionFlag = true
return builder
}
// 颜值打分:[0, 100]
//
// 示例值:88
func (builder *FaceAttributeBuilder) Beauty(beauty int) *FaceAttributeBuilder {
builder.beauty = beauty
builder.beautyFlag = true
return builder
}
// 人脸姿态
//
// 示例值:
func (builder *FaceAttributeBuilder) Pose(pose *FacePose) *FaceAttributeBuilder {
builder.pose = pose
builder.poseFlag = true
return builder
}
// 帽子:0 未戴帽子,1 戴帽子
//
// 示例值:
func (builder *FaceAttributeBuilder) Hat(hat *AttributeItem) *FaceAttributeBuilder {
builder.hat = hat
builder.hatFlag = true
return builder
}
// 眼镜:0 未戴眼镜,1 戴眼镜
//
// 示例值:
func (builder *FaceAttributeBuilder) Glass(glass *AttributeItem) *FaceAttributeBuilder {
builder.glass = glass
builder.glassFlag = true
return builder
}
// 口罩:0 未戴口罩,1 戴口罩
//
// 示例值:
func (builder *FaceAttributeBuilder) Mask(mask *AttributeItem) *FaceAttributeBuilder {
builder.mask = mask
builder.maskFlag = true
return builder
}
func (builder *FaceAttributeBuilder) Build() *FaceAttribute {
req := &FaceAttribute{}
if builder.genderFlag {
req.Gender = builder.gender
}
if builder.ageFlag {
req.Age = &builder.age
}
if builder.emotionFlag {
req.Emotion = builder.emotion
}
if builder.beautyFlag {
req.Beauty = &builder.beauty
}
if builder.poseFlag {
req.Pose = builder.pose
}
if builder.hatFlag {
req.Hat = builder.hat
}
if builder.glassFlag {
req.Glass = builder.glass
}
if builder.maskFlag {
req.Mask = builder.mask
}
return req
}
type FaceInfo struct {
Position *FacePosition `json:"position,omitempty"` // 人脸位置信息
Attribute *FaceAttribute `json:"attribute,omitempty"` // 人脸属性信息
Quality *FaceQuality `json:"quality,omitempty"` // 人脸质量信息
}
type FaceInfoBuilder struct {
position *FacePosition // 人脸位置信息
positionFlag bool
attribute *FaceAttribute // 人脸属性信息
attributeFlag bool
quality *FaceQuality // 人脸质量信息
qualityFlag bool
}
func NewFaceInfoBuilder() *FaceInfoBuilder {
builder := &FaceInfoBuilder{}
return builder
}
// 人脸位置信息
//
// 示例值:
func (builder *FaceInfoBuilder) Position(position *FacePosition) *FaceInfoBuilder {
builder.position = position
builder.positionFlag = true
return builder
}
// 人脸属性信息
//
// 示例值:
func (builder *FaceInfoBuilder) Attribute(attribute *FaceAttribute) *FaceInfoBuilder {
builder.attribute = attribute
builder.attributeFlag = true
return builder
}
// 人脸质量信息
//
// 示例值:
func (builder *FaceInfoBuilder) Quality(quality *FaceQuality) *FaceInfoBuilder {
builder.quality = quality
builder.qualityFlag = true
return builder
}
func (builder *FaceInfoBuilder) Build() *FaceInfo {
req := &FaceInfo{}
if builder.positionFlag {
req.Position = builder.position
}
if builder.attributeFlag {
req.Attribute = builder.attribute
}
if builder.qualityFlag {
req.Quality = builder.quality
}
return req
}
type FaceOcclude struct {
Eyebrow *float64 `json:"eyebrow,omitempty"` // 眉毛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
Nose *float64 `json:"nose,omitempty"` // 鼻子被遮挡情况:[0, 1] 值越大被遮挡的概率越高
Cheek *float64 `json:"cheek,omitempty"` // 脸颊被遮挡情况:[0, 1] 值越大被遮挡的概率越高
Mouth *float64 `json:"mouth,omitempty"` // 嘴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
Chin *float64 `json:"chin,omitempty"` // 下巴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
LeftEye *float64 `json:"left_eye,omitempty"` // 左眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
RightEye *float64 `json:"right_eye,omitempty"` // 右眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
}
type FaceOccludeBuilder struct {
eyebrow float64 // 眉毛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
eyebrowFlag bool
nose float64 // 鼻子被遮挡情况:[0, 1] 值越大被遮挡的概率越高
noseFlag bool
cheek float64 // 脸颊被遮挡情况:[0, 1] 值越大被遮挡的概率越高
cheekFlag bool
mouth float64 // 嘴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
mouthFlag bool
chin float64 // 下巴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
chinFlag bool
leftEye float64 // 左眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
leftEyeFlag bool
rightEye float64 // 右眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
rightEyeFlag bool
}
func NewFaceOccludeBuilder() *FaceOccludeBuilder {
builder := &FaceOccludeBuilder{}
return builder
}
// 眉毛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.02345
func (builder *FaceOccludeBuilder) Eyebrow(eyebrow float64) *FaceOccludeBuilder {
builder.eyebrow = eyebrow
builder.eyebrowFlag = true
return builder
}
// 鼻子被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.99876
func (builder *FaceOccludeBuilder) Nose(nose float64) *FaceOccludeBuilder {
builder.nose = nose
builder.noseFlag = true
return builder
}
// 脸颊被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.88767
func (builder *FaceOccludeBuilder) Cheek(cheek float64) *FaceOccludeBuilder {
builder.cheek = cheek
builder.cheekFlag = true
return builder
}
// 嘴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.45678
func (builder *FaceOccludeBuilder) Mouth(mouth float64) *FaceOccludeBuilder {
builder.mouth = mouth
builder.mouthFlag = true
return builder
}
// 下巴被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.66436
func (builder *FaceOccludeBuilder) Chin(chin float64) *FaceOccludeBuilder {
builder.chin = chin
builder.chinFlag = true
return builder
}
// 左眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.87699
func (builder *FaceOccludeBuilder) LeftEye(leftEye float64) *FaceOccludeBuilder {
builder.leftEye = leftEye
builder.leftEyeFlag = true
return builder
}
// 右眼睛被遮挡情况:[0, 1] 值越大被遮挡的概率越高
//
// 示例值:0.78884
func (builder *FaceOccludeBuilder) RightEye(rightEye float64) *FaceOccludeBuilder {
builder.rightEye = rightEye
builder.rightEyeFlag = true
return builder
}
func (builder *FaceOccludeBuilder) Build() *FaceOcclude {
req := &FaceOcclude{}
if builder.eyebrowFlag {
req.Eyebrow = &builder.eyebrow
}
if builder.noseFlag {
req.Nose = &builder.nose
}
if builder.cheekFlag {
req.Cheek = &builder.cheek
}
if builder.mouthFlag {
req.Mouth = &builder.mouth
}
if builder.chinFlag {
req.Chin = &builder.chin
}
if builder.leftEyeFlag {
req.LeftEye = &builder.leftEye
}
if builder.rightEyeFlag {
req.RightEye = &builder.rightEye
}
return req
}
type FacePose struct {
Pitch *int `json:"pitch,omitempty"` // 脸部上下偏移 [-90, 90]
Yaw *int `json:"yaw,omitempty"` // 脸部左右偏移 [-90, 90]
Roll *int `json:"roll,omitempty"` // 平面旋转 [-90, 90]
}
type FacePoseBuilder struct {
pitch int // 脸部上下偏移 [-90, 90]
pitchFlag bool
yaw int // 脸部左右偏移 [-90, 90]
yawFlag bool
roll int // 平面旋转 [-90, 90]
rollFlag bool
}
func NewFacePoseBuilder() *FacePoseBuilder {
builder := &FacePoseBuilder{}
return builder
}
// 脸部上下偏移 [-90, 90]
//
// 示例值:-31
func (builder *FacePoseBuilder) Pitch(pitch int) *FacePoseBuilder {
builder.pitch = pitch
builder.pitchFlag = true
return builder
}
// 脸部左右偏移 [-90, 90]
//
// 示例值:22
func (builder *FacePoseBuilder) Yaw(yaw int) *FacePoseBuilder {
builder.yaw = yaw
builder.yawFlag = true
return builder
}
// 平面旋转 [-90, 90]
//
// 示例值:-32
func (builder *FacePoseBuilder) Roll(roll int) *FacePoseBuilder {
builder.roll = roll
builder.rollFlag = true
return builder
}
func (builder *FacePoseBuilder) Build() *FacePose {
req := &FacePose{}
if builder.pitchFlag {
req.Pitch = &builder.pitch
}
if builder.yawFlag {
req.Yaw = &builder.yaw
}
if builder.rollFlag {
req.Roll = &builder.roll
}
return req
}
type FacePosition struct {
UpperLeft *Point `json:"upper_left,omitempty"` // 人脸框的左上角坐标
LowerRight *Point `json:"lower_right,omitempty"` // 人脸框的右下角坐标
}
type FacePositionBuilder struct {
upperLeft *Point // 人脸框的左上角坐标
upperLeftFlag bool
lowerRight *Point // 人脸框的右下角坐标
lowerRightFlag bool
}
func NewFacePositionBuilder() *FacePositionBuilder {
builder := &FacePositionBuilder{}
return builder
}
// 人脸框的左上角坐标
//
// 示例值:
func (builder *FacePositionBuilder) UpperLeft(upperLeft *Point) *FacePositionBuilder {
builder.upperLeft = upperLeft
builder.upperLeftFlag = true
return builder
}
// 人脸框的右下角坐标
//
// 示例值:
func (builder *FacePositionBuilder) LowerRight(lowerRight *Point) *FacePositionBuilder {
builder.lowerRight = lowerRight
builder.lowerRightFlag = true
return builder
}
func (builder *FacePositionBuilder) Build() *FacePosition {
req := &FacePosition{}
if builder.upperLeftFlag {
req.UpperLeft = builder.upperLeft
}
if builder.lowerRightFlag {
req.LowerRight = builder.lowerRight
}
return req
}
type FaceQuality struct {
Sharpness *float64 `json:"sharpness,omitempty"` // 清晰度,值越高越清晰
Brightness *float64 `json:"brightness,omitempty"` // 亮度
Occlude *FaceOcclude `json:"occlude,omitempty"` // 面部遮挡属性
}
type FaceQualityBuilder struct {
sharpness float64 // 清晰度,值越高越清晰
sharpnessFlag bool
brightness float64 // 亮度
brightnessFlag bool
occlude *FaceOcclude // 面部遮挡属性
occludeFlag bool
}
func NewFaceQualityBuilder() *FaceQualityBuilder {
builder := &FaceQualityBuilder{}
return builder
}
// 清晰度,值越高越清晰
//
// 示例值:0.77
func (builder *FaceQualityBuilder) Sharpness(sharpness float64) *FaceQualityBuilder {
builder.sharpness = sharpness
builder.sharpnessFlag = true
return builder
}
// 亮度
//
// 示例值:0.6
func (builder *FaceQualityBuilder) Brightness(brightness float64) *FaceQualityBuilder {
builder.brightness = brightness
builder.brightnessFlag = true
return builder
}
// 面部遮挡属性
//
// 示例值:
func (builder *FaceQualityBuilder) Occlude(occlude *FaceOcclude) *FaceQualityBuilder {
builder.occlude = occlude
builder.occludeFlag = true
return builder
}
func (builder *FaceQualityBuilder) Build() *FaceQuality {
req := &FaceQuality{}
if builder.sharpnessFlag {
req.Sharpness = &builder.sharpness
}
if builder.brightnessFlag {
req.Brightness = &builder.brightness
}
if builder.occludeFlag {
req.Occlude = builder.occlude
}
return req
}
type Image struct {
Width *int `json:"width,omitempty"` // 图片的宽度
Height *int `json:"height,omitempty"` // 图片的高度
}
type ImageBuilder struct {
width int // 图片的宽度
widthFlag bool
height int // 图片的高度
heightFlag bool
}
func NewImageBuilder() *ImageBuilder {
builder := &ImageBuilder{}
return builder
}
// 图片的宽度
//
// 示例值:400
func (builder *ImageBuilder) Width(width int) *ImageBuilder {
builder.width = width
builder.widthFlag = true
return builder
}
// 图片的高度
//
// 示例值:500
func (builder *ImageBuilder) Height(height int) *ImageBuilder {
builder.height = height
builder.heightFlag = true
return builder
}
func (builder *ImageBuilder) Build() *Image {
req := &Image{}
if builder.widthFlag {
req.Width = &builder.width
}
if builder.heightFlag {
req.Height = &builder.height
}
return req
}
type Point struct {
X *float64 `json:"x,omitempty"` // 横轴坐标
Y *float64 `json:"y,omitempty"` // 纵轴坐标
}
type PointBuilder struct {
x float64 // 横轴坐标
xFlag bool
y float64 // 纵轴坐标
yFlag bool
}
func NewPointBuilder() *PointBuilder {
builder := &PointBuilder{}
return builder
}
// 横轴坐标
//
// 示例值:200
func (builder *PointBuilder) X(x float64) *PointBuilder {
builder.x = x
builder.xFlag = true
return builder
}
// 纵轴坐标
//
// 示例值:200
func (builder *PointBuilder) Y(y float64) *PointBuilder {
builder.y = y
builder.yFlag = true
return builder
}
func (builder *PointBuilder) Build() *Point {
req := &Point{}
if builder.xFlag {
req.X = &builder.x
}
if builder.yFlag {
req.Y = &builder.y
}
return req
}
type DetectFaceAttributesImageReqBodyBuilder struct {
image string // 图片 base64 数据
imageFlag bool
}
func NewDetectFaceAttributesImageReqBodyBuilder() *DetectFaceAttributesImageReqBodyBuilder {
builder := &DetectFaceAttributesImageReqBodyBuilder{}
return builder
}
// 图片 base64 数据
//
//示例值:图片 base64 后的字符串
func (builder *DetectFaceAttributesImageReqBodyBuilder) Image(image string) *DetectFaceAttributesImageReqBodyBuilder {
builder.image = image
builder.imageFlag = true
return builder
}
func (builder *DetectFaceAttributesImageReqBodyBuilder) Build() *DetectFaceAttributesImageReqBody {
req := &DetectFaceAttributesImageReqBody{}
if builder.imageFlag {
req.Image = &builder.image
}
return req
}
type DetectFaceAttributesImagePathReqBodyBuilder struct {
image string // 图片 base64 数据
imageFlag bool
}
func NewDetectFaceAttributesImagePathReqBodyBuilder() *DetectFaceAttributesImagePathReqBodyBuilder {
builder := &DetectFaceAttributesImagePathReqBodyBuilder{}
return builder
}
// 图片 base64 数据
//
// 示例值:图片 base64 后的字符串
func (builder *DetectFaceAttributesImagePathReqBodyBuilder) Image(image string) *DetectFaceAttributesImagePathReqBodyBuilder {
builder.image = image
builder.imageFlag = true
return builder
}
func (builder *DetectFaceAttributesImagePathReqBodyBuilder) Build() (*DetectFaceAttributesImageReqBody, error) {
req := &DetectFaceAttributesImageReqBody{}
if builder.imageFlag {
req.Image = &builder.image
}
return req, nil
}
type DetectFaceAttributesImageReqBuilder struct {
apiReq *larkcore.ApiReq
body *DetectFaceAttributesImageReqBody
}
func NewDetectFaceAttributesImageReqBuilder() *DetectFaceAttributesImageReqBuilder {
builder := &DetectFaceAttributesImageReqBuilder{}
builder.apiReq = &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
}
return builder
}
// 检测图片中的人脸属性和质量等信息
func (builder *DetectFaceAttributesImageReqBuilder) Body(body *DetectFaceAttributesImageReqBody) *DetectFaceAttributesImageReqBuilder {
builder.body = body
return builder
}
func (builder *DetectFaceAttributesImageReqBuilder) Build() *DetectFaceAttributesImageReq {
req := &DetectFaceAttributesImageReq{}
req.apiReq = &larkcore.ApiReq{}
req.apiReq.Body = builder.body
return req
}
type DetectFaceAttributesImageReqBody struct {
Image *string `json:"image,omitempty"` // 图片 base64 数据
}
type DetectFaceAttributesImageReq struct {
apiReq *larkcore.ApiReq
Body *DetectFaceAttributesImageReqBody `body:""`
}
type DetectFaceAttributesImageRespData struct {
ImageInfo *Image `json:"image_info,omitempty"` // 图片信息
FaceInfos []*FaceInfo `json:"face_infos,omitempty"` // 人脸信息列表
}
type DetectFaceAttributesImageResp struct {
*larkcore.ApiResp `json:"-"`
larkcore.CodeError
Data *DetectFaceAttributesImageRespData `json:"data"` // 业务数据
}
func (resp *DetectFaceAttributesImageResp) Success() bool {
return resp.Code == 0
}