diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/LICENSE.txt b/sdk/cognitiveservices/cognitiveservices-computervision/LICENSE.txt index b73b4a1293c3..ea8fb1516028 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/LICENSE.txt +++ b/sdk/cognitiveservices/cognitiveservices-computervision/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Microsoft +Copyright (c) 2020 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/package.json b/sdk/cognitiveservices/cognitiveservices-computervision/package.json index 933c302dee3d..f24cd9bc0bef 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/package.json +++ b/sdk/cognitiveservices/cognitiveservices-computervision/package.json @@ -2,7 +2,7 @@ "name": "@azure/cognitiveservices-computervision", "author": "Microsoft Corporation", "description": "ComputerVisionClient Library with typescript type definitions for node.js and browser.", - "version": "6.0.0", + "version": "7.0.0", "dependencies": { "@azure/ms-rest-js": "^2.0.4", "tslib": "^1.10.0" diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClient.ts b/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClient.ts index 31881a6652c6..a02c25a96c87 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClient.ts +++ b/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClient.ts @@ -353,131 +353,65 @@ class ComputerVisionClient extends ComputerVisionClientContext { callback) as Promise; } - /** - * 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 Recognize Text Operation Result operation. - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image. - * @param [options] The optional parameters - * @returns Promise - */ - recognizeText(mode: Models.TextRecognitionMode, url: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image. - * @param callback The callback - */ - recognizeText(mode: Models.TextRecognitionMode, url: string, callback: msRest.ServiceCallback): void; - /** - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image. - * @param options The optional parameters - * @param callback The callback - */ - recognizeText(mode: Models.TextRecognitionMode, url: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - recognizeText(mode: Models.TextRecognitionMode, url: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - mode, - url, - options - }, - recognizeTextOperationSpec, - callback) as Promise; - } - - /** - * This interface is used for getting text operation result. The URL to this interface should be - * retrieved from 'Operation-Location' field returned from Recognize Text interface. - * @param operationId Id of the text operation returned in the response of the 'Recognize Text' - * @param [options] The optional parameters - * @returns Promise - */ - getTextOperationResult(operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param operationId Id of the text operation returned in the response of the 'Recognize Text' - * @param callback The callback - */ - getTextOperationResult(operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param operationId Id of the text operation returned in the response of the 'Recognize Text' - * @param options The optional parameters - * @param callback The callback - */ - getTextOperationResult(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getTextOperationResult(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - operationId, - options - }, - getTextOperationResultOperationSpec, - callback) as Promise; - } - /** * Use this interface to get the result of a Read operation, employing the state-of-the-art Optical * Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read - * File interface, the response contains a field called 'Operation-Location'. The - * 'Operation-Location' field contains the URL that you must use for your 'GetReadOperationResult' - * operation to access OCR results.​ + * interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' + * field contains the URL that you must use for your 'GetReadResult' operation to access OCR + * results.​ * @param url Publicly reachable URL of an image. * @param [options] The optional parameters - * @returns Promise + * @returns Promise */ - batchReadFile(url: string, options?: msRest.RequestOptionsBase): Promise; + read(url: string, options?: Models.ComputerVisionClientReadOptionalParams): Promise; /** * @param url Publicly reachable URL of an image. * @param callback The callback */ - batchReadFile(url: string, callback: msRest.ServiceCallback): void; + read(url: string, callback: msRest.ServiceCallback): void; /** * @param url Publicly reachable URL of an image. * @param options The optional parameters * @param callback The callback */ - batchReadFile(url: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - batchReadFile(url: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + read(url: string, options: Models.ComputerVisionClientReadOptionalParams, callback: msRest.ServiceCallback): void; + read(url: string, options?: Models.ComputerVisionClientReadOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { url, options }, - batchReadFileOperationSpec, - callback) as Promise; + readOperationSpec, + callback) as Promise; } /** * This interface is used for getting OCR results of Read operation. The URL to this interface - * should be retrieved from 'Operation-Location' field returned from Batch Read File interface. - * @param operationId Id of read operation returned in the response of the 'Batch Read File' - * interface. + * should be retrieved from 'Operation-Location' field returned from Read interface. + * @param operationId Id of read operation returned in the response of the 'Read' interface. * @param [options] The optional parameters - * @returns Promise + * @returns Promise */ - getReadOperationResult(operationId: string, options?: msRest.RequestOptionsBase): Promise; + getReadResult(operationId: string, options?: msRest.RequestOptionsBase): Promise; /** - * @param operationId Id of read operation returned in the response of the 'Batch Read File' - * interface. + * @param operationId Id of read operation returned in the response of the 'Read' interface. * @param callback The callback */ - getReadOperationResult(operationId: string, callback: msRest.ServiceCallback): void; + getReadResult(operationId: string, callback: msRest.ServiceCallback): void; /** - * @param operationId Id of read operation returned in the response of the 'Batch Read File' - * interface. + * @param operationId Id of read operation returned in the response of the 'Read' interface. * @param options The optional parameters * @param callback The callback */ - getReadOperationResult(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getReadOperationResult(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getReadResult(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getReadResult(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { operationId, options }, - getReadOperationResultOperationSpec, - callback) as Promise; + getReadResultOperationSpec, + callback) as Promise; } /** @@ -781,69 +715,35 @@ class ComputerVisionClient extends ComputerVisionClientContext { } /** - * 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 Recognize Text Operation Result operation. - * @param image An image stream. - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param [options] The optional parameters - * @returns Promise - */ - recognizeTextInStream(image: msRest.HttpRequestBody, mode: Models.TextRecognitionMode, options?: msRest.RequestOptionsBase): Promise; - /** - * @param image An image stream. - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param callback The callback - */ - recognizeTextInStream(image: msRest.HttpRequestBody, mode: Models.TextRecognitionMode, callback: msRest.ServiceCallback): void; - /** - * @param image An image stream. - * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param options The optional parameters - * @param callback The callback - */ - recognizeTextInStream(image: msRest.HttpRequestBody, mode: Models.TextRecognitionMode, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - recognizeTextInStream(image: msRest.HttpRequestBody, mode: Models.TextRecognitionMode, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - image, - mode, - options - }, - recognizeTextInStreamOperationSpec, - callback) as Promise; - } - - /** - * Use this interface to get the result of a Read Document operation, employing the - * state-of-the-art Optical Character Recognition (OCR) algorithms optimized for text-heavy - * documents. When you use the Read Document interface, the response contains a field called - * 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your - * 'Get Read Result operation' to access OCR results.​ + * Use this interface to get the result of a Read operation, employing the state-of-the-art Optical + * Character Recognition (OCR) algorithms optimized for text-heavy documents. When you use the Read + * interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' + * field contains the URL that you must use for your 'GetReadResult' operation to access OCR + * results.​ * @param image An image stream. * @param [options] The optional parameters - * @returns Promise + * @returns Promise */ - batchReadFileInStream(image: msRest.HttpRequestBody, options?: msRest.RequestOptionsBase): Promise; + readInStream(image: msRest.HttpRequestBody, options?: Models.ComputerVisionClientReadInStreamOptionalParams): Promise; /** * @param image An image stream. * @param callback The callback */ - batchReadFileInStream(image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; + readInStream(image: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; /** * @param image An image stream. * @param options The optional parameters * @param callback The callback */ - batchReadFileInStream(image: msRest.HttpRequestBody, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - batchReadFileInStream(image: msRest.HttpRequestBody, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + readInStream(image: msRest.HttpRequestBody, options: Models.ComputerVisionClientReadInStreamOptionalParams, callback: msRest.ServiceCallback): void; + readInStream(image: msRest.HttpRequestBody, options?: Models.ComputerVisionClientReadInStreamOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { image, options }, - batchReadFileInStreamOperationSpec, - callback) as Promise; + readInStreamOperationSpec, + callback) as Promise; } } @@ -1104,58 +1004,14 @@ const getAreaOfInterestOperationSpec: msRest.OperationSpec = { serializer }; -const recognizeTextOperationSpec: msRest.OperationSpec = { +const readOperationSpec: msRest.OperationSpec = { httpMethod: "POST", - path: "recognizeText", + path: "read/analyze", urlParameters: [ Parameters.endpoint ], queryParameters: [ - Parameters.mode - ], - requestBody: { - parameterPath: { - url: "url" - }, - mapper: { - ...Mappers.ImageUrl, - required: true - } - }, - responses: { - 202: { - headersMapper: Mappers.RecognizeTextHeaders - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -const getTextOperationResultOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "textOperations/{operationId}", - urlParameters: [ - Parameters.endpoint, - Parameters.operationId - ], - responses: { - 200: { - bodyMapper: Mappers.TextOperationResult - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -const batchReadFileOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "read/core/asyncBatchAnalyze", - urlParameters: [ - Parameters.endpoint + Parameters.language0 ], requestBody: { parameterPath: { @@ -1168,18 +1024,19 @@ const batchReadFileOperationSpec: msRest.OperationSpec = { }, responses: { 202: { - headersMapper: Mappers.BatchReadFileHeaders + headersMapper: Mappers.ReadHeaders }, default: { - bodyMapper: Mappers.ComputerVisionError + bodyMapper: Mappers.ComputerVisionError, + headersMapper: Mappers.ReadHeaders } }, serializer }; -const getReadOperationResultOperationSpec: msRest.OperationSpec = { +const getReadResultOperationSpec: msRest.OperationSpec = { httpMethod: "GET", - path: "read/operations/{operationId}", + path: "read/analyzeResults/{operationId}", urlParameters: [ Parameters.endpoint, Parameters.operationId @@ -1449,42 +1306,14 @@ const tagImageInStreamOperationSpec: msRest.OperationSpec = { serializer }; -const recognizeTextInStreamOperationSpec: msRest.OperationSpec = { +const readInStreamOperationSpec: msRest.OperationSpec = { httpMethod: "POST", - path: "recognizeText", + path: "read/analyze", urlParameters: [ Parameters.endpoint ], queryParameters: [ - Parameters.mode - ], - requestBody: { - parameterPath: "image", - mapper: { - required: true, - serializedName: "Image", - type: { - name: "Stream" - } - } - }, - contentType: "application/octet-stream", - responses: { - 202: { - headersMapper: Mappers.RecognizeTextInStreamHeaders - }, - default: { - bodyMapper: Mappers.ComputerVisionError - } - }, - serializer -}; - -const batchReadFileInStreamOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "read/core/asyncBatchAnalyze", - urlParameters: [ - Parameters.endpoint + Parameters.language0 ], requestBody: { parameterPath: "image", @@ -1499,10 +1328,11 @@ const batchReadFileInStreamOperationSpec: msRest.OperationSpec = { contentType: "application/octet-stream", responses: { 202: { - headersMapper: Mappers.BatchReadFileInStreamHeaders + headersMapper: Mappers.ReadInStreamHeaders }, default: { - bodyMapper: Mappers.ComputerVisionError + bodyMapper: Mappers.ComputerVisionError, + headersMapper: Mappers.ReadInStreamHeaders } }, serializer diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClientContext.ts b/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClientContext.ts index 594fedf88c8e..7975f9e94177 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClientContext.ts +++ b/sdk/cognitiveservices/cognitiveservices-computervision/src/computerVisionClientContext.ts @@ -11,7 +11,7 @@ import * as msRest from "@azure/ms-rest-js"; const packageName = "@azure/cognitiveservices-computervision"; -const packageVersion = "6.0.0"; +const packageVersion = "7.0.0"; export class ComputerVisionClientContext extends msRest.ServiceClient { endpoint: string; @@ -42,7 +42,7 @@ export class ComputerVisionClientContext extends msRest.ServiceClient { super(credentials, options); - this.baseUri = "{Endpoint}/vision/v2.1"; + this.baseUri = "{Endpoint}/vision/v3.0"; this.requestContentType = "application/json; charset=utf-8"; this.endpoint = endpoint; this.credentials = credentials; diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/index.ts b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/index.ts index d9d64beaba56..bad4b3dba42c 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/index.ts +++ b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/index.ts @@ -650,54 +650,63 @@ export interface Word { */ text: string; /** - * Qualitative confidence measure. Possible values include: 'High', 'Low' + * Qualitative confidence measure. */ - confidence?: TextRecognitionResultConfidenceClass; + confidence: number; } /** * An object representing a recognized text line. */ export interface Line { + /** + * The BCP-47 language code of the recognized text line. Only provided where the language of the + * line differs from the page's. + */ + language?: string; /** * Bounding box of a recognized line. */ - boundingBox?: number[]; + boundingBox: number[]; /** * The text content of the line. */ - text?: string; + text: string; /** * List of words in the text line. */ - words?: Word[]; + words: Word[]; } /** - * An object representing a recognized text region + * Text extracted from a page in the input document. */ -export interface TextRecognitionResult { +export interface ReadResult { /** * The 1-based page number of the recognition result. */ - page?: number; + page: number; /** - * The orientation of the image in degrees in the clockwise direction. Range between [0, 360). + * The BCP-47 language code of the recognized text page. */ - clockwiseOrientation?: number; + language?: string; + /** + * The orientation of the image in degrees in the clockwise direction. Range between [-180, 180). + */ + angle: number; /** * The width of the image in pixels or the PDF in inches. */ - width?: number; + width: number; /** * The height of the image in pixels or the PDF in inches. */ - height?: number; + height: number; /** * The unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, * the unit is 'inch'. Possible values include: 'pixel', 'inch' */ - unit?: TextRecognitionResultDimensionUnit; + unit: TextRecognitionResultDimensionUnit; /** * A list of recognized text lines. */ @@ -705,18 +714,17 @@ export interface TextRecognitionResult { } /** - * Result of recognition text operation. + * Analyze batch operation result. */ -export interface TextOperationResult { +export interface AnalyzeResults { /** - * Status of the text operation. Possible values include: 'NotStarted', 'Running', 'Failed', - * 'Succeeded' + * Version of schema used for this result. */ - status?: TextOperationStatusCodes; + version: string; /** - * Text recognition result of the text operation. + * Text extracted from the input. */ - recognitionResult?: TextRecognitionResult; + readResults: ReadResult[]; } /** @@ -724,14 +732,22 @@ export interface TextOperationResult { */ export interface ReadOperationResult { /** - * Status of the read operation. Possible values include: 'NotStarted', 'Running', 'Failed', - * 'Succeeded' + * Status of the read operation. Possible values include: 'notStarted', 'running', 'failed', + * 'succeeded' + */ + status?: OperationStatusCodes; + /** + * Get UTC date time the batch operation was submitted. + */ + createdDateTime?: string; + /** + * Get last updated UTC date time of this batch operation. */ - status?: TextOperationStatusCodes; + lastUpdatedDateTime?: string; /** - * An array of text recognition result of the read operation. + * Analyze batch operation result. */ - recognitionResults?: TextRecognitionResult[]; + analyzeResult?: AnalyzeResults; } /** @@ -843,6 +859,21 @@ export interface ComputerVisionClientGenerateThumbnailOptionalParams extends msR smartCropping?: boolean; } +/** + * Optional Parameters. + */ +export interface ComputerVisionClientReadOptionalParams extends msRest.RequestOptionsBase { + /** + * The BCP-47 language code of the text to be detected in the image. In future versions, when + * language parameter is not passed, language detection will be used to determine the language. + * However, in the current version, missing language parameter will cause English to be used. To + * ensure that your document is always parsed in English without the use of language detection in + * the future, pass “en” in the language parameter. Possible values include: 'en', 'es', 'fr', + * 'de', 'it', 'nl', 'pt'. Default value: 'en'. + */ + language?: OcrDetectionLanguage; +} + /** * Optional Parameters. */ @@ -953,29 +984,24 @@ export interface ComputerVisionClientTagImageInStreamOptionalParams extends msRe } /** - * Defines headers for RecognizeText operation. - */ -export interface RecognizeTextHeaders { - /** - * URL to query for status of the operation. The operation ID will expire in 48 hours. - */ - operationLocation: string; -} - -/** - * Defines headers for BatchReadFile operation. + * Optional Parameters. */ -export interface BatchReadFileHeaders { +export interface ComputerVisionClientReadInStreamOptionalParams extends msRest.RequestOptionsBase { /** - * URL to query for status of the operation. The operation ID will expire in 48 hours. + * The BCP-47 language code of the text to be detected in the image. In future versions, when + * language parameter is not passed, language detection will be used to determine the language. + * However, in the current version, missing language parameter will cause English to be used. To + * ensure that your document is always parsed in English without the use of language detection in + * the future, pass “en” in the language parameter. Possible values include: 'en', 'es', 'fr', + * 'de', 'it', 'nl', 'pt'. Default value: 'en'. */ - operationLocation: string; + language?: OcrDetectionLanguage; } /** - * Defines headers for RecognizeTextInStream operation. + * Defines headers for Read operation. */ -export interface RecognizeTextInStreamHeaders { +export interface ReadHeaders { /** * URL to query for status of the operation. The operation ID will expire in 48 hours. */ @@ -983,9 +1009,9 @@ export interface RecognizeTextInStreamHeaders { } /** - * Defines headers for BatchReadFileInStream operation. + * Defines headers for ReadInStream operation. */ -export interface BatchReadFileInStreamHeaders { +export interface ReadInStreamHeaders { /** * URL to query for status of the operation. The operation ID will expire in 48 hours. */ @@ -1001,12 +1027,12 @@ export interface BatchReadFileInStreamHeaders { export type Gender = 'Male' | 'Female'; /** - * Defines values for TextOperationStatusCodes. - * Possible values include: 'NotStarted', 'Running', 'Failed', 'Succeeded' + * Defines values for OperationStatusCodes. + * Possible values include: 'notStarted', 'running', 'failed', 'succeeded' * @readonly * @enum {string} */ -export type TextOperationStatusCodes = 'NotStarted' | 'Running' | 'Failed' | 'Succeeded'; +export type OperationStatusCodes = 'notStarted' | 'running' | 'failed' | 'succeeded'; /** * Defines values for TextRecognitionResultDimensionUnit. @@ -1016,14 +1042,6 @@ export type TextOperationStatusCodes = 'NotStarted' | 'Running' | 'Failed' | 'Su */ export type TextRecognitionResultDimensionUnit = 'pixel' | 'inch'; -/** - * Defines values for TextRecognitionResultConfidenceClass. - * Possible values include: 'High', 'Low' - * @readonly - * @enum {string} - */ -export type TextRecognitionResultConfidenceClass = 'High' | 'Low'; - /** * Defines values for DescriptionExclude. * Possible values include: 'Celebrities', 'Landmarks' @@ -1052,12 +1070,12 @@ export type OcrLanguages = 'unk' | 'zh-Hans' | 'zh-Hant' | 'cs' | 'da' | 'nl' | export type VisualFeatureTypes = 'ImageType' | 'Faces' | 'Adult' | 'Categories' | 'Color' | 'Tags' | 'Description' | 'Objects' | 'Brands'; /** - * Defines values for TextRecognitionMode. - * Possible values include: 'Handwritten', 'Printed' + * Defines values for OcrDetectionLanguage. + * Possible values include: 'en', 'es', 'fr', 'de', 'it', 'nl', 'pt' * @readonly * @enum {string} */ -export type TextRecognitionMode = 'Handwritten' | 'Printed'; +export type OcrDetectionLanguage = 'en' | 'es' | 'fr' | 'de' | 'it' | 'nl' | 'pt'; /** * Defines values for Details. @@ -1318,9 +1336,9 @@ export type GetAreaOfInterestResponse = AreaOfInterestResult & { }; /** - * Contains response data for the recognizeText operation. + * Contains response data for the read operation. */ -export type RecognizeTextResponse = RecognizeTextHeaders & { +export type ReadResponse = ReadHeaders & { /** * The underlying HTTP response. */ @@ -1328,49 +1346,14 @@ export type RecognizeTextResponse = RecognizeTextHeaders & { /** * The parsed HTTP response headers. */ - parsedHeaders: RecognizeTextHeaders; + parsedHeaders: ReadHeaders; }; }; /** - * Contains response data for the getTextOperationResult operation. + * Contains response data for the getReadResult operation. */ -export type GetTextOperationResultResponse = TextOperationResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: TextOperationResult; - }; -}; - -/** - * Contains response data for the batchReadFile operation. - */ -export type BatchReadFileResponse = BatchReadFileHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: BatchReadFileHeaders; - }; -}; - -/** - * Contains response data for the getReadOperationResult operation. - */ -export type GetReadOperationResultResponse = ReadOperationResult & { +export type GetReadResultResponse = ReadOperationResult & { /** * The underlying HTTP response. */ @@ -1554,24 +1537,9 @@ export type TagImageInStreamResponse = TagResult & { }; /** - * Contains response data for the recognizeTextInStream operation. - */ -export type RecognizeTextInStreamResponse = RecognizeTextInStreamHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RecognizeTextInStreamHeaders; - }; -}; - -/** - * Contains response data for the batchReadFileInStream operation. + * Contains response data for the readInStream operation. */ -export type BatchReadFileInStreamResponse = BatchReadFileInStreamHeaders & { +export type ReadInStreamResponse = ReadInStreamHeaders & { /** * The underlying HTTP response. */ @@ -1579,6 +1547,6 @@ export type BatchReadFileInStreamResponse = BatchReadFileInStreamHeaders & { /** * The parsed HTTP response headers. */ - parsedHeaders: BatchReadFileInStreamHeaders; + parsedHeaders: ReadInStreamHeaders; }; }; diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/mappers.ts index 76ddaebb1771..ea33ac0fc26d 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/mappers.ts +++ b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/mappers.ts @@ -1224,14 +1224,10 @@ export const Word: msRest.CompositeMapper = { } }, confidence: { - nullable: true, + required: true, serializedName: "confidence", type: { - name: "Enum", - allowedValues: [ - "High", - "Low" - ] + name: "Number" } } } @@ -1244,7 +1240,14 @@ export const Line: msRest.CompositeMapper = { name: "Composite", className: "Line", modelProperties: { + language: { + serializedName: "language", + type: { + name: "String" + } + }, boundingBox: { + required: true, serializedName: "boundingBox", type: { name: "Sequence", @@ -1256,12 +1259,14 @@ export const Line: msRest.CompositeMapper = { } }, text: { + required: true, serializedName: "text", type: { name: "String" } }, words: { + required: true, serializedName: "words", type: { name: "Sequence", @@ -1277,38 +1282,49 @@ export const Line: msRest.CompositeMapper = { } }; -export const TextRecognitionResult: msRest.CompositeMapper = { - serializedName: "TextRecognitionResult", +export const ReadResult: msRest.CompositeMapper = { + serializedName: "ReadResult", type: { name: "Composite", - className: "TextRecognitionResult", + className: "ReadResult", modelProperties: { page: { + required: true, serializedName: "page", type: { name: "Number" } }, - clockwiseOrientation: { - serializedName: "clockwiseOrientation", + language: { + serializedName: "language", + type: { + name: "String" + } + }, + angle: { + required: true, + serializedName: "angle", type: { name: "Number" } }, width: { + required: true, serializedName: "width", type: { name: "Number" } }, height: { + required: true, serializedName: "height", type: { name: "Number" } }, unit: { - nullable: true, + required: true, + nullable: false, serializedName: "unit", type: { name: "Enum", @@ -1335,30 +1351,30 @@ export const TextRecognitionResult: msRest.CompositeMapper = { } }; -export const TextOperationResult: msRest.CompositeMapper = { - serializedName: "TextOperationResult", +export const AnalyzeResults: msRest.CompositeMapper = { + serializedName: "analyzeResults", type: { name: "Composite", - className: "TextOperationResult", + className: "AnalyzeResults", modelProperties: { - status: { - nullable: false, - serializedName: "status", + version: { + required: true, + serializedName: "version", type: { - name: "Enum", - allowedValues: [ - "NotStarted", - "Running", - "Failed", - "Succeeded" - ] + name: "String" } }, - recognitionResult: { - serializedName: "recognitionResult", + readResults: { + required: true, + serializedName: "readResults", type: { - name: "Composite", - className: "TextRecognitionResult" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReadResult" + } + } } } } @@ -1377,66 +1393,43 @@ export const ReadOperationResult: msRest.CompositeMapper = { type: { name: "Enum", allowedValues: [ - "NotStarted", - "Running", - "Failed", - "Succeeded" + "notStarted", + "running", + "failed", + "succeeded" ] } }, - recognitionResults: { - serializedName: "recognitionResults", + createdDateTime: { + nullable: false, + serializedName: "createdDateTime", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "TextRecognitionResult" - } - } + name: "String" } - } - } - } -}; - -export const RecognizeTextHeaders: msRest.CompositeMapper = { - serializedName: "recognizetext-headers", - type: { - name: "Composite", - className: "RecognizeTextHeaders", - modelProperties: { - operationLocation: { - serializedName: "operation-location", + }, + lastUpdatedDateTime: { + nullable: false, + serializedName: "lastUpdatedDateTime", type: { name: "String" } - } - } - } -}; - -export const BatchReadFileHeaders: msRest.CompositeMapper = { - serializedName: "batchreadfile-headers", - type: { - name: "Composite", - className: "BatchReadFileHeaders", - modelProperties: { - operationLocation: { - serializedName: "operation-location", + }, + analyzeResult: { + serializedName: "analyzeResult", type: { - name: "String" + name: "Composite", + className: "AnalyzeResults" } } } } }; -export const RecognizeTextInStreamHeaders: msRest.CompositeMapper = { - serializedName: "recognizetextinstream-headers", +export const ReadHeaders: msRest.CompositeMapper = { + serializedName: "read-headers", type: { name: "Composite", - className: "RecognizeTextInStreamHeaders", + className: "ReadHeaders", modelProperties: { operationLocation: { serializedName: "operation-location", @@ -1448,11 +1441,11 @@ export const RecognizeTextInStreamHeaders: msRest.CompositeMapper = { } }; -export const BatchReadFileInStreamHeaders: msRest.CompositeMapper = { - serializedName: "batchreadfileinstream-headers", +export const ReadInStreamHeaders: msRest.CompositeMapper = { + serializedName: "readinstream-headers", type: { name: "Composite", - className: "BatchReadFileInStreamHeaders", + className: "ReadInStreamHeaders", modelProperties: { operationLocation: { serializedName: "operation-location", diff --git a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/parameters.ts index 208beac77dbb..456cb2aa4e23 100644 --- a/sdk/cognitiveservices/cognitiveservices-computervision/src/models/parameters.ts +++ b/sdk/cognitiveservices/cognitiveservices-computervision/src/models/parameters.ts @@ -159,20 +159,6 @@ export const maxCandidates: msRest.OperationQueryParameter = { } } }; -export const mode: msRest.OperationQueryParameter = { - parameterPath: "mode", - mapper: { - required: true, - serializedName: "mode", - type: { - name: "Enum", - allowedValues: [ - "Handwritten", - "Printed" - ] - } - } -}; export const model: msRest.OperationURLParameter = { parameterPath: "model", mapper: { @@ -189,7 +175,7 @@ export const operationId: msRest.OperationURLParameter = { required: true, serializedName: "operationId", type: { - name: "String" + name: "Uuid" } } };