diff --git a/docs/Usage-CN.md b/docs/Usage-CN.md new file mode 100644 index 0000000000..7b69b47f8a --- /dev/null +++ b/docs/Usage-CN.md @@ -0,0 +1,90 @@ +[English](Usage-EN.md) | 简体中文 + +![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg) + +# TypeScript/Node.js SDK 使用说明 + +## 要求 + +- Node.js >= 8.x + +## 安装 + +你可以使用 `npm` 来管理你的依赖,并通过下面命令安装依赖并写入 package.json + +```sh +$ npm install @alicloud/facebody20191230 -S +``` + +## 快速使用 + +在您开始之前,您需要注册阿里云帐户并获取您的[凭证](https://usercenter.console.aliyun.com/#/manage/ak)。 +SDK 使用 [credentials-nodejs](https://github.com/aliyun/credentials-nodejs/blob/master/README-CN.md) 来管理凭证。 + +## 使用示例 + +```javascript +import Client from "@alicloud/facebody20191230"; +import * as Util from "@alicloud/tea-util"; +// 创建客户端 +const client = new Client({ + endpoint: "your endpoint", + accessKeyId: "your access key id", + accessKeySecret: "your access key secret", + type: "access_key", + regionId: "cn-hangzhou" +}); +// 初始化 runtimeObject +const runtimeObject = new Util.RuntimeOptions({}); +// 初始化 request +const addFaceEntityRequest = new AddFaceEntityRequest({ + dbName: "dbName", + entityId: "entityId", + labels: "labels" +}); +// 调用 api +const res = await client.addFaceEntity(addFaceEntityRequest, runtimeObject); +``` + +## 参数说明 + +```javascript +const Config = { + AccessKeyId: "AccessKeyId", // AccessKey Id + AccessKeySecret: "AccessKeySecret", // AccessKey Secret + Type: "Type", // 凭证类型,如有疑问请参考 https://github.com/aliyun/credentials-nodejs/blob/master/README-CN.md#%E5%87%AD%E8%AF%81%E7%B1%BB%E5%9E%8B + SecurityToken: "SecurityToken", // Security Token + Endpoint: "Endpoint", // endpoint + Protocol: "Protocol", // 请求协议 + RegionId: "RegionId", // 区域 + UserAgent: "UserAgent", // UserAgent + ReadTimeout: "ReadTimeout", // 读超时 + ConnectTimeout: "ConnectTimeout", // 连接超时 + LocalAddr: "LocalAddr", // 本地网卡 ip + HttpProxy: "HttpProxy", // http 的代理 + HttpsProxy: "HttpsProxy", // https 的代理 + NoProxy: "NoProxy", // 代理白名单 + Socks5Proxy: "Socks5Proxy", // socks5 代理 + Socks5NetWork: "Socks5NetWork", // socks5 代理协议 + MaxIdleConns: "MaxIdleConns", // 最大连接数 + EndpointType: "EndpointType", // 域名类型:internal,accelerate 或不填 + OpenPlatformEndpoint: "OpenPlatformEndpoint" // 文件上传时授权使用的域名(目前暂不需要填写) +}; + +const RuntimeOptions = { + Autoretry: "Autoretry", // 是否开启重试 + IgnoreSSL: "IgnoreSSL", // 是否忽略 SSL 校验 + MaxAttempts: "MaxAttempts", // 最大重试次数, 默认为 3 + BackoffPolicy: "BackoffPolicy", // 重试休眠策略,默认为 no + BackoffPeriod: "BackoffPeriod", // 重试休眠时间, 默认为 1 + ReadTimeout: "ReadTimeout", // 读超时 + ConnectTimeout: "ConnectTimeout", // 连接超时 + LocalAddr: "LocalAddr", // 本地网卡 ip + HttpProxy: "HttpProxy", // http 的代理 + HttpsProxy: "HttpsProxy", // https 的代理 + NoProxy: "NoProxy", // 代理白名单 + MaxIdleConns: "MaxIdleConns", // 最大连接数 + Socks5Proxy: "Socks5Proxy", // socks5 代理 + Socks5NetWork: "Socks5NetWork" // socks5 代理协议 +}; +``` diff --git a/docs/Usage-EN.md b/docs/Usage-EN.md new file mode 100644 index 0000000000..6550775946 --- /dev/null +++ b/docs/Usage-EN.md @@ -0,0 +1,89 @@ +English | [简体中文](Usage-CN.md) + +![](https://aliyunsdk-pages.alicdn.com/icons/AlibabaCloud.svg) + +# TypeScript/Node.js SDK instructions + +## Requirements + +- Node.js >= 8.x + +## Installation + +If you use `npm` to manage your dependence, you can use the following command: + +```sh +$ npm install @alicloud/facebody20191230 -S +``` + +## Quick Examples + +Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak). + +## Demo + +```javascript +import Client from "@alicloud/facebody20191230"; +import * as Util from "@alicloud/tea-util"; +// init client +const client = new Client({ + endpoint: "your endpoint", + accessKeyId: "your access key id", + accessKeySecret: "your access key secret", + type: "access_key", + regionId: "cn-hangzhou" +}); +// init runtimeObject +const runtimeObject = new Util.RuntimeOptions({}); +// init request +const addFaceEntityRequest = new AddFaceEntityRequest({ + dbName: "dbName", + entityId: "entityId", + labels: "labels" +}); +// call api +const res = await client.addFaceEntity(addFaceEntityRequest, runtimeObject); +``` + +## Parameter Specification + +```javascript +const config = { + AccessKeyId: "AccessKeyId", // AccessKey Id + AccessKeySecret: "AccessKeySecret", // AccessKey Secret + Type: "Type", // credential type,If you have any questions, please refer to it https://github.com/aliyun/credentials-nodejs/blob/master/README-CN.md#%E5%87%AD%E8%AF%81%E7%B1%BB%E5%9E%8B + SecurityToken: "SecurityToken", // Security Token + Endpoint: "Endpoint", // endpoint + Protocol: "Protocol", // http or https + RegionId: "RegionId", // region + UserAgent: "UserAgent", // UserAgent + ReadTimeout: "ReadTimeout", // read timeout + ConnectTimeout: "ConnectTimeout", // connect tiemout + LocalAddr: "LocalAddr", // the local network adapter ip + HttpProxy: "HttpProxy", // http proxy + HttpsProxy: "HttpsProxy", // https proxy + NoProxy: "NoProxy", // agent whitelist + Socks5Proxy: "Socks5Proxy", // socks5 proxy + Socks5NetWork: "Socks5NetWork", // socks5 agency agreement + MaxIdleConns: "MaxIdleConns", // maximum number of connections + EndpointType: "EndpointType", // ednpoint type:internal,accelerate or null + OpenPlatformEndpoint: "OpenPlatformEndpoint" // endpoint used when the file is uploaded(Not at the moment) +}; + +const RuntimeOptions = { + Autoretry: "Autoretry", // whether to enable retry + IgnoreSSL: "IgnoreSSL", // whether SSL validation is ignored + MaxAttempts: "MaxAttempts", // maximum number of retries, defaut: 3 + BackoffPolicy: "BackoffPolicy", // retry the sleep strategy, default: no + BackoffPeriod: "BackoffPeriod", // retry the sleep time,default: 1 + ReadTimeout: "ReadTimeout", // read timeout + ConnectTimeout: "ConnectTimeout", // connect timeout + LocalAddr: "LocalAddr", // the local network adapter ip + HttpProxy: "HttpProxy", // http proxy + HttpsProxy: "HttpsProxy", // https proxy + NoProxy: "NoProxy", // agent whitelist + MaxIdleConns: "MaxIdleConns", // maximum number of connections + Socks5Proxy: "Socks5Proxy", // socks5 proxy + Socks5NetWork: "Socks5NetWork" // socks5 agency agreement +}; +```