/** * Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * @file src/face_client.ts * @author leeight */ import BceBaseClient from './bce_base_client'; import type { BceConfig, BceResponse } from './types/common'; /** Face 客户端选项 */ interface FaceClientOptions { config?: Partial; } /** 应用信息 */ interface App { appId: string; name: string; createTime: string; } /** 分组信息 */ interface Group { groupName: string; createTime: string; personCount: number; } /** 人员信息 */ interface Person { personName: string; groupName: string; createTime: string; faceCount: number; } /** 识别结果 */ interface IdentifyResult { personName: string; score: number; } /** 验证结果 */ interface VerifyResult { score: number; isMatch: boolean; } /** 列出人员的选项 */ interface ListPersonsOptions extends FaceClientOptions { groupName?: string; } /** * 人脸识别API客户端 * * @see http://gollum.baidu.com/bcefaceapi */ export default class FaceClient extends BceBaseClient { /** * 构造函数 * @param config Face 客户端配置 */ constructor(config: BceConfig); /** * 创建应用 * @param options 选项 * @returns Promise 解析为应用信息 */ createApp(options?: FaceClientOptions): Promise>; /** * 列出应用 * @param options 选项 * @returns Promise 解析为应用列表 */ listApps(options?: FaceClientOptions): Promise>; /** * 创建分组 * @param appId 应用ID * @param groupName 分组名称 * @param options 选项 * @returns Promise 解析为创建结果 */ createGroup(appId: string, groupName: string, options?: FaceClientOptions): Promise>; /** * 删除分组 * @param appId 应用ID * @param groupName 分组名称 * @param options 选项 * @returns Promise 解析为删除结果 */ deleteGroup(appId: string, groupName: string, options?: FaceClientOptions): Promise>; /** * 获取分组信息 * @param appId 应用ID * @param groupName 分组名称 * @param options 选项 * @returns Promise 解析为分组信息 */ getGroup(appId: string, groupName: string, options?: FaceClientOptions): Promise>; /** * 列出分组 * @param appId 应用ID * @param options 选项 * @returns Promise 解析为分组列表 */ listGroups(appId: string, options?: FaceClientOptions): Promise>; /** * 创建人员 * @param appId 应用ID * @param groupName 分组名称 * @param personName 人员名称 * @param faces 人脸图片路径列表 * @param options 选项 * @returns Promise 解析为创建结果 */ createPerson(appId: string, groupName: string, personName: string, faces: string[], options?: FaceClientOptions): Promise>; /** * 删除人员 * @param appId 应用ID * @param personName 人员名称 * @param options 选项 * @returns Promise 解析为删除结果 */ deletePerson(appId: string, personName: string, options?: FaceClientOptions): Promise>; /** * 更新人员 * @param appId 应用ID * @param personName 人员名称 * @param faces 人脸图片路径列表 * @param options 选项 * @returns Promise 解析为更新结果 */ updatePerson(appId: string, personName: string, faces: string[], options?: FaceClientOptions): Promise>; /** * 获取人员信息 * @param appId 应用ID * @param personName 人员名称 * @param options 选项 * @returns Promise 解析为人员信息 */ getPerson(appId: string, personName: string, options?: FaceClientOptions): Promise>; /** * 列出人员 * @param appId 应用ID * @param options 选项 * @returns Promise 解析为人员列表 */ listPersons(appId: string, options?: ListPersonsOptions): Promise>; /** * 人脸识别 * @param appId 应用ID * @param groupName 分组名称 * @param data 图片数据(Buffer 或 BOS 路径) * @param options 选项 * @returns Promise 解析为识别结果 */ identify(appId: string, groupName: string, data: Buffer | string, options?: FaceClientOptions): Promise>; /** * 人脸验证 * @param appId 应用ID * @param personName 人员名称 * @param data 图片数据(Buffer 或 BOS 路径) * @param options 选项 * @returns Promise 解析为验证结果 */ verify(appId: string, personName: string, data: Buffer | string, options?: FaceClientOptions): Promise>; } export {}; //# sourceMappingURL=face_client.d.ts.map