forked from googleapis/google-api-go-client
/
vision-gen.go
5798 lines (5159 loc) · 221 KB
/
vision-gen.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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package vision provides access to the Cloud Vision API.
//
// See https://cloud.google.com/vision/
//
// Usage example:
//
// import "google.golang.org/api/vision/v1"
// ...
// visionService, err := vision.New(oauthHttpClient)
package vision // import "google.golang.org/api/vision/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
context "golang.org/x/net/context"
ctxhttp "golang.org/x/net/context/ctxhttp"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "vision:v1"
const apiName = "vision"
const apiVersion = "v1"
const basePath = "https://vision.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// View and manage your data across Google Cloud Platform services
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
// Apply machine learning models to understand and label images
CloudVisionScope = "https://www.googleapis.com/auth/cloud-vision"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Images = NewImagesService(s)
s.Locations = NewLocationsService(s)
s.Operations = NewOperationsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Images *ImagesService
Locations *LocationsService
Operations *OperationsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewImagesService(s *Service) *ImagesService {
rs := &ImagesService{s: s}
return rs
}
type ImagesService struct {
s *Service
}
func NewLocationsService(s *Service) *LocationsService {
rs := &LocationsService{s: s}
rs.Operations = NewLocationsOperationsService(s)
return rs
}
type LocationsService struct {
s *Service
Operations *LocationsOperationsService
}
func NewLocationsOperationsService(s *Service) *LocationsOperationsService {
rs := &LocationsOperationsService{s: s}
return rs
}
type LocationsOperationsService struct {
s *Service
}
func NewOperationsService(s *Service) *OperationsService {
rs := &OperationsService{s: s}
return rs
}
type OperationsService struct {
s *Service
}
// AnnotateImageRequest: Request for performing Google Cloud Vision API
// tasks over a user-provided
// image, with user-requested features.
type AnnotateImageRequest struct {
// Features: Requested features.
Features []*Feature `json:"features,omitempty"`
// Image: The image to be processed.
Image *Image `json:"image,omitempty"`
// ImageContext: Additional context that may accompany the image.
ImageContext *ImageContext `json:"imageContext,omitempty"`
// ForceSendFields is a list of field names (e.g. "Features") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Features") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *AnnotateImageRequest) MarshalJSON() ([]byte, error) {
type NoMethod AnnotateImageRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// AnnotateImageResponse: Response to an image annotation request.
type AnnotateImageResponse struct {
// CropHintsAnnotation: If present, crop hints have completed
// successfully.
CropHintsAnnotation *CropHintsAnnotation `json:"cropHintsAnnotation,omitempty"`
// Error: If set, represents the error message for the operation.
// Note that filled-in image annotations are guaranteed to be
// correct, even when `error` is set.
Error *Status `json:"error,omitempty"`
// FaceAnnotations: If present, face detection has completed
// successfully.
FaceAnnotations []*FaceAnnotation `json:"faceAnnotations,omitempty"`
// FullTextAnnotation: If present, text (OCR) detection or document
// (OCR) text detection has
// completed successfully.
// This annotation provides the structural hierarchy for the OCR
// detected
// text.
FullTextAnnotation *TextAnnotation `json:"fullTextAnnotation,omitempty"`
// ImagePropertiesAnnotation: If present, image properties were
// extracted successfully.
ImagePropertiesAnnotation *ImageProperties `json:"imagePropertiesAnnotation,omitempty"`
// LabelAnnotations: If present, label detection has completed
// successfully.
LabelAnnotations []*EntityAnnotation `json:"labelAnnotations,omitempty"`
// LandmarkAnnotations: If present, landmark detection has completed
// successfully.
LandmarkAnnotations []*EntityAnnotation `json:"landmarkAnnotations,omitempty"`
// LogoAnnotations: If present, logo detection has completed
// successfully.
LogoAnnotations []*EntityAnnotation `json:"logoAnnotations,omitempty"`
// SafeSearchAnnotation: If present, safe-search annotation has
// completed successfully.
SafeSearchAnnotation *SafeSearchAnnotation `json:"safeSearchAnnotation,omitempty"`
// TextAnnotations: If present, text (OCR) detection has completed
// successfully.
TextAnnotations []*EntityAnnotation `json:"textAnnotations,omitempty"`
// WebDetection: If present, web detection has completed successfully.
WebDetection *WebDetection `json:"webDetection,omitempty"`
// ForceSendFields is a list of field names (e.g. "CropHintsAnnotation")
// to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CropHintsAnnotation") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *AnnotateImageResponse) MarshalJSON() ([]byte, error) {
type NoMethod AnnotateImageResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BatchAnnotateImagesRequest: Multiple image annotation requests are
// batched into a single service call.
type BatchAnnotateImagesRequest struct {
// Requests: Individual image annotation requests for this batch.
Requests []*AnnotateImageRequest `json:"requests,omitempty"`
// ForceSendFields is a list of field names (e.g. "Requests") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Requests") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BatchAnnotateImagesRequest) MarshalJSON() ([]byte, error) {
type NoMethod BatchAnnotateImagesRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// BatchAnnotateImagesResponse: Response to a batch image annotation
// request.
type BatchAnnotateImagesResponse struct {
// Responses: Individual responses to image annotation requests within
// the batch.
Responses []*AnnotateImageResponse `json:"responses,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Responses") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Responses") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BatchAnnotateImagesResponse) MarshalJSON() ([]byte, error) {
type NoMethod BatchAnnotateImagesResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Block: Logical element on the page.
type Block struct {
// BlockType: Detected block type (text, image etc) for this block.
//
// Possible values:
// "UNKNOWN" - Unknown block type.
// "TEXT" - Regular text block.
// "TABLE" - Table block.
// "PICTURE" - Image block.
// "RULER" - Horizontal/vertical line box.
// "BARCODE" - Barcode block.
BlockType string `json:"blockType,omitempty"`
// BoundingBox: The bounding box for the block.
// The vertices are in the order of top-left, top-right,
// bottom-right,
// bottom-left. When a rotation of the bounding box is detected the
// rotation
// is represented as around the top-left corner as defined when the text
// is
// read in the 'natural' orientation.
// For example:
//
// * when the text is horizontal it might look like:
//
// 0----1
// | |
// 3----2
//
// * when it's rotated 180 degrees around the top-left corner it
// becomes:
//
// 2----3
// | |
// 1----0
//
// and the vertice order will still be (0, 1, 2, 3).
BoundingBox *BoundingPoly `json:"boundingBox,omitempty"`
// Confidence: Confidence of the OCR results on the block. Range [0, 1].
Confidence float64 `json:"confidence,omitempty"`
// Paragraphs: List of paragraphs in this block (if this blocks is of
// type text).
Paragraphs []*Paragraph `json:"paragraphs,omitempty"`
// Property: Additional information detected for the block.
Property *TextProperty `json:"property,omitempty"`
// ForceSendFields is a list of field names (e.g. "BlockType") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BlockType") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Block) MarshalJSON() ([]byte, error) {
type NoMethod Block
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *Block) UnmarshalJSON(data []byte) error {
type NoMethod Block
var s1 struct {
Confidence gensupport.JSONFloat64 `json:"confidence"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.Confidence = float64(s1.Confidence)
return nil
}
// BoundingPoly: A bounding polygon for the detected image annotation.
type BoundingPoly struct {
// Vertices: The bounding polygon vertices.
Vertices []*Vertex `json:"vertices,omitempty"`
// ForceSendFields is a list of field names (e.g. "Vertices") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Vertices") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *BoundingPoly) MarshalJSON() ([]byte, error) {
type NoMethod BoundingPoly
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CancelOperationRequest: The request message for
// Operations.CancelOperation.
type CancelOperationRequest struct {
}
// Color: Represents a color in the RGBA color space. This
// representation is designed
// for simplicity of conversion to/from color representations in
// various
// languages over compactness; for example, the fields of this
// representation
// can be trivially provided to the constructor of "java.awt.Color" in
// Java; it
// can also be trivially provided to UIColor's
// "+colorWithRed:green:blue:alpha"
// method in iOS; and, with just a little work, it can be easily
// formatted into
// a CSS "rgba()" string in JavaScript, as well. Here are some
// examples:
//
// Example (Java):
//
// import com.google.type.Color;
//
// // ...
// public static java.awt.Color fromProto(Color protocolor) {
// float alpha = protocolor.hasAlpha()
// ? protocolor.getAlpha().getValue()
// : 1.0;
//
// return new java.awt.Color(
// protocolor.getRed(),
// protocolor.getGreen(),
// protocolor.getBlue(),
// alpha);
// }
//
// public static Color toProto(java.awt.Color color) {
// float red = (float) color.getRed();
// float green = (float) color.getGreen();
// float blue = (float) color.getBlue();
// float denominator = 255.0;
// Color.Builder resultBuilder =
// Color
// .newBuilder()
// .setRed(red / denominator)
// .setGreen(green / denominator)
// .setBlue(blue / denominator);
// int alpha = color.getAlpha();
// if (alpha != 255) {
// result.setAlpha(
// FloatValue
// .newBuilder()
// .setValue(((float) alpha) / denominator)
// .build());
// }
// return resultBuilder.build();
// }
// // ...
//
// Example (iOS / Obj-C):
//
// // ...
// static UIColor* fromProto(Color* protocolor) {
// float red = [protocolor red];
// float green = [protocolor green];
// float blue = [protocolor blue];
// FloatValue* alpha_wrapper = [protocolor alpha];
// float alpha = 1.0;
// if (alpha_wrapper != nil) {
// alpha = [alpha_wrapper value];
// }
// return [UIColor colorWithRed:red green:green blue:blue
// alpha:alpha];
// }
//
// static Color* toProto(UIColor* color) {
// CGFloat red, green, blue, alpha;
// if (![color getRed:&red green:&green blue:&blue
// alpha:&alpha]) {
// return nil;
// }
// Color* result = [Color alloc] init];
// [result setRed:red];
// [result setGreen:green];
// [result setBlue:blue];
// if (alpha <= 0.9999) {
// [result setAlpha:floatWrapperWithValue(alpha)];
// }
// [result autorelease];
// return result;
// }
// // ...
//
// Example (JavaScript):
//
// // ...
//
// var protoToCssColor = function(rgb_color) {
// var redFrac = rgb_color.red || 0.0;
// var greenFrac = rgb_color.green || 0.0;
// var blueFrac = rgb_color.blue || 0.0;
// var red = Math.floor(redFrac * 255);
// var green = Math.floor(greenFrac * 255);
// var blue = Math.floor(blueFrac * 255);
//
// if (!('alpha' in rgb_color)) {
// return rgbToCssColor_(red, green, blue);
// }
//
// var alphaFrac = rgb_color.alpha.value || 0.0;
// var rgbParams = [red, green, blue].join(',');
// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
// };
//
// var rgbToCssColor_ = function(red, green, blue) {
// var rgbNumber = new Number((red << 16) | (green << 8) | blue);
// var hexString = rgbNumber.toString(16);
// var missingZeros = 6 - hexString.length;
// var resultBuilder = ['#'];
// for (var i = 0; i < missingZeros; i++) {
// resultBuilder.push('0');
// }
// resultBuilder.push(hexString);
// return resultBuilder.join('');
// };
//
// // ...
type Color struct {
// Alpha: The fraction of this color that should be applied to the
// pixel. That is,
// the final pixel color is defined by the equation:
//
// pixel color = alpha * (this color) + (1.0 - alpha) * (background
// color)
//
// This means that a value of 1.0 corresponds to a solid color,
// whereas
// a value of 0.0 corresponds to a completely transparent color.
// This
// uses a wrapper message rather than a simple float scalar so that it
// is
// possible to distinguish between a default value and the value being
// unset.
// If omitted, this color object is to be rendered as a solid color
// (as if the alpha value had been explicitly given with a value of
// 1.0).
Alpha float64 `json:"alpha,omitempty"`
// Blue: The amount of blue in the color as a value in the interval [0,
// 1].
Blue float64 `json:"blue,omitempty"`
// Green: The amount of green in the color as a value in the interval
// [0, 1].
Green float64 `json:"green,omitempty"`
// Red: The amount of red in the color as a value in the interval [0,
// 1].
Red float64 `json:"red,omitempty"`
// ForceSendFields is a list of field names (e.g. "Alpha") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Alpha") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Color) MarshalJSON() ([]byte, error) {
type NoMethod Color
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *Color) UnmarshalJSON(data []byte) error {
type NoMethod Color
var s1 struct {
Alpha gensupport.JSONFloat64 `json:"alpha"`
Blue gensupport.JSONFloat64 `json:"blue"`
Green gensupport.JSONFloat64 `json:"green"`
Red gensupport.JSONFloat64 `json:"red"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.Alpha = float64(s1.Alpha)
s.Blue = float64(s1.Blue)
s.Green = float64(s1.Green)
s.Red = float64(s1.Red)
return nil
}
// ColorInfo: Color information consists of RGB channels, score, and the
// fraction of
// the image that the color occupies in the image.
type ColorInfo struct {
// Color: RGB components of the color.
Color *Color `json:"color,omitempty"`
// PixelFraction: The fraction of pixels the color occupies in the
// image.
// Value in range [0, 1].
PixelFraction float64 `json:"pixelFraction,omitempty"`
// Score: Image-specific score for this color. Value in range [0, 1].
Score float64 `json:"score,omitempty"`
// ForceSendFields is a list of field names (e.g. "Color") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Color") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ColorInfo) MarshalJSON() ([]byte, error) {
type NoMethod ColorInfo
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *ColorInfo) UnmarshalJSON(data []byte) error {
type NoMethod ColorInfo
var s1 struct {
PixelFraction gensupport.JSONFloat64 `json:"pixelFraction"`
Score gensupport.JSONFloat64 `json:"score"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.PixelFraction = float64(s1.PixelFraction)
s.Score = float64(s1.Score)
return nil
}
// CropHint: Single crop hint that is used to generate a new crop when
// serving an image.
type CropHint struct {
// BoundingPoly: The bounding polygon for the crop region. The
// coordinates of the bounding
// box are in the original image's scale, as returned in `ImageParams`.
BoundingPoly *BoundingPoly `json:"boundingPoly,omitempty"`
// Confidence: Confidence of this being a salient region. Range [0, 1].
Confidence float64 `json:"confidence,omitempty"`
// ImportanceFraction: Fraction of importance of this salient region
// with respect to the original
// image.
ImportanceFraction float64 `json:"importanceFraction,omitempty"`
// ForceSendFields is a list of field names (e.g. "BoundingPoly") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BoundingPoly") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CropHint) MarshalJSON() ([]byte, error) {
type NoMethod CropHint
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *CropHint) UnmarshalJSON(data []byte) error {
type NoMethod CropHint
var s1 struct {
Confidence gensupport.JSONFloat64 `json:"confidence"`
ImportanceFraction gensupport.JSONFloat64 `json:"importanceFraction"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.Confidence = float64(s1.Confidence)
s.ImportanceFraction = float64(s1.ImportanceFraction)
return nil
}
// CropHintsAnnotation: Set of crop hints that are used to generate new
// crops when serving images.
type CropHintsAnnotation struct {
// CropHints: Crop hint results.
CropHints []*CropHint `json:"cropHints,omitempty"`
// ForceSendFields is a list of field names (e.g. "CropHints") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "CropHints") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CropHintsAnnotation) MarshalJSON() ([]byte, error) {
type NoMethod CropHintsAnnotation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CropHintsParams: Parameters for crop hints annotation request.
type CropHintsParams struct {
// AspectRatios: Aspect ratios in floats, representing the ratio of the
// width to the height
// of the image. For example, if the desired aspect ratio is 4/3,
// the
// corresponding float value should be 1.33333. If not specified,
// the
// best possible crop is returned. The number of provided aspect ratios
// is
// limited to a maximum of 16; any aspect ratios provided after the 16th
// are
// ignored.
AspectRatios []float64 `json:"aspectRatios,omitempty"`
// ForceSendFields is a list of field names (e.g. "AspectRatios") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "AspectRatios") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *CropHintsParams) MarshalJSON() ([]byte, error) {
type NoMethod CropHintsParams
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DetectedBreak: Detected start or end of a structural component.
type DetectedBreak struct {
// IsPrefix: True if break prepends the element.
IsPrefix bool `json:"isPrefix,omitempty"`
// Type: Detected break type.
//
// Possible values:
// "UNKNOWN" - Unknown break label type.
// "SPACE" - Regular space.
// "SURE_SPACE" - Sure space (very wide).
// "EOL_SURE_SPACE" - Line-wrapping break.
// "HYPHEN" - End-line hyphen that is not present in text; does not
// co-occur with
// `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`.
// "LINE_BREAK" - Line break that ends a paragraph.
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "IsPrefix") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "IsPrefix") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DetectedBreak) MarshalJSON() ([]byte, error) {
type NoMethod DetectedBreak
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// DetectedLanguage: Detected language for a structural component.
type DetectedLanguage struct {
// Confidence: Confidence of detected language. Range [0, 1].
Confidence float64 `json:"confidence,omitempty"`
// LanguageCode: The BCP-47 language code, such as "en-US" or "sr-Latn".
// For more
// information,
// see
// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
LanguageCode string `json:"languageCode,omitempty"`
// ForceSendFields is a list of field names (e.g. "Confidence") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Confidence") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DetectedLanguage) MarshalJSON() ([]byte, error) {
type NoMethod DetectedLanguage
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
func (s *DetectedLanguage) UnmarshalJSON(data []byte) error {
type NoMethod DetectedLanguage
var s1 struct {
Confidence gensupport.JSONFloat64 `json:"confidence"`
*NoMethod
}
s1.NoMethod = (*NoMethod)(s)
if err := json.Unmarshal(data, &s1); err != nil {
return err
}
s.Confidence = float64(s1.Confidence)
return nil
}
// DominantColorsAnnotation: Set of dominant colors and their
// corresponding scores.
type DominantColorsAnnotation struct {
// Colors: RGB color values with their score and pixel fraction.
Colors []*ColorInfo `json:"colors,omitempty"`
// ForceSendFields is a list of field names (e.g. "Colors") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Colors") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DominantColorsAnnotation) MarshalJSON() ([]byte, error) {
type NoMethod DominantColorsAnnotation
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Empty: A generic empty message that you can re-use to avoid defining
// duplicated
// empty messages in your APIs. A typical example is to use it as the
// request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns
// (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct {
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
}
// EntityAnnotation: Set of detected entity features.
type EntityAnnotation struct {
// BoundingPoly: Image region to which this entity belongs. Not
// produced
// for `LABEL_DETECTION` features.
BoundingPoly *BoundingPoly `json:"boundingPoly,omitempty"`
// Confidence: **Deprecated. Use `score` instead.**
// The accuracy of the entity detection in an image.
// For example, for an image in which the "Eiffel Tower" entity is
// detected,
// this field represents the confidence that there is a tower in the
// query
// image. Range [0, 1].
Confidence float64 `json:"confidence,omitempty"`
// Description: Entity textual description, expressed in its `locale`
// language.
Description string `json:"description,omitempty"`
// Locale: The language code for the locale in which the entity
// textual
// `description` is expressed.
Locale string `json:"locale,omitempty"`
// Locations: The location information for the detected entity.
// Multiple
// `LocationInfo` elements can be present because one location
// may
// indicate the location of the scene in the image, and another
// location
// may indicate the location of the place where the image was
// taken.
// Location information is usually present for landmarks.
Locations []*LocationInfo `json:"locations,omitempty"`
// Mid: Opaque entity ID. Some IDs may be available in
// [Google Knowledge Graph
// Search
// API](https://developers.google.com/knowledge-graph/).
Mid string `json:"mid,omitempty"`
// Properties: Some entities may have optional user-supplied `Property`
// (name/value)
// fields, such a score or string that qualifies the entity.
Properties []*Property `json:"properties,omitempty"`
// Score: Overall score of the result. Range [0, 1].
Score float64 `json:"score,omitempty"`
// Topicality: The relevancy of the ICA (Image Content Annotation) label
// to the
// image. For example, the relevancy of "tower" is likely higher to an
// image
// containing the detected "Eiffel Tower" than to an image containing
// a
// detected distant towering building, even though the confidence
// that
// there is a tower in each image may be the same. Range [0, 1].
Topicality float64 `json:"topicality,omitempty"`
// ForceSendFields is a list of field names (e.g. "BoundingPoly") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "BoundingPoly") to include
// in API requests with the JSON null value. By default, fields with