index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) 2020 Tencent Cloud.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. 'use strict';
  17. const { request } = require('./utils.js');
  18. /**
  19. * 获取人脸核身结果
  20. * @param {object} params - 参数包装对象
  21. * @param {string} params.name - 人脸核身 API的Action值 https://cloud.tencent.com/document/product/1007/31320
  22. * @param {object} params.payload - API需要的参数
  23. * @return {Promise<object>} API返回数据
  24. */
  25. async function getFaceidResult(params) {
  26. if (!params.name) {
  27. throw new Error('缺少API Action参数');
  28. }
  29. const result = await request(params.name, params.payload);
  30. return result;
  31. }
  32. module.exports = {
  33. getFaceidResult
  34. };