@unifyport/sdk-node 0.1.0

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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/dist/core/errors.d.ts +54 -0
  4. package/dist/core/errors.d.ts.map +1 -0
  5. package/dist/core/errors.js +54 -0
  6. package/dist/core/errors.js.map +1 -0
  7. package/dist/core/pagination.d.ts +13 -0
  8. package/dist/core/pagination.d.ts.map +1 -0
  9. package/dist/core/pagination.js +65 -0
  10. package/dist/core/pagination.js.map +1 -0
  11. package/dist/core/runtime.d.ts +5 -0
  12. package/dist/core/runtime.d.ts.map +1 -0
  13. package/dist/core/runtime.js +570 -0
  14. package/dist/core/runtime.js.map +1 -0
  15. package/dist/core/types.d.ts +82 -0
  16. package/dist/core/types.d.ts.map +1 -0
  17. package/dist/core/types.js +2 -0
  18. package/dist/core/types.js.map +1 -0
  19. package/dist/device/index.d.ts +9 -0
  20. package/dist/device/index.d.ts.map +1 -0
  21. package/dist/device/index.js +6 -0
  22. package/dist/device/index.js.map +1 -0
  23. package/dist/generated/device/client.d.ts +140 -0
  24. package/dist/generated/device/client.d.ts.map +1 -0
  25. package/dist/generated/device/client.js +724 -0
  26. package/dist/generated/device/client.js.map +1 -0
  27. package/dist/generated/device/operation-catalog.d.ts +8333 -0
  28. package/dist/generated/device/operation-catalog.d.ts.map +1 -0
  29. package/dist/generated/device/operation-catalog.js +10144 -0
  30. package/dist/generated/device/operation-catalog.js.map +1 -0
  31. package/dist/generated/device/schema.d.ts +3300 -0
  32. package/dist/generated/device/schema.d.ts.map +1 -0
  33. package/dist/generated/device/schema.js +2 -0
  34. package/dist/generated/device/schema.js.map +1 -0
  35. package/dist/index.d.ts +9 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +6 -0
  38. package/dist/index.js.map +1 -0
  39. package/package.json +43 -0
