|
| 1 | + |
| 2 | +'use strict'; |
| 3 | + |
| 4 | +const { RPCClient } = require('@alicloud/pop-core'); |
| 5 | + |
| 6 | +function hasOwnProperty(obj, key) { |
| 7 | + return Object.prototype.hasOwnProperty.call(obj, key); |
| 8 | +} |
| 9 | + |
| 10 | +class Client extends RPCClient { |
| 11 | + constructor(config) { |
| 12 | + config.apiVersion = '2019-12-30'; |
| 13 | + super(config); |
| 14 | + } |
| 15 | + |
| 16 | + /** |
| 17 | + * @param {Integer} ImageType - imageType. required. |
| 18 | + * @param {String} ImageURLA - imageUrlA. optional. |
| 19 | + * @param {String} ImageContentA - imageContentA. optional. |
| 20 | + * @param {String} ImageURLB - imageUrlB. optional. |
| 21 | + * @param {String} ImageContentB - imageContentB. optional. |
| 22 | + * @param {Integer} Mode - mode. required. |
| 23 | + */ |
| 24 | + compareFace(params = {}, options = {}) { |
| 25 | + if (!hasOwnProperty(params, 'ImageType')) { |
| 26 | + throw new TypeError('parameter "ImageType" is required'); |
| 27 | + } |
| 28 | + |
| 29 | + if (!hasOwnProperty(params, 'Mode')) { |
| 30 | + throw new TypeError('parameter "Mode" is required'); |
| 31 | + } |
| 32 | + |
| 33 | + options.method = 'POST'; |
| 34 | + return this.request('CompareFace', params, options); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * @param {Integer} ImageType - imageType. required. |
| 39 | + * @param {String} ImageURL - imageUrl. optional. |
| 40 | + * @param {String} ImageContent - imageContent. optional. |
| 41 | + */ |
| 42 | + detectFace(params = {}, options = {}) { |
| 43 | + if (!hasOwnProperty(params, 'ImageType')) { |
| 44 | + throw new TypeError('parameter "ImageType" is required'); |
| 45 | + } |
| 46 | + |
| 47 | + options.method = 'POST'; |
| 48 | + return this.request('DetectFace', params, options); |
| 49 | + } |
| 50 | + |
| 51 | + /** |
| 52 | + * @param {Integer} ImageType - imageType. required. |
| 53 | + * @param {String} ImageURL - imageUrl. optional. |
| 54 | + * @param {String} ImageContent - imageContent. optional. |
| 55 | + * @param {Integer} Mode - mode. required. |
| 56 | + */ |
| 57 | + recognizeFace(params = {}, options = {}) { |
| 58 | + if (!hasOwnProperty(params, 'ImageType')) { |
| 59 | + throw new TypeError('parameter "ImageType" is required'); |
| 60 | + } |
| 61 | + |
| 62 | + if (!hasOwnProperty(params, 'Mode')) { |
| 63 | + throw new TypeError('parameter "Mode" is required'); |
| 64 | + } |
| 65 | + |
| 66 | + options.method = 'POST'; |
| 67 | + return this.request('RecognizeFace', params, options); |
| 68 | + } |
| 69 | + |
| 70 | +} |
| 71 | + |
| 72 | +module.exports = Client; |
0 commit comments