diff --git a/lib/services/computerVision/LICENSE.txt b/lib/services/computerVision/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/computerVision/LICENSE.txt +++ b/lib/services/computerVision/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/computerVision/lib/computerVisionAPIClient.d.ts b/lib/services/computerVision/lib/computerVisionAPIClient.d.ts index c95b834679..29a3cf5dd0 100644 --- a/lib/services/computerVision/lib/computerVisionAPIClient.d.ts +++ b/lib/services/computerVision/lib/computerVisionAPIClient.d.ts @@ -104,7 +104,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * parameter to allow you to choose which features to return. By default, * image categories are returned in the response. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -125,11 +125,11 @@ export default class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -149,7 +149,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * parameter to allow you to choose which features to return. By default, * image categories are returned in the response. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -170,11 +170,11 @@ export default class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -221,7 +221,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {number} height Height of the thumbnail. It must be between 1 and * 1024. Recommended minimum of 50. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -254,7 +254,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {number} height Height of the thumbnail. It must be between 1 and * 1024. Recommended minimum of 50. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -303,7 +303,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * image orientation and correct it before further processing (e.g. if it's * upside-down). * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -337,7 +337,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * image orientation and correct it before further processing (e.g. if it's * upside-down). * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -388,13 +388,19 @@ export default class ComputerVisionAPIClient extends ServiceClient { * response will contain an error code and a message to help understand what * went wrong. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -404,7 +410,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * @reject {Error|ServiceError} - The error object. */ - describeImageWithHttpOperationResponse(url: string, options?: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + describeImageWithHttpOperationResponse(url: string, options?: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * This operation generates a description of an image in human readable @@ -417,13 +423,19 @@ export default class ComputerVisionAPIClient extends ServiceClient { * response will contain an error code and a message to help understand what * went wrong. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -449,9 +461,9 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - describeImage(url: string, options?: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + describeImage(url: string, options?: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }): Promise; describeImage(url: string, callback: ServiceCallback): void; - describeImage(url: string, options: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + describeImage(url: string, options: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -460,13 +472,19 @@ export default class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -476,7 +494,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * @reject {Error|ServiceError} - The error object. */ - tagImageWithHttpOperationResponse(url: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + tagImageWithHttpOperationResponse(url: string, options?: { language? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * This operation generates a list of words, or tags, that are relevant to the @@ -484,13 +502,19 @@ export default class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -516,9 +540,9 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - tagImage(url: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + tagImage(url: string, options?: { language? : string, customHeaders? : { [headerName: string]: string; } }): Promise; tagImage(url: string, callback: ServiceCallback): void; - tagImage(url: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + tagImage(url: string, options: { language? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -534,7 +558,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {string} model The domain-specific content to recognize. Possible * values include: 'Celebrities', 'Landmarks' * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -562,7 +586,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {string} model The domain-specific content to recognize. Possible * values include: 'Celebrities', 'Landmarks' * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -598,16 +622,16 @@ export default class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -623,16 +647,16 @@ export default class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -750,11 +774,11 @@ export default class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. Possible values include: 'Celebrities', 'Landmarks' * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -792,11 +816,11 @@ export default class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. Possible values include: 'Celebrities', 'Landmarks' * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1017,6 +1041,12 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1026,7 +1056,7 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * @reject {Error|ServiceError} - The error object. */ - describeImageInStreamWithHttpOperationResponse(image: stream.Readable, options?: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + describeImageInStreamWithHttpOperationResponse(image: stream.Readable, options?: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * This operation generates a description of an image in human readable @@ -1046,6 +1076,12 @@ export default class ComputerVisionAPIClient extends ServiceClient { * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1071,9 +1107,9 @@ export default class ComputerVisionAPIClient extends ServiceClient { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - describeImageInStream(image: stream.Readable, options?: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + describeImageInStream(image: stream.Readable, options?: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }): Promise; describeImageInStream(image: stream.Readable, callback: ServiceCallback): void; - describeImageInStream(image: stream.Readable, options: { maxCandidates? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + describeImageInStream(image: stream.Readable, options: { maxCandidates? : string, language? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1082,8 +1118,8 @@ export default class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * * @param {object} image An image stream. * @@ -1106,8 +1142,8 @@ export default class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * * @param {object} image An image stream. * @@ -1218,16 +1254,16 @@ export default class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * * @param {object} image An image stream. * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1243,16 +1279,16 @@ export default class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * * @param {object} image An image stream. * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/computerVision/lib/computerVisionAPIClient.js b/lib/services/computerVision/lib/computerVisionAPIClient.js index c092f26ae8..281445a1a3 100644 --- a/lib/services/computerVision/lib/computerVisionAPIClient.js +++ b/lib/services/computerVision/lib/computerVisionAPIClient.js @@ -155,7 +155,7 @@ function _listModels(options, callback) { * parameter to allow you to choose which features to return. By default, * image categories are returned in the response. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -176,11 +176,11 @@ function _listModels(options, callback) { * feature types include:Celebrities - identifies celebrities if detected in * the image. * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -242,11 +242,8 @@ function _analyzeImage(url, options, callback) { } } } - if (language) { - let allowedValues3 = [ 'en', 'zh' ]; - if (!allowedValues3.some( function(item) { return item === language; })) { - throw new Error(language + ' is not a valid value. The valid values are: ' + allowedValues3); - } + if (language !== null && language !== undefined && typeof language.valueOf() !== 'string') { + throw new Error('language must be of type string.'); } if (url === null || url === undefined || typeof url.valueOf() !== 'string') { throw new Error('url cannot be null or undefined and it must be of type string.'); @@ -379,7 +376,7 @@ function _analyzeImage(url, options, callback) { * @param {number} height Height of the thumbnail. It must be between 1 and * 1024. Recommended minimum of 50. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -557,7 +554,7 @@ function _generateThumbnail(width, height, url, options, callback) { * image orientation and correct it before further processing (e.g. if it's * upside-down). * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -736,13 +733,19 @@ function _recognizePrintedText(detectOrientation, url, options, callback) { * response will contain an error code and a message to help understand what * went wrong. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -770,6 +773,7 @@ function _describeImage(url, options, callback) { throw new Error('callback cannot be null.'); } let maxCandidates = (options && options.maxCandidates !== undefined) ? options.maxCandidates : '1'; + let language = (options && options.language !== undefined) ? options.language : 'en'; // Validate try { if (this.azureRegion) { @@ -784,6 +788,9 @@ function _describeImage(url, options, callback) { if (maxCandidates !== null && maxCandidates !== undefined && typeof maxCandidates.valueOf() !== 'string') { throw new Error('maxCandidates must be of type string.'); } + if (language !== null && language !== undefined && typeof language.valueOf() !== 'string') { + throw new Error('language must be of type string.'); + } if (url === null || url === undefined || typeof url.valueOf() !== 'string') { throw new Error('url cannot be null or undefined and it must be of type string.'); } @@ -804,6 +811,9 @@ function _describeImage(url, options, callback) { if (maxCandidates !== null && maxCandidates !== undefined) { queryParameters.push('maxCandidates=' + encodeURIComponent(maxCandidates)); } + if (language !== null && language !== undefined) { + queryParameters.push('language=' + encodeURIComponent(language)); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -900,13 +910,19 @@ function _describeImage(url, options, callback) { * 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. + * 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. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -933,6 +949,7 @@ function _tagImage(url, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let language = (options && options.language !== undefined) ? options.language : 'en'; // Validate try { if (this.azureRegion) { @@ -944,6 +961,9 @@ function _tagImage(url, options, callback) { } else { throw new Error('this.azureRegion cannot be null or undefined.'); } + if (language !== null && language !== undefined && typeof language.valueOf() !== 'string') { + throw new Error('language must be of type string.'); + } if (url === null || url === undefined || typeof url.valueOf() !== 'string') { throw new Error('url cannot be null or undefined and it must be of type string.'); } @@ -960,6 +980,13 @@ function _tagImage(url, options, callback) { let baseUrl = this.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'tag'; requestUrl = requestUrl.replace('{AzureRegion}', this.azureRegion); + let queryParameters = []; + if (language !== null && language !== undefined) { + queryParameters.push('language=' + encodeURIComponent(language)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } // Create HTTP transport objects let httpRequest = new WebResource(); @@ -1060,7 +1087,7 @@ function _tagImage(url, options, callback) { * @param {string} model The domain-specific content to recognize. Possible * values include: 'Celebrities', 'Landmarks' * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -1215,16 +1242,16 @@ function _analyzeImageByDomain(model, url, options, callback) { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1517,11 +1544,11 @@ function _getTextOperationResult(operationId, options, callback) { * feature types include:Celebrities - identifies celebrities if detected in * the image. Possible values include: 'Celebrities', 'Landmarks' * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1827,10 +1854,6 @@ function _generateThumbnailInStream(width, height, image, options, callback) { error.code = internalError ? internalError.code : parsedErrorResponse.code; error.message = internalError ? internalError.message : parsedErrorResponse.message; } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ComputerVisionError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } } catch (defaultError) { error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + `- "${responseBody}" for the default response.`; @@ -2027,6 +2050,12 @@ function _recognizePrintedTextInStream(detectOrientation, image, options, callba * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2054,6 +2083,7 @@ function _describeImageInStream(image, options, callback) { throw new Error('callback cannot be null.'); } let maxCandidates = (options && options.maxCandidates !== undefined) ? options.maxCandidates : '1'; + let language = (options && options.language !== undefined) ? options.language : 'en'; // Validate try { if (this.azureRegion) { @@ -2068,6 +2098,9 @@ function _describeImageInStream(image, options, callback) { if (maxCandidates !== null && maxCandidates !== undefined && typeof maxCandidates.valueOf() !== 'string') { throw new Error('maxCandidates must be of type string.'); } + if (language !== null && language !== undefined && typeof language.valueOf() !== 'string') { + throw new Error('language must be of type string.'); + } if (image === null || image === undefined) { throw new Error('image cannot be null or undefined and it must be of type object.'); } @@ -2083,6 +2116,9 @@ function _describeImageInStream(image, options, callback) { if (maxCandidates !== null && maxCandidates !== undefined) { queryParameters.push('maxCandidates=' + encodeURIComponent(maxCandidates)); } + if (language !== null && language !== undefined) { + queryParameters.push('language=' + encodeURIComponent(language)); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2167,8 +2203,8 @@ function _describeImageInStream(image, options, callback) { * 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. + * 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. * * @param {object} image An image stream. * @@ -2442,16 +2478,16 @@ function _analyzeImageByDomainInStream(model, image, options, callback) { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * * @param {object} image An image stream. * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2713,7 +2749,7 @@ class ComputerVisionAPIClient extends ServiceClient { * parameter to allow you to choose which features to return. By default, * image categories are returned in the response. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -2734,11 +2770,11 @@ class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2770,7 +2806,7 @@ class ComputerVisionAPIClient extends ServiceClient { * parameter to allow you to choose which features to return. By default, * image categories are returned in the response. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -2791,11 +2827,11 @@ class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2857,7 +2893,7 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {number} height Height of the thumbnail. It must be between 1 and * 1024. Recommended minimum of 50. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -2902,7 +2938,7 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {number} height Height of the thumbnail. It must be between 1 and * 1024. Recommended minimum of 50. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -2966,7 +3002,7 @@ class ComputerVisionAPIClient extends ServiceClient { * image orientation and correct it before further processing (e.g. if it's * upside-down). * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -3012,7 +3048,7 @@ class ComputerVisionAPIClient extends ServiceClient { * image orientation and correct it before further processing (e.g. if it's * upside-down). * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -3078,13 +3114,19 @@ class ComputerVisionAPIClient extends ServiceClient { * response will contain an error code and a message to help understand what * went wrong. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3119,13 +3161,19 @@ class ComputerVisionAPIClient extends ServiceClient { * response will contain an error code and a message to help understand what * went wrong. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3177,13 +3225,19 @@ class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3213,13 +3267,19 @@ class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3278,7 +3338,7 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {string} model The domain-specific content to recognize. Possible * values include: 'Celebrities', 'Landmarks' * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -3318,7 +3378,7 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {string} model The domain-specific content to recognize. Possible * values include: 'Celebrities', 'Landmarks' * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * @@ -3369,16 +3429,16 @@ class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3406,16 +3466,16 @@ class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * - * @param {string} url + * @param {string} url Publicly reachable URL of an image * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3575,11 +3635,11 @@ class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. Possible values include: 'Celebrities', 'Landmarks' * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -3629,11 +3689,11 @@ class ComputerVisionAPIClient extends ServiceClient { * feature types include:Celebrities - identifies celebrities if detected in * the image. Possible values include: 'Celebrities', 'Landmarks' * - * @param {string} [options.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. Possible values include: 'en', 'zh' + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -3923,6 +3983,12 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3964,6 +4030,12 @@ class ComputerVisionAPIClient extends ServiceClient { * @param {string} [options.maxCandidates] Maximum number of candidate * descriptions to be returned. The default is 1. * + * @param {string} [options.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. Possible values include: 'en', 'ja', + * 'pt', 'zh' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -4015,8 +4087,8 @@ class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * * @param {object} image An image stream. * @@ -4051,8 +4123,8 @@ class ComputerVisionAPIClient extends ServiceClient { * 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. + * 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. * * @param {object} image An image stream. * @@ -4205,16 +4277,16 @@ class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * * @param {object} image An image stream. * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4242,16 +4314,16 @@ class ComputerVisionAPIClient extends ServiceClient { /** * 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 + * response contains a field called 'Operation-Location'. The + * 'Operation-Location' field contains the URL that you must use for your Get * Handwritten Text Operation Result operation. * * @param {object} image An image stream. * * @param {object} [options] Optional Parameters. * - * @param {boolean} [options.detectHandwriting] If “true” is specified, - * handwriting recognition is performed. If this parameter is set to “false” or + * @param {boolean} [options.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. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/computerVision/lib/models/category.js b/lib/services/computerVision/lib/models/category.js index ec05c90198..8a017cd12e 100644 --- a/lib/services/computerVision/lib/models/category.js +++ b/lib/services/computerVision/lib/models/category.js @@ -21,7 +21,7 @@ class Category { * Create a Category. * @member {string} [name] Name of the category. * @member {number} [score] Scoring of the category. - * @member {object} [detail] Additional category detail if available. + * @member {object} [detail] * @member {array} [detail.celebrities] An array of celebrities if any * identified. */ diff --git a/lib/services/computerVision/lib/models/domainModelResults.js b/lib/services/computerVision/lib/models/domainModelResults.js index fb960d641c..28e0e26456 100644 --- a/lib/services/computerVision/lib/models/domainModelResults.js +++ b/lib/services/computerVision/lib/models/domainModelResults.js @@ -23,7 +23,7 @@ class DomainModelResults { * @member {array} [celebrities] An array of possible celebritied identified * in the image. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Additional image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format diff --git a/lib/services/computerVision/lib/models/faceDescription.js b/lib/services/computerVision/lib/models/faceDescription.js index c3228be77d..be432ff1f3 100644 --- a/lib/services/computerVision/lib/models/faceDescription.js +++ b/lib/services/computerVision/lib/models/faceDescription.js @@ -60,7 +60,8 @@ class FaceDescription { required: false, serializedName: 'gender', type: { - name: 'String' + name: 'Enum', + allowedValues: [ 'Male', 'Female' ] } }, faceRectangle: { diff --git a/lib/services/computerVision/lib/models/imageAnalysis.js b/lib/services/computerVision/lib/models/imageAnalysis.js index 403ff712cb..c594a630fb 100644 --- a/lib/services/computerVision/lib/models/imageAnalysis.js +++ b/lib/services/computerVision/lib/models/imageAnalysis.js @@ -20,8 +20,7 @@ class ImageAnalysis { /** * Create a ImageAnalysis. * @member {array} [categories] An array indicating identified categories. - * @member {object} [adult] A property scoring on whether the image is - * adult-oriented and/or racy. + * @member {object} [adult] * @member {boolean} [adult.isAdultContent] A value indicating if the image * contains adult-oriented content. * @member {boolean} [adult.isRacyContent] A value indicating if the image is @@ -30,7 +29,7 @@ class ImageAnalysis { * much of adult content is within the image. * @member {number} [adult.racyScore] Score from 0 to 1 that indicates how * suggestive is the image. - * @member {object} [color] A property scoring on color spectrums. + * @member {object} [color] * @member {string} [color.dominantColorForeground] Possible dominant * foreground color. * @member {string} [color.dominantColorBackground] Possible dominant @@ -40,25 +39,24 @@ class ImageAnalysis { * @member {string} [color.accentColor] Possible accent color. * @member {boolean} [color.isBWImg] A value indicating if the image is black * and white. - * @member {object} [imageType] A property indicating type of image (whether - * it's clipart or line drawing) + * @member {object} [imageType] * @member {number} [imageType.clipArtType] Confidence level that the image * is a clip art. * @member {number} [imageType.lineDrawingType] Confidence level that the * image is a line drawing. * @member {array} [tags] A list of tags with confidence level. - * @member {object} [description] Description of the image. + * @member {object} [description] * @member {array} [description.tags] A collection of image tags. * @member {array} [description.captions] A list of captions, sorted by * confidence level. * @member {string} [description.requestId] Id of the REST API request. - * @member {object} [description.metadata] Image metadata + * @member {object} [description.metadata] * @member {number} [description.metadata.width] Image width * @member {number} [description.metadata.height] Image height * @member {string} [description.metadata.format] Image format * @member {array} [faces] An array of possible faces within the image. * @member {string} [requestId] Id of the request for tracking purposes. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format diff --git a/lib/services/computerVision/lib/models/imageDescription.js b/lib/services/computerVision/lib/models/imageDescription.js index 3eae3446a5..8cbe813f3a 100644 --- a/lib/services/computerVision/lib/models/imageDescription.js +++ b/lib/services/computerVision/lib/models/imageDescription.js @@ -23,7 +23,7 @@ class ImageDescription { * @member {array} [tags] A collection of image tags. * @member {array} [captions] A list of captions, sorted by confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format diff --git a/lib/services/computerVision/lib/models/imageDescriptionDetails.js b/lib/services/computerVision/lib/models/imageDescriptionDetails.js index 6a8cf6c228..3b7bbffd26 100644 --- a/lib/services/computerVision/lib/models/imageDescriptionDetails.js +++ b/lib/services/computerVision/lib/models/imageDescriptionDetails.js @@ -23,7 +23,7 @@ class ImageDescriptionDetails { * @member {array} [tags] A collection of image tags. * @member {array} [captions] A list of captions, sorted by confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format diff --git a/lib/services/computerVision/lib/models/imageUrl.js b/lib/services/computerVision/lib/models/imageUrl.js index 3feb6972d1..1727196bb1 100644 --- a/lib/services/computerVision/lib/models/imageUrl.js +++ b/lib/services/computerVision/lib/models/imageUrl.js @@ -16,7 +16,7 @@ class ImageUrl { /** * Create a ImageUrl. - * @member {string} url + * @member {string} url Publicly reachable URL of an image */ constructor() { } diff --git a/lib/services/computerVision/lib/models/index.d.ts b/lib/services/computerVision/lib/models/index.d.ts index 66e853c48d..469903f74a 100644 --- a/lib/services/computerVision/lib/models/index.d.ts +++ b/lib/services/computerVision/lib/models/index.d.ts @@ -124,7 +124,7 @@ export interface CategoryDetail { * * @member {string} [name] Name of the category. * @member {number} [score] Scoring of the category. - * @member {object} [detail] Additional category detail if available. + * @member {object} [detail] * @member {array} [detail.celebrities] An array of celebrities if any * identified. */ @@ -251,7 +251,7 @@ export interface ImageMetadata { * @member {array} [tags] A collection of image tags. * @member {array} [captions] A list of captions, sorted by confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format @@ -295,8 +295,7 @@ export interface FaceDescription { * Result of AnalyzeImage operation. * * @member {array} [categories] An array indicating identified categories. - * @member {object} [adult] A property scoring on whether the image is - * adult-oriented and/or racy. + * @member {object} [adult] * @member {boolean} [adult.isAdultContent] A value indicating if the image * contains adult-oriented content. * @member {boolean} [adult.isRacyContent] A value indicating if the image is @@ -305,7 +304,7 @@ export interface FaceDescription { * much of adult content is within the image. * @member {number} [adult.racyScore] Score from 0 to 1 that indicates how * suggestive is the image. - * @member {object} [color] A property scoring on color spectrums. + * @member {object} [color] * @member {string} [color.dominantColorForeground] Possible dominant * foreground color. * @member {string} [color.dominantColorBackground] Possible dominant @@ -314,25 +313,24 @@ export interface FaceDescription { * @member {string} [color.accentColor] Possible accent color. * @member {boolean} [color.isBWImg] A value indicating if the image is black * and white. - * @member {object} [imageType] A property indicating type of image (whether - * it's clipart or line drawing) + * @member {object} [imageType] * @member {number} [imageType.clipArtType] Confidence level that the image is * a clip art. * @member {number} [imageType.lineDrawingType] Confidence level that the image * is a line drawing. * @member {array} [tags] A list of tags with confidence level. - * @member {object} [description] Description of the image. + * @member {object} [description] * @member {array} [description.tags] A collection of image tags. * @member {array} [description.captions] A list of captions, sorted by * confidence level. * @member {string} [description.requestId] Id of the REST API request. - * @member {object} [description.metadata] Image metadata + * @member {object} [description.metadata] * @member {number} [description.metadata.width] Image width * @member {number} [description.metadata.height] Image height * @member {string} [description.metadata.format] Image format * @member {array} [faces] An array of possible faces within the image. * @member {string} [requestId] Id of the request for tracking purposes. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format @@ -474,7 +472,7 @@ export interface ListModelsResult { * @member {array} [celebrities] An array of possible celebritied identified in * the image. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Additional image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format @@ -495,7 +493,7 @@ export interface DomainModelResults { * @member {array} [tags] A collection of image tags. * @member {array} [captions] A list of captions, sorted by confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format @@ -515,7 +513,7 @@ export interface ImageDescription { * * @member {array} [tags] A list of tags with confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format @@ -549,7 +547,7 @@ export interface ComputerVisionError { * @class * Initializes a new instance of the ImageUrl class. * @constructor - * @member {string} url + * @member {string} url Publicly reachable URL of an image */ export interface ImageUrl { url: string; diff --git a/lib/services/computerVision/lib/models/tagResult.js b/lib/services/computerVision/lib/models/tagResult.js index 6bc33ce148..dae941c67f 100644 --- a/lib/services/computerVision/lib/models/tagResult.js +++ b/lib/services/computerVision/lib/models/tagResult.js @@ -21,7 +21,7 @@ class TagResult { * Create a TagResult. * @member {array} [tags] A list of tags with confidence level. * @member {string} [requestId] Id of the REST API request. - * @member {object} [metadata] Image metadata + * @member {object} [metadata] * @member {number} [metadata.width] Image width * @member {number} [metadata.height] Image height * @member {string} [metadata.format] Image format diff --git a/lib/services/computerVision/package.json b/lib/services/computerVision/package.json index ca99a6d703..3da9b38259 100644 --- a/lib/services/computerVision/package.json +++ b/lib/services/computerVision/package.json @@ -2,11 +2,14 @@ "name": "azure-cognitiveservices-computervision", "author": "Microsoft Corporation", "description": "ComputerVisionAPIClient Library with typescript type definitions for node", - "version": "1.0.1", + "version": "1.0.0-preview", "dependencies": { - "ms-rest": "^2.3.2" + "ms-rest": "^2.3.3" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/computerVisionAPIClient.js", "types": "./lib/computerVisionAPIClient.d.ts",