tencentcloud-sdk-nodejs-mqtt 4.0.991 → 4.0.1027
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 +41 -12
- package/package.json +1 -1
- package/src/services/mqtt/v20240516/mqtt_client.ts +196 -56
- package/src/services/mqtt/v20240516/mqtt_models.ts +1222 -706
- package/tencentcloud/services/mqtt/v20240516/mqtt_client.d.ts +56 -10
- package/tencentcloud/services/mqtt/v20240516/mqtt_client.js +79 -11
- package/tencentcloud/services/mqtt/v20240516/mqtt_models.d.ts +1113 -625
- package/products.md +0 -261
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 简介
|
|
2
2
|
|
|
3
|
-
欢迎使用腾讯云开发者工具套件(SDK),NODEJS SDK 4.0 是云 API 3.0
|
|
3
|
+
欢迎使用腾讯云开发者工具套件(SDK),NODEJS SDK 4.0 是云 API 3.0 平台的配套工具。
|
|
4
4
|
为方便 NODEJS 开发者调试和接入腾讯云产品 API,这里向您介绍适用于 NODEJS 的腾讯云开发工具包,并提供首次使用开发工具包的简单示例。让您快速获取腾讯云 NODEJS SDK 并开始调用。
|
|
5
5
|
|
|
6
6
|
# 依赖环境
|
|
@@ -13,21 +13,50 @@
|
|
|
13
13
|
|
|
14
14
|
安装 NODEJS SDK 前,先获取安全凭证。在第一次使用云 API 之前,用户首先需要在腾讯云控制台上申请安全凭证,安全凭证包括 SecretID 和 SecretKey, SecretID 是用于标识 API 调用者的身份,SecretKey 是用于加密签名字符串和服务器端验证签名字符串的密钥。SecretKey 必须严格保管,避免泄露。
|
|
15
15
|
|
|
16
|
-
## 通过
|
|
16
|
+
## 通过 NPM 安装
|
|
17
17
|
|
|
18
|
-
通过
|
|
18
|
+
通过 NPM 获取安装是使用 NODEJS SDK 的推荐方法,NPM 是 NODEJS 的包管理工具。关于 NPM 详细可参考 [NPM 官网](https://www.npmjs.com/) 。
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
### 安装指定产品 SDK(推荐)
|
|
21
|
+
|
|
22
|
+
安装 CVM SDK:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install tencentcloud-sdk-nodejs-cvm --save
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
安装 VPC SDK:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
npm install tencentcloud-sdk-nodejs-vpc --save
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
具体产品的缩写表请参考 [products.md](./products.md) 中的包名字段。
|
|
35
|
+
|
|
36
|
+
安装指定产品 SDK 后,注意修改引入的包名:
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
- const tencentcloud = require("tencentcloud-sdk-nodejs")
|
|
40
|
+
+ const { cvm } = require("tencentcloud-sdk-nodejs-cvm")
|
|
41
|
+
|
|
42
|
+
- const CvmClient = tencentcloud.cvm.v20170312.Client
|
|
43
|
+
+ const CvmClient = cvm.v20170312.Client
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 安装全产品 SDK
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm install tencentcloud-sdk-nodejs --save
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
全产品 SDK 包含了所有云产品的调用代码,体积偏大,对体积敏感的场景,推荐安装指定产品 SDK。
|
|
24
53
|
|
|
25
54
|
## 通过源码包安装
|
|
26
55
|
|
|
27
|
-
1. 前往 [
|
|
56
|
+
1. 前往 [GitHub 仓库](https://github.com/tencentcloud/tencentcloud-sdk-nodejs) 或者 [Gitee 仓库](https://gitee.com/tencentcloud/tencentcloud-sdk-nodejs) 下载源码压缩包。
|
|
28
57
|
2. 解压源码包到您项目合适的位置,例如 `sdk/tencentcloud-sdk-nodejs`。
|
|
29
58
|
3. 执行 `npm install ./sdk/tencentcloud-sdk-nodejs`。
|
|
30
|
-
4. 使用 `require("tencentcloud-sdk-nodejs")` 的方式引入
|
|
59
|
+
4. 使用 `require("tencentcloud-sdk-nodejs")` 的方式引入SDK,具体可参考示例。
|
|
31
60
|
|
|
32
61
|
# 示例
|
|
33
62
|
|
|
@@ -120,14 +149,14 @@ new XxxClient({
|
|
|
120
149
|
|
|
121
150
|
# 旧版 SDK
|
|
122
151
|
|
|
123
|
-
我们推荐使用新版 NODEJS SDK,如果一定要用旧版 SDK,请前往[
|
|
152
|
+
我们推荐使用新版 NODEJS SDK,如果一定要用旧版 SDK,请前往[GitHub 仓库](https://github.com/CFETeam/qcloudapi-sdk)下载。
|
|
124
153
|
|
|
125
154
|
# 常见问题
|
|
126
155
|
- webpack打包出错/浏览器报错
|
|
127
156
|
|
|
128
|
-
请**务必不要**将此
|
|
157
|
+
请**务必不要**将此SDK直接用于web前端(包括小程序等),暴露密钥在这些环境非常不安全。
|
|
129
158
|
|
|
130
|
-
正确的做法是在自己的服务端引用此
|
|
159
|
+
正确的做法是在自己的服务端引用此SDK,并保存好密钥,做好请求鉴权;前端再调用服务端执行业务流程。
|
|
131
160
|
|
|
132
161
|
- `The "original" argument must be of type Function.`
|
|
133
162
|
|
package/package.json
CHANGED
|
@@ -17,64 +17,92 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as TencentCloudCommon from "tencentcloud-sdk-nodejs-common"
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
DeleteUserRequest,
|
|
21
|
+
ModifyJWTAuthenticatorResponse,
|
|
21
22
|
UpdateAuthorizationPolicyPriorityRequest,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
ActivateDeviceCertificateRequest,
|
|
24
|
+
CreateInstanceResponse,
|
|
25
|
+
DescribeAuthenticatorRequest,
|
|
26
|
+
ModifyJWTAuthenticatorRequest,
|
|
27
|
+
AuthorizationPolicyPriority,
|
|
28
|
+
ModifyInstanceRequest,
|
|
29
|
+
DeleteTopicRequest,
|
|
30
|
+
ModifyUserResponse,
|
|
31
|
+
DescribeDeviceCertificatesRequest,
|
|
32
|
+
DeleteAuthenticatorRequest,
|
|
33
|
+
PublicAccessRule,
|
|
34
|
+
VpcInfo,
|
|
35
|
+
DeleteAuthorizationPolicyResponse,
|
|
36
|
+
ModifyJWKSAuthenticatorRequest,
|
|
37
|
+
DeleteInstanceResponse,
|
|
27
38
|
RegisterDeviceCertificateResponse,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
MQTTAuthenticatorItem,
|
|
40
|
+
Tag,
|
|
41
|
+
DescribeDeviceCertificateRequest,
|
|
42
|
+
MQTTInstanceItem,
|
|
43
|
+
DescribeInstanceListResponse,
|
|
44
|
+
ModifyInstanceResponse,
|
|
45
|
+
ModifyInsPublicEndpointResponse,
|
|
46
|
+
ModifyJWKSAuthenticatorResponse,
|
|
47
|
+
CreateInsPublicEndpointResponse,
|
|
48
|
+
CreateUserResponse,
|
|
33
49
|
CreateAuthorizationPolicyRequest,
|
|
34
|
-
ActivateDeviceCertificateRequest,
|
|
35
|
-
DescribeInstanceResponse,
|
|
36
50
|
DescribeAuthenticatorResponse,
|
|
37
51
|
DeleteDeviceCertificateRequest,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
DescribeDeviceCertificateResponse,
|
|
41
|
-
RevokedDeviceCertificateRequest,
|
|
42
|
-
AuthorizationPolicyPriority,
|
|
43
|
-
CreateAuthorizationPolicyResponse,
|
|
52
|
+
DescribeInsPublicEndpointsRequest,
|
|
53
|
+
DeleteUserResponse,
|
|
44
54
|
DeleteDeviceCertificateResponse,
|
|
45
|
-
|
|
46
|
-
DeleteTopicRequest,
|
|
55
|
+
ModifyAuthorizationPolicyResponse,
|
|
47
56
|
CreateJWKSAuthenticatorRequest,
|
|
48
|
-
ModifyTopicResponse,
|
|
49
57
|
DescribeTopicResponse,
|
|
50
|
-
DescribeDeviceCertificatesRequest,
|
|
51
58
|
CreateJWKSAuthenticatorResponse,
|
|
52
|
-
DeleteAuthenticatorRequest,
|
|
53
59
|
DescribeAuthorizationPoliciesResponse,
|
|
54
|
-
RegisterDeviceCertificateRequest,
|
|
55
60
|
CreateTopicRequest,
|
|
56
|
-
|
|
61
|
+
TagFilter,
|
|
62
|
+
DescribeUserListResponse,
|
|
63
|
+
ModifyTopicResponse,
|
|
64
|
+
DeactivateDeviceCertificateResponse,
|
|
65
|
+
MQTTUserItem,
|
|
66
|
+
ActivateDeviceCertificateResponse,
|
|
67
|
+
DescribeTopicRequest,
|
|
68
|
+
UpdateAuthorizationPolicyPriorityResponse,
|
|
69
|
+
CreateTopicResponse,
|
|
70
|
+
DeleteInsPublicEndpointResponse,
|
|
71
|
+
MQTTEndpointItem,
|
|
72
|
+
DescribeTopicListRequest,
|
|
73
|
+
AuthorizationPolicyItem,
|
|
74
|
+
RevokedDeviceCertificateRequest,
|
|
75
|
+
CreateAuthorizationPolicyResponse,
|
|
76
|
+
CreateInstanceRequest,
|
|
77
|
+
CreateInsPublicEndpointRequest,
|
|
78
|
+
RegisterDeviceCertificateRequest,
|
|
57
79
|
Filter,
|
|
58
|
-
|
|
80
|
+
DeactivateDeviceCertificateRequest,
|
|
59
81
|
DescribeDeviceCertificatesResponse,
|
|
60
|
-
ModifyJWKSAuthenticatorRequest,
|
|
61
82
|
ModifyTopicRequest,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
CreateUserRequest,
|
|
84
|
+
DescribeInstanceResponse,
|
|
85
|
+
DeleteInstanceRequest,
|
|
86
|
+
DescribeInsPublicEndpointsResponse,
|
|
87
|
+
ModifyInsPublicEndpointRequest,
|
|
88
|
+
DeleteInsPublicEndpointRequest,
|
|
89
|
+
DescribeUserListRequest,
|
|
90
|
+
CreateJWTAuthenticatorResponse,
|
|
91
|
+
DeleteAuthorizationPolicyRequest,
|
|
92
|
+
DescribeAuthorizationPoliciesRequest,
|
|
65
93
|
RevokedDeviceCertificateResponse,
|
|
94
|
+
DescribeDeviceCertificateResponse,
|
|
95
|
+
DescribeInstanceListRequest,
|
|
96
|
+
CreateJWTAuthenticatorRequest,
|
|
97
|
+
DeviceCertificateItem,
|
|
98
|
+
MQTTTopicItem,
|
|
99
|
+
ModifyAuthorizationPolicyRequest,
|
|
100
|
+
DescribeTopicListResponse,
|
|
66
101
|
DeleteTopicResponse,
|
|
67
|
-
DeactivateDeviceCertificateResponse,
|
|
68
|
-
DescribeDeviceCertificateRequest,
|
|
69
|
-
DeactivateDeviceCertificateRequest,
|
|
70
102
|
DescribeInstanceRequest,
|
|
71
|
-
|
|
103
|
+
ModifyUserRequest,
|
|
72
104
|
DeleteAuthenticatorResponse,
|
|
73
|
-
|
|
74
|
-
ModifyAuthorizationPolicyRequest,
|
|
75
|
-
ActivateDeviceCertificateResponse,
|
|
76
|
-
DescribeInstanceListResponse,
|
|
77
|
-
DescribeTopicRequest,
|
|
105
|
+
IpRule,
|
|
78
106
|
} from "./mqtt_models"
|
|
79
107
|
|
|
80
108
|
/**
|
|
@@ -86,6 +114,26 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
86
114
|
super("mqtt.tencentcloudapi.com", "2024-05-16", clientConfig)
|
|
87
115
|
}
|
|
88
116
|
|
|
117
|
+
/**
|
|
118
|
+
* 购买新的MQTT实例
|
|
119
|
+
*/
|
|
120
|
+
async CreateInstance(
|
|
121
|
+
req: CreateInstanceRequest,
|
|
122
|
+
cb?: (error: string, rep: CreateInstanceResponse) => void
|
|
123
|
+
): Promise<CreateInstanceResponse> {
|
|
124
|
+
return this.request("CreateInstance", req, cb)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 为MQTT实例创建公网接入点
|
|
129
|
+
*/
|
|
130
|
+
async CreateInsPublicEndpoint(
|
|
131
|
+
req: CreateInsPublicEndpointRequest,
|
|
132
|
+
cb?: (error: string, rep: CreateInsPublicEndpointResponse) => void
|
|
133
|
+
): Promise<CreateInsPublicEndpointResponse> {
|
|
134
|
+
return this.request("CreateInsPublicEndpoint", req, cb)
|
|
135
|
+
}
|
|
136
|
+
|
|
89
137
|
/**
|
|
90
138
|
* 修改主题属性
|
|
91
139
|
*/
|
|
@@ -136,6 +184,16 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
136
184
|
return this.request("DeleteDeviceCertificate", req, cb)
|
|
137
185
|
}
|
|
138
186
|
|
|
187
|
+
/**
|
|
188
|
+
* 删除MQTT实例
|
|
189
|
+
*/
|
|
190
|
+
async DeleteInstance(
|
|
191
|
+
req: DeleteInstanceRequest,
|
|
192
|
+
cb?: (error: string, rep: DeleteInstanceResponse) => void
|
|
193
|
+
): Promise<DeleteInstanceResponse> {
|
|
194
|
+
return this.request("DeleteInstance", req, cb)
|
|
195
|
+
}
|
|
196
|
+
|
|
139
197
|
/**
|
|
140
198
|
* 修改MQTT JWKS 认证器
|
|
141
199
|
*/
|
|
@@ -166,6 +224,38 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
166
224
|
return this.request("DescribeDeviceCertificates", req, cb)
|
|
167
225
|
}
|
|
168
226
|
|
|
227
|
+
/**
|
|
228
|
+
* 查询MQTT实例公网接入点
|
|
229
|
+
*/
|
|
230
|
+
async DescribeInsPublicEndpoints(
|
|
231
|
+
req: DescribeInsPublicEndpointsRequest,
|
|
232
|
+
cb?: (error: string, rep: DescribeInsPublicEndpointsResponse) => void
|
|
233
|
+
): Promise<DescribeInsPublicEndpointsResponse> {
|
|
234
|
+
return this.request("DescribeInsPublicEndpoints", req, cb)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* 查询用户列表,Filter参数使用说明如下:
|
|
239
|
+
|
|
240
|
+
1. Username,用户名称模糊搜索
|
|
241
|
+
*/
|
|
242
|
+
async DescribeUserList(
|
|
243
|
+
req: DescribeUserListRequest,
|
|
244
|
+
cb?: (error: string, rep: DescribeUserListResponse) => void
|
|
245
|
+
): Promise<DescribeUserListResponse> {
|
|
246
|
+
return this.request("DescribeUserList", req, cb)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 更新MQTT实例公网接入点
|
|
251
|
+
*/
|
|
252
|
+
async ModifyInsPublicEndpoint(
|
|
253
|
+
req: ModifyInsPublicEndpointRequest,
|
|
254
|
+
cb?: (error: string, rep: ModifyInsPublicEndpointResponse) => void
|
|
255
|
+
): Promise<ModifyInsPublicEndpointResponse> {
|
|
256
|
+
return this.request("ModifyInsPublicEndpoint", req, cb)
|
|
257
|
+
}
|
|
258
|
+
|
|
169
259
|
/**
|
|
170
260
|
* 注册设备证书
|
|
171
261
|
*/
|
|
@@ -206,6 +296,16 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
206
296
|
return this.request("DescribeAuthorizationPolicies", req, cb)
|
|
207
297
|
}
|
|
208
298
|
|
|
299
|
+
/**
|
|
300
|
+
* 删除MQTT实例的公网接入点
|
|
301
|
+
*/
|
|
302
|
+
async DeleteInsPublicEndpoint(
|
|
303
|
+
req: DeleteInsPublicEndpointRequest,
|
|
304
|
+
cb?: (error: string, rep: DeleteInsPublicEndpointResponse) => void
|
|
305
|
+
): Promise<DeleteInsPublicEndpointResponse> {
|
|
306
|
+
return this.request("DeleteInsPublicEndpoint", req, cb)
|
|
307
|
+
}
|
|
308
|
+
|
|
209
309
|
/**
|
|
210
310
|
* 查询设备证书详情接口
|
|
211
311
|
*/
|
|
@@ -252,13 +352,16 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
252
352
|
}
|
|
253
353
|
|
|
254
354
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
355
|
+
* 获取主题列表,Filter参数使用说明如下:
|
|
356
|
+
|
|
357
|
+
1. TopicName,主题名称模糊搜索
|
|
358
|
+
2. TopicType,主题类型查询,支持多选,可选值:Normal,Order,Transaction,DelayScheduled
|
|
359
|
+
*/
|
|
360
|
+
async DescribeTopicList(
|
|
361
|
+
req: DescribeTopicListRequest,
|
|
362
|
+
cb?: (error: string, rep: DescribeTopicListResponse) => void
|
|
363
|
+
): Promise<DescribeTopicListResponse> {
|
|
364
|
+
return this.request("DescribeTopicList", req, cb)
|
|
262
365
|
}
|
|
263
366
|
|
|
264
367
|
/**
|
|
@@ -271,6 +374,26 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
271
374
|
return this.request("CreateJWKSAuthenticator", req, cb)
|
|
272
375
|
}
|
|
273
376
|
|
|
377
|
+
/**
|
|
378
|
+
* 修改MQTT角色
|
|
379
|
+
*/
|
|
380
|
+
async ModifyUser(
|
|
381
|
+
req: ModifyUserRequest,
|
|
382
|
+
cb?: (error: string, rep: ModifyUserResponse) => void
|
|
383
|
+
): Promise<ModifyUserResponse> {
|
|
384
|
+
return this.request("ModifyUser", req, cb)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 删除MQTT访问用户
|
|
389
|
+
*/
|
|
390
|
+
async DeleteUser(
|
|
391
|
+
req: DeleteUserRequest,
|
|
392
|
+
cb?: (error: string, rep: DeleteUserResponse) => void
|
|
393
|
+
): Promise<DeleteUserResponse> {
|
|
394
|
+
return this.request("DeleteUser", req, cb)
|
|
395
|
+
}
|
|
396
|
+
|
|
274
397
|
/**
|
|
275
398
|
* 修改策略规则
|
|
276
399
|
*/
|
|
@@ -322,16 +445,23 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
322
445
|
}
|
|
323
446
|
|
|
324
447
|
/**
|
|
325
|
-
|
|
448
|
+
* 添加mqtt角色
|
|
449
|
+
*/
|
|
450
|
+
async CreateUser(
|
|
451
|
+
req: CreateUserRequest,
|
|
452
|
+
cb?: (error: string, rep: CreateUserResponse) => void
|
|
453
|
+
): Promise<CreateUserResponse> {
|
|
454
|
+
return this.request("CreateUser", req, cb)
|
|
455
|
+
}
|
|
326
456
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
async
|
|
331
|
-
req:
|
|
332
|
-
cb?: (error: string, rep:
|
|
333
|
-
): Promise<
|
|
334
|
-
return this.request("
|
|
457
|
+
/**
|
|
458
|
+
* 删除MQTT主题
|
|
459
|
+
*/
|
|
460
|
+
async DeleteTopic(
|
|
461
|
+
req: DeleteTopicRequest,
|
|
462
|
+
cb?: (error: string, rep: DeleteTopicResponse) => void
|
|
463
|
+
): Promise<DeleteTopicResponse> {
|
|
464
|
+
return this.request("DeleteTopic", req, cb)
|
|
335
465
|
}
|
|
336
466
|
|
|
337
467
|
/**
|
|
@@ -343,4 +473,14 @@ export class Client extends TencentCloudCommon.AbstractClient {
|
|
|
343
473
|
): Promise<CreateAuthorizationPolicyResponse> {
|
|
344
474
|
return this.request("CreateAuthorizationPolicy", req, cb)
|
|
345
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* 修改实例属性
|
|
479
|
+
*/
|
|
480
|
+
async ModifyInstance(
|
|
481
|
+
req: ModifyInstanceRequest,
|
|
482
|
+
cb?: (error: string, rep: ModifyInstanceResponse) => void
|
|
483
|
+
): Promise<ModifyInstanceResponse> {
|
|
484
|
+
return this.request("ModifyInstance", req, cb)
|
|
485
|
+
}
|
|
346
486
|
}
|