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