This package has been deprecated

Author message:

no

faceplatform-cli

1.3.13 • Public • Published

faceplatform

Installation

npm i --save faceplatform-cli

Super simple to Use

const FP = require('faceplatform-cli');

const fp = new FP();

fp.getRepository().then(console.log)).catch(console.error);

Supported Versions

version ^1.3.0 说明
pgy 蒲公英
mtx.2 满天星2
mtx.3 满天星3
bsd 波塞冬
platform 底层接口
website 网站接口

Initialization

Basic

const FP = require('faceplatform-cli');

const fp = new FP({
    address: '10.10.10.10',
    version: '1.8.a',
    auth: { name: 'admin', password: 'admin' },
});

Keep-Alive

当设置keepAlive: true时,client会对session_id进行保活. 当不设置时,在session_id失效后会重新获取。因此此选项通常可以设为false。

const fp = new FP({
    address: '10.10.10.10',
    keepAlive: true,
    interval: 30000, // keep-alive 周期,单位ms,默认60s
});

Singleton

当设置singleton: true时,client会采用单例模式.

const fp = new FP({
    address: '10.10.10.10',
    singleton: true,
});

Request

options

以相同方式传入body或者query string

fp.addRepository({ name: 'test' }, 'id')
    .then(id => fp.del_repository({ id }))
    .catch(console.error);

natice options

当传入参数包含native: true时,可以对request进行更多自定义设置

fp.addRepository({
        body: { name: 'test' },
        headers: { session_id: '12345678@DEFAULT' },
        native: true,
    })
    .then(console.log)
    .catch(console.error);

Response

fields

传入一个域名称, 获得该域的值

fp.getRepository('results')
    .then(results => console.log(results.map(result => result.id)))
    .catch(console.error);

format

传入一个函数,对返回值进行处理

fp.getRepository(resp => resp.results.map(result => result.id))
    .then(console.log)
    .catch(console.error);

DEBUG

设置DEBUG=faceplatform后,可以看到DEBUG信息

DEBUG=faceplatform node examples/1.8.a.js
输出
 faceplatform {"uri":"http://127.0.0.1:11180/business/api/login","method":"POST","json":true,"body":{"name":"admin","password":"21232f297a57a5a743894a0e4a801fc3"}} +0ms
...

log

重定向输出到日志

const fp = new FP({ address: '127.0.0.1' }, console.info);
const logger = require('log4js').getLogger();
const fp = new FP({ address: '127.0.0.1' }, logger.debug);

All Available Options

versions

const fp = new FP();
fp.getVersions(); // [ '1.8.a', 'mtx.2', 'mtx.3', 'pgy' ]

interfaces description

const fp = new FP({ version: 'mtx.2' });

fp.getInterfaces(); // [ { name: 'login', description: '登录' }, ... ]

fp.description; 
// ## bsd

//   - 登录
//     - Call : fp.login(options, formatter)
//     - URI  : POST http://{HOST}:11180/business/api/login ...

session_id/cluster_id

const fp = new FP();
console.log(fp.session_id); // null 如果在次之前有调用过需要登录的接口,会返回session_id
console.log(fp.cluster_id); // 'DEFAULT'

DIY

如果需要自定义接口版本,可以在lib/versions/目录下创建接口说明文件your.version.json

然后就可以使用你的DIY版本

Version Alias

  • 1.8.a: bsd
  • business: bsd
  • default: bsd
  • latest: bsd

Interfaces

Interface platform pgy mtx.2 mtx.3 bsd website Description
addCamera × 添加摄像头
addClass × × × × × 创建Class
addGroup × × 新建部门
addImage × × 同步导图
addMultiPerson × × × × × 批量多人图片导入
addNNTask × × × 新建nn比对任务
addObject × × × × × 创建对象
addPicture 异步导图
addPictureAsync × × × × × 同步导图
addPictureSync × 同步导图
addRegion × × 添加摄像头区域
addRepository 创建人像库
addSinglePerson × × × × × 批量单人图片导入
addSubscription × × × × × 添加订阅
addTask × 添加布控
addUser × × 新建用户
addVideo × × 新建离线视频
annotation × × 命中标注
delCamera × 删除摄像头
delFace × × 删除人像
delGroup × × 删除部门
delNNTask × × × 删除nn比对任务
delObject × × × × × 移除对象
delRegion × × 删除摄像头区域
delRepository 删除人像库
delSubscription × × × × × 删除订阅
delTask × 删除布控
delUser × × 删除用户
delVideo × × 删除离线视频
dowloadRepository × × × × 下载人像库
exportRepository × × × × 导出人像库
extract × × × × × 获取特征
faceDetection × × × × × 人脸检测
getAlert × × × × 获取报警数据
getAll × × × × × 获取监控信息
getAllClusterId × × × 获取全部集群id
getCamera × 查看摄像头
getCapture × × × × 获取抓拍数据
getClusterId × × 获取cluster id
getFailed × × 获取导图失败图片
getGroup × × × × × 列出部门
getHit × 查看报警
getImage 读取图片
getLog × × × × × 获取日志
getNNHit × × × 获取NN比对结果
getNNTask × × × 获取nn比对任务
getNvNHit × × × × × 查看命中
getObject × × × × × 获取对象
getRepository 获取人像库
getSingleImage × × × 获取单张图片
getSubscription × × × × × 获取订阅
getTask × 查看布控
getUserByDepth 获取一定深度的子节点
getUserSelf × 获取自身
getUserTop × × 获取顶层对象
getVersion × × × × × 获取版本
getVideo × × 获取离线视频
history × × × × × 历史检索
login 登录
logout × × × × × 登出
modCamera × 修改摄像头
modFace × × 更新人像
modGroup × × 修改部门
modNNTask × × × 修改nn比对任务
modObject × × × × × 修改对象
modRegion × × 修改摄像头区域
modRepository 更新人像库
modSubscription × × × × × 修改订阅
modTask × 修改布控
modUser × × 修改用户
modVideo × × 修改离线视频
moveObject × × × × × 移动对象
query 条件查询
queryCamera × × × × × 摄像头查询
readVideo × × × 读取视频
removeObject × × × × × 删除对象
retrieval 人像库检索
retrievalCamera × × × × × 路人库检索
setPermission × × × × × 设置权限
syncSurveillance × × × × × 同步布控任务
verify × 1v1比对

Change Log

v1.3.11 (2018/5/21)

  • 支持获取cluster_id/session_id
  • 支持新的底层接口(同步布控,获取布控报警等)

v1.3.8 (2018/3/22)

  • 支持底层接口
  • 统一方法名称和描述

v1.3.4 (2018/2/22)

  • 支持单例模式

v1.3.2 (2018/1/23)

  • 修复qs可能出错的问题
  • 支持版本别名
  • 部分支持网站接口

v1.3.1 (2018/1/12)

  • 修改getHit接口method错误

v1.3.0 (2017/12/27)

  • 重构
  • new supported version: 1.8.a

v1.2.0 (2017/12/7)

  • 限制最大回调深度
  • 增加后台接口 (version: platform)

Readme

Keywords

none

Package Sidebar

Install

npm i faceplatform-cli

Weekly Downloads

0

Version

1.3.13

License

MIT

Unpacked Size

91.3 kB

Total Files

23

Last publish

Collaborators

  • xiaoyu.bai