From 054b21995a34c097dc39985c969e1212c1195ce0 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 17 May 2018 00:16:04 +0000 Subject: [PATCH] Generated from 984c12a568b2dd36acb521eb3b1c00fbd5b42995 Update CognitiveService ComputerVision Swagger for new extensions (#1) * Merged PR 17875: Add new languages Add new languages Also tidy up the enum definition so that AutoRest generates C# that actually compiles * Merged PR 17942: Replace fancy quotes with plain single quotes Make javac compile without complaint even without setting the codepage to utf-8 by dropping the gratuitous typographic quotes. * Merged PR 17956: Rename url argument for overloaded endpoint to imageUrl This name will become the name of the argument in Python. Since you can used named arguments in Python, give them less ambiguous names. * Changes to make --azure-validator run more cleanly Errors Fixed * XmsExamplesRequired/D5001/Documentation (7) * XmsPathsMustOverloadPaths/R2058/SDKViolation (7) Errors Ignored * SecurityDefinitionsStructure/R2054/SDKViolation (1) - API Key scheme for Cognitive Services * APIVersionPattern/R3012/ARMViolation (1) - Keeping with the Cognitive Services numbering scheme * OperationsAPIImplementation/R3023/ARMViolation (1) - Not sure what this is Warnings Fixed * XmsEnumValidation/R2018/SDKViolation (1) * DescriptionAndTitleMissing/R4000/SDKViolation (1) Warnings Ignored * DescriptionAndTitleMissing/R4000/SDKViolation (35) - description is contained in #ref * EnumInsteadOfBoolean/R3018/ARMViolation (5) - fix would be a breaking change * ListInOperationName/R1003/SDKViolation (1) - fix would be a breaking change * LongRunningOperationsWithLongRunningExtension/R2007/SDKViolation (2) - endpoint will not ultimately yield a 200, as this extension would require * NonApplicationJsonType/R2004/ARMViolation (15) - fix would be breaking change * PageableOperation/R2029/SDKViolation (1) - not actually pageable * ParameterNotDefinedInGlobalParameters/R2015/SDKViolation (1) - All our own parameters specify x-ms-parameter-location * PostOperationIdContainsUrlVerb/R2066/SDKViolation (7) - fix would be breaking change --- .../computervision/models.go | 64 +++---- .../computervision/models.go | 64 +++---- .../v1.0/computervision/client.go | 83 ++++++--- .../v1.0/computervision/models.go | 164 ++++++++---------- 4 files changed, 179 insertions(+), 196 deletions(-) diff --git a/profiles/latest/cognitiveservices/computervision/models.go b/profiles/latest/cognitiveservices/computervision/models.go index 2dc6f7da8878..954a0e004ccb 100644 --- a/profiles/latest/cognitiveservices/computervision/models.go +++ b/profiles/latest/cognitiveservices/computervision/models.go @@ -78,43 +78,36 @@ const ( Male Gender = original.Male ) -type Language1 = original.Language1 - -const ( - En Language1 = original.En - Zh Language1 = original.Zh -) - type OcrLanguages = original.OcrLanguages const ( - OcrLanguagesAr OcrLanguages = original.OcrLanguagesAr - OcrLanguagesCs OcrLanguages = original.OcrLanguagesCs - OcrLanguagesDa OcrLanguages = original.OcrLanguagesDa - OcrLanguagesDe OcrLanguages = original.OcrLanguagesDe - OcrLanguagesEl OcrLanguages = original.OcrLanguagesEl - OcrLanguagesEn OcrLanguages = original.OcrLanguagesEn - OcrLanguagesEs OcrLanguages = original.OcrLanguagesEs - OcrLanguagesFi OcrLanguages = original.OcrLanguagesFi - OcrLanguagesFr OcrLanguages = original.OcrLanguagesFr - OcrLanguagesHu OcrLanguages = original.OcrLanguagesHu - OcrLanguagesIt OcrLanguages = original.OcrLanguagesIt - OcrLanguagesJa OcrLanguages = original.OcrLanguagesJa - OcrLanguagesKo OcrLanguages = original.OcrLanguagesKo - OcrLanguagesNb OcrLanguages = original.OcrLanguagesNb - OcrLanguagesNl OcrLanguages = original.OcrLanguagesNl - OcrLanguagesPl OcrLanguages = original.OcrLanguagesPl - OcrLanguagesPt OcrLanguages = original.OcrLanguagesPt - OcrLanguagesRo OcrLanguages = original.OcrLanguagesRo - OcrLanguagesRu OcrLanguages = original.OcrLanguagesRu - OcrLanguagesSk OcrLanguages = original.OcrLanguagesSk - OcrLanguagesSrCyrl OcrLanguages = original.OcrLanguagesSrCyrl - OcrLanguagesSrLatn OcrLanguages = original.OcrLanguagesSrLatn - OcrLanguagesSv OcrLanguages = original.OcrLanguagesSv - OcrLanguagesTr OcrLanguages = original.OcrLanguagesTr - OcrLanguagesUnk OcrLanguages = original.OcrLanguagesUnk - OcrLanguagesZhHans OcrLanguages = original.OcrLanguagesZhHans - OcrLanguagesZhHant OcrLanguages = original.OcrLanguagesZhHant + Ar OcrLanguages = original.Ar + Cs OcrLanguages = original.Cs + Da OcrLanguages = original.Da + De OcrLanguages = original.De + El OcrLanguages = original.El + En OcrLanguages = original.En + Es OcrLanguages = original.Es + Fi OcrLanguages = original.Fi + Fr OcrLanguages = original.Fr + Hu OcrLanguages = original.Hu + It OcrLanguages = original.It + Ja OcrLanguages = original.Ja + Ko OcrLanguages = original.Ko + Nb OcrLanguages = original.Nb + Nl OcrLanguages = original.Nl + Pl OcrLanguages = original.Pl + Pt OcrLanguages = original.Pt + Ro OcrLanguages = original.Ro + Ru OcrLanguages = original.Ru + Sk OcrLanguages = original.Sk + SrCyrl OcrLanguages = original.SrCyrl + SrLatn OcrLanguages = original.SrLatn + Sv OcrLanguages = original.Sv + Tr OcrLanguages = original.Tr + Unk OcrLanguages = original.Unk + ZhHans OcrLanguages = original.ZhHans + ZhHant OcrLanguages = original.ZhHant ) type TextOperationStatusCodes = original.TextOperationStatusCodes @@ -190,9 +183,6 @@ func PossibleErrorCodesValues() []ErrorCodes { func PossibleGenderValues() []Gender { return original.PossibleGenderValues() } -func PossibleLanguage1Values() []Language1 { - return original.PossibleLanguage1Values() -} func PossibleOcrLanguagesValues() []OcrLanguages { return original.PossibleOcrLanguagesValues() } diff --git a/profiles/preview/cognitiveservices/computervision/models.go b/profiles/preview/cognitiveservices/computervision/models.go index 05c11824382f..bbb11cb1d0a7 100644 --- a/profiles/preview/cognitiveservices/computervision/models.go +++ b/profiles/preview/cognitiveservices/computervision/models.go @@ -78,43 +78,36 @@ const ( Male Gender = original.Male ) -type Language1 = original.Language1 - -const ( - En Language1 = original.En - Zh Language1 = original.Zh -) - type OcrLanguages = original.OcrLanguages const ( - OcrLanguagesAr OcrLanguages = original.OcrLanguagesAr - OcrLanguagesCs OcrLanguages = original.OcrLanguagesCs - OcrLanguagesDa OcrLanguages = original.OcrLanguagesDa - OcrLanguagesDe OcrLanguages = original.OcrLanguagesDe - OcrLanguagesEl OcrLanguages = original.OcrLanguagesEl - OcrLanguagesEn OcrLanguages = original.OcrLanguagesEn - OcrLanguagesEs OcrLanguages = original.OcrLanguagesEs - OcrLanguagesFi OcrLanguages = original.OcrLanguagesFi - OcrLanguagesFr OcrLanguages = original.OcrLanguagesFr - OcrLanguagesHu OcrLanguages = original.OcrLanguagesHu - OcrLanguagesIt OcrLanguages = original.OcrLanguagesIt - OcrLanguagesJa OcrLanguages = original.OcrLanguagesJa - OcrLanguagesKo OcrLanguages = original.OcrLanguagesKo - OcrLanguagesNb OcrLanguages = original.OcrLanguagesNb - OcrLanguagesNl OcrLanguages = original.OcrLanguagesNl - OcrLanguagesPl OcrLanguages = original.OcrLanguagesPl - OcrLanguagesPt OcrLanguages = original.OcrLanguagesPt - OcrLanguagesRo OcrLanguages = original.OcrLanguagesRo - OcrLanguagesRu OcrLanguages = original.OcrLanguagesRu - OcrLanguagesSk OcrLanguages = original.OcrLanguagesSk - OcrLanguagesSrCyrl OcrLanguages = original.OcrLanguagesSrCyrl - OcrLanguagesSrLatn OcrLanguages = original.OcrLanguagesSrLatn - OcrLanguagesSv OcrLanguages = original.OcrLanguagesSv - OcrLanguagesTr OcrLanguages = original.OcrLanguagesTr - OcrLanguagesUnk OcrLanguages = original.OcrLanguagesUnk - OcrLanguagesZhHans OcrLanguages = original.OcrLanguagesZhHans - OcrLanguagesZhHant OcrLanguages = original.OcrLanguagesZhHant + Ar OcrLanguages = original.Ar + Cs OcrLanguages = original.Cs + Da OcrLanguages = original.Da + De OcrLanguages = original.De + El OcrLanguages = original.El + En OcrLanguages = original.En + Es OcrLanguages = original.Es + Fi OcrLanguages = original.Fi + Fr OcrLanguages = original.Fr + Hu OcrLanguages = original.Hu + It OcrLanguages = original.It + Ja OcrLanguages = original.Ja + Ko OcrLanguages = original.Ko + Nb OcrLanguages = original.Nb + Nl OcrLanguages = original.Nl + Pl OcrLanguages = original.Pl + Pt OcrLanguages = original.Pt + Ro OcrLanguages = original.Ro + Ru OcrLanguages = original.Ru + Sk OcrLanguages = original.Sk + SrCyrl OcrLanguages = original.SrCyrl + SrLatn OcrLanguages = original.SrLatn + Sv OcrLanguages = original.Sv + Tr OcrLanguages = original.Tr + Unk OcrLanguages = original.Unk + ZhHans OcrLanguages = original.ZhHans + ZhHant OcrLanguages = original.ZhHant ) type TextOperationStatusCodes = original.TextOperationStatusCodes @@ -190,9 +183,6 @@ func PossibleErrorCodesValues() []ErrorCodes { func PossibleGenderValues() []Gender { return original.PossibleGenderValues() } -func PossibleLanguage1Values() []Language1 { - return original.PossibleLanguage1Values() -} func PossibleOcrLanguagesValues() []OcrLanguages { return original.PossibleOcrLanguagesValues() } diff --git a/services/cognitiveservices/v1.0/computervision/client.go b/services/cognitiveservices/v1.0/computervision/client.go index 909ab3ae2a76..5c695f7e7836 100644 --- a/services/cognitiveservices/v1.0/computervision/client.go +++ b/services/cognitiveservices/v1.0/computervision/client.go @@ -69,10 +69,10 @@ func NewWithoutDefaults(azureRegion AzureRegions) BaseClient { // details - a string indicating which domain-specific details to return. Multiple values should be // comma-separated. Valid visual feature types include:Celebrities - identifies celebrities if detected in the // image. -// language - a string indicating which language to return. The service will return recognition results in -// specified language. If this parameter is not specified, the default value is "en".Supported -// languages:en - English, Default.zh - Simplified Chinese. -func (client BaseClient) AnalyzeImage(ctx context.Context, imageURL ImageURL, visualFeatures []VisualFeatureTypes, details []Details, language Language1) (result ImageAnalysis, err error) { +// language - the desired language for output generation. If this parameter is not specified, the default value +// is "en".Supported languages:en - English, Default.ja - Japanese pt - Portuguese zh - Simplified +// Chinese. +func (client BaseClient) AnalyzeImage(ctx context.Context, imageURL ImageURL, visualFeatures []VisualFeatureTypes, details []Details, language string) (result ImageAnalysis, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { @@ -101,7 +101,7 @@ func (client BaseClient) AnalyzeImage(ctx context.Context, imageURL ImageURL, vi } // AnalyzeImagePreparer prepares the AnalyzeImage request. -func (client BaseClient) AnalyzeImagePreparer(ctx context.Context, imageURL ImageURL, visualFeatures []VisualFeatureTypes, details []Details, language Language1) (*http.Request, error) { +func (client BaseClient) AnalyzeImagePreparer(ctx context.Context, imageURL ImageURL, visualFeatures []VisualFeatureTypes, details []Details, language string) (*http.Request, error) { urlParameters := map[string]interface{}{ "AzureRegion": client.AzureRegion, } @@ -307,9 +307,9 @@ func (client BaseClient) AnalyzeImageByDomainInStreamResponder(resp *http.Respon // details - a string indicating which domain-specific details to return. Multiple values should be // comma-separated. Valid visual feature types include:Celebrities - identifies celebrities if detected in the // image. -// language - a string indicating which language to return. The service will return recognition results in -// specified language. If this parameter is not specified, the default value is "en".Supported -// languages:en - English, Default.zh - Simplified Chinese. +// language - the desired language for output generation. If this parameter is not specified, the default value +// is "en".Supported languages:en - English, Default.ja - Japanese pt - Portuguese zh - Simplified +// Chinese. func (client BaseClient) AnalyzeImageInStream(ctx context.Context, imageParameter io.ReadCloser, visualFeatures []VisualFeatureTypes, details string, language string) (result ImageAnalysis, err error) { req, err := client.AnalyzeImageInStreamPreparer(ctx, imageParameter, visualFeatures, details, language) if err != nil { @@ -390,14 +390,17 @@ func (client BaseClient) AnalyzeImageInStreamResponder(resp *http.Response) (res // Parameters: // imageURL - a JSON document with a URL pointing to the image that is to be analyzed. // maxCandidates - maximum number of candidate descriptions to be returned. The default is 1. -func (client BaseClient) DescribeImage(ctx context.Context, imageURL ImageURL, maxCandidates string) (result ImageDescription, err error) { +// language - the desired language for output generation. If this parameter is not specified, the default value +// is "en".Supported languages:en - English, Default.ja - Japanese pt - Portuguese zh - Simplified +// Chinese. +func (client BaseClient) DescribeImage(ctx context.Context, imageURL ImageURL, maxCandidates string, language string) (result ImageDescription, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("computervision.BaseClient", "DescribeImage", err.Error()) } - req, err := client.DescribeImagePreparer(ctx, imageURL, maxCandidates) + req, err := client.DescribeImagePreparer(ctx, imageURL, maxCandidates, language) if err != nil { err = autorest.NewErrorWithError(err, "computervision.BaseClient", "DescribeImage", nil, "Failure preparing request") return @@ -419,7 +422,7 @@ func (client BaseClient) DescribeImage(ctx context.Context, imageURL ImageURL, m } // DescribeImagePreparer prepares the DescribeImage request. -func (client BaseClient) DescribeImagePreparer(ctx context.Context, imageURL ImageURL, maxCandidates string) (*http.Request, error) { +func (client BaseClient) DescribeImagePreparer(ctx context.Context, imageURL ImageURL, maxCandidates string, language string) (*http.Request, error) { urlParameters := map[string]interface{}{ "AzureRegion": client.AzureRegion, } @@ -430,6 +433,11 @@ func (client BaseClient) DescribeImagePreparer(ctx context.Context, imageURL Ima } else { queryParameters["maxCandidates"] = autorest.Encode("query", "1") } + if len(string(language)) > 0 { + queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "en") + } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), @@ -470,8 +478,11 @@ func (client BaseClient) DescribeImageResponder(resp *http.Response) (result Ima // Parameters: // imageParameter - an image stream. // maxCandidates - maximum number of candidate descriptions to be returned. The default is 1. -func (client BaseClient) DescribeImageInStream(ctx context.Context, imageParameter io.ReadCloser, maxCandidates string) (result ImageDescription, err error) { - req, err := client.DescribeImageInStreamPreparer(ctx, imageParameter, maxCandidates) +// language - the desired language for output generation. If this parameter is not specified, the default value +// is "en".Supported languages:en - English, Default.ja - Japanese pt - Portuguese zh - Simplified +// Chinese. +func (client BaseClient) DescribeImageInStream(ctx context.Context, imageParameter io.ReadCloser, maxCandidates string, language string) (result ImageDescription, err error) { + req, err := client.DescribeImageInStreamPreparer(ctx, imageParameter, maxCandidates, language) if err != nil { err = autorest.NewErrorWithError(err, "computervision.BaseClient", "DescribeImageInStream", nil, "Failure preparing request") return @@ -493,7 +504,7 @@ func (client BaseClient) DescribeImageInStream(ctx context.Context, imageParamet } // DescribeImageInStreamPreparer prepares the DescribeImageInStream request. -func (client BaseClient) DescribeImageInStreamPreparer(ctx context.Context, imageParameter io.ReadCloser, maxCandidates string) (*http.Request, error) { +func (client BaseClient) DescribeImageInStreamPreparer(ctx context.Context, imageParameter io.ReadCloser, maxCandidates string, language string) (*http.Request, error) { urlParameters := map[string]interface{}{ "AzureRegion": client.AzureRegion, } @@ -504,6 +515,11 @@ func (client BaseClient) DescribeImageInStreamPreparer(ctx context.Context, imag } else { queryParameters["maxCandidates"] = autorest.Encode("query", "1") } + if len(string(language)) > 0 { + queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "en") + } preparer := autorest.CreatePreparer( autorest.AsContentType("application/octet-stream"), @@ -996,12 +1012,12 @@ func (client BaseClient) RecognizePrintedTextInStreamResponder(resp *http.Respon } // RecognizeText recognize Text operation. When you use the Recognize Text interface, the response contains a field -// called “Operation-Location”. The “Operation-Location” field contains the URL that you must use for your Get +// called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get // Handwritten Text Operation Result operation. // Parameters: // imageURL - a JSON document with a URL pointing to the image that is to be analyzed. -// detectHandwriting - if “true” is specified, handwriting recognition is performed. If this parameter is set -// to “false” or is not specified, printed text recognition is performed. +// detectHandwriting - if 'true' is specified, handwriting recognition is performed. If this parameter is set +// to 'false' or is not specified, printed text recognition is performed. func (client BaseClient) RecognizeText(ctx context.Context, imageURL ImageURL, detectHandwriting *bool) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, @@ -1073,12 +1089,12 @@ func (client BaseClient) RecognizeTextResponder(resp *http.Response) (result aut } // RecognizeTextInStream recognize Text operation. When you use the Recognize Text interface, the response contains a -// field called “Operation-Location”. The “Operation-Location” field contains the URL that you must use for your Get +// field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get // Handwritten Text Operation Result operation. // Parameters: // imageParameter - an image stream. -// detectHandwriting - if “true” is specified, handwriting recognition is performed. If this parameter is set -// to “false” or is not specified, printed text recognition is performed. +// detectHandwriting - if 'true' is specified, handwriting recognition is performed. If this parameter is set +// to 'false' or is not specified, printed text recognition is performed. func (client BaseClient) RecognizeTextInStream(ctx context.Context, imageParameter io.ReadCloser, detectHandwriting *bool) (result autorest.Response, err error) { req, err := client.RecognizeTextInStreamPreparer(ctx, imageParameter, detectHandwriting) if err != nil { @@ -1146,18 +1162,21 @@ func (client BaseClient) RecognizeTextInStreamResponder(resp *http.Response) (re // TagImage this operation generates a list of words, or tags, that are relevant to the content of the supplied image. // The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. Unlike // categories, tags are not organized according to a hierarchical classification system, but correspond to image -// content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be -// accompanied by the hint “musical instrument”. All tags are in English. +// content. Tags may contain hints to avoid ambiguity or provide context, for example the tag 'cello' may be +// accompanied by the hint 'musical instrument'. All tags are in English. // Parameters: // imageURL - a JSON document with a URL pointing to the image that is to be analyzed. -func (client BaseClient) TagImage(ctx context.Context, imageURL ImageURL) (result TagResult, err error) { +// language - the desired language for output generation. If this parameter is not specified, the default value +// is "en".Supported languages:en - English, Default.ja - Japanese pt - Portuguese zh - Simplified +// Chinese. +func (client BaseClient) TagImage(ctx context.Context, imageURL ImageURL, language string) (result TagResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: imageURL, Constraints: []validation.Constraint{{Target: "imageURL.URL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("computervision.BaseClient", "TagImage", err.Error()) } - req, err := client.TagImagePreparer(ctx, imageURL) + req, err := client.TagImagePreparer(ctx, imageURL, language) if err != nil { err = autorest.NewErrorWithError(err, "computervision.BaseClient", "TagImage", nil, "Failure preparing request") return @@ -1179,17 +1198,25 @@ func (client BaseClient) TagImage(ctx context.Context, imageURL ImageURL) (resul } // TagImagePreparer prepares the TagImage request. -func (client BaseClient) TagImagePreparer(ctx context.Context, imageURL ImageURL) (*http.Request, error) { +func (client BaseClient) TagImagePreparer(ctx context.Context, imageURL ImageURL, language string) (*http.Request, error) { urlParameters := map[string]interface{}{ "AzureRegion": client.AzureRegion, } + queryParameters := map[string]interface{}{} + if len(string(language)) > 0 { + queryParameters["language"] = autorest.Encode("query", language) + } else { + queryParameters["language"] = autorest.Encode("query", "en") + } + preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithCustomBaseURL("https://{AzureRegion}.api.cognitive.microsoft.com/vision/v1.0", urlParameters), autorest.WithPath("/tag"), - autorest.WithJSON(imageURL)) + autorest.WithJSON(imageURL), + autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -1216,8 +1243,8 @@ func (client BaseClient) TagImageResponder(resp *http.Response) (result TagResul // TagImageInStream this operation generates a list of words, or tags, that are relevant to the content of the supplied // image. The Computer Vision API can return tags based on objects, living beings, scenery or actions found in images. // Unlike categories, tags are not organized according to a hierarchical classification system, but correspond to image -// content. Tags may contain hints to avoid ambiguity or provide context, for example the tag “cello” may be -// accompanied by the hint “musical instrument”. All tags are in English. +// content. Tags may contain hints to avoid ambiguity or provide context, for example the tag 'cello' may be +// accompanied by the hint 'musical instrument'. All tags are in English. // Parameters: // imageParameter - an image stream. func (client BaseClient) TagImageInStream(ctx context.Context, imageParameter io.ReadCloser) (result TagResult, err error) { diff --git a/services/cognitiveservices/v1.0/computervision/models.go b/services/cognitiveservices/v1.0/computervision/models.go index 31ec4091b5ea..d342a5268f17 100644 --- a/services/cognitiveservices/v1.0/computervision/models.go +++ b/services/cognitiveservices/v1.0/computervision/models.go @@ -140,84 +140,69 @@ func PossibleGenderValues() []Gender { return []Gender{Female, Male} } -// Language1 enumerates the values for language 1. -type Language1 string - -const ( - // En ... - En Language1 = "en" - // Zh ... - Zh Language1 = "zh" -) - -// PossibleLanguage1Values returns an array of possible values for the Language1 const type. -func PossibleLanguage1Values() []Language1 { - return []Language1{En, Zh} -} - // OcrLanguages enumerates the values for ocr languages. type OcrLanguages string const ( - // OcrLanguagesAr ... - OcrLanguagesAr OcrLanguages = "ar" - // OcrLanguagesCs ... - OcrLanguagesCs OcrLanguages = "cs" - // OcrLanguagesDa ... - OcrLanguagesDa OcrLanguages = "da" - // OcrLanguagesDe ... - OcrLanguagesDe OcrLanguages = "de" - // OcrLanguagesEl ... - OcrLanguagesEl OcrLanguages = "el" - // OcrLanguagesEn ... - OcrLanguagesEn OcrLanguages = "en" - // OcrLanguagesEs ... - OcrLanguagesEs OcrLanguages = "es" - // OcrLanguagesFi ... - OcrLanguagesFi OcrLanguages = "fi" - // OcrLanguagesFr ... - OcrLanguagesFr OcrLanguages = "fr" - // OcrLanguagesHu ... - OcrLanguagesHu OcrLanguages = "hu" - // OcrLanguagesIt ... - OcrLanguagesIt OcrLanguages = "it" - // OcrLanguagesJa ... - OcrLanguagesJa OcrLanguages = "ja" - // OcrLanguagesKo ... - OcrLanguagesKo OcrLanguages = "ko" - // OcrLanguagesNb ... - OcrLanguagesNb OcrLanguages = "nb" - // OcrLanguagesNl ... - OcrLanguagesNl OcrLanguages = "nl" - // OcrLanguagesPl ... - OcrLanguagesPl OcrLanguages = "pl" - // OcrLanguagesPt ... - OcrLanguagesPt OcrLanguages = "pt" - // OcrLanguagesRo ... - OcrLanguagesRo OcrLanguages = "ro" - // OcrLanguagesRu ... - OcrLanguagesRu OcrLanguages = "ru" - // OcrLanguagesSk ... - OcrLanguagesSk OcrLanguages = "sk" - // OcrLanguagesSrCyrl ... - OcrLanguagesSrCyrl OcrLanguages = "sr-Cyrl" - // OcrLanguagesSrLatn ... - OcrLanguagesSrLatn OcrLanguages = "sr-Latn" - // OcrLanguagesSv ... - OcrLanguagesSv OcrLanguages = "sv" - // OcrLanguagesTr ... - OcrLanguagesTr OcrLanguages = "tr" - // OcrLanguagesUnk ... - OcrLanguagesUnk OcrLanguages = "unk" - // OcrLanguagesZhHans ... - OcrLanguagesZhHans OcrLanguages = "zh-Hans" - // OcrLanguagesZhHant ... - OcrLanguagesZhHant OcrLanguages = "zh-Hant" + // Ar ... + Ar OcrLanguages = "ar" + // Cs ... + Cs OcrLanguages = "cs" + // Da ... + Da OcrLanguages = "da" + // De ... + De OcrLanguages = "de" + // El ... + El OcrLanguages = "el" + // En ... + En OcrLanguages = "en" + // Es ... + Es OcrLanguages = "es" + // Fi ... + Fi OcrLanguages = "fi" + // Fr ... + Fr OcrLanguages = "fr" + // Hu ... + Hu OcrLanguages = "hu" + // It ... + It OcrLanguages = "it" + // Ja ... + Ja OcrLanguages = "ja" + // Ko ... + Ko OcrLanguages = "ko" + // Nb ... + Nb OcrLanguages = "nb" + // Nl ... + Nl OcrLanguages = "nl" + // Pl ... + Pl OcrLanguages = "pl" + // Pt ... + Pt OcrLanguages = "pt" + // Ro ... + Ro OcrLanguages = "ro" + // Ru ... + Ru OcrLanguages = "ru" + // Sk ... + Sk OcrLanguages = "sk" + // SrCyrl ... + SrCyrl OcrLanguages = "sr-Cyrl" + // SrLatn ... + SrLatn OcrLanguages = "sr-Latn" + // Sv ... + Sv OcrLanguages = "sv" + // Tr ... + Tr OcrLanguages = "tr" + // Unk ... + Unk OcrLanguages = "unk" + // ZhHans ... + ZhHans OcrLanguages = "zh-Hans" + // ZhHant ... + ZhHant OcrLanguages = "zh-Hant" ) // PossibleOcrLanguagesValues returns an array of possible values for the OcrLanguages const type. func PossibleOcrLanguagesValues() []OcrLanguages { - return []OcrLanguages{OcrLanguagesAr, OcrLanguagesCs, OcrLanguagesDa, OcrLanguagesDe, OcrLanguagesEl, OcrLanguagesEn, OcrLanguagesEs, OcrLanguagesFi, OcrLanguagesFr, OcrLanguagesHu, OcrLanguagesIt, OcrLanguagesJa, OcrLanguagesKo, OcrLanguagesNb, OcrLanguagesNl, OcrLanguagesPl, OcrLanguagesPt, OcrLanguagesRo, OcrLanguagesRu, OcrLanguagesSk, OcrLanguagesSrCyrl, OcrLanguagesSrLatn, OcrLanguagesSv, OcrLanguagesTr, OcrLanguagesUnk, OcrLanguagesZhHans, OcrLanguagesZhHant} + 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} } // TextOperationStatusCodes enumerates the values for text operation status codes. @@ -281,8 +266,7 @@ type Category struct { // Name - Name of the category. Name *string `json:"name,omitempty"` // Score - Scoring of the category. - Score *float64 `json:"score,omitempty"` - // Detail - Additional category detail if available. + Score *float64 `json:"score,omitempty"` Detail *CategoryDetail `json:"detail,omitempty"` } @@ -323,13 +307,11 @@ type DomainModelResult struct { // DomainModelResults result of image analysis using a specific domain model including additional metadata. type DomainModelResults struct { - autorest.Response `json:"-"` - // DomainModelResult - Result of the image analysis. + autorest.Response `json:"-"` *DomainModelResult `json:"result,omitempty"` // RequestID - Id of the REST API request. - RequestID *string `json:"requestId,omitempty"` - // Metadata - Additional image metadata - Metadata *ImageMetadata `json:"metadata,omitempty"` + RequestID *string `json:"requestId,omitempty"` + Metadata *ImageMetadata `json:"metadata,omitempty"` } // MarshalJSON is the custom marshaler for DomainModelResults. @@ -425,22 +407,17 @@ type ImageAnalysis struct { autorest.Response `json:"-"` // Categories - An array indicating identified categories. Categories *[]Category `json:"categories,omitempty"` - // Adult - A property scoring on whether the image is adult-oriented and/or racy. - Adult *AdultInfo `json:"adult,omitempty"` - // Color - A property scoring on color spectrums. - Color *ColorInfo `json:"color,omitempty"` - // ImageType - A property indicating type of image (whether it's clipart or line drawing) - ImageType *ImageType `json:"imageType,omitempty"` + Adult *AdultInfo `json:"adult,omitempty"` + Color *ColorInfo `json:"color,omitempty"` + ImageType *ImageType `json:"imageType,omitempty"` // Tags - A list of tags with confidence level. - Tags *[]ImageTag `json:"tags,omitempty"` - // Description - Description of the image. + Tags *[]ImageTag `json:"tags,omitempty"` Description *ImageDescriptionDetails `json:"description,omitempty"` // Faces - An array of possible faces within the image. Faces *[]FaceDescription `json:"faces,omitempty"` // RequestID - Id of the request for tracking purposes. - RequestID *string `json:"requestId,omitempty"` - // Metadata - Image metadata - Metadata *ImageMetadata `json:"metadata,omitempty"` + RequestID *string `json:"requestId,omitempty"` + Metadata *ImageMetadata `json:"metadata,omitempty"` } // ImageCaption an image caption, i.e. a brief description of what the image depicts. @@ -499,9 +476,8 @@ type ImageDescriptionDetails struct { // Captions - A list of captions, sorted by confidence level. Captions *[]ImageCaption `json:"captions,omitempty"` // RequestID - Id of the REST API request. - RequestID *string `json:"requestId,omitempty"` - // Metadata - Image metadata - Metadata *ImageMetadata `json:"metadata,omitempty"` + RequestID *string `json:"requestId,omitempty"` + Metadata *ImageMetadata `json:"metadata,omitempty"` } // ImageMetadata image metadata @@ -532,6 +508,7 @@ type ImageType struct { // ImageURL ... type ImageURL struct { + // URL - Publicly reachable URL of an image URL *string `json:"url,omitempty"` } @@ -607,9 +584,8 @@ type TagResult struct { // Tags - A list of tags with confidence level. Tags *[]ImageTag `json:"tags,omitempty"` // RequestID - Id of the REST API request. - RequestID *string `json:"requestId,omitempty"` - // Metadata - Image metadata - Metadata *ImageMetadata `json:"metadata,omitempty"` + RequestID *string `json:"requestId,omitempty"` + Metadata *ImageMetadata `json:"metadata,omitempty"` } // TextOperationResult ...