tencentcloud-sdk-nodejs-cii 4.0.810 → 4.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,36 +1,88 @@
1
1
  # 简介
2
2
 
3
- 欢迎使用腾讯云开发者工具套件(SDK),NODEJS SDK 4.0 是云 API 3.0 平台的配套工具。目前已经支持 cvm、vpc、cbs 等产品,后续所有的云服务产品都会接入进来。新版 SDK 实现了统一化,具有各个语言版本的 SDK 使用方法相同,接口调用方式相同,统一的错误码和返回包格式这些优点。
4
- 为方便 NODEJS 开发者调试和接入腾讯云产品 API,这里向您介绍适用于 NODEJS 的腾讯云开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取腾讯云 NODEJS SDK 并开始调用。
3
+ 欢迎使用腾讯云开发者工具套件(SDK),Node.js SDK 4.0 是云 API 3.0 平台的配套工具。
4
+ 为方便 Node.js 开发者调试和接入腾讯云产品 API,这里向您介绍适用于 Node.js 的腾讯云开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取腾讯云 Node.js SDK 并开始调用。
5
5
 
6
6
  # 依赖环境
7
7
 
8
- 1. NODEJS 10.0.0 版本及以上
9
- 2. 从腾讯云控制台 开通相应产品
10
- 3. 获取 SecretID、SecretKey 以及调用地址(endpoint),endpoint 一般形式为\*.tencentcloudapi.com,如 CVM 的调用地址为 cvm.tencentcloudapi.com,具体参考各产品说明。
8
+ 1. Node.js 10.0.0 版本及以上。
9
+ 2. 注意:部分产品需在 [腾讯云控制台](https://console.cloud.tencent.com/) 开通服务后才能使用。
11
10
 
12
11
  # 获取安装
13
12
 
14
- 安装 NODEJS SDK 前,先获取安全凭证。在第一次使用云 API 之前,用户首先需要在腾讯云控制台上申请安全凭证,安全凭证包括 SecretID SecretKey, SecretID 是用于标识 API 调用者的身份,SecretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥。SecretKey 必须严格保管,避免泄露。
13
+ 使用 SDK 需要 API 密钥,可前往 [腾讯云控制台 - 访问密钥](https://console.cloud.tencent.com/cam/capi) 页面申请,API 密钥包括 SecretID SecretKey,密钥须严格保管,避免泄露。
15
14
 
16
- ## 通过 Npm 安装
15
+ ## 通过 npm 安装
17
16
 
18
- 通过 npm 获取安装是使用 NODEJS SDK 的推荐方法,npm 是 NODEJS 的包管理工具。关于 npm 详细可参考[ npm 官网](https://www.npmjs.com/) 。
17
+ 通过 npm 获取安装是使用 Node.js SDK 的推荐方法,关于 npm 详细可参考 [NPM 官网](https://www.npmjs.com/) 。
19
18
 
20
- 1. 执行以下安装命令:
21
- > npm install tencentcloud-sdk-nodejs --save
22
- 2. 在您的代码中引用对应模块代码,可参考示例。
23
- 3. 如上引用方式会将腾讯云所有产品sdk下载到本地,可以将tencentcloud-sdk-nodejs换成tencentcloud-sdk-nodejs-cvm/cbs/vpc等,即可引用特定产品的sdk,代码中可将require("tencentcloud-sdk-nodejs")改为require("tencentcloud-sdk-nodejs-cvm/cbs/vpc"),其余不变,可参考示例,可大大节省存储空间。
19
+ ### 安装指定产品 SDK(推荐)
20
+
21
+ 安装 CVM SDK:
22
+
23
+ ```
24
+ npm install tencentcloud-sdk-nodejs-cvm --save
25
+ ```
26
+
27
+ 安装 VPC SDK:
28
+
29
+ ```
30
+ npm install tencentcloud-sdk-nodejs-vpc --save
31
+ ```
32
+
33
+ 具体产品的缩写表请参考 [products.md](./products.md) 中的包名字段。
34
+
35
+ 安装指定产品 SDK 后,注意修改引入的包名:
36
+
37
+ ```diff
38
+ - const tencentcloud = require("tencentcloud-sdk-nodejs")
39
+ + const { cvm } = require("tencentcloud-sdk-nodejs-cvm")
40
+
41
+ - const CvmClient = tencentcloud.cvm.v20170312.Client
42
+ + const CvmClient = cvm.v20170312.Client
43
+ ```
44
+
45
+ ### 安装全产品 SDK
46
+
47
+ 如果项目依赖的云产品较多,可以引入全产品 SDK。
48
+
49
+ ```
50
+ npm install tencentcloud-sdk-nodejs --save
51
+ ```
52
+
53
+ 全产品 SDK 包含所有云产品调用代码和 TypeScript 类型文件,体积偏大。对于体积敏感的场景,推荐安装指定产品 SDK。
54
+
55
+ 如果既希望全产品调用,又对包体积比较敏感,可以使用 Slim 版本 SDK。Slim SDK 移除类型文件,并进行了代码压缩,适合体积敏感场景使用:
56
+
57
+ ```
58
+ npm install tencentcloud-sdk-slim-nodejs --save
59
+ ```
24
60
 
25
61
  ## 通过源码包安装
26
62
 
27
- 1. 前往 [Github 仓库](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) 或者 [Gitee 仓库](https://gitee.com/tencentcloud/tencentcloud-sdk-nodejs) 下载源码压缩包。
28
- 2. 解压源码包到您项目合适的位置,例如 `sdk/tencentcloud-sdk-nodejs`。
29
- 3. 执行 `npm install ./sdk/tencentcloud-sdk-nodejs`。
30
- 4. 使用 `require("tencentcloud-sdk-nodejs")` 的方式引入sdk,具体可参考示例。
63
+ 1. clone 代码到本地:
64
+ ```
65
+ git clone https://github.com/tencentcloud/tencentcloud-sdk-nodejs
66
+ # 或者
67
+ git clone https://gitee.com/tencentcloud/tencentcloud-sdk-nodejs
68
+ ```
69
+ 2. 在项目根目录执行以下命令完成构建:
70
+ ```
71
+ npm install && npm run build
72
+ ```
73
+ 3. 打包 NPM 压缩文件,例如 `tencentcloud-sdk-nodejs-4.0.0.tgz`
74
+ ```
75
+ npm pack
76
+ ```
77
+ 4. 安装包到你的项目里:
78
+ ```
79
+ npm install /path/to/tencentcloud-sdk-nodejs/tencentcloud-sdk-nodejs-4.0.0.tgz
80
+ ```
31
81
 
32
82
  # 示例
33
83
 
84
+ 以云服务器产品查询可用区列表接口为例。
85
+
34
86
  ```js
35
87
  const tencentcloud = require("tencentcloud-sdk-nodejs")
36
88
 
@@ -73,7 +125,7 @@ client.DescribeZones().then(
73
125
  )
74
126
  ```
75
127
 
76
- 在支持 typescript 项目中,采用如下方式调用
128
+ 在支持 TypeScript 项目中,采用如下方式调用
77
129
 
78
130
  ```js
79
131
  import * as tencentcloud from "tencentcloud-sdk-nodejs"
@@ -83,23 +135,31 @@ const CvmClient = tencentcloud.cvm.v20170312.Client
83
135
  // ...
84
136
  ```
85
137
 
86
- 实例化`Client` 的入参支持 `clientConfig` 数据结构和说明 详见 [ClientConfig](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/src/common/interface.ts)
138
+ 实例化 `Client` 的入参支持 `clientConfig`,数据结构和说明详见 [ClientConfig](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/src/common/interface.ts)
139
+
140
+ ## Common Client
141
+
142
+ 从 4.0.714 版本开始,腾讯云 Node.js SDK 支持使用泛用性的 API 调用方式(Common Client)进行请求。您只需要安装 tencentcloud-sdk-nodejs-common 包,即可向任何产品发起调用。
143
+
144
+ **注意,您必须明确知道您调用的接口所需参数,否则可能会调用失败。**
145
+
146
+ 详细使用请参阅示例:[使用 Common Client 进行调用](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/tree/master/examples/common)
87
147
 
88
148
  ## 更多示例
89
149
 
90
- 更丰富的使用 demo 请在 examples 目录中寻找。
150
+ 请参考 [examples](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/tree/master/examples) 目录。
91
151
 
92
152
  # 相关配置
93
153
 
94
154
  ## 代理
95
155
 
96
- 如果是有代理的环境下,需要配置代理,请在创建Client时传入 [profile.httpProfile.proxy](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/src/common/interface.ts#L78) 参数,或设置系统环境变量 `http_proxy` ,否则可能无法正常调用,抛出连接超时的异常。
156
+ 如果是有代理的环境下,需要配置代理,请在创建 Client 时传入 [profile.httpProfile.proxy](https://github.com/TencentCloud/tencentcloud-sdk-nodejs/blob/master/src/common/interface.ts#L78) 参数,或设置系统环境变量 `http_proxy` ,否则可能无法正常调用,抛出连接超时的异常。
97
157
 
98
158
  # 凭证管理
99
159
 
100
160
  除显式传入凭证外,从 `v4.0.506` 起支持 [腾讯云实例角色](https://cloud.tencent.com/document/product/213/47668)
101
161
 
102
- 在您为实例绑定角色后,您可以在实例中访问相关元数据接口获取临时凭证。用法可参考 [js示例代码](./examples/cvm_role.js) 或 [ts示例代码](./examples/cvm_role.ts)
162
+ 在您为实例绑定角色后,您可以在实例中访问相关元数据接口获取临时凭证。用法可参考 [js 示例代码](./examples/cvm_role.js) 或 [ts 示例代码](./examples/cvm_role.ts)
103
163
  ```javascript
104
164
  // ...
105
165
  const CvmRoleCredential = require("tencentcloud-sdk-nodejs/tencentcloud/common/cvm_role_credential").default
@@ -111,20 +171,16 @@ new XxxClient({
111
171
  })
112
172
  ```
113
173
 
114
- # 旧版 SDK
115
-
116
- 我们推荐使用新版 NODEJS SDK,如果一定要用旧版 SDK,请前往[github 仓库](https://github.com/CFETeam/qcloudapi-sdk)下载。
117
-
118
174
  # 常见问题
119
- - webpack打包出错/浏览器报错
175
+ - webpack 打包出错/浏览器报错
120
176
 
121
- 请**务必不要**将此sdk直接用于web前端(包括小程序等),暴露密钥在这些环境非常不安全。
177
+ 请**务必不要**将此 SDK 直接用于 Web 前端(包括小程序等),暴露密钥在这些环境非常不安全。
122
178
 
123
- 正确的做法是在自己的服务端引用此sdk,并保存好密钥,做好请求鉴权;前端再调用服务端执行业务流程。
179
+ 正确的做法是在自己的服务端引用此 SDK,并保存好密钥,做好请求鉴权,前端再调用服务端执行业务流程。
124
180
 
125
181
  - `The "original" argument must be of type Function.`
126
182
 
127
- 通常是因为nodejs版本低于 `v10` ,或处于非node环境,请再次确认执行环境。
183
+ 通常是因为 Node.js 版本低于 `v10` ,或处于非 Node.js 环境,请再次确认执行环境。
128
184
 
129
185
  - 请求不通
130
186
 
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./services";
@@ -0,0 +1,6 @@
1
+ import { v20201210 } from "./v20201210";
2
+ import { v20210408 } from "./v20210408";
3
+ export const cii = {
4
+ v20201210: v20201210,
5
+ v20210408: v20210408,
6
+ };
@@ -0,0 +1,15 @@
1
+ import * as TencentCloudCommon from "tencentcloud-sdk-nodejs-common";
2
+ export class Client extends TencentCloudCommon.AbstractClient {
3
+ constructor(clientConfig) {
4
+ super("cii.tencentcloudapi.com", "2020-12-10", clientConfig);
5
+ }
6
+ async DescribeStructCompareData(req, cb) {
7
+ return this.request("DescribeStructCompareData", req, cb);
8
+ }
9
+ async DescribeStructureTaskResult(req, cb) {
10
+ return this.request("DescribeStructureTaskResult", req, cb);
11
+ }
12
+ async CreateStructureTask(req, cb) {
13
+ return this.request("CreateStructureTask", req, cb);
14
+ }
15
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ import * as Models from "./cii_models";
2
+ import { Client } from "./cii_client";
3
+ export const v20201210 = {
4
+ Client: Client,
5
+ Models: Models,
6
+ };
@@ -0,0 +1,51 @@
1
+ import * as TencentCloudCommon from "tencentcloud-sdk-nodejs-common";
2
+ export class Client extends TencentCloudCommon.AbstractClient {
3
+ constructor(clientConfig) {
4
+ super("cii.tencentcloudapi.com", "2021-04-08", clientConfig);
5
+ }
6
+ async DescribeStructureDifference(req, cb) {
7
+ return this.request("DescribeStructureDifference", req, cb);
8
+ }
9
+ async DescribeStructureTaskResult(req, cb) {
10
+ return this.request("DescribeStructureTaskResult", req, cb);
11
+ }
12
+ async UploadMedicalFile(req, cb) {
13
+ let options = {
14
+ multipart: true,
15
+ };
16
+ return this.request("UploadMedicalFile", req, cb);
17
+ }
18
+ async CreateUnderwriteTaskById(req, cb) {
19
+ return this.request("CreateUnderwriteTaskById", req, cb);
20
+ }
21
+ async DescribeUnderwriteTask(req, cb) {
22
+ return this.request("DescribeUnderwriteTask", req, cb);
23
+ }
24
+ async DescribeMachineUnderwrite(req, cb) {
25
+ return this.request("DescribeMachineUnderwrite", req, cb);
26
+ }
27
+ async CreateStructureTask(req, cb) {
28
+ return this.request("CreateStructureTask", req, cb);
29
+ }
30
+ async CreateAutoClassifyStructureTask(req, cb) {
31
+ return this.request("CreateAutoClassifyStructureTask", req, cb);
32
+ }
33
+ async DescribeStructCompareData(req, cb) {
34
+ return this.request("DescribeStructCompareData", req, cb);
35
+ }
36
+ async DescribeQualityScore(req, cb) {
37
+ let options = {
38
+ multipart: true,
39
+ };
40
+ return this.request("DescribeQualityScore", req, cb);
41
+ }
42
+ async DescribeStructureResult(req, cb) {
43
+ return this.request("DescribeStructureResult", req, cb);
44
+ }
45
+ async DescribeReportClassify(req, cb) {
46
+ return this.request("DescribeReportClassify", req, cb);
47
+ }
48
+ async AddSubStructureTasks(req, cb) {
49
+ return this.request("AddSubStructureTasks", req, cb);
50
+ }
51
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ import * as Models from "./cii_models";
2
+ import { Client } from "./cii_client";
3
+ export const v20210408 = {
4
+ Client: Client,
5
+ Models: Models,
6
+ };
@@ -0,0 +1 @@
1
+ export { cii } from "./cii";
package/package.json CHANGED
@@ -1,16 +1,26 @@
1
1
  {
2
2
  "name": "tencentcloud-sdk-nodejs-cii",
3
- "version": "4.0.810",
4
- "description": "Tencent Cloud API NODEJS SDK",
5
- "main": "tencentcloud/index.js",
3
+ "version": "4.1.24",
4
+ "description": "腾讯云 API NODEJS SDK",
5
+ "main": "./tencentcloud/index.js",
6
+ "module": "./es/index.js",
7
+ "types": "./tencentcloud/index.d.ts",
6
8
  "scripts": {
7
9
  "test": "mocha -t 10000",
8
- "build": "tsc",
9
- "prettier": "prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"
10
+ "build": "concurrently 'npm:build:cjs' 'npm:build:es'",
11
+ "build:cjs": "tsc -p tsconfig.json",
12
+ "build:es": "tsc -p tsconfig.es.json",
13
+ "build:slim": "node ./scripts/build_slim.js",
14
+ "prettier": "prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'",
15
+ "clean": "rimraf tencentcloud es"
10
16
  },
11
17
  "engines": {
12
18
  "node": ">=10"
13
19
  },
20
+ "files": [
21
+ "tencentcloud",
22
+ "es"
23
+ ],
14
24
  "keywords": [
15
25
  "tencentcloudapi",
16
26
  "tencentcloud",
@@ -22,7 +32,8 @@
22
32
  "author": "tencentcloudapi",
23
33
  "license": "Apache-2.0",
24
34
  "dependencies": {
25
- "tencentcloud-sdk-nodejs-common": "^4.0.488"
35
+ "tencentcloud-sdk-nodejs-common": "*",
36
+ "tslib": "1.13.0"
26
37
  },
27
38
  "directories": {
28
39
  "example": "examples",
@@ -34,14 +45,22 @@
34
45
  },
35
46
  "devDependencies": {
36
47
  "@types/form-data": "^2.5.0",
48
+ "@types/json-bigint": "^1.0.1",
37
49
  "@types/node": "^14.0.26",
38
50
  "@types/node-fetch": "^2.5.7",
51
+ "@types/uuid": "^9.0.8",
39
52
  "@typescript-eslint/eslint-plugin": "^2.34.0",
40
53
  "@typescript-eslint/parser": "^2.34.0",
54
+ "babel-eslint": "^10.0.2",
41
55
  "chai": "^4.2.0",
56
+ "concurrently": "^6.5.1",
57
+ "esbuild": "^0.25.0",
42
58
  "eslint": "^6.8.0",
43
- "mocha": "^8.1.1",
59
+ "eslint-plugin-react": "^7.17.0",
60
+ "mocha": "^8.4.0",
61
+ "prettier": "^2.3.0",
62
+ "rimraf": "^5.0.10",
44
63
  "ts-node": "^8.10.2",
45
64
  "typescript": "^3.9.7"
46
65
  }
47
- }
66
+ }
@@ -1,10 +1,10 @@
1
1
  export declare const cii: {
2
- v20210408: {
3
- Client: typeof import("./v20210408/cii_client").Client;
4
- Models: typeof import("./v20210408/cii_models");
5
- };
6
2
  v20201210: {
7
3
  Client: typeof import("./v20201210/cii_client").Client;
8
4
  Models: typeof import("./v20201210/cii_models");
9
5
  };
6
+ v20210408: {
7
+ Client: typeof import("./v20210408/cii_client").Client;
8
+ Models: typeof import("./v20210408/cii_models");
9
+ };
10
10
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cii = void 0;
4
- const v20210408_1 = require("./v20210408");
5
4
  const v20201210_1 = require("./v20201210");
5
+ const v20210408_1 = require("./v20210408");
6
6
  exports.cii = {
7
- v20210408: v20210408_1.v20210408,
8
7
  v20201210: v20201210_1.v20201210,
8
+ v20210408: v20210408_1.v20210408,
9
9
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Client = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  /* eslint-disable @typescript-eslint/no-unused-vars */
5
6
  /*
6
7
  * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
@@ -18,7 +19,7 @@ exports.Client = void 0;
18
19
  * specific language governing permissions and limitations
19
20
  * under the License.
20
21
  */
21
- const TencentCloudCommon = require("tencentcloud-sdk-nodejs-common");
22
+ const TencentCloudCommon = tslib_1.__importStar(require("tencentcloud-sdk-nodejs-common"));
22
23
  /**
23
24
  * cii client
24
25
  * @class
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.v20201210 = void 0;
4
- const Models = require("./cii_models");
4
+ const tslib_1 = require("tslib");
5
+ const Models = tslib_1.__importStar(require("./cii_models"));
5
6
  const cii_client_1 = require("./cii_client");
6
7
  exports.v20201210 = {
7
8
  Client: cii_client_1.Client,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Client = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  /* eslint-disable @typescript-eslint/no-unused-vars */
5
6
  /*
6
7
  * Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
@@ -18,7 +19,7 @@ exports.Client = void 0;
18
19
  * specific language governing permissions and limitations
19
20
  * under the License.
20
21
  */
21
- const TencentCloudCommon = require("tencentcloud-sdk-nodejs-common");
22
+ const TencentCloudCommon = tslib_1.__importStar(require("tencentcloud-sdk-nodejs-common"));
22
23
  /**
23
24
  * cii client
24
25
  * @class
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.v20210408 = void 0;
4
- const Models = require("./cii_models");
4
+ const tslib_1 = require("tslib");
5
+ const Models = tslib_1.__importStar(require("./cii_models"));
5
6
  const cii_client_1 = require("./cii_client");
6
7
  exports.v20210408 = {
7
8
  Client: cii_client_1.Client,
package/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import * as tencentcloud from './tencentcloud';
2
- export default tencentcloud;
package/index.js DELETED
@@ -1,6 +0,0 @@
1
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', { value: true })
3
- const tslib_1 = require('tslib')
4
- const tencentcloud = tslib_1.__importStar(require('./tencentcloud'))
5
- exports.default = tencentcloud
6
- //# sourceMappingURL=index.js.map
@@ -1,38 +0,0 @@
1
- // prettier.config.js
2
- module.exports = {
3
- // 一行最多 100 字符
4
- printWidth: 100,
5
- // 使用 4 个空格缩进
6
- tabWidth: 2,
7
- // 不使用缩进符,而使用空格
8
- useTabs: false,
9
- // 行尾需要有分号
10
- semi: false,
11
- // 使用单引号
12
- singleQuote: false,
13
- // 对象的 key 仅在必要时用引号
14
- quoteProps: "as-needed",
15
- // jsx 不使用单引号,而使用双引号
16
- jsxSingleQuote: false,
17
- // 末尾不需要逗号
18
- trailingComma: "es5",
19
- // 大括号内的首尾需要空格
20
- bracketSpacing: true,
21
- // jsx 标签的反尖括号需要换行
22
- jsxBracketSameLine: false,
23
- // 箭头函数,只有一个参数的时候,也需要括号
24
- arrowParens: "always",
25
- // 每个文件格式化的范围是文件的全部内容
26
- rangeStart: 0,
27
- rangeEnd: Infinity,
28
- // 不需要写文件开头的 @prettier
29
- requirePragma: false,
30
- // 不需要自动在文件开头插入 @prettier
31
- insertPragma: false,
32
- // 使用默认的折行标准
33
- proseWrap: "preserve",
34
- // 根据显示样式决定 html 要不要折行
35
- htmlWhitespaceSensitivity: "css",
36
- // 换行符使用 lf
37
- endOfLine: "lf",
38
- }