@@ -0,0 +1,724 @@
1
+ /**
2
+ * 此文件由 `pnpm generate` 根据 contracts/device.openapi.yaml 生成。
3
+ * 生成边界用于保证契约、SDK 与 MCP 同步;请修改来源契约或生成器,不要手工编辑。
4
+ */
5
+ import createClient, {} from "openapi-fetch";
6
+ import { createDeviceRuntime } from "../../core/runtime.js";
7
+ import { deviceOperations } from "./operation-catalog.js";
8
+ export class UnifyPortDeviceClient {
9
+ #runtime;
10
+ #client;
11
+ constructor(config) {
12
+ this.#runtime = createDeviceRuntime(config);
13
+ // 底层 OpenAPI client 保持私有,避免绕过安全整数解析、错误归一化和 operation policy。
14
+ this.#client = createClient({
15
+ baseUrl: this.#runtime.baseUrl,
16
+ fetch: this.#runtime.rawFetch,
17
+ });
18
+ }
19
+ /** 封锁联系人 */
20
+ async blockContact(request, execution = {}) {
21
+ const operation = deviceOperations["blockContact"];
22
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/contacts/block", {
23
+ ...request,
24
+ baseUrl: this.#runtime.baseUrl,
25
+ fetch: this.#runtime.createFetch(operation, execution),
26
+ redirect: "error",
27
+ parseAs: "text",
28
+ }));
29
+ }
30
+ /** 取消授权流程 */
31
+ async cancelAccountAuth(request, execution = {}) {
32
+ const operation = deviceOperations["cancelAccountAuth"];
33
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/cancel", {
34
+ ...request,
35
+ baseUrl: this.#runtime.baseUrl,
36
+ fetch: this.#runtime.createFetch(operation, execution),
37
+ redirect: "error",
38
+ parseAs: "text",
39
+ }));
40
+ }
41
+ /** 检查二维码授权结果 */
42
+ async checkAccountQrAuth(request, execution = {}) {
43
+ const operation = deviceOperations["checkAccountQrAuth"];
44
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/qr/check", {
45
+ ...request,
46
+ baseUrl: this.#runtime.baseUrl,
47
+ fetch: this.#runtime.createFetch(operation, execution),
48
+ redirect: "error",
49
+ parseAs: "text",
50
+ }));
51
+ }
52
+ /** 创建账号 */
53
+ async createAccount(request, execution = {}) {
54
+ const operation = deviceOperations["createAccount"];
55
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts", {
56
+ ...request,
57
+ baseUrl: this.#runtime.baseUrl,
58
+ fetch: this.#runtime.createFetch(operation, execution),
59
+ redirect: "error",
60
+ parseAs: "text",
61
+ }));
62
+ }
63
+ /** 创建 API Key */
64
+ async createApiKey(request, execution = {}) {
65
+ const operation = deviceOperations["createApiKey"];
66
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/api-keys", {
67
+ ...request,
68
+ baseUrl: this.#runtime.baseUrl,
69
+ fetch: this.#runtime.createFetch(operation, execution),
70
+ redirect: "error",
71
+ parseAs: "text",
72
+ }));
73
+ }
74
+ /** 创建群组 */
75
+ async createGroup(request, execution = {}) {
76
+ const operation = deviceOperations["createGroup"];
77
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/create", {
78
+ ...request,
79
+ baseUrl: this.#runtime.baseUrl,
80
+ fetch: this.#runtime.createFetch(operation, execution),
81
+ redirect: "error",
82
+ parseAs: "text",
83
+ }));
84
+ }
85
+ /** 创建 webhook endpoint */
86
+ async createWebhookEndpoint(request, execution = {}) {
87
+ const operation = deviceOperations["createWebhookEndpoint"];
88
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/webhook-endpoints", {
89
+ ...request,
90
+ baseUrl: this.#runtime.baseUrl,
91
+ fetch: this.#runtime.createFetch(operation, execution),
92
+ redirect: "error",
93
+ parseAs: "text",
94
+ }));
95
+ }
96
+ /** 停用 webhook endpoint */
97
+ async deactivateWebhookEndpoint(request, execution = {}) {
98
+ const operation = deviceOperations["deactivateWebhookEndpoint"];
99
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/webhook-endpoints/{endpoint_id}/deactivate", {
100
+ ...request,
101
+ baseUrl: this.#runtime.baseUrl,
102
+ fetch: this.#runtime.createFetch(operation, execution),
103
+ redirect: "error",
104
+ parseAs: "text",
105
+ }));
106
+ }
107
+ /** 删除账号 */
108
+ async deleteAccount(request, execution = {}) {
109
+ const operation = deviceOperations["deleteAccount"];
110
+ return await this.#runtime.execute(operation, async () => await this.#client.DELETE("/v1/accounts/{account_id}", {
111
+ ...request,
112
+ baseUrl: this.#runtime.baseUrl,
113
+ fetch: this.#runtime.createFetch(operation, execution),
114
+ redirect: "error",
115
+ parseAs: "text",
116
+ }));
117
+ }
118
+ /** 删除会话标签 */
119
+ async deleteConversationLabel(request, execution = {}) {
120
+ const operation = deviceOperations["deleteConversationLabel"];
121
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/labels/delete", {
122
+ ...request,
123
+ baseUrl: this.#runtime.baseUrl,
124
+ fetch: this.#runtime.createFetch(operation, execution),
125
+ redirect: "error",
126
+ parseAs: "text",
127
+ }));
128
+ }
129
+ /** 删除 webhook endpoint */
130
+ async deleteWebhookEndpoint(request, execution = {}) {
131
+ const operation = deviceOperations["deleteWebhookEndpoint"];
132
+ return await this.#runtime.execute(operation, async () => await this.#client.DELETE("/v1/webhook-endpoints/{endpoint_id}", {
133
+ ...request,
134
+ baseUrl: this.#runtime.baseUrl,
135
+ fetch: this.#runtime.createFetch(operation, execution),
136
+ redirect: "error",
137
+ parseAs: "text",
138
+ }));
139
+ }
140
+ /** 编辑消息文本 */
141
+ async editMessage(request, execution = {}) {
142
+ const operation = deviceOperations["editMessage"];
143
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/messages/edit", {
144
+ ...request,
145
+ baseUrl: this.#runtime.baseUrl,
146
+ fetch: this.#runtime.createFetch(operation, execution),
147
+ redirect: "error",
148
+ parseAs: "text",
149
+ }));
150
+ }
151
+ /** 获取账号详情 */
152
+ async getAccount(request, execution = {}) {
153
+ const operation = deviceOperations["getAccount"];
154
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}", {
155
+ ...request,
156
+ baseUrl: this.#runtime.baseUrl,
157
+ fetch: this.#runtime.createFetch(operation, execution),
158
+ redirect: "error",
159
+ parseAs: "text",
160
+ }));
161
+ }
162
+ /** 获取账号授权状态 */
163
+ async getAccountAuthState(request, execution = {}) {
164
+ const operation = deviceOperations["getAccountAuthState"];
165
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/auth", {
166
+ ...request,
167
+ baseUrl: this.#runtime.baseUrl,
168
+ fetch: this.#runtime.createFetch(operation, execution),
169
+ redirect: "error",
170
+ parseAs: "text",
171
+ }));
172
+ }
173
+ /** 获取联系人详情 */
174
+ async getContact(request, execution = {}) {
175
+ const operation = deviceOperations["getContact"];
176
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/contacts/info", {
177
+ ...request,
178
+ baseUrl: this.#runtime.baseUrl,
179
+ fetch: this.#runtime.createFetch(operation, execution),
180
+ redirect: "error",
181
+ parseAs: "text",
182
+ }));
183
+ }
184
+ /** 获取会话详情 */
185
+ async getConversation(request, execution = {}) {
186
+ const operation = deviceOperations["getConversation"];
187
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/conversations/info", {
188
+ ...request,
189
+ baseUrl: this.#runtime.baseUrl,
190
+ fetch: this.#runtime.createFetch(operation, execution),
191
+ redirect: "error",
192
+ parseAs: "text",
193
+ }));
194
+ }
195
+ /** 获取群组详情 */
196
+ async getGroup(request, execution = {}) {
197
+ const operation = deviceOperations["getGroup"];
198
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/groups/info", {
199
+ ...request,
200
+ baseUrl: this.#runtime.baseUrl,
201
+ fetch: this.#runtime.createFetch(operation, execution),
202
+ redirect: "error",
203
+ parseAs: "text",
204
+ }));
205
+ }
206
+ /** 获取群邀请链接或邀请码 */
207
+ async getGroupInviteCode(request, execution = {}) {
208
+ const operation = deviceOperations["getGroupInviteCode"];
209
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/groups/invite-code", {
210
+ ...request,
211
+ baseUrl: this.#runtime.baseUrl,
212
+ fetch: this.#runtime.createFetch(operation, execution),
213
+ redirect: "error",
214
+ parseAs: "text",
215
+ }));
216
+ }
217
+ /** 获取 webhook endpoint */
218
+ async getWebhookEndpoint(request, execution = {}) {
219
+ const operation = deviceOperations["getWebhookEndpoint"];
220
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/webhook-endpoints/{endpoint_id}", {
221
+ ...request,
222
+ baseUrl: this.#runtime.baseUrl,
223
+ fetch: this.#runtime.createFetch(operation, execution),
224
+ redirect: "error",
225
+ parseAs: "text",
226
+ }));
227
+ }
228
+ /** 获取当前 workspace */
229
+ async getWorkspace(request = {}, execution = {}) {
230
+ const operation = deviceOperations["getWorkspace"];
231
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/workspace", {
232
+ ...request,
233
+ baseUrl: this.#runtime.baseUrl,
234
+ fetch: this.#runtime.createFetch(operation, execution),
235
+ redirect: "error",
236
+ parseAs: "text",
237
+ }));
238
+ }
239
+ /** 导入会话授权 */
240
+ async importAccountAuthSession(request, execution = {}) {
241
+ const operation = deviceOperations["importAccountAuthSession"];
242
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/session", {
243
+ ...request,
244
+ baseUrl: this.#runtime.baseUrl,
245
+ fetch: this.#runtime.createFetch(operation, execution),
246
+ redirect: "error",
247
+ parseAs: "text",
248
+ }));
249
+ }
250
+ /** 退出群组 */
251
+ async leaveGroup(request, execution = {}) {
252
+ const operation = deviceOperations["leaveGroup"];
253
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/leave", {
254
+ ...request,
255
+ baseUrl: this.#runtime.baseUrl,
256
+ fetch: this.#runtime.createFetch(operation, execution),
257
+ redirect: "error",
258
+ parseAs: "text",
259
+ }));
260
+ }
261
+ /** 列出账号 */
262
+ async listAccounts(request = {}, execution = {}) {
263
+ const operation = deviceOperations["listAccounts"];
264
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts", {
265
+ ...request,
266
+ baseUrl: this.#runtime.baseUrl,
267
+ fetch: this.#runtime.createFetch(operation, execution),
268
+ redirect: "error",
269
+ parseAs: "text",
270
+ }));
271
+ }
272
+ /** 列出 API Key */
273
+ async listApiKeys(request = {}, execution = {}) {
274
+ const operation = deviceOperations["listApiKeys"];
275
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/api-keys", {
276
+ ...request,
277
+ baseUrl: this.#runtime.baseUrl,
278
+ fetch: this.#runtime.createFetch(operation, execution),
279
+ redirect: "error",
280
+ parseAs: "text",
281
+ }));
282
+ }
283
+ /** 查询联系人黑名单 */
284
+ async listContactBlocklist(request, execution = {}) {
285
+ const operation = deviceOperations["listContactBlocklist"];
286
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/contacts/blocklist", {
287
+ ...request,
288
+ baseUrl: this.#runtime.baseUrl,
289
+ fetch: this.#runtime.createFetch(operation, execution),
290
+ redirect: "error",
291
+ parseAs: "text",
292
+ }));
293
+ }
294
+ /** 列出联系人 */
295
+ async listContacts(request, execution = {}) {
296
+ const operation = deviceOperations["listContacts"];
297
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/contacts", {
298
+ ...request,
299
+ baseUrl: this.#runtime.baseUrl,
300
+ fetch: this.#runtime.createFetch(operation, execution),
301
+ redirect: "error",
302
+ parseAs: "text",
303
+ }));
304
+ }
305
+ /** 列出会话标签 */
306
+ async listConversationLabels(request, execution = {}) {
307
+ const operation = deviceOperations["listConversationLabels"];
308
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/conversations/labels", {
309
+ ...request,
310
+ baseUrl: this.#runtime.baseUrl,
311
+ fetch: this.#runtime.createFetch(operation, execution),
312
+ redirect: "error",
313
+ parseAs: "text",
314
+ }));
315
+ }
316
+ /** 列出会话成员 */
317
+ async listConversationMembers(request, execution = {}) {
318
+ const operation = deviceOperations["listConversationMembers"];
319
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/conversations/members", {
320
+ ...request,
321
+ baseUrl: this.#runtime.baseUrl,
322
+ fetch: this.#runtime.createFetch(operation, execution),
323
+ redirect: "error",
324
+ parseAs: "text",
325
+ }));
326
+ }
327
+ /** 列出会话 */
328
+ async listConversations(request, execution = {}) {
329
+ const operation = deviceOperations["listConversations"];
330
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/conversations", {
331
+ ...request,
332
+ baseUrl: this.#runtime.baseUrl,
333
+ fetch: this.#runtime.createFetch(operation, execution),
334
+ redirect: "error",
335
+ parseAs: "text",
336
+ }));
337
+ }
338
+ /** 列出待审批入群申请 */
339
+ async listGroupJoinRequests(request, execution = {}) {
340
+ const operation = deviceOperations["listGroupJoinRequests"];
341
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/groups/join-requests", {
342
+ ...request,
343
+ baseUrl: this.#runtime.baseUrl,
344
+ fetch: this.#runtime.createFetch(operation, execution),
345
+ redirect: "error",
346
+ parseAs: "text",
347
+ }));
348
+ }
349
+ /** 列出群组 */
350
+ async listGroups(request, execution = {}) {
351
+ const operation = deviceOperations["listGroups"];
352
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/accounts/{account_id}/groups", {
353
+ ...request,
354
+ baseUrl: this.#runtime.baseUrl,
355
+ fetch: this.#runtime.createFetch(operation, execution),
356
+ redirect: "error",
357
+ parseAs: "text",
358
+ }));
359
+ }
360
+ /** 查询 provider 地区可用性 */
361
+ async listProviderRegions(request, execution = {}) {
362
+ const operation = deviceOperations["listProviderRegions"];
363
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/providers/{provider}/regions", {
364
+ ...request,
365
+ baseUrl: this.#runtime.baseUrl,
366
+ fetch: this.#runtime.createFetch(operation, execution),
367
+ redirect: "error",
368
+ parseAs: "text",
369
+ }));
370
+ }
371
+ /** 列出 webhook endpoint */
372
+ async listWebhookEndpoints(request = {}, execution = {}) {
373
+ const operation = deviceOperations["listWebhookEndpoints"];
374
+ return await this.#runtime.execute(operation, async () => await this.#client.GET("/v1/webhook-endpoints", {
375
+ ...request,
376
+ baseUrl: this.#runtime.baseUrl,
377
+ fetch: this.#runtime.createFetch(operation, execution),
378
+ redirect: "error",
379
+ parseAs: "text",
380
+ }));
381
+ }
382
+ /** 标记会话已读 */
383
+ async markConversationRead(request, execution = {}) {
384
+ const operation = deviceOperations["markConversationRead"];
385
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/read", {
386
+ ...request,
387
+ baseUrl: this.#runtime.baseUrl,
388
+ fetch: this.#runtime.createFetch(operation, execution),
389
+ redirect: "error",
390
+ parseAs: "text",
391
+ }));
392
+ }
393
+ /** 标记会话未读 */
394
+ async markConversationUnread(request, execution = {}) {
395
+ const operation = deviceOperations["markConversationUnread"];
396
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/unread", {
397
+ ...request,
398
+ baseUrl: this.#runtime.baseUrl,
399
+ fetch: this.#runtime.createFetch(operation, execution),
400
+ redirect: "error",
401
+ parseAs: "text",
402
+ }));
403
+ }
404
+ /** 静音会话 */
405
+ async muteConversation(request, execution = {}) {
406
+ const operation = deviceOperations["muteConversation"];
407
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/mute", {
408
+ ...request,
409
+ baseUrl: this.#runtime.baseUrl,
410
+ fetch: this.#runtime.createFetch(operation, execution),
411
+ redirect: "error",
412
+ parseAs: "text",
413
+ }));
414
+ }
415
+ /** 置顶会话 */
416
+ async pinConversation(request, execution = {}) {
417
+ const operation = deviceOperations["pinConversation"];
418
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/pin", {
419
+ ...request,
420
+ baseUrl: this.#runtime.baseUrl,
421
+ fetch: this.#runtime.createFetch(operation, execution),
422
+ redirect: "error",
423
+ parseAs: "text",
424
+ }));
425
+ }
426
+ /** 置顶或取消置顶消息 */
427
+ async pinMessage(request, execution = {}) {
428
+ const operation = deviceOperations["pinMessage"];
429
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/messages/pin", {
430
+ ...request,
431
+ baseUrl: this.#runtime.baseUrl,
432
+ fetch: this.#runtime.createFetch(operation, execution),
433
+ redirect: "error",
434
+ parseAs: "text",
435
+ }));
436
+ }
437
+ /** 给消息加表情回应或取消回应 */
438
+ async reactMessage(request, execution = {}) {
439
+ const operation = deviceOperations["reactMessage"];
440
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/messages/reaction", {
441
+ ...request,
442
+ baseUrl: this.#runtime.baseUrl,
443
+ fetch: this.#runtime.createFetch(operation, execution),
444
+ redirect: "error",
445
+ parseAs: "text",
446
+ }));
447
+ }
448
+ /** 重连账号运行态 */
449
+ async reconnectAccountRuntime(request, execution = {}) {
450
+ const operation = deviceOperations["reconnectAccountRuntime"];
451
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/runtime/reconnect", {
452
+ ...request,
453
+ baseUrl: this.#runtime.baseUrl,
454
+ fetch: this.#runtime.createFetch(operation, execution),
455
+ redirect: "error",
456
+ parseAs: "text",
457
+ }));
458
+ }
459
+ /** 刷新账号运行态 */
460
+ async refreshAccountRuntime(request, execution = {}) {
461
+ const operation = deviceOperations["refreshAccountRuntime"];
462
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/runtime/refresh", {
463
+ ...request,
464
+ baseUrl: this.#runtime.baseUrl,
465
+ fetch: this.#runtime.createFetch(operation, execution),
466
+ redirect: "error",
467
+ parseAs: "text",
468
+ }));
469
+ }
470
+ /** 撤回消息 */
471
+ async revokeMessage(request, execution = {}) {
472
+ const operation = deviceOperations["revokeMessage"];
473
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/messages/revoke", {
474
+ ...request,
475
+ baseUrl: this.#runtime.baseUrl,
476
+ fetch: this.#runtime.createFetch(operation, execution),
477
+ redirect: "error",
478
+ parseAs: "text",
479
+ }));
480
+ }
481
+ /** 轮换 API Key */
482
+ async rotateApiKey(request, execution = {}) {
483
+ const operation = deviceOperations["rotateApiKey"];
484
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/api-keys/{key_id}/rotate", {
485
+ ...request,
486
+ baseUrl: this.#runtime.baseUrl,
487
+ fetch: this.#runtime.createFetch(operation, execution),
488
+ redirect: "error",
489
+ parseAs: "text",
490
+ }));
491
+ }
492
+ /** 发送消息 */
493
+ async sendMessage(request, execution = {}) {
494
+ const operation = deviceOperations["sendMessage"];
495
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/messages", {
496
+ ...request,
497
+ baseUrl: this.#runtime.baseUrl,
498
+ fetch: this.#runtime.createFetch(operation, execution),
499
+ redirect: "error",
500
+ parseAs: "text",
501
+ }));
502
+ }
503
+ /** 设置或清空联系人备注 */
504
+ async setContactNote(request, execution = {}) {
505
+ const operation = deviceOperations["setContactNote"];
506
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/contacts/note", {
507
+ ...request,
508
+ baseUrl: this.#runtime.baseUrl,
509
+ fetch: this.#runtime.createFetch(operation, execution),
510
+ redirect: "error",
511
+ parseAs: "text",
512
+ }));
513
+ }
514
+ /** 给会话打标或移除标签 */
515
+ async setConversationLabelMembers(request, execution = {}) {
516
+ const operation = deviceOperations["setConversationLabelMembers"];
517
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/labels", {
518
+ ...request,
519
+ baseUrl: this.#runtime.baseUrl,
520
+ fetch: this.#runtime.createFetch(operation, execution),
521
+ redirect: "error",
522
+ parseAs: "text",
523
+ }));
524
+ }
525
+ /** 设置入群审批模式 */
526
+ async setGroupJoinApprovalMode(request, execution = {}) {
527
+ const operation = deviceOperations["setGroupJoinApprovalMode"];
528
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/join-approval-mode", {
529
+ ...request,
530
+ baseUrl: this.#runtime.baseUrl,
531
+ fetch: this.#runtime.createFetch(operation, execution),
532
+ redirect: "error",
533
+ parseAs: "text",
534
+ }));
535
+ }
536
+ /** 启动验证码类授权 */
537
+ async startAccountAuth(request, execution = {}) {
538
+ const operation = deviceOperations["startAccountAuth"];
539
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/start", {
540
+ ...request,
541
+ baseUrl: this.#runtime.baseUrl,
542
+ fetch: this.#runtime.createFetch(operation, execution),
543
+ redirect: "error",
544
+ parseAs: "text",
545
+ }));
546
+ }
547
+ /** 启动二维码授权 */
548
+ async startAccountQrAuth(request, execution = {}) {
549
+ const operation = deviceOperations["startAccountQrAuth"];
550
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/qr/start", {
551
+ ...request,
552
+ baseUrl: this.#runtime.baseUrl,
553
+ fetch: this.#runtime.createFetch(operation, execution),
554
+ redirect: "error",
555
+ parseAs: "text",
556
+ }));
557
+ }
558
+ /** 启动账号运行态 */
559
+ async startAccountRuntime(request, execution = {}) {
560
+ const operation = deviceOperations["startAccountRuntime"];
561
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/runtime/start", {
562
+ ...request,
563
+ baseUrl: this.#runtime.baseUrl,
564
+ fetch: this.#runtime.createFetch(operation, execution),
565
+ redirect: "error",
566
+ parseAs: "text",
567
+ }));
568
+ }
569
+ /** 停止账号运行态 */
570
+ async stopAccountRuntime(request, execution = {}) {
571
+ const operation = deviceOperations["stopAccountRuntime"];
572
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/runtime/stop", {
573
+ ...request,
574
+ baseUrl: this.#runtime.baseUrl,
575
+ fetch: this.#runtime.createFetch(operation, execution),
576
+ redirect: "error",
577
+ parseAs: "text",
578
+ }));
579
+ }
580
+ /** 提交验证码 */
581
+ async submitAccountAuthCode(request, execution = {}) {
582
+ const operation = deviceOperations["submitAccountAuthCode"];
583
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/code", {
584
+ ...request,
585
+ baseUrl: this.#runtime.baseUrl,
586
+ fetch: this.#runtime.createFetch(operation, execution),
587
+ redirect: "error",
588
+ parseAs: "text",
589
+ }));
590
+ }
591
+ /** 提交二次密码 */
592
+ async submitAccountAuthPassword(request, execution = {}) {
593
+ const operation = deviceOperations["submitAccountAuthPassword"];
594
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/auth/password", {
595
+ ...request,
596
+ baseUrl: this.#runtime.baseUrl,
597
+ fetch: this.#runtime.createFetch(operation, execution),
598
+ redirect: "error",
599
+ parseAs: "text",
600
+ }));
601
+ }
602
+ /** 解封联系人 */
603
+ async unblockContact(request, execution = {}) {
604
+ const operation = deviceOperations["unblockContact"];
605
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/contacts/unblock", {
606
+ ...request,
607
+ baseUrl: this.#runtime.baseUrl,
608
+ fetch: this.#runtime.createFetch(operation, execution),
609
+ redirect: "error",
610
+ parseAs: "text",
611
+ }));
612
+ }
613
+ /** 取消静音会话 */
614
+ async unmuteConversation(request, execution = {}) {
615
+ const operation = deviceOperations["unmuteConversation"];
616
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/unmute", {
617
+ ...request,
618
+ baseUrl: this.#runtime.baseUrl,
619
+ fetch: this.#runtime.createFetch(operation, execution),
620
+ redirect: "error",
621
+ parseAs: "text",
622
+ }));
623
+ }
624
+ /** 取消置顶会话 */
625
+ async unpinConversation(request, execution = {}) {
626
+ const operation = deviceOperations["unpinConversation"];
627
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/unpin", {
628
+ ...request,
629
+ baseUrl: this.#runtime.baseUrl,
630
+ fetch: this.#runtime.createFetch(operation, execution),
631
+ redirect: "error",
632
+ parseAs: "text",
633
+ }));
634
+ }
635
+ /** 更新账号 */
636
+ async updateAccount(request, execution = {}) {
637
+ const operation = deviceOperations["updateAccount"];
638
+ return await this.#runtime.execute(operation, async () => await this.#client.PATCH("/v1/accounts/{account_id}", {
639
+ ...request,
640
+ baseUrl: this.#runtime.baseUrl,
641
+ fetch: this.#runtime.createFetch(operation, execution),
642
+ redirect: "error",
643
+ parseAs: "text",
644
+ }));
645
+ }
646
+ /** 更新 API Key 状态 */
647
+ async updateApiKeyStatus(request, execution = {}) {
648
+ const operation = deviceOperations["updateApiKeyStatus"];
649
+ return await this.#runtime.execute(operation, async () => await this.#client.PATCH("/v1/api-keys/{key_id}", {
650
+ ...request,
651
+ baseUrl: this.#runtime.baseUrl,
652
+ fetch: this.#runtime.createFetch(operation, execution),
653
+ redirect: "error",
654
+ parseAs: "text",
655
+ }));
656
+ }
657
+ /** 修改群信息 */
658
+ async updateGroupInfo(request, execution = {}) {
659
+ const operation = deviceOperations["updateGroupInfo"];
660
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/update-info", {
661
+ ...request,
662
+ baseUrl: this.#runtime.baseUrl,
663
+ fetch: this.#runtime.createFetch(operation, execution),
664
+ redirect: "error",
665
+ parseAs: "text",
666
+ }));
667
+ }
668
+ /** 处理入群申请 */
669
+ async updateGroupJoinRequests(request, execution = {}) {
670
+ const operation = deviceOperations["updateGroupJoinRequests"];
671
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/join-requests/update", {
672
+ ...request,
673
+ baseUrl: this.#runtime.baseUrl,
674
+ fetch: this.#runtime.createFetch(operation, execution),
675
+ redirect: "error",
676
+ parseAs: "text",
677
+ }));
678
+ }
679
+ /** 管理群成员 */
680
+ async updateGroupMembers(request, execution = {}) {
681
+ const operation = deviceOperations["updateGroupMembers"];
682
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/groups/members", {
683
+ ...request,
684
+ baseUrl: this.#runtime.baseUrl,
685
+ fetch: this.#runtime.createFetch(operation, execution),
686
+ redirect: "error",
687
+ parseAs: "text",
688
+ }));
689
+ }
690
+ /** 更新 webhook endpoint */
691
+ async updateWebhookEndpoint(request, execution = {}) {
692
+ const operation = deviceOperations["updateWebhookEndpoint"];
693
+ return await this.#runtime.execute(operation, async () => await this.#client.PATCH("/v1/webhook-endpoints/{endpoint_id}", {
694
+ ...request,
695
+ baseUrl: this.#runtime.baseUrl,
696
+ fetch: this.#runtime.createFetch(operation, execution),
697
+ redirect: "error",
698
+ parseAs: "text",
699
+ }));
700
+ }
701
+ /** 更新当前 workspace */
702
+ async updateWorkspace(request, execution = {}) {
703
+ const operation = deviceOperations["updateWorkspace"];
704
+ return await this.#runtime.execute(operation, async () => await this.#client.PATCH("/v1/workspace", {
705
+ ...request,
706
+ baseUrl: this.#runtime.baseUrl,
707
+ fetch: this.#runtime.createFetch(operation, execution),
708
+ redirect: "error",
709
+ parseAs: "text",
710
+ }));
711
+ }
712
+ /** 新建或更新会话标签 */
713
+ async upsertConversationLabel(request, execution = {}) {
714
+ const operation = deviceOperations["upsertConversationLabel"];
715
+ return await this.#runtime.execute(operation, async () => await this.#client.POST("/v1/accounts/{account_id}/conversations/labels/upsert", {
716
+ ...request,
717
+ baseUrl: this.#runtime.baseUrl,
718
+ fetch: this.#runtime.createFetch(operation, execution),
719
+ redirect: "error",
720
+ parseAs: "text",
721
+ }));
722
+ }
723
+ }
724
+ //# sourceMappingURL=client.js.map