diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f733ab6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +pnpm-lock.yaml diff --git a/package.json b/package.json index 1c287b5..f26c810 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,16 @@ "version": "2.4.6", "description": "百度AI开放平台Nodejs SDK, 文档以及详情请访问官网: https://ai.baidu.com", "main": "src/index.js", + "types": "types/index.d.ts", "scripts": { + "preinstall": "npm run build", + "build": "tsc", "test": "mocha" }, + "files": [ + "src", + "types" + ], "author": "baidu-aip", "license": "Apache-2.0", "repository": { @@ -17,10 +24,18 @@ "iconv-lite": "^0.4.15", "keep-alive-agent": "0.0.1", "request": "^2.79.0", - "underscore": "^1.8.3" + "typescript": "^5.4.5" }, "optionalDependencies": { - "should": "^13.2.0", - "mocha": "^4.0.1" + "mocha": "^4.0.1", + "should": "^13.2.0" + }, + "devDependencies": { + "underscore": "^1.8.3", + "@types/node": "^20.12.7" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6a20a06 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "include": ["src/index.js"], + "compilerOptions": { + "allowJs": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "types", + "declarationMap": false + } +} diff --git a/types/AipContentCensor.d.ts b/types/AipContentCensor.d.ts new file mode 100644 index 0000000..a638093 --- /dev/null +++ b/types/AipContentCensor.d.ts @@ -0,0 +1,20 @@ +export = AipImageCensor; +/** + * AipContentCensor类,构造调用图像审核对象 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipImageCensor extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + jsonRequestImpl(param: any): Promise; + imageCensorUserDefined(image: any, type: any): Promise; + textCensorUserDefined(text: any, type: any): Promise; + report(feedback: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipFace.d.ts b/types/AipFace.d.ts new file mode 100644 index 0000000..119b55a --- /dev/null +++ b/types/AipFace.d.ts @@ -0,0 +1,255 @@ +export = AipFace; +/** + * AipFace类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipFace extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 人脸检测接口 + * + * @param {string} image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * face_field 包括**age,beauty,expression,face_shape,gender,glasses,landmark,landmark72,landmark150,race,quality,eye_status,emotion,face_type信息**
逗号分隔. 默认只返回face_token、人脸框、概率和旋转角度 + * max_face_num 最多处理人脸的数目,默认值为1,仅检测图片中面积最大的那个人脸;**最大值10**,检测图片中面积最大的几张人脸。 + * face_type 人脸的类型 **LIVE**表示生活照:通常为手机、相机拍摄的人像图片、或从网络获取的人像图片等**IDCARD**表示身份证芯片照:二代身份证内置芯片中的人像照片 **WATERMARK**表示带水印证件照:一般为带水印的小图,如公安网小图 **CERT**表示证件照片:如拍摄的身份证、工卡、护照、学生证等证件图片 默认**LIVE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * @return {Promise} - 标准Promise对象 + */ + detect(image: string, imageType: string, options: any): Promise; + /** + * 人脸搜索接口 + * + * @param {string} image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {string} groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个** + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * max_face_num 最多处理人脸的数目
**默认值为1(仅检测图片中面积最大的那个人脸)** **最大值10** + * match_threshold 匹配阈值(设置阈值后,score低于此阈值的用户信息将不会返回) 最大100 最小0 默认80
**此阈值设置得越高,检索速度将会越快,推荐使用默认阈值`80`** + * quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * user_id 当需要对特定用户进行比对时,指定user_id进行比对。即人脸认证功能。 + * max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回50个。 + * @return {Promise} - 标准Promise对象 + */ + search(image: string, imageType: string, groupIdList: string, options: any): Promise; + /** + * 人脸搜索 M:N 识别接口 + * + * @param {string} image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {string} groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个** + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * max_face_num 最多处理人脸的数目
**默认值为1(仅检测图片中面积最大的那个人脸)** **最大值10** + * match_threshold 匹配阈值(设置阈值后,score低于此阈值的用户信息将不会返回) 最大100 最小0 默认80
**此阈值设置得越高,检索速度将会越快,推荐使用默认阈值`80`** + * quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回50个。 + * @return {Promise} - 标准Promise对象 + */ + multiSearch(image: string, imageType: string, groupIdList: string, options: any): Promise; + /** + * 人脸注册接口 + * + * @param {string} image - 图片信息(总数据大小应小于10M),图片上传方式根据image_type来判断。注:组内每个uid下的人脸图片数目上限为20张 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * user_info 用户资料,长度限制256B + * quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * action_type 操作方式 APPEND: 当user_id在库中已经存在时,对此user_id重复注册时,新注册的图片默认会追加到该user_id下,REPLACE : 当对此user_id重复注册时,则会用新图替换库中该user_id下所有图片,默认使用APPEND + * @return {Promise} - 标准Promise对象 + */ + addUser(image: string, imageType: string, groupId: string, userId: string, options: any): Promise; + /** + * 人脸更新接口 + * + * @param {string} image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {string} groupId - 更新指定groupid下uid对应的信息 + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * user_info 用户资料,长度限制256B + * quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * action_type 操作方式 APPEND: 当user_id在库中已经存在时,对此user_id重复注册时,新注册的图片默认会追加到该user_id下,REPLACE : 当对此user_id重复注册时,则会用新图替换库中该user_id下所有图片,默认使用APPEND + * @return {Promise} - 标准Promise对象 + */ + updateUser(image: string, imageType: string, groupId: string, userId: string, options: any): Promise; + /** + * 人脸删除接口 + * + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {string} faceToken - 需要删除的人脸图片token,(由数字、字母、下划线组成)长度限制64B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + faceDelete(userId: string, groupId: string, faceToken: string, options: any): Promise; + /** + * 用户信息查询接口 + * + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + getUser(userId: string, groupId: string, options: any): Promise; + /** + * 获取用户人脸列表接口 + * + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + faceGetlist(userId: string, groupId: string, options: any): Promise; + /** + * 获取用户列表接口 + * + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * start 默认值0,起始序号 + * length 返回数量,默认值100,最大值1000 + * @return {Promise} - 标准Promise对象 + */ + getGroupUsers(groupId: string, options: any): Promise; + /** + * 复制用户接口 + * + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * src_group_id 从指定组里复制信息 + * dst_group_id 需要添加用户的组id + * @return {Promise} - 标准Promise对象 + */ + userCopy(userId: string, options: any): Promise; + /** + * 删除用户接口 + * + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {string} userId - 用户id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + deleteUser(groupId: string, userId: string, options: any): Promise; + /** + * 创建用户组接口 + * + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + groupAdd(groupId: string, options: any): Promise; + /** + * 删除用户组接口 + * + * @param {string} groupId - 用户组id(由数字、字母、下划线组成),长度限制128B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + groupDelete(groupId: string, options: any): Promise; + /** + * 组列表查询接口 + * + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * start 默认值0,起始序号 + * length 返回数量,默认值100,最大值1000 + * @return {Promise} - 标准Promise对象 + */ + getGrouplist(options: any): Promise; + /** + * 身份验证接口 + * + * @param {string} image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 + * @param {string} imageType - 图片类型
**BASE64**:图片的base64值,base64编码后的图片数据,编码后的图片大小不超过2M;
**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长);
**FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个。 + * @param {string} idCardNumber - 身份证号(真实身份证号号码) + * @param {string} name - utf8,姓名(真实姓名,和身份证号匹配) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** + * liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** + * @return {Promise} - 标准Promise对象 + */ + personVerify(image: string, imageType: string, idCardNumber: string, name: string, options: any): Promise; + /** + * 语音校验码接口接口 + * + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * appid 百度云创建应用时的唯一标识ID + * @return {Promise} - 标准Promise对象 + */ + videoSessioncode(options: any): Promise; + /** + * 在线活体检测 + * + * @param {Object} param - 参数对象数组 + * @return {Promise} - 标准Promise对象 + * > 说明:两张图片的对象举例: + * > + * > [ + * > { + * > "image": "sfasq35sadvsvqwr5q...", + * > "image_type": "BASE64", + * > "face_field": "quality" + * > }, + * > { + * > "image": "sfasq35sadvsvqwr5q...", + * > "image_type": "BASE64", + * > "face_field": "quality" + * > } + * > ] + */ + faceverify(object: any): Promise; + /** + * 人脸比对接口 + * + * @param {Object} param - 参数对象数组 + * @return {Promise} - 标准Promise对象 + * > 说明:两张图片的对象举例: + * > + * > [ + * > { + * > "image": "sfasq35sadvsvqwr5q...", + * > "image_type": "BASE64", + * > "face_type": "LIVE", + * > "quality_control": "LOW", + * > "liveness_control": "HIGH" + * > }, + * > { + * > "image": "sfasq35sadvsvqwr5q...", + * > "image_type": "BASE64", + * > "face_type": "IDCARD", + * > "quality_control": "LOW", + * > "liveness_control": "HIGH" + * > } + * > ] + */ + match(object: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipImageClassify.d.ts b/types/AipImageClassify.d.ts new file mode 100644 index 0000000..24b4b1b --- /dev/null +++ b/types/AipImageClassify.d.ts @@ -0,0 +1,274 @@ +export = AipImageClassify; +/** + * AipImageClassify类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipImageClassify extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 通用物体识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + advancedGeneral(image: string, options: any): Promise; + /** + * 菜品识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * top_num 返回预测得分top结果数,默认为5 + * @return {Promise} - 标准Promise对象 + */ + dishDetect(image: string, options: any): Promise; + /** + * 车辆识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * top_num 返回预测得分top结果数,默认为5 + * @return {Promise} - 标准Promise对象 + */ + carDetect(image: string, options: any): Promise; + /** + * logo商标识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * custom_lib 是否只使用自定义logo库的结果,默认false:返回自定义库+默认库的识别结果 + * @return {Promise} - 标准Promise对象 + */ + logoSearch(image: string, options: any): Promise; + /** + * logo商标识别—添加接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {string} brief - brief,检索时带回。此处要传对应的name与code字段,name长度小于100B,code长度小于150B + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + logoAdd(image: string, brief: string, options: any): Promise; + /** + * logo商标识别—删除接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + logoDeleteByImage(image: string, options: any): Promise; + /** + * logo商标识别—删除接口 + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + logoDeleteBySign(contSign: string, options: any): Promise; + /** + * 动物识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * top_num 返回预测得分top结果数,默认为6 + * @return {Promise} - 标准Promise对象 + */ + animalDetect(image: string, options: any): Promise; + /** + * 植物识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + plantDetect(image: string, options: any): Promise; + /** + * 图像主体检测接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * with_face 如果检测主体是人,主体区域是否带上人脸部分,0-不带人脸区域,其他-带人脸区域,裁剪类需求推荐带人脸,检索/识别类需求推荐不带人脸。默认取1,带人脸。 + * @return {Promise} - 标准Promise对象 + */ + objectDetect(image: string, options: any): Promise; + /** + * 自定义菜品识别—入库 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {string} brief - 简介 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + customDishesAddImage(image: string, brief: string, options: any): Promise; + /** + * 自定义菜品识别—检索 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + customDishesSearch(image: string, options: any): Promise; + /** + * 自定义菜品识别—删除 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + customDishesDeleteImage(image: string, options: any): Promise; + /** + * 自定义菜品识别—删除 + * + * @param {string} cont_sign - 图片签名 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + customDishesDeleteContSign(cont_sign: string, options: any): Promise; + /** + * 图像多主体检测 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + multiObjectDetect(image: string, options: any): Promise; + /** + * 车辆属性识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type 是否选定某些属性输出对应的信息,可从12种输出属性中任选若干,用英文逗号分隔(例如vehicle_type,roof_rack,skylight)。默认输出全部属性 + * @return {Promise} - 标准Promise对象 + */ + vehicleAttr(image: string, options: any): Promise; + /** + * 车辆属性识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type 是否选定某些属性输出对应的信息,可从12种输出属性中任选若干,用英文逗号分隔(例如vehicle_type,roof_rack,skylight)。默认输出全部属性 + * @return {Promise} - 标准Promise对象 + */ + vehicleAttrUrl(url: string, options: any): Promise; + /** + * 车辆检测-高空版 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * area 只统计该矩形区域内的车辆数,缺省时为全图统计。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合矩形区域。 + * @return {Promise} - 标准Promise对象 + */ + vehicleDetectHigh(image: string, options: any): Promise; + /** + * 车辆检测-高空版 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * area 只统计该矩形区域内的车辆数,缺省时为全图统计。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合矩形区域。 + * @return {Promise} - 标准Promise对象 + */ + vehicleDetectHighUrl(url: string, options: any): Promise; + /** + * 车型识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * top_num 返回结果top n,默认5。e + * baike_num 返回百科信息的结果数,默认不返回 + * @return {Promise} - 标准Promise对象 + */ + carDetectUrl(url: string, options: any): Promise; + /** + * 车辆检测 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * area 只统计该矩形区域内的车辆数,缺省时为全图统计。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合矩形区域。 + * @return {Promise} - 标准Promise对象 + */ + vehicleDetect(image: string, options: any): Promise; + /** + * 车辆检测 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * area 只统计该矩形区域内的车辆数,缺省时为全图统计。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合矩形区域。 + * @return {Promise} - 标准Promise对象 + */ + vehicleDetectUrl(url: string, options: any): Promise; + /** + * 车辆分割 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type 可以通过设置type参数,自主设置返回哪些结果图,避免造成带宽的浪费。1)可选值说明:labelmap - 二值图像,需二次处理方能查看分割效果scoremap - 车辆前景灰度图2)type 参数值可以是可选值的组合,用逗号分隔;如果无此参数默认输出全部3类结果图 + * @return {Promise} - 标准Promise对象 + */ + vehicleSeg(image: string, options: any): Promise; + /** + * 车辆外观损伤识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vehicleDamage(image: string, options: any): Promise; + /** + * 车流统计 + * + * @param {string} image - 二进制图像数据 + * @param {string} case_id - 任务ID(通过case_id区分不同视频流,自拟,不同序列间不可重复) + * @param {string} case_init - 每个case的初始化信号,为true时对该case下的跟踪算法进行初始化,为false时重载该case的跟踪状态。当为false且读取不到相应case的信息时,直接重新初始化 + * @param {string} area - 只统计进出该区域的车辆。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合多边形区域。 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * show 是否返回结果图(含统计值和跟踪框)。选true时返回渲染后的图片(base64),其它无效值或为空则默认false。 + * @return {Promise} - 标准Promise对象 + */ + trafficFlow(image: string, case_id: string, case_init: string, area: string, options: any): Promise; + /** + * 车流统计 + * + * @param {string} url - 图片完整URL + * @param {string} case_id - 任务ID(通过case_id区分不同视频流,自拟,不同序列间不可重复) + * @param {string} case_init - 每个case的初始化信号,为true时对该case下的跟踪算法进行初始化,为false时重载该case的跟踪状态。当为false且读取不到相应case的信息时,直接重新初始化 + * @param {string} area - 只统计进出该区域的车辆。逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的x、y坐标(默认尾点和首点相连),形成闭合多边形区域。 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * show 是否返回结果图(含统计值和跟踪框)。选true时返回渲染后的图片(base64),其它无效值或为空则默认false。 + * @return {Promise} - 标准Promise对象 + */ + trafficFlowUrl(url: string, case_id: string, case_init: string, area: string, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipImageProcess.d.ts b/types/AipImageProcess.d.ts new file mode 100644 index 0000000..ca93b2b --- /dev/null +++ b/types/AipImageProcess.d.ts @@ -0,0 +1,222 @@ +export = AipImageProcess; +/** + * AipImageProcess类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipImageProcess extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + jsonRequestImpl(param: any): Promise; + /** + * 图像修复 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + inpaintingByMask(image: string, rectangle: any): Promise; + /** + * 图像风格转换 + * + * @param {string} image - 二进制图像数据 + * @param {string} option - 转换风格 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + styleTrans(image: string, options: any): Promise; + /** + * 图像风格转换 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {string} option - 转换风格 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + styleTransUrl(url: string, options: any): Promise; + /** + * 图像清晰度增强 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + imageDefinitionEnhance(image: string): Promise; + /** + * 图像清晰度增强 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + imageDefinitionEnhanceUrl(url: string): Promise; + /** + * 图像去雾 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + dehaze(image: string): Promise; + /** + * 图像去雾 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + dehazeUrl(url: string): Promise; + /** + * 拉伸图像恢复 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + stretchRestore(image: string): Promise; + /** + * 拉伸图像恢复 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + stretchRestoreUrl(url: string): Promise; + /** + * 图像色彩增强 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + colorEnhance(image: string): Promise; + /** + * 图像色彩增强 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + colorEnhanceUrl(url: string): Promise; + /** + * 天空分割 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + skySeg(image: string): Promise; + /** + * 天空分割 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + skySegUrl(url: string): Promise; + /** + * 黑白图像上色 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + colourize(image: string, options: any): Promise; + /** + * 黑白图像上色 + * + * @param {string} url - 图片完整URL路径 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + colourizeUrl(url: string, options: any): Promise; + /** + * 图像对比度增强 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + contrastEnhance(image: string): Promise; + /** + * 图像对比度增强 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + contrastEnhanceUrl(url: string): Promise; + /** + * 图像无损放大 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + imageQualityEnhance(image: string): Promise; + /** + * 图像无损放大 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + imageQualityEnhanceUrl(url: string): Promise; + /** + * 人像动漫化 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type anime或者anime_mask。前者生成二次元动漫图,后者生成戴口罩的二次元动漫人像 + * mask_id 在type参数填入anime_mask时生效,1~8之间的整数,用于指定所使用的口罩的编码。type参数没有填入anime_mask, + 或mask_id 为空时,生成不戴口罩的二次元动漫图。 + * @return {Promise} - 标准Promise对象 + */ + selfieAnime(image: string, options: any): Promise; + /** + * 人像动漫化 + * + * @param {string} url - 图片完整URL路径,URL长度不超过1024字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type anime或者anime_mask。前者生成二次元动漫图,后者生成戴口罩的二次元动漫人像 + * mask_id 在type参数填入anime_mask时生效,1~8之间的整数,用于指定所使用的口罩的编码。type参数没有填入anime_mask, + 或mask_id 为空时,生成不戴口罩的二次元动漫图。 + * @return {Promise} - 标准Promise对象 + */ + selfieAnimeUrl(url: string, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipImageSearch.d.ts b/types/AipImageSearch.d.ts new file mode 100644 index 0000000..38562a7 --- /dev/null +++ b/types/AipImageSearch.d.ts @@ -0,0 +1,416 @@ +export = AipImageSearch; +/** + * AipImageSearch类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipImageSearch extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 相同图检索—入库接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。 + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + sameHqAdd(image: string, brief: any, options: any): Promise; + /** + * 相同图检索—入库接口 + * + * @param {string} url - 图像url + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。 + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + sameHqAddUrl(url: string, brief: any, options: any): Promise; + /** + * 相同图检索—检索接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + sameHqSearch(image: string, options: any): Promise; + /** + * 相同图检索—检索接口 + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + sameHqSearchUrl(url: string, options: any): Promise; + /** + * 相同图片搜索—更新-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqUpdate(image: string, options: any): Promise; + /** + * 相同图片搜索—更新-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqUpdateUrl(url: string, options: any): Promise; + /** + * 相同图片搜索——更新-cont_sign + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqUpdateContSign(contSign: string, options: any): Promise; + /** + * 相同图检索—删除接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqDeleteByImage(image: string, options: any): Promise; + /** + * 相同图检索—删除接口 + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqDeleteBySign(contSign: string, options: any): Promise; + /** + * 相同图检索—删除接口 + * + * @param {string} url - 图片url + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sameHqDeleteByUrl(url: string, options: any): Promise; + /** + * 相似图检索—入库接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。 + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + similarAdd(image: string, options: any): Promise; + /** + * 相似图检索—入库接口 + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。 + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + similarAddUrl(url: string, options: any): Promise; + /** + * 相似图检索—检索接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + similarSearch(image: string, options: any): Promise; + /** + * 相似图检索—检索接口 + * + * @param {string} image - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 + * tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + similarSearchUrl(url: any, options: any): Promise; + /** + * 相似图检索—更新-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarUpdate(image: string, options: any): Promise; + /** + * 相似图检索——更新-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarUpdateUrl(url: string, options: any): Promise; + /** + * 相似图检索——更新-cont_sign + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarUpdateContSign(contSign: string, options: any): Promise; + /** + * 相似图检索—删除接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarDeleteByImage(image: string, options: any): Promise; + /** + * 相似图检索—删除接口 + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarDeleteByUrl(url: string, options: any): Promise; + /** + * 相似图检索—删除接口 + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + similarDeleteBySign(contSign: string, options: any): Promise; + /** + * 商品检索—入库接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。**请注意,检索接口不返回原图,仅反馈当前填写的brief信息,所以调用该入库接口时,brief信息请尽量填写可关联至本地图库的图片id或者图片url、图片名称等信息** + * class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + productAdd(image: string, options: any): Promise; + /** + * 商品检索—入库接口 + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * brief 检索时原样带回,最长256B。**请注意,检索接口不返回原图,仅反馈当前填写的brief信息,所以调用该入库接口时,brief信息请尽量填写可关联至本地图库的图片id或者图片url、图片名称等信息** + * class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * @return {Promise} - 标准Promise对象 + */ + productAddUrl(url: string, options: any): Promise; + /** + * 商品检索—检索接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + productSearch(image: string, options: any): Promise; + /** + * 商品检索—检索接口 + * + * @param {string} url - 图片url + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索 + * pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条 + * rn 分页功能,截取条数,例:250 + * @return {Promise} - 标准Promise对象 + */ + productSearchUrl(url: string, options: any): Promise; + /** + * 商品检索—更新-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productUpdate(image: string, options: any): Promise; + /** + * 商品检索——更新-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productUpdateUrl(url: string, options: any): Promise; + /** + * 商品检索——更新-cont_sign + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productUpdateContSign(contSign: string, options: any): Promise; + /** + * 商品检索—删除接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productDeleteByImage(image: string, options: any): Promise; + /** + * 商品检索—删除接口 + * + * @param {string} url - 图像url + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productDeleteByUrl(url: string, options: any): Promise; + /** + * 商品检索—删除接口 + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + productDeleteBySign(contSign: string, options: any): Promise; + /** + * 绘本图片搜索—入库-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {string} brief - 简介 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookAddImage(image: string, brief: string, options: any): Promise; + /** + * 绘本图片搜索—入库-url + * + * @param {string} url - 图片地址 + * @param {string} brief - 简介 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookAddUrl(url: string, brief: string, options: any): Promise; + /** + * 绘本图片搜索—检索-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookSearchImage(image: string, options: any): Promise; + /** + * 绘本图片搜索—检索-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookSearchUrl(url: string, options: any): Promise; + /** + * 绘本图片搜索—更新-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookUpdate(image: string, options: any): Promise; + /** + * 绘本图片搜索—更新-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookUpdateUrl(url: string, options: any): Promise; + /** + * 绘本图片搜索—更新-cont_sign + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookUpdateContSign(contSign: string, options: any): Promise; + /** + * 绘本图片搜索—删除-image + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookDeleteByImage(image: string, options: any): Promise; + /** + * 绘本图片搜索—删除-url + * + * @param {string} url - 图片地址 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookDeleteByUrl(url: string, options: any): Promise; + /** + * 绘本图片搜索—删除-cont_sign + * + * @param {string} contSign - 图片签名(和image二选一,image优先级更高) + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + pictureBookDeleteBySign(contSign: string, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipKg.d.ts b/types/AipKg.d.ts new file mode 100644 index 0000000..0f55735 --- /dev/null +++ b/types/AipKg.d.ts @@ -0,0 +1,84 @@ +export = AipKg; +/** + * AipKg类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipKg extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 创建任务接口 + * + * @param {string} name - 任务名字 + * @param {string} templateContent - json string 解析模板内容 + * @param {string} inputMappingFile - 抓取结果映射文件的路径 + * @param {string} outputFile - 输出文件名字 + * @param {string} urlPattern - url pattern + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * limit_count 限制解析数量limit_count为0时进行全量任务,limit_count>0时只解析limit_count数量的页面 + * @return {Promise} - 标准Promise对象 + */ + createTask(name: string, templateContent: string, inputMappingFile: string, outputFile: string, urlPattern: string, options: any): Promise; + /** + * 更新任务接口 + * + * @param {integer} id - 任务ID + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * name 任务名字 + * template_content json string 解析模板内容 + * input_mapping_file 抓取结果映射文件的路径 + * url_pattern url pattern + * output_file 输出文件名字 + * @return {Promise} - 标准Promise对象 + */ + updateTask(id: integer, options: any): Promise; + /** + * 获取任务详情接口 + * + * @param {integer} id - 任务ID + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + getTaskInfo(id: integer, options: any): Promise; + /** + * 以分页的方式查询当前用户所有的任务信息接口 + * + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * id 任务ID,精确匹配 + * name 中缀模糊匹配,abc可以匹配abc,aaabc,abcde等 + * status 要筛选的任务状态 + * page 页码 + * per_page 页码 + * @return {Promise} - 标准Promise对象 + */ + getUserTasks(options: any): Promise; + /** + * 启动任务接口 + * + * @param {integer} id - 任务ID + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + startTask(id: integer, options: any): Promise; + /** + * 查询任务状态接口 + * + * @param {integer} id - 任务ID + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + getTaskStatus(id: integer, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipNlp.d.ts b/types/AipNlp.d.ts new file mode 100644 index 0000000..99fccf0 --- /dev/null +++ b/types/AipNlp.d.ts @@ -0,0 +1,162 @@ +export = AipNlp; +/** + * AipNlp类 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipNlp extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 词法分析接口 + * + * @param {string} text - 待分析文本(目前仅支持GBK编码),长度不超过65536字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + lexer(text: string, options: any): Promise; + /** + * 词法分析(定制版)接口 + * + * @param {string} text - 待分析文本(目前仅支持GBK编码),长度不超过65536字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + lexerCustom(text: string, options: any): Promise; + /** + * 依存句法分析接口 + * + * @param {string} text - 待分析文本(目前仅支持GBK编码),长度不超过256字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * mode 模型选择。默认值为0,可选值mode=0(对应web模型);mode=1(对应query模型) + * @return {Promise} - 标准Promise对象 + */ + depparser(text: string, options: any): Promise; + /** + * 词向量表示接口 + * + * @param {string} word - 文本内容(GBK编码),最大64字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + wordembedding(word: string, options: any): Promise; + /** + * DNN语言模型接口 + * + * @param {string} text - 文本内容(GBK编码),最大512字节,不需要切词 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + dnnlmCn(text: string, options: any): Promise; + /** + * 词义相似度接口 + * + * @param {string} word1 - 词1(GBK编码),最大64字节 + * @param {string} word2 - 词1(GBK编码),最大64字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * mode 预留字段,可选择不同的词义相似度模型。默认值为0,目前仅支持mode=0 + * @return {Promise} - 标准Promise对象 + */ + wordSimEmbedding(word1: string, word2: string, options: any): Promise; + /** + * 短文本相似度接口 + * + * @param {string} text1 - 待比较文本1(GBK编码),最大512字节 + * @param {string} text2 - 待比较文本2(GBK编码),最大512字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * model 默认为"BOW",可选"BOW"、"CNN"与"GRNN" + * @return {Promise} - 标准Promise对象 + */ + simnet(text1: string, text2: string, options: any): Promise; + /** + * 评论观点抽取接口 + * + * @param {string} text - 评论内容(GBK编码),最大10240字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * type 评论行业类型,默认为4(餐饮美食) + * @return {Promise} - 标准Promise对象 + */ + commentTag(text: string, options: any): Promise; + /** + * 情感倾向分析接口 + * + * @param {string} text - 文本内容(GBK编码),最大102400字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + sentimentClassify(text: string, options: any): Promise; + /** + * 文章标签接口 + * + * @param {string} title - 篇章的标题,最大80字节 + * @param {string} content - 篇章的正文,最大65535字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + keyword(title: string, content: string, options: any): Promise; + /** + * 文章分类接口 + * + * @param {string} title - 篇章的标题,最大80字节 + * @param {string} content - 篇章的正文,最大65535字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + topic(title: string, content: string, options: any): Promise; + /** + * 文本纠错接口 + * + * @param {string} text - 待纠错文本,输入限制511字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + ecnet(text: string, options: any): Promise; + /** + * 对话情绪识别接口接口 + * + * @param {string} text - 待识别情感文本,输入限制512字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * scene default(默认项-不区分场景),talk(闲聊对话-如度秘聊天等),task(任务型对话-如导航对话等),customer_service(客服对话-如电信/银行客服等) + * @return {Promise} - 标准Promise对象 + */ + emotion(text: string, options: any): Promise; + /** + * 新闻摘要接口接口 + * + * @param {string} content - 字符串(限3000字符数以内)字符串仅支持GBK编码,长度需小于3000字符数(即6000字节),请输入前确认字符数没有超限,若字符数超长会返回错误。正文中如果包含段落信息,请使用"\n"分隔,段落信息算法中有重要的作用,请尽量保留 + * @param {integer} maxSummaryLen - 此数值将作为摘要结果的最大长度。例如:原文长度1000字,本参数设置为150,则摘要结果的最大长度是150字;推荐最优区间:200-500字 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * title 字符串(限200字符数)字符串仅支持GBK编码,长度需小于200字符数(即400字节),请输入前确认字符数没有超限,若字符数超长会返回错误。标题在算法中具有重要的作用,若文章确无标题,输入参数的“标题”字段为空即可 + * @return {Promise} - 标准Promise对象 + */ + newsSummary(content: string, maxSummaryLen: integer, options: any): Promise; + /** + * 地址识别接口接口 + * + * @param {string} text - 待识别的文本内容,不超过1000字节 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + address(text: string, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipOcr.d.ts b/types/AipOcr.d.ts new file mode 100644 index 0000000..b1d719f --- /dev/null +++ b/types/AipOcr.d.ts @@ -0,0 +1,676 @@ +export = AipOcr; +/** + * AipOcr类 + * + * @class + * @extends BaseClient + * @constructor` + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipOcr extends BaseClient { + constructor(appId: any, ak: any, sk: any); + commonImpl(param: any): Promise; + /** + * 通用文字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + generalBasic(image: string, options: any): Promise; + /** + * 通用文字识别接口 + * + * @param {string} url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + generalBasicUrl(url: string, options: any): Promise; + /** + * 通用文字识别(高精度版)接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + accurateBasic(image: string, options: any): Promise; + /** + * 通用文字识别(含位置信息版)接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + general(image: string, options: any): Promise; + /** + * 通用文字识别(含位置信息版)接口 + * + * @param {string} url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + generalUrl(url: string, options: any): Promise; + /** + * 通用文字识别(含位置高精度版)接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + accurate(image: string, options: any): Promise; + /** + * 通用文字识别(含生僻字版)接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + generalEnhance(image: string, options: any): Promise; + /** + * 通用文字识别(含生僻字版)接口 + * + * @param {string} url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG。可选值包括:
- CHN_ENG:中英文混合;
- ENG:英文;
- POR:葡萄牙语;
- FRE:法语;
- GER:德语;
- ITA:意大利语;
- SPA:西班牙语;
- RUS:俄语;
- JAP:日语;
- KOR:韩语; + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * probability 是否返回识别结果中每一行的置信度 + * @return {Promise} - 标准Promise对象 + */ + generalEnhanceUrl(url: string, options: any): Promise; + /** + * 网络图片文字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * @return {Promise} - 标准Promise对象 + */ + webImage(image: string, options: any): Promise; + /** + * 网络图片文字识别接口 + * + * @param {string} url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) + * @return {Promise} - 标准Promise对象 + */ + webImageUrl(url: string, options: any): Promise; + /** + * 身份证识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {string} idCardSide - front:身份证含照片的一面;back:身份证带国徽的一面 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * detect_risk 是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启 + * @return {Promise} - 标准Promise对象 + */ + idcard(image: string, idCardSide: string, options: any): Promise; + /** + * 银行卡识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + bankcard(image: string, options: any): Promise; + /** + * 驾驶证识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * @return {Promise} - 标准Promise对象 + */ + drivingLicense(image: string, options: any): Promise; + /** + * 行驶证识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * accuracy normal 使用快速服务,1200ms左右时延;缺省或其它值使用高精度服务,1600ms左右时延 + * @return {Promise} - 标准Promise对象 + */ + vehicleLicense(image: string, options: any): Promise; + /** + * 车牌识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * multi_detect 是否检测多张车牌,默认为false,当置为true的时候可以对一张图片内的多张车牌进行识别 + * @return {Promise} - 标准Promise对象 + */ + licensePlate(image: string, options: any): Promise; + /** + * 营业执照识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + businessLicense(image: string, options: any): Promise; + /** + * 通用票据识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * probability 是否返回识别结果中每一行的置信度 + * accuracy normal 使用快速服务,1200ms左右时延;缺省或其它值使用高精度服务,1600ms左右时延 + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * @return {Promise} - 标准Promise对象 + */ + receipt(image: string, options: any): Promise; + /** + * 表格文字识别同步接口接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + form(image: string, options: any): Promise; + /** + * 表格文字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + tableBegin(image: string, options: any): Promise; + /** + * 表格识别结果接口 + * + * @param {string} requestId - 发送表格文字识别请求时返回的request id + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * result_type 期望获取结果的类型,取值为“excel”时返回xls文件的地址,取值为“json”时返回json格式的字符串,默认为”excel” + * @return {Promise} - 标准Promise对象 + */ + tableGetresult(requestId: string, options: any): Promise; + /** + * 增值税发票识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vatInvoice(image: string, options: any): Promise; + /** + * 增值税发票识别接口 + * + * @param {string} image - url + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vatInvoiceUrl(image: string, options: any): Promise; + /** + * 增值税发票识别接口 + * + * @param {string} image - pdf + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vatInvoicePdf(image: string, options: any): Promise; + /** + * 二维码识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + qrcode(image: string, options: any): Promise; + /** + * 数字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
- true:检测朝向;
- false:不检测朝向。 + * @return {Promise} - 标准Promise对象 + */ + numbers(image: string, options: any): Promise; + /** + * 彩票识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * @return {Promise} - 标准Promise对象 + */ + lottery(image: string, options: any): Promise; + /** + * 护照识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + passport(image: string, options: any): Promise; + /** + * 名片识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + businessCard(image: string, options: any): Promise; + /** + * 手写文字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * @return {Promise} - 标准Promise对象 + */ + handwriting(image: string, options: any): Promise; + /** + * 自定义模板文字识别接口 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param {string} templateSign - 您在自定义文字识别平台制作的模板的ID + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + custom(image: string, templateSign: string, options: any): Promise; + tableRecorgnize(image: any, type: any, timeout: any, interval: any): Promise; + /** + * 文档版面分析与识别 + * + * @param {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param languageType + 识别语言类型,默认为CHN_ENG 可选值包括:CHN_ENG:中英文, ENG:英文 + * @param resultType + 返回识别结果是按单行结果返回,还是按单字结果返回,默认为big。 + big:返回行识别结果 + small:返回行识别结果之上还会返回单字结果 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * detect_direction: + * 类型: string 可选值范围: true/false 说明:是否检测图像朝向,默认不检测,即:false。 + * line_probability: + * 类型: string 可选值范围: true/false 说明:是否返回每行识别结果的置信度。默认为false + * words_type: + * 类型: string 可选值范围: handwring_only/handprint_mix 说明:文字类型, 默认 印刷文字识别 + * layout_analysis: + * 类型: string 可选值范围: true/false 说明:是否分析文档版面:包括图、表、标题、段落的分析输出 + * @return {Promise} - 标准Promise对象 + */ + docAnalysis(image: string, languageType: any, resultType: any, options: any): Promise; + /** + * 仪器仪表盘读数识别 + {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param options - options列表 + * probability: + * 类型: string 可选值范围: true/false 说明:是否返回每行识别结果的置信度。默认为false + * poly_location: + * 类型: string 可选值范围: true/false 说明:位置信息返回形式,默认:false + * @return + */ + meter(image: any, options: any): Promise; + /** + * 网络图片文字识别(含位置版) + * {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param options - options列表 + * detect_direction: + * 类型: string 可选值范围: true/false 说明:是否检测图像朝向,默认不检测,即:false。 + * probability: + * 类型: string 可选值范围: true/false 说明:是否返回每行识别结果的置信度。默认为false + * poly_location: + * 类型: string 可选值范围: handwring_only/handprint_mix 说明:是否返回文字所在区域的外接四边形的4个点坐标信息。默认为false + * recognize_granularity: + * 类型: string 可选值范围: true/false 说明:是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置 + * @return + */ + webimageLoc(image: any, options: any): Promise; + /** + * 出租车票识别 + * {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param options - options列表 + * @return + */ + taxiReceipt(image: any, options: any): Promise; + /** + * 出租车票识别 + * {string} image - url + * @param options - options列表 + * @return + */ + taxiReceiptUrl(image: any, options: any): Promise; + /** + * VIN码识别 + * {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param options - options列表 + * @return + */ + vinCode(image: any, options: any): Promise; + /** + * VIN码识别 + * {string} image - url + * @param options - options列表 + * @return + */ + vinCodeUrl(image: any, options: any): Promise; + /** + * 火车票识别 + * {string} image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式 + * @param options - options列表 + * @return + */ + trainTicket(image: any, options: any): Promise; + /** + * 火车票识别 + * {string} image - url + * @param options - options列表 + * @return + */ + trainTicketUrl(image: any, options: any): Promise; + /** + * 二维码识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + qrcodeUrl(url: string, options: any): Promise; + /** + * 试卷分析与识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * multi_detect 控制是否开启多航班信息识别功能,默认值:false + * @return {Promise} - 标准Promise对象 + */ + docAnalysisUrl(url: string, options: any): Promise; + /** + * 机动车销售发票 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vehicleInvoice(image: string, options: any): Promise; + /** + * 机动车销售发票 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + vehicleInvoiceUrl(url: string, options: any): Promise; + /** + * 车辆合格证 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG + * result_type 返回识别结果是按单行结果返回,还是按单字结果返回,默认为big + * detect_direction 是否检测图像朝向,默认不检测,即:false + * line_probability 是否返回每行识别结果的置信度。默认为false + * words_type 文字类型。 + * @return {Promise} - 标准Promise对象 + */ + vehicleCertificate(image: string, options: any): Promise; + /** + * 车辆合格证 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * language_type 识别语言类型,默认为CHN_ENG + * result_type 返回识别结果是按单行结果返回,还是按单字结果返回,默认为big + * detect_direction 是否检测图像朝向,默认不检测,即:false + * line_probability 是否返回每行识别结果的置信度。默认为false + * words_type 文字类型。 + * @return {Promise} - 标准Promise对象 + */ + vehicleCertificateUrl(url: string, options: any): Promise; + /** + * 户口本识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + householdRegister(image: string, options: any): Promise; + /** + * 户口本识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + householdRegisterUrl(url: string, options: any): Promise; + /** + * 手写文字识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * recognize_granularity 是否定位单字符位置, + * probability 是否返回识别结果中每一行的置信度,默认为false,不返回置信度 + * detect_direction 是否检测图像朝向,默认不检测,即:false + * @return {Promise} - 标准Promise对象 + */ + handwritingUrl(url: string, options: any): Promise; + /** + * 飞机行程单识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * multi_detect 控制是否开启多航班信息识别功能,默认值:false + * @return {Promise} - 标准Promise对象 + */ + airTicket(image: string, options: any): Promise; + /** + * 飞机行程单识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * multi_detect 控制是否开启多航班信息识别功能,默认值:false + * @return {Promise} - 标准Promise对象 + */ + airTicketUrl(url: string, options: any): Promise; + /** + * 通用机打发票 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * location 是否输出位置信息,true:输出位置信息,false:不输出位置信息,默认false + * @return {Promise} - 标准Promise对象 + */ + invoice(image: string, options: any): Promise; + /** + * 通用机打发票 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * location 是否输出位置信息,true:输出位置信息,false:不输出位置信息,默认false + * @return {Promise} - 标准Promise对象 + */ + invoiceUrl(url: string, options: any): Promise; + /** + * 护照识别 + * + * @param {string} url - 图片完整URL + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * @return {Promise} - 标准Promise对象 + */ + passportUrl(url: string, options: any): Promise; + /** + * 网约车行程单识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * @return {Promise} - 标准Promise对象 + */ + onlineTaxiItinerary(image: string): Promise; + /** + * 网约车行程单识别 + * + * @param {string} url - 图片完整URL路径 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * @return {Promise} - 标准Promise对象 + */ + onlineTaxiItineraryUrl(url: string): Promise; + /** + * 网约车行程单识别 + * + * @param {string} pdf_file - pdf文件二进制数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * @return {Promise} - 标准Promise对象 + */ + onlineTaxiItineraryPdf(pdf_file: string, options: any): Promise; + /** + * 磅单识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + weightNote(image: string, options: any): Promise; + /** + * 磅单识别 + * + * @param {string} url - 图片完整URL路径 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + weightNoteUrl(url: string, options: any): Promise; + /** + * 磅单识别 + * + * @param {string} pdf_file - 图片完整URL路径 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * pdf_file_num 需要识别的PDF文件的对应页码,当 pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页 + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + weightNotePdf(pdf_file: string, options: any): Promise; + /** + * 医疗费用明细识别 + * + * @param {string} image - 二进制图像数据 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * location 是否返回字段的位置信息,默认为 false,可缺省 + - false:不返回字段位置信息 + - true:返回字段的位置信息,包括上边距(top)、左边距(left)、宽度(width)、高度(height) + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + medicalDetail(image: string, options: any): Promise; + /** + * 医疗费用明细识别 + * + * @param {string} url - 图片完整URL路径 + * @param {Object} options - 可选参数对象,key: value都为string类型 + * @description options - options列表: + * location 是否返回字段的位置信息,默认为 false,可缺省 + - false:不返回字段位置信息 + - true:返回字段的位置信息,包括上边距(top)、左边距(left)、宽度(width)、高度(height) + * probability 是否返回字段识别结果的置信度,默认为 false,可缺省 + - false:不返回字段识别结果的置信度 + - true:返回字段识别结果的置信度,包括字段识别结果中各字符置信度的平均值(average)和最小值(min) + * @return {Promise} - 标准Promise对象 + */ + medicalDetailUrl(url: string, options: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/AipSpeech.d.ts b/types/AipSpeech.d.ts new file mode 100644 index 0000000..da37228 --- /dev/null +++ b/types/AipSpeech.d.ts @@ -0,0 +1,23 @@ +export = AipSpeech; +/** + * AipSpeech类,构造调用语音接口 + * + * @class + * @extends BaseClient + * @constructor + * @param {string} appid appid. + * @param {string} ak access key. + * @param {string} sk security key. + */ +declare class AipSpeech extends BaseClient { + constructor(appId: any, ak: any, sk: any); + recognizePro(buffer: any, format: any, rate: any, options: any): Promise; + recognize(buffer: any, format: any, rate: any, options: any): Promise; + recognizeByUrl(url: any, callback: any, format: any, rate: any, options: any): Promise; + asrImpl(param: any): Promise; + asrImplPro(param: any): Promise; + asrImplPath(param: any, url: any): Promise; + text2audio(text: any, options: any): Promise; + ttsImpl(param: any): Promise; +} +import BaseClient = require("./client/baseClient"); diff --git a/types/auth/bceAuth/auth.d.ts b/types/auth/bceAuth/auth.d.ts new file mode 100644 index 0000000..98612e1 --- /dev/null +++ b/types/auth/bceAuth/auth.d.ts @@ -0,0 +1,54 @@ +export = Auth; +/** + * Auth + * + * @constructor + * @param {string} ak The access key. + * @param {string} sk The security key. + */ +declare function Auth(ak: string, sk: string): void; +declare class Auth { + /** + * Auth + * + * @constructor + * @param {string} ak The access key. + * @param {string} sk The security key. + */ + constructor(ak: string, sk: string); + ak: string; + sk: string; + /** + * Generate the signature based on http://gollum.baidu.com/AuthenticationMechanism + * + * @param {string} method The http request method, such as GET, POST, DELETE, PUT, ... + * @param {string} resource The request path. + * @param {Object=} params The query strings. + * @param {Object=} headers The http request headers. + * @param {number=} timestamp Set the current timestamp. + * @param {number=} expirationInSeconds The signature validation time. + * @param {Array.=} headersToSign The request headers list which will be used to calcualate the signature. + * + * @return {string} The signature. + */ + generateAuthorization(method: string, resource: string, params?: any | undefined, headers?: any | undefined, timestamp?: number | undefined, expirationInSeconds?: number | undefined, headersToSign?: Array | undefined): string; + uriCanonicalization(uri: any): any; + /** + * Canonical the query strings. + * + * @see http://gollum.baidu.com/AuthenticationMechanism#生成CanonicalQueryString + * @param {Object} params The query strings. + * @return {string} + */ + queryStringCanonicalization(params: any): string; + /** + * Canonical the http request headers. + * + * @see http://gollum.baidu.com/AuthenticationMechanism#生成CanonicalHeaders + * @param {Object} headers The http request headers. + * @param {Array.=} headersToSign The request headers list which will be used to calcualate the signature. + * @return {*} canonicalHeaders and signedHeaders + */ + headersCanonicalization(headers: any, headersToSign?: Array | undefined): any; + hash(data: any, key: any): string; +} diff --git a/types/auth/bceAuth/headers.d.ts b/types/auth/bceAuth/headers.d.ts new file mode 100644 index 0000000..d85917b --- /dev/null +++ b/types/auth/bceAuth/headers.d.ts @@ -0,0 +1,29 @@ +export const CONTENT_TYPE: "Content-Type"; +export const CONTENT_LENGTH: "Content-Length"; +export const CONTENT_MD5: "Content-MD5"; +export const CONTENT_ENCODING: "Content-Encoding"; +export const CONTENT_DISPOSITION: "Content-Disposition"; +export const ETAG: "ETag"; +export const CONNECTION: "Connection"; +export const HOST: "Host"; +export const USER_AGENT: "User-Agent"; +export const CACHE_CONTROL: "Cache-Control"; +export const EXPIRES: "Expires"; +export const AUTHORIZATION: "Authorization"; +export const X_BCE_DATE: "x-bce-date"; +export const X_BCE_ACL: "x-bce-acl"; +export const X_BCE_REQUEST_ID: "x-bce-request-id"; +export const X_BCE_CONTENT_SHA256: "x-bce-content-sha256"; +export const X_BCE_OBJECT_ACL: "x-bce-object-acl"; +export const X_BCE_OBJECT_GRANT_READ: "x-bce-object-grant-read"; +export const X_HTTP_HEADERS: "http_headers"; +export const X_BODY: "body"; +export const X_STATUS_CODE: "status_code"; +export const X_MESSAGE: "message"; +export const X_CODE: "code"; +export const X_REQUEST_ID: "request_id"; +export const SESSION_TOKEN: "x-bce-security-token"; +export const X_VOD_MEDIA_TITLE: "x-vod-media-title"; +export const X_VOD_MEDIA_DESCRIPTION: "x-vod-media-description"; +export const ACCEPT_ENCODING: "accept-encoding"; +export const ACCEPT: "accept"; diff --git a/types/auth/bceAuth/strings.d.ts b/types/auth/bceAuth/strings.d.ts new file mode 100644 index 0000000..872f880 --- /dev/null +++ b/types/auth/bceAuth/strings.d.ts @@ -0,0 +1,2 @@ +export function normalize(string: any, encodingSlash: any): string; +export function trim(string: any): any; diff --git a/types/auth/cloudAuth.d.ts b/types/auth/cloudAuth.d.ts new file mode 100644 index 0000000..a2c1cd5 --- /dev/null +++ b/types/auth/cloudAuth.d.ts @@ -0,0 +1,19 @@ +export = CloudAuth; +/** +* CloudAuth类 +* +* 百度云鉴权签名类,依赖百度云签名实现(bceAuth目录) +* @see https://github.com/baidubce/bce-sdk-js +* @see http://gollum.baidu.com/AuthenticationMechanism#生成CanonicalQueryString +* @constructor +* @param {string} ak The access key. +* @param {string} sk The security key. +*/ +declare class CloudAuth { + constructor(ak: any, sk: any); + ak: any; + sk: any; + authProxy: BceAuth; + getAuthorization(method: any, uri: any, params: any, headers: any, time: any): string; +} +import BceAuth = require("./bceAuth/auth"); diff --git a/types/auth/devAuth.d.ts b/types/auth/devAuth.d.ts new file mode 100644 index 0000000..69fb5ef --- /dev/null +++ b/types/auth/devAuth.d.ts @@ -0,0 +1,25 @@ +export = DevAuth; +/** +* devAuth类 +* 百度开发者token获取类 +* +* @constructor +* @param {string} ak API Key. +* @param {string} sk Secret Key. +*/ +declare class DevAuth { + constructor(ak: any, sk: any); + ak: any; + sk: any; + httpClient: HttpClient; + gotData(data: any): DevAuthToken; + gotDataError(err: any): void; + getToken(): Promise; +} +declare namespace DevAuth { + let EVENT_ERRTYPE_ILLEGAL_RESPONSE: string; + let EVENT_ERRTYPE_NETWORK: string; + let EVENT_ERRTYPE_NORMAL: string; +} +import HttpClient = require("../http/httpClient"); +import DevAuthToken = require("./devAuthToken"); diff --git a/types/auth/devAuthToken.d.ts b/types/auth/devAuthToken.d.ts new file mode 100644 index 0000000..a4c6c54 --- /dev/null +++ b/types/auth/devAuthToken.d.ts @@ -0,0 +1,28 @@ +export = DevAuthToken; +/** +* devAuthToken类 +* 百度开发者token信息包装类 +* +* @constructor +* @param {string} token access_token +* @param {number} expireTime 多久之后过期 +* @param {string} scope 权限 +*/ +declare class DevAuthToken { + constructor(token: any, expireTime: any, scope: any); + token: any; + expireTime: any; + scope: any; + authDate: Date; + hasScopeFlag: boolean; + initScope(): void; + hasScope(scope: any): boolean; + isExpired(): boolean; +} +declare namespace DevAuthToken { + /** + * 设置提前获取access_token的时间 + */ + function setExpireAhead(duration: any): void; + let DEFAULT_EXPIRE_DURATION: number; +} diff --git a/types/client/baseClient.d.ts b/types/client/baseClient.d.ts new file mode 100644 index 0000000..734529d --- /dev/null +++ b/types/client/baseClient.d.ts @@ -0,0 +1,30 @@ +export = BaseClient; +/** +* BaseClient类 +* 各具体接口类基类,处理鉴权逻辑等 +* +* @constructor +* @param {string} appid appid. +* @param {string} ak The access key. +* @param {string} sk The security key. +*/ +declare class BaseClient { + constructor(appId: any, ak: any, sk: any, options: any); + appId: number; + ak: any; + sk: any; + options: any; + authType: number; + status: number; + devAccessToken: any; + devAuth: DevAuth; + setAccessToken(token: any, expireTime: any): void; + authTypeReq(): Promise; + pms: Promise; + gotDevAuthSuccess(token: any): void; + gotDevAuthFail(err: any): void; + doRequest(requestInfo: any, httpClient: any): Promise; + checkDevPermission(requestInfo: any): any; + preRequest(requestInfo: any): boolean; +} +import DevAuth = require("../auth/devAuth"); diff --git a/types/client/requestInfo.d.ts b/types/client/requestInfo.d.ts new file mode 100644 index 0000000..f6a7a69 --- /dev/null +++ b/types/client/requestInfo.d.ts @@ -0,0 +1,29 @@ +export = RequestInfo; +/** +* RequestInfo类 +* 构造供request库调用的请求信息对象 +* +* @constructor +*/ +declare class RequestInfo { + constructor(path: any, params: any, method: any, isHttp: any, headers: any); + isHttp: any; + method: any; + host: string; + path: any; + params: any; + createDate: Date; + mergeHeaders: any; + devAccessToken: any; + setHost(host: any): void; + initCommonHeader(): void; + headers: {}; + makeDevOptions(devAccessToken: any): void; + makeBceOptions(ak: any, sk: any): void; + getUTCDateStr(): string; + getAccessToken(): any; + getUrl(): string; + getPureUrl(): string; + getHttpsUrl(): string; + getHttpUrl(): string; +} diff --git a/types/const/code.d.ts b/types/const/code.d.ts new file mode 100644 index 0000000..2d2faa4 --- /dev/null +++ b/types/const/code.d.ts @@ -0,0 +1,7 @@ +declare const _exports: Readonly<{ + GBK: string; + BIN: string; + UTF8: string; + BASE64: string; +}>; +export = _exports; diff --git a/types/const/devScope.d.ts b/types/const/devScope.d.ts new file mode 100644 index 0000000..22237a5 --- /dev/null +++ b/types/const/devScope.d.ts @@ -0,0 +1,17 @@ +export = devScope; +/** + * Copyright (c) 2017 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 百度开发者权限常量 + * @author baiduAip + */ +declare const devScope: "brain_all_scope"; diff --git a/types/const/httpHeader.d.ts b/types/const/httpHeader.d.ts new file mode 100644 index 0000000..91ce1e6 --- /dev/null +++ b/types/const/httpHeader.d.ts @@ -0,0 +1,7 @@ +declare const _exports: Readonly<{ + BCE_DATE: string; + HOST: string; + BCE_AUTHORIZATION: string; + CONTENT_TYPE: string; +}>; +export = _exports; diff --git a/types/http/httpClient.d.ts b/types/http/httpClient.d.ts new file mode 100644 index 0000000..322c1a6 --- /dev/null +++ b/types/http/httpClient.d.ts @@ -0,0 +1,32 @@ +export = HttpClient; +/** + * HttpClient类 + * 通用接口调用,依赖request库 + * @see https://github.com/request/request + * + * @class + * @constructor + */ +declare class HttpClient { + postWithInfo(requestInfo: any): Promise; + req(options: any): Promise; +} +declare namespace HttpClient { + /** + * 用来设置request库的参数,会覆盖所有options,设置时请确保你知道它的作用 + * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/request/request + */ + function setRequestOptions(options: any): void; + /** + * 用来获取和设置request库的参数,会覆盖所有options,设置时请确保你知道它的作用 + * 优先级高于setRequestOptions + * + * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/request/request + */ + function setRequestInterceptor(interceptorCallback: any): void; + let REQUEST_GLOBAL_OPTIONS: any; + let REQUEST_INTERCEPTOR: any; + let DEFAULT_TIMEOUT: number; +} diff --git a/types/http/httpClientExt.d.ts b/types/http/httpClientExt.d.ts new file mode 100644 index 0000000..f47e833 --- /dev/null +++ b/types/http/httpClientExt.d.ts @@ -0,0 +1,13 @@ +export = HttpClientExt; +/** + * HttpClientExt类 + * 图像审核某个接口调用需要json的Content-type,请求body为json字符串 + * + * @class + * @extends HttpClient + * @constructor + */ +declare class HttpClientExt extends HttpClient { + createBody(param: any): string; +} +import HttpClient = require("./httpClient"); diff --git a/types/http/httpClientNlp.d.ts b/types/http/httpClientNlp.d.ts new file mode 100644 index 0000000..42eab22 --- /dev/null +++ b/types/http/httpClientNlp.d.ts @@ -0,0 +1,14 @@ +export = HttpClientNlp; +/** + * HttpClientNlp类 + * nlp接口调用使用GBK编码解码实现,依赖iconv-lite库 + * @see https://github.com/ashtuchkin/iconv-lite + * + * @class + * @extends HttpClient + * @constructor + */ +declare class HttpClientNlp extends HttpClient { + createBody(param: any): Buffer; +} +import HttpClient = require("./httpClient"); diff --git a/types/http/httpClientVoiceASR.d.ts b/types/http/httpClientVoiceASR.d.ts new file mode 100644 index 0000000..a652270 --- /dev/null +++ b/types/http/httpClientVoiceASR.d.ts @@ -0,0 +1,15 @@ +export = HttpClientVoiceASR; +/** + * HttpClientVoice类 + * 百度语音接口调用封装 + * 参考文档:http://speech.baidu.com/docs/asr/57 + * + * @class + * @extends HttpClient + * @constructor + */ +declare class HttpClientVoiceASR extends HttpClient { + createBody(param: any): string; + genMd5(str: any): any; +} +import HttpClient = require("./httpClient"); diff --git a/types/http/httpClientVoiceTTS.d.ts b/types/http/httpClientVoiceTTS.d.ts new file mode 100644 index 0000000..749c14f --- /dev/null +++ b/types/http/httpClientVoiceTTS.d.ts @@ -0,0 +1,14 @@ +export = HttpClientVoiceTTS; +/** + * HttpClientVoice类 + * 百度语音接口调用封装 + * 参考文档:http://speech.baidu.com/docs/asr/57 + * + * @class + * @extends HttpClient + * @constructor + */ +declare class HttpClientVoiceTTS extends HttpClient { + genMd5(str: any): any; +} +import HttpClient = require("./httpClient"); diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..4038924 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,10 @@ +export let imageprocess: typeof import("./AipImageProcess"); +export let imageSearch: typeof import("./AipImageSearch"); +export let imageClassify: typeof import("./AipImageClassify"); +export let contentCensor: typeof import("./AipContentCensor"); +export let face: typeof import("./AipFace"); +export let ocr: typeof import("./AipOcr"); +export let nlp: typeof import("./AipNlp"); +export let kg: typeof import("./AipKg"); +export let speech: typeof import("./AipSpeech"); +export let HttpClient: typeof import("./http/httpClient"); diff --git a/types/util/objectTools.d.ts b/types/util/objectTools.d.ts new file mode 100644 index 0000000..78d4dd0 --- /dev/null +++ b/types/util/objectTools.d.ts @@ -0,0 +1,5 @@ +export function merge(source: any, dest: any): {}; +export function ensureArray(arrayLike: any): any; +export function isArray(obj: any): boolean; +export function isObject(obj: any): boolean; +export function isFunction(obj: any): boolean;