1package computervision
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"io"
24)
25
26// Details enumerates the values for details.
27type Details string
28
29const (
30	// Celebrities ...
31	Celebrities Details = "Celebrities"
32	// Landmarks ...
33	Landmarks Details = "Landmarks"
34)
35
36// PossibleDetailsValues returns an array of possible values for the Details const type.
37func PossibleDetailsValues() []Details {
38	return []Details{Celebrities, Landmarks}
39}
40
41// ErrorCodes enumerates the values for error codes.
42type ErrorCodes string
43
44const (
45	// BadArgument ...
46	BadArgument ErrorCodes = "BadArgument"
47	// FailedToProcess ...
48	FailedToProcess ErrorCodes = "FailedToProcess"
49	// InternalServerError ...
50	InternalServerError ErrorCodes = "InternalServerError"
51	// InvalidDetails ...
52	InvalidDetails ErrorCodes = "InvalidDetails"
53	// InvalidImageFormat ...
54	InvalidImageFormat ErrorCodes = "InvalidImageFormat"
55	// InvalidImageSize ...
56	InvalidImageSize ErrorCodes = "InvalidImageSize"
57	// InvalidImageURL ...
58	InvalidImageURL ErrorCodes = "InvalidImageUrl"
59	// NotSupportedImage ...
60	NotSupportedImage ErrorCodes = "NotSupportedImage"
61	// NotSupportedLanguage ...
62	NotSupportedLanguage ErrorCodes = "NotSupportedLanguage"
63	// NotSupportedVisualFeature ...
64	NotSupportedVisualFeature ErrorCodes = "NotSupportedVisualFeature"
65	// StorageException ...
66	StorageException ErrorCodes = "StorageException"
67	// Timeout ...
68	Timeout ErrorCodes = "Timeout"
69	// Unspecified ...
70	Unspecified ErrorCodes = "Unspecified"
71)
72
73// PossibleErrorCodesValues returns an array of possible values for the ErrorCodes const type.
74func PossibleErrorCodesValues() []ErrorCodes {
75	return []ErrorCodes{BadArgument, FailedToProcess, InternalServerError, InvalidDetails, InvalidImageFormat, InvalidImageSize, InvalidImageURL, NotSupportedImage, NotSupportedLanguage, NotSupportedVisualFeature, StorageException, Timeout, Unspecified}
76}
77
78// Gender enumerates the values for gender.
79type Gender string
80
81const (
82	// Female ...
83	Female Gender = "Female"
84	// Male ...
85	Male Gender = "Male"
86)
87
88// PossibleGenderValues returns an array of possible values for the Gender const type.
89func PossibleGenderValues() []Gender {
90	return []Gender{Female, Male}
91}
92
93// OcrLanguages enumerates the values for ocr languages.
94type OcrLanguages string
95
96const (
97	// Ar ...
98	Ar OcrLanguages = "ar"
99	// Cs ...
100	Cs OcrLanguages = "cs"
101	// Da ...
102	Da OcrLanguages = "da"
103	// De ...
104	De OcrLanguages = "de"
105	// El ...
106	El OcrLanguages = "el"
107	// En ...
108	En OcrLanguages = "en"
109	// Es ...
110	Es OcrLanguages = "es"
111	// Fi ...
112	Fi OcrLanguages = "fi"
113	// Fr ...
114	Fr OcrLanguages = "fr"
115	// Hu ...
116	Hu OcrLanguages = "hu"
117	// It ...
118	It OcrLanguages = "it"
119	// Ja ...
120	Ja OcrLanguages = "ja"
121	// Ko ...
122	Ko OcrLanguages = "ko"
123	// Nb ...
124	Nb OcrLanguages = "nb"
125	// Nl ...
126	Nl OcrLanguages = "nl"
127	// Pl ...
128	Pl OcrLanguages = "pl"
129	// Pt ...
130	Pt OcrLanguages = "pt"
131	// Ro ...
132	Ro OcrLanguages = "ro"
133	// Ru ...
134	Ru OcrLanguages = "ru"
135	// Sk ...
136	Sk OcrLanguages = "sk"
137	// SrCyrl ...
138	SrCyrl OcrLanguages = "sr-Cyrl"
139	// SrLatn ...
140	SrLatn OcrLanguages = "sr-Latn"
141	// Sv ...
142	Sv OcrLanguages = "sv"
143	// Tr ...
144	Tr OcrLanguages = "tr"
145	// Unk ...
146	Unk OcrLanguages = "unk"
147	// ZhHans ...
148	ZhHans OcrLanguages = "zh-Hans"
149	// ZhHant ...
150	ZhHant OcrLanguages = "zh-Hant"
151)
152
153// PossibleOcrLanguagesValues returns an array of possible values for the OcrLanguages const type.
154func PossibleOcrLanguagesValues() []OcrLanguages {
155	return []OcrLanguages{Ar, Cs, Da, De, El, En, Es, Fi, Fr, Hu, It, Ja, Ko, Nb, Nl, Pl, Pt, Ro, Ru, Sk, SrCyrl, SrLatn, Sv, Tr, Unk, ZhHans, ZhHant}
156}
157
158// TextOperationStatusCodes enumerates the values for text operation status codes.
159type TextOperationStatusCodes string
160
161const (
162	// Failed ...
163	Failed TextOperationStatusCodes = "Failed"
164	// NotStarted ...
165	NotStarted TextOperationStatusCodes = "Not Started"
166	// Running ...
167	Running TextOperationStatusCodes = "Running"
168	// Succeeded ...
169	Succeeded TextOperationStatusCodes = "Succeeded"
170)
171
172// PossibleTextOperationStatusCodesValues returns an array of possible values for the TextOperationStatusCodes const type.
173func PossibleTextOperationStatusCodesValues() []TextOperationStatusCodes {
174	return []TextOperationStatusCodes{Failed, NotStarted, Running, Succeeded}
175}
176
177// TextRecognitionMode enumerates the values for text recognition mode.
178type TextRecognitionMode string
179
180const (
181	// Handwritten ...
182	Handwritten TextRecognitionMode = "Handwritten"
183	// Printed ...
184	Printed TextRecognitionMode = "Printed"
185)
186
187// PossibleTextRecognitionModeValues returns an array of possible values for the TextRecognitionMode const type.
188func PossibleTextRecognitionModeValues() []TextRecognitionMode {
189	return []TextRecognitionMode{Handwritten, Printed}
190}
191
192// VisualFeatureTypes enumerates the values for visual feature types.
193type VisualFeatureTypes string
194
195const (
196	// VisualFeatureTypesAdult ...
197	VisualFeatureTypesAdult VisualFeatureTypes = "Adult"
198	// VisualFeatureTypesCategories ...
199	VisualFeatureTypesCategories VisualFeatureTypes = "Categories"
200	// VisualFeatureTypesColor ...
201	VisualFeatureTypesColor VisualFeatureTypes = "Color"
202	// VisualFeatureTypesDescription ...
203	VisualFeatureTypesDescription VisualFeatureTypes = "Description"
204	// VisualFeatureTypesFaces ...
205	VisualFeatureTypesFaces VisualFeatureTypes = "Faces"
206	// VisualFeatureTypesImageType ...
207	VisualFeatureTypesImageType VisualFeatureTypes = "ImageType"
208	// VisualFeatureTypesTags ...
209	VisualFeatureTypesTags VisualFeatureTypes = "Tags"
210)
211
212// PossibleVisualFeatureTypesValues returns an array of possible values for the VisualFeatureTypes const type.
213func PossibleVisualFeatureTypesValues() []VisualFeatureTypes {
214	return []VisualFeatureTypes{VisualFeatureTypesAdult, VisualFeatureTypesCategories, VisualFeatureTypesColor, VisualFeatureTypesDescription, VisualFeatureTypesFaces, VisualFeatureTypesImageType, VisualFeatureTypesTags}
215}
216
217// AdultInfo an object describing whether the image contains adult-oriented content and/or is racy.
218type AdultInfo struct {
219	// IsAdultContent - A value indicating if the image contains adult-oriented content.
220	IsAdultContent *bool `json:"isAdultContent,omitempty"`
221	// IsRacyContent - A value indicating if the image is race.
222	IsRacyContent *bool `json:"isRacyContent,omitempty"`
223	// AdultScore - Score from 0 to 1 that indicates how much of adult content is within the image.
224	AdultScore *float64 `json:"adultScore,omitempty"`
225	// RacyScore - Score from 0 to 1 that indicates how suggestive is the image.
226	RacyScore *float64 `json:"racyScore,omitempty"`
227}
228
229// Category an object describing identified category.
230type Category struct {
231	// Name - Name of the category.
232	Name *string `json:"name,omitempty"`
233	// Score - Scoring of the category.
234	Score  *float64        `json:"score,omitempty"`
235	Detail *CategoryDetail `json:"detail,omitempty"`
236}
237
238// CategoryDetail an object describing additional category details.
239type CategoryDetail struct {
240	// Celebrities - An array of celebrities if any identified.
241	Celebrities *[]CelebritiesModel `json:"celebrities,omitempty"`
242	// Landmarks - An array of landmarks if any identified.
243	Landmarks *[]LandmarksModel `json:"landmarks,omitempty"`
244}
245
246// CelebritiesModel an object describing possible celebrity identification.
247type CelebritiesModel struct {
248	// Name - Name of the celebrity.
249	Name *string `json:"name,omitempty"`
250	// Confidence - Level of confidence ranging from 0 to 1.
251	Confidence    *float64       `json:"confidence,omitempty"`
252	FaceRectangle *FaceRectangle `json:"faceRectangle,omitempty"`
253}
254
255// CelebrityResults list of celebrities recognized in the image.
256type CelebrityResults struct {
257	Celebrities *[]CelebritiesModel `json:"celebrities,omitempty"`
258	// RequestID - Id of the REST API request.
259	RequestID *string        `json:"requestId,omitempty"`
260	Metadata  *ImageMetadata `json:"metadata,omitempty"`
261}
262
263// ColorInfo an object providing additional metadata describing color attributes.
264type ColorInfo struct {
265	// DominantColorForeground - Possible dominant foreground color.
266	DominantColorForeground *string `json:"dominantColorForeground,omitempty"`
267	// DominantColorBackground - Possible dominant background color.
268	DominantColorBackground *string `json:"dominantColorBackground,omitempty"`
269	// DominantColors - An array of possible dominant colors.
270	DominantColors *[]string `json:"dominantColors,omitempty"`
271	// AccentColor - Possible accent color.
272	AccentColor *string `json:"accentColor,omitempty"`
273	// IsBWImg - A value indicating if the image is black and white.
274	IsBWImg *bool `json:"isBWImg,omitempty"`
275}
276
277// DomainModelResults result of image analysis using a specific domain model including additional metadata.
278type DomainModelResults struct {
279	autorest.Response `json:"-"`
280	// Result - Model-specific response
281	Result interface{} `json:"result,omitempty"`
282	// RequestID - Id of the REST API request.
283	RequestID *string        `json:"requestId,omitempty"`
284	Metadata  *ImageMetadata `json:"metadata,omitempty"`
285}
286
287// Error ...
288type Error struct {
289	// Code - The error code. Possible values include: 'InvalidImageURL', 'InvalidImageFormat', 'InvalidImageSize', 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', 'InternalServerError', 'Unspecified', 'StorageException'
290	Code ErrorCodes `json:"code,omitempty"`
291	// Message - A message explaining the error reported by the service.
292	Message *string `json:"message,omitempty"`
293	// RequestID - A unique request identifier.
294	RequestID *string `json:"requestId,omitempty"`
295}
296
297// FaceDescription an object describing a face identified in the image.
298type FaceDescription struct {
299	// Age - Possible age of the face.
300	Age *int32 `json:"age,omitempty"`
301	// Gender - Possible gender of the face. Possible values include: 'Male', 'Female'
302	Gender        Gender         `json:"gender,omitempty"`
303	FaceRectangle *FaceRectangle `json:"faceRectangle,omitempty"`
304}
305
306// FaceRectangle an object describing face rectangle.
307type FaceRectangle struct {
308	// Left - X-coordinate of the top left point of the face.
309	Left *int32 `json:"left,omitempty"`
310	// Top - Y-coordinate of the top left point of the face.
311	Top *int32 `json:"top,omitempty"`
312	// Width - Width measured from the top-left point of the face.
313	Width *int32 `json:"width,omitempty"`
314	// Height - Height measured from the top-left point of the face.
315	Height *int32 `json:"height,omitempty"`
316}
317
318// ImageAnalysis result of AnalyzeImage operation.
319type ImageAnalysis struct {
320	autorest.Response `json:"-"`
321	// Categories - An array indicating identified categories.
322	Categories *[]Category `json:"categories,omitempty"`
323	Adult      *AdultInfo  `json:"adult,omitempty"`
324	Color      *ColorInfo  `json:"color,omitempty"`
325	ImageType  *ImageType  `json:"imageType,omitempty"`
326	// Tags - A list of tags with confidence level.
327	Tags        *[]ImageTag              `json:"tags,omitempty"`
328	Description *ImageDescriptionDetails `json:"description,omitempty"`
329	// Faces - An array of possible faces within the image.
330	Faces *[]FaceDescription `json:"faces,omitempty"`
331	// RequestID - Id of the request for tracking purposes.
332	RequestID *string        `json:"requestId,omitempty"`
333	Metadata  *ImageMetadata `json:"metadata,omitempty"`
334}
335
336// ImageCaption an image caption, i.e. a brief description of what the image depicts.
337type ImageCaption struct {
338	// Text - The text of the caption
339	Text *string `json:"text,omitempty"`
340	// Confidence - The level of confidence the service has in the caption
341	Confidence *float64 `json:"confidence,omitempty"`
342}
343
344// ImageDescription a collection of content tags, along with a list of captions sorted by confidence level, and
345// image metadata.
346type ImageDescription struct {
347	autorest.Response        `json:"-"`
348	*ImageDescriptionDetails `json:"description,omitempty"`
349	// RequestID - Id of the REST API request.
350	RequestID *string        `json:"requestId,omitempty"`
351	Metadata  *ImageMetadata `json:"metadata,omitempty"`
352}
353
354// MarshalJSON is the custom marshaler for ImageDescription.
355func (ID ImageDescription) MarshalJSON() ([]byte, error) {
356	objectMap := make(map[string]interface{})
357	if ID.ImageDescriptionDetails != nil {
358		objectMap["description"] = ID.ImageDescriptionDetails
359	}
360	if ID.RequestID != nil {
361		objectMap["requestId"] = ID.RequestID
362	}
363	if ID.Metadata != nil {
364		objectMap["metadata"] = ID.Metadata
365	}
366	return json.Marshal(objectMap)
367}
368
369// UnmarshalJSON is the custom unmarshaler for ImageDescription struct.
370func (ID *ImageDescription) UnmarshalJSON(body []byte) error {
371	var m map[string]*json.RawMessage
372	err := json.Unmarshal(body, &m)
373	if err != nil {
374		return err
375	}
376	for k, v := range m {
377		switch k {
378		case "description":
379			if v != nil {
380				var imageDescriptionDetails ImageDescriptionDetails
381				err = json.Unmarshal(*v, &imageDescriptionDetails)
382				if err != nil {
383					return err
384				}
385				ID.ImageDescriptionDetails = &imageDescriptionDetails
386			}
387		case "requestId":
388			if v != nil {
389				var requestID string
390				err = json.Unmarshal(*v, &requestID)
391				if err != nil {
392					return err
393				}
394				ID.RequestID = &requestID
395			}
396		case "metadata":
397			if v != nil {
398				var metadata ImageMetadata
399				err = json.Unmarshal(*v, &metadata)
400				if err != nil {
401					return err
402				}
403				ID.Metadata = &metadata
404			}
405		}
406	}
407
408	return nil
409}
410
411// ImageDescriptionDetails a collection of content tags, along with a list of captions sorted by confidence level,
412// and image metadata.
413type ImageDescriptionDetails struct {
414	// Tags - A collection of image tags.
415	Tags *[]string `json:"tags,omitempty"`
416	// Captions - A list of captions, sorted by confidence level.
417	Captions *[]ImageCaption `json:"captions,omitempty"`
418}
419
420// ImageMetadata image metadata
421type ImageMetadata struct {
422	// Width - Image width
423	Width *int32 `json:"width,omitempty"`
424	// Height - Image height
425	Height *int32 `json:"height,omitempty"`
426	// Format - Image format
427	Format *string `json:"format,omitempty"`
428}
429
430// ImageTag an image caption, i.e. a brief description of what the image depicts.
431type ImageTag struct {
432	// Name - The tag value
433	Name *string `json:"name,omitempty"`
434	// Confidence - The level of confidence the service has in the caption
435	Confidence *float64 `json:"confidence,omitempty"`
436	// Hint - Optional categorization for the tag
437	Hint *string `json:"hint,omitempty"`
438}
439
440// ImageType an object providing possible image types and matching confidence levels.
441type ImageType struct {
442	// ClipArtType - Confidence level that the image is a clip art.
443	ClipArtType *int32 `json:"clipArtType,omitempty"`
444	// LineDrawingType - Confidence level that the image is a line drawing.
445	LineDrawingType *int32 `json:"lineDrawingType,omitempty"`
446}
447
448// ImageURL ...
449type ImageURL struct {
450	// URL - Publicly reachable URL of an image
451	URL *string `json:"url,omitempty"`
452}
453
454// LandmarkResults list of landmarks recognized in the image.
455type LandmarkResults struct {
456	Landmarks *[]LandmarksModel `json:"landmarks,omitempty"`
457	// RequestID - Id of the REST API request.
458	RequestID *string        `json:"requestId,omitempty"`
459	Metadata  *ImageMetadata `json:"metadata,omitempty"`
460}
461
462// LandmarksModel a landmark recognized in the image
463type LandmarksModel struct {
464	// Name - Name of the landmark.
465	Name *string `json:"name,omitempty"`
466	// Confidence - Confidence level for the landmark recognition.
467	Confidence *float64 `json:"confidence,omitempty"`
468}
469
470// Line ...
471type Line struct {
472	BoundingBox *[]int32 `json:"boundingBox,omitempty"`
473	Text        *string  `json:"text,omitempty"`
474	Words       *[]Word  `json:"words,omitempty"`
475}
476
477// ListModelsResult result of the List Domain Models operation.
478type ListModelsResult struct {
479	autorest.Response `json:"-"`
480	// ModelsProperty - An array of supported models.
481	ModelsProperty *[]ModelDescription `json:"models,omitempty"`
482}
483
484// ModelDescription an object describing supported model by name and categories.
485type ModelDescription struct {
486	Name       *string   `json:"name,omitempty"`
487	Categories *[]string `json:"categories,omitempty"`
488}
489
490// OcrLine an object describing a single recognized line of text.
491type OcrLine struct {
492	// BoundingBox - Bounding box of a recognized line. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
493	BoundingBox *string `json:"boundingBox,omitempty"`
494	// Words - An array of objects, where each object represents a recognized word.
495	Words *[]OcrWord `json:"words,omitempty"`
496}
497
498// OcrRegion a region consists of multiple lines (e.g. a column of text in a multi-column document).
499type OcrRegion struct {
500	// BoundingBox - Bounding box of a recognized region. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
501	BoundingBox *string    `json:"boundingBox,omitempty"`
502	Lines       *[]OcrLine `json:"lines,omitempty"`
503}
504
505// OcrResult ...
506type OcrResult struct {
507	autorest.Response `json:"-"`
508	// Language - The BCP-47 language code of the text in the image.
509	Language *string `json:"language,omitempty"`
510	// TextAngle - The angle, in degrees, of the detected text with respect to the closest horizontal or vertical direction. After rotating the input image clockwise by this angle, the recognized text lines become horizontal or vertical. In combination with the orientation property it can be used to overlay recognition results correctly on the original image, by rotating either the original image or recognition results by a suitable angle around the center of the original image. If the angle cannot be confidently detected, this property is not present. If the image contains text at different angles, only part of the text will be recognized correctly.
511	TextAngle *float64 `json:"textAngle,omitempty"`
512	// Orientation - Orientation of the text recognized in the image. The value (up,down,left, or right) refers to the direction that the top of the recognized text is facing, after the image has been rotated around its center according to the detected text angle (see textAngle property).
513	Orientation *string `json:"orientation,omitempty"`
514	// Regions - An array of objects, where each object represents a region of recognized text.
515	Regions *[]OcrRegion `json:"regions,omitempty"`
516}
517
518// OcrWord information on a recognized word.
519type OcrWord struct {
520	// BoundingBox - Bounding box of a recognized word. The four integers represent the x-coordinate of the left edge, the y-coordinate of the top edge, width, and height of the bounding box, in the coordinate system of the input image, after it has been rotated around its center according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down.
521	BoundingBox *string `json:"boundingBox,omitempty"`
522	// Text - String value of a recognized word.
523	Text *string `json:"text,omitempty"`
524}
525
526// ReadCloser ...
527type ReadCloser struct {
528	autorest.Response `json:"-"`
529	Value             *io.ReadCloser `json:"value,omitempty"`
530}
531
532// RecognitionResult ...
533type RecognitionResult struct {
534	Lines *[]Line `json:"lines,omitempty"`
535}
536
537// TagResult the results of a image tag operation, including any tags and image metadata.
538type TagResult struct {
539	autorest.Response `json:"-"`
540	// Tags - A list of tags with confidence level.
541	Tags *[]ImageTag `json:"tags,omitempty"`
542	// RequestID - Id of the REST API request.
543	RequestID *string        `json:"requestId,omitempty"`
544	Metadata  *ImageMetadata `json:"metadata,omitempty"`
545}
546
547// TextOperationResult ...
548type TextOperationResult struct {
549	autorest.Response `json:"-"`
550	// Status - Status of the text operation. Possible values include: 'NotStarted', 'Running', 'Failed', 'Succeeded'
551	Status            TextOperationStatusCodes `json:"status,omitempty"`
552	RecognitionResult *RecognitionResult       `json:"recognitionResult,omitempty"`
553}
554
555// Word ...
556type Word struct {
557	BoundingBox *[]int32 `json:"boundingBox,omitempty"`
558	Text        *string  `json:"text,omitempty"`
559}
560