@larksuiteoapi/node-sdk 1.8.1 → 1.10.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 (4) hide show
  1. package/es/index.js +899 -171
  2. package/lib/index.js +899 -171
  3. package/package.json +1 -1
  4. package/types/index.d.ts +1682 -115
package/es/index.js CHANGED
@@ -114,9 +114,17 @@ class DefaultCache {
114
114
  constructor() {
115
115
  this.values = new Map();
116
116
  }
117
- get(key) {
117
+ // When there is a namespace, splice the namespace and key to form a new key
118
+ getCacheKey(key, namespace) {
119
+ if (namespace) {
120
+ return `${namespace}/${key.toString()}`;
121
+ }
122
+ return key;
123
+ }
124
+ get(key, options) {
118
125
  return __awaiter(this, void 0, void 0, function* () {
119
- const data = this.values.get(key);
126
+ const cacheKey = this.getCacheKey(key, get(options, 'namespace'));
127
+ const data = this.values.get(cacheKey);
120
128
  if (data) {
121
129
  const { value, expiredTime } = data;
122
130
  if (!expiredTime || expiredTime - new Date().getTime() > 0) {
@@ -126,9 +134,10 @@ class DefaultCache {
126
134
  return undefined;
127
135
  });
128
136
  }
129
- set(key, value, expiredTime) {
137
+ set(key, value, expiredTime, options) {
130
138
  return __awaiter(this, void 0, void 0, function* () {
131
- this.values.set(key, {
139
+ const cacheKey = this.getCacheKey(key, get(options, 'namespace'));
140
+ this.values.set(cacheKey, {
132
141
  value,
133
142
  expiredTime,
134
143
  });
@@ -561,7 +570,7 @@ class Client$1 {
561
570
  },
562
571
  };
563
572
  /**
564
- * 管理后台-企业勋章
573
+ * 管理后台-密码
565
574
  */
566
575
  this.admin = {
567
576
  /**
@@ -1765,7 +1774,7 @@ class Client$1 {
1765
1774
  }),
1766
1775
  },
1767
1776
  /**
1768
- * 原生审批实例
1777
+ * 审批查询
1769
1778
  */
1770
1779
  instance: {
1771
1780
  /**
@@ -3364,6 +3373,86 @@ class Client$1 {
3364
3373
  }),
3365
3374
  },
3366
3375
  };
3376
+ /**
3377
+
3378
+ */
3379
+ this.authen = {
3380
+ /**
3381
+ * access_token
3382
+ */
3383
+ accessToken: {
3384
+ /**
3385
+ * {@link https://open.feishu.cn/api-explorer?project=authen&resource=access_token&apiName=create&version=v1 click to debug }
3386
+ *
3387
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=authen&resource=access_token&version=v1 document }
3388
+ */
3389
+ create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
3390
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
3391
+ return httpInstance
3392
+ .request({
3393
+ url: fillApiPath(`${this.domain}/open-apis/authen/v1/access_token`, path),
3394
+ method: "POST",
3395
+ data,
3396
+ params,
3397
+ headers,
3398
+ })
3399
+ .catch((e) => {
3400
+ this.logger.error(formatErrors(e));
3401
+ throw e;
3402
+ });
3403
+ }),
3404
+ },
3405
+ /**
3406
+ * refresh_access_token
3407
+ */
3408
+ refreshAccessToken: {
3409
+ /**
3410
+ * {@link https://open.feishu.cn/api-explorer?project=authen&resource=refresh_access_token&apiName=create&version=v1 click to debug }
3411
+ *
3412
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=authen&resource=refresh_access_token&version=v1 document }
3413
+ */
3414
+ create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
3415
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
3416
+ return httpInstance
3417
+ .request({
3418
+ url: fillApiPath(`${this.domain}/open-apis/authen/v1/refresh_access_token`, path),
3419
+ method: "POST",
3420
+ data,
3421
+ params,
3422
+ headers,
3423
+ })
3424
+ .catch((e) => {
3425
+ this.logger.error(formatErrors(e));
3426
+ throw e;
3427
+ });
3428
+ }),
3429
+ },
3430
+ /**
3431
+ * user_info
3432
+ */
3433
+ userInfo: {
3434
+ /**
3435
+ * {@link https://open.feishu.cn/api-explorer?project=authen&resource=user_info&apiName=get&version=v1 click to debug }
3436
+ *
3437
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=get&project=authen&resource=user_info&version=v1 document }
3438
+ */
3439
+ get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
3440
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
3441
+ return httpInstance
3442
+ .request({
3443
+ url: fillApiPath(`${this.domain}/open-apis/authen/v1/user_info`, path),
3444
+ method: "GET",
3445
+ data,
3446
+ params,
3447
+ headers,
3448
+ })
3449
+ .catch((e) => {
3450
+ this.logger.error(formatErrors(e));
3451
+ throw e;
3452
+ });
3453
+ }),
3454
+ },
3455
+ };
3367
3456
  /**
3368
3457
 
3369
3458
  */
@@ -4543,6 +4632,26 @@ class Client$1 {
4543
4632
  throw e;
4544
4633
  });
4545
4634
  }),
4635
+ /**
4636
+ * {@link https://open.feishu.cn/api-explorer?project=bitable&resource=app.table&apiName=patch&version=v1 click to debug }
4637
+ *
4638
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table/patch document }
4639
+ */
4640
+ patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
4641
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
4642
+ return httpInstance
4643
+ .request({
4644
+ url: fillApiPath(`${this.domain}/open-apis/bitable/v1/apps/:app_token/tables/:table_id`, path),
4645
+ method: "PATCH",
4646
+ data,
4647
+ params,
4648
+ headers,
4649
+ })
4650
+ .catch((e) => {
4651
+ this.logger.error(formatErrors(e));
4652
+ throw e;
4653
+ });
4654
+ }),
4546
4655
  },
4547
4656
  /**
4548
4657
  * 字段
@@ -8899,7 +9008,7 @@ class Client$1 {
8899
9008
  }),
8900
9009
  },
8901
9010
  /**
8902
- * 下载
9011
+ * 文件夹
8903
9012
  */
8904
9013
  file: {
8905
9014
  /**
@@ -9385,23 +9494,23 @@ class Client$1 {
9385
9494
  }),
9386
9495
  },
9387
9496
  /**
9388
- * 导入
9497
+ * 文档版本
9389
9498
  */
9390
- importTask: {
9499
+ fileVersion: {
9391
9500
  /**
9392
- * {@link https://open.feishu.cn/api-explorer?project=drive&resource=import_task&apiName=create&version=v1 click to debug }
9501
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=file.version&apiName=create&version=v1 click to debug }
9393
9502
  *
9394
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/create document }
9503
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file-version/create document }
9395
9504
  *
9396
- * 创建导入任务
9505
+ * 创建文档版本
9397
9506
  *
9398
- * 创建导入任务。支持导入为 doc、docx、sheet、bitable,参考[导入用户指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/import-user-guide)
9507
+ * 创建文档版本。
9399
9508
  */
9400
9509
  create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9401
9510
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
9402
9511
  return httpInstance
9403
9512
  .request({
9404
- url: fillApiPath(`${this.domain}/open-apis/drive/v1/import_tasks`, path),
9513
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions`, path),
9405
9514
  method: "POST",
9406
9515
  data,
9407
9516
  params,
@@ -9413,20 +9522,20 @@ class Client$1 {
9413
9522
  });
9414
9523
  }),
9415
9524
  /**
9416
- * {@link https://open.feishu.cn/api-explorer?project=drive&resource=import_task&apiName=get&version=v1 click to debug }
9525
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=file.version&apiName=delete&version=v1 click to debug }
9417
9526
  *
9418
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/get document }
9527
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file-version/delete document }
9419
9528
  *
9420
- * 查询导入结果
9529
+ * 删除文档版本
9421
9530
  *
9422
- * 根据创建导入任务返回的 ticket 查询导入结果。
9531
+ * 删除文档版本。
9423
9532
  */
9424
- get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9533
+ delete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9425
9534
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
9426
9535
  return httpInstance
9427
9536
  .request({
9428
- url: fillApiPath(`${this.domain}/open-apis/drive/v1/import_tasks/:ticket`, path),
9429
- method: "GET",
9537
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions/:version_id`, path),
9538
+ method: "DELETE",
9430
9539
  data,
9431
9540
  params,
9432
9541
  headers,
@@ -9436,27 +9545,68 @@ class Client$1 {
9436
9545
  throw e;
9437
9546
  });
9438
9547
  }),
9439
- },
9440
- /**
9441
- * 分片上传
9442
- */
9443
- media: {
9548
+ getWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9549
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9550
+ const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
9551
+ const res = yield httpInstance
9552
+ .request({
9553
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions/:version_id`, path),
9554
+ method: "GET",
9555
+ headers: pickBy(innerPayload.headers, identity),
9556
+ params: pickBy(innerPayload.params, identity),
9557
+ })
9558
+ .catch((e) => {
9559
+ this.logger.error(formatErrors(e));
9560
+ });
9561
+ return res;
9562
+ });
9563
+ const Iterable = {
9564
+ [Symbol.asyncIterator]() {
9565
+ return __asyncGenerator(this, arguments, function* _a() {
9566
+ let hasMore = true;
9567
+ let pageToken;
9568
+ while (hasMore) {
9569
+ try {
9570
+ const res = yield __await(sendRequest({
9571
+ headers,
9572
+ params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
9573
+ data,
9574
+ }));
9575
+ const _b = get(res, "data") || {}, {
9576
+ // @ts-ignore
9577
+ has_more,
9578
+ // @ts-ignore
9579
+ page_token,
9580
+ // @ts-ignore
9581
+ next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
9582
+ yield yield __await(rest);
9583
+ hasMore = Boolean(has_more);
9584
+ pageToken = page_token || next_page_token;
9585
+ }
9586
+ catch (e) {
9587
+ yield yield __await(null);
9588
+ break;
9589
+ }
9590
+ }
9591
+ });
9592
+ },
9593
+ };
9594
+ return Iterable;
9595
+ }),
9444
9596
  /**
9445
- * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=batch_get_tmp_download_url&version=v1 click to debug }
9597
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=file.version&apiName=get&version=v1 click to debug }
9446
9598
  *
9447
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url document }
9448
- *
9449
- * 获取素材临时下载链接
9599
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file-version/get document }
9450
9600
  *
9451
- * 通过file_token获取素材临时下载链接,链接时效性是24小时,过期失效。
9601
+ * 获取文档版本
9452
9602
  *
9453
- * 该接口不支持太高的并发,且调用频率上限为5QPS
9603
+ * 获取文档版本。
9454
9604
  */
9455
- batchGetTmpDownloadUrl: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9605
+ get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9456
9606
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
9457
9607
  return httpInstance
9458
9608
  .request({
9459
- url: fillApiPath(`${this.domain}/open-apis/drive/v1/medias/batch_get_tmp_download_url`, path),
9609
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions/:version_id`, path),
9460
9610
  method: "GET",
9461
9611
  data,
9462
9612
  params,
@@ -9467,63 +9617,219 @@ class Client$1 {
9467
9617
  throw e;
9468
9618
  });
9469
9619
  }),
9620
+ listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9621
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9622
+ const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
9623
+ const res = yield httpInstance
9624
+ .request({
9625
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions`, path),
9626
+ method: "GET",
9627
+ headers: pickBy(innerPayload.headers, identity),
9628
+ params: pickBy(innerPayload.params, identity),
9629
+ })
9630
+ .catch((e) => {
9631
+ this.logger.error(formatErrors(e));
9632
+ });
9633
+ return res;
9634
+ });
9635
+ const Iterable = {
9636
+ [Symbol.asyncIterator]() {
9637
+ return __asyncGenerator(this, arguments, function* _a() {
9638
+ let hasMore = true;
9639
+ let pageToken;
9640
+ while (hasMore) {
9641
+ try {
9642
+ const res = yield __await(sendRequest({
9643
+ headers,
9644
+ params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
9645
+ data,
9646
+ }));
9647
+ const _b = get(res, "data") || {}, {
9648
+ // @ts-ignore
9649
+ has_more,
9650
+ // @ts-ignore
9651
+ page_token,
9652
+ // @ts-ignore
9653
+ next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
9654
+ yield yield __await(rest);
9655
+ hasMore = Boolean(has_more);
9656
+ pageToken = page_token || next_page_token;
9657
+ }
9658
+ catch (e) {
9659
+ yield yield __await(null);
9660
+ break;
9661
+ }
9662
+ }
9663
+ });
9664
+ },
9665
+ };
9666
+ return Iterable;
9667
+ }),
9470
9668
  /**
9471
- * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=download&version=v1 click to debug }
9669
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=file.version&apiName=list&version=v1 click to debug }
9472
9670
  *
9473
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download document }
9474
- *
9475
- * 下载素材
9671
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/file-version/list document }
9476
9672
  *
9477
- * 使用该接口可以下载素材。素材表示在各种创作容器里的文件,如Doc文档内的图片,文件均属于素材。支持range下载。
9673
+ * 获取文档版本列表
9478
9674
  *
9479
- * 该接口不支持太高的并发,且调用频率上限为5QPS
9675
+ * 获取文档所有版本。
9480
9676
  */
9481
- download: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9677
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9482
9678
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
9483
- const res = yield httpInstance
9679
+ return httpInstance
9484
9680
  .request({
9485
- url: fillApiPath(`${this.domain}/open-apis/drive/v1/medias/:file_token/download`, path),
9681
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/files/:file_token/versions`, path),
9486
9682
  method: "GET",
9487
- headers,
9488
9683
  data,
9489
9684
  params,
9490
- responseType: "stream",
9685
+ headers,
9491
9686
  })
9492
9687
  .catch((e) => {
9493
9688
  this.logger.error(formatErrors(e));
9494
9689
  throw e;
9495
9690
  });
9496
- return {
9497
- writeFile: (filePath) => __awaiter(this, void 0, void 0, function* () {
9498
- return new Promise((resolve, reject) => {
9499
- const writableStream = fs.createWriteStream(filePath);
9500
- writableStream.on("finish", () => {
9501
- resolve(filePath);
9502
- });
9503
- writableStream.on("error", (e) => {
9504
- reject(e);
9505
- });
9506
- res.pipe(writableStream);
9507
- });
9508
- }),
9509
- };
9510
9691
  }),
9692
+ },
9693
+ /**
9694
+ * 导入
9695
+ */
9696
+ importTask: {
9511
9697
  /**
9512
- * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=upload_all&version=v1 click to debug }
9513
- *
9514
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all document }
9515
- *
9516
- * 上传素材
9698
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=import_task&apiName=create&version=v1 click to debug }
9517
9699
  *
9518
- * 将文件、图片、视频等素材文件上传到指定云文档中。素材文件在云空间中不会显示,只会显示在对应云文档中。
9700
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/create document }
9519
9701
  *
9520
- * 该接口支持调用频率上限为5QPS
9702
+ * 创建导入任务
9521
9703
  *
9522
- * 请不要使用这个接口上传大于20MB的文件,如果有这个需求可以尝试使用[分片上传接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)
9704
+ * 创建导入任务。支持导入为 doc、docx、sheet、bitable,参考[导入用户指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/import-user-guide)
9523
9705
  */
9524
- uploadAll: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9706
+ create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9525
9707
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
9526
- const res = yield httpInstance
9708
+ return httpInstance
9709
+ .request({
9710
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/import_tasks`, path),
9711
+ method: "POST",
9712
+ data,
9713
+ params,
9714
+ headers,
9715
+ })
9716
+ .catch((e) => {
9717
+ this.logger.error(formatErrors(e));
9718
+ throw e;
9719
+ });
9720
+ }),
9721
+ /**
9722
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=import_task&apiName=get&version=v1 click to debug }
9723
+ *
9724
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/import_task/get document }
9725
+ *
9726
+ * 查询导入结果
9727
+ *
9728
+ * 根据创建导入任务返回的 ticket 查询导入结果。
9729
+ */
9730
+ get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9731
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9732
+ return httpInstance
9733
+ .request({
9734
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/import_tasks/:ticket`, path),
9735
+ method: "GET",
9736
+ data,
9737
+ params,
9738
+ headers,
9739
+ })
9740
+ .catch((e) => {
9741
+ this.logger.error(formatErrors(e));
9742
+ throw e;
9743
+ });
9744
+ }),
9745
+ },
9746
+ /**
9747
+ * 素材
9748
+ */
9749
+ media: {
9750
+ /**
9751
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=batch_get_tmp_download_url&version=v1 click to debug }
9752
+ *
9753
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/batch_get_tmp_download_url document }
9754
+ *
9755
+ * 获取素材临时下载链接
9756
+ *
9757
+ * 通过file_token获取素材临时下载链接,链接时效性是24小时,过期失效。
9758
+ *
9759
+ * 该接口不支持太高的并发,且调用频率上限为5QPS
9760
+ */
9761
+ batchGetTmpDownloadUrl: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9762
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9763
+ return httpInstance
9764
+ .request({
9765
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/medias/batch_get_tmp_download_url`, path),
9766
+ method: "GET",
9767
+ data,
9768
+ params,
9769
+ headers,
9770
+ })
9771
+ .catch((e) => {
9772
+ this.logger.error(formatErrors(e));
9773
+ throw e;
9774
+ });
9775
+ }),
9776
+ /**
9777
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=download&version=v1 click to debug }
9778
+ *
9779
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/download document }
9780
+ *
9781
+ * 下载素材
9782
+ *
9783
+ * 使用该接口可以下载素材。素材表示在各种创作容器里的文件,如Doc文档内的图片,文件均属于素材。支持range下载。
9784
+ *
9785
+ * 该接口不支持太高的并发,且调用频率上限为5QPS
9786
+ */
9787
+ download: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9788
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9789
+ const res = yield httpInstance
9790
+ .request({
9791
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/medias/:file_token/download`, path),
9792
+ method: "GET",
9793
+ headers,
9794
+ data,
9795
+ params,
9796
+ responseType: "stream",
9797
+ })
9798
+ .catch((e) => {
9799
+ this.logger.error(formatErrors(e));
9800
+ throw e;
9801
+ });
9802
+ return {
9803
+ writeFile: (filePath) => __awaiter(this, void 0, void 0, function* () {
9804
+ return new Promise((resolve, reject) => {
9805
+ const writableStream = fs.createWriteStream(filePath);
9806
+ writableStream.on("finish", () => {
9807
+ resolve(filePath);
9808
+ });
9809
+ writableStream.on("error", (e) => {
9810
+ reject(e);
9811
+ });
9812
+ res.pipe(writableStream);
9813
+ });
9814
+ }),
9815
+ };
9816
+ }),
9817
+ /**
9818
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=media&apiName=upload_all&version=v1 click to debug }
9819
+ *
9820
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/upload_all document }
9821
+ *
9822
+ * 上传素材
9823
+ *
9824
+ * 将文件、图片、视频等素材文件上传到指定云文档中。素材文件在云空间中不会显示,只会显示在对应云文档中。
9825
+ *
9826
+ * 该接口支持调用频率上限为5QPS
9827
+ *
9828
+ * 请不要使用这个接口上传大于20MB的文件,如果有这个需求可以尝试使用[分片上传接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/media/multipart-upload-media/introduction)。
9829
+ */
9830
+ uploadAll: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9831
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9832
+ const res = yield httpInstance
9527
9833
  .request({
9528
9834
  url: fillApiPath(`${this.domain}/open-apis/drive/v1/medias/upload_all`, path),
9529
9835
  method: "POST",
@@ -9652,6 +9958,26 @@ class Client$1 {
9652
9958
  * 成员
9653
9959
  */
9654
9960
  permissionMember: {
9961
+ /**
9962
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=permission.member&apiName=auth&version=v1 click to debug }
9963
+ *
9964
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=auth&project=drive&resource=permission.member&version=v1 document }
9965
+ */
9966
+ auth: (payload, options) => __awaiter(this, void 0, void 0, function* () {
9967
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
9968
+ return httpInstance
9969
+ .request({
9970
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/permissions/:token/members/auth`, path),
9971
+ method: "GET",
9972
+ data,
9973
+ params,
9974
+ headers,
9975
+ })
9976
+ .catch((e) => {
9977
+ this.logger.error(formatErrors(e));
9978
+ throw e;
9979
+ });
9980
+ }),
9655
9981
  /**
9656
9982
  * {@link https://open.feishu.cn/api-explorer?project=drive&resource=permission.member&apiName=create&version=v1 click to debug }
9657
9983
  *
@@ -9726,6 +10052,26 @@ class Client$1 {
9726
10052
  throw e;
9727
10053
  });
9728
10054
  }),
10055
+ /**
10056
+ * {@link https://open.feishu.cn/api-explorer?project=drive&resource=permission.member&apiName=transfer_owner&version=v1 click to debug }
10057
+ *
10058
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=transfer_owner&project=drive&resource=permission.member&version=v1 document }
10059
+ */
10060
+ transferOwner: (payload, options) => __awaiter(this, void 0, void 0, function* () {
10061
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
10062
+ return httpInstance
10063
+ .request({
10064
+ url: fillApiPath(`${this.domain}/open-apis/drive/v1/permissions/:token/members/transfer_owner`, path),
10065
+ method: "POST",
10066
+ data,
10067
+ params,
10068
+ headers,
10069
+ })
10070
+ .catch((e) => {
10071
+ this.logger.error(formatErrors(e));
10072
+ throw e;
10073
+ });
10074
+ }),
9729
10075
  /**
9730
10076
  * {@link https://open.feishu.cn/api-explorer?project=drive&resource=permission.member&apiName=update&version=v1 click to debug }
9731
10077
  *
@@ -11998,6 +12344,30 @@ class Client$1 {
11998
12344
  throw e;
11999
12345
  });
12000
12346
  }),
12347
+ /**
12348
+ * {@link https://open.feishu.cn/api-explorer?project=hire&resource=job&apiName=combined_update&version=v1 click to debug }
12349
+ *
12350
+ * {@link https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/job/combined_update document }
12351
+ *
12352
+ * 更新职位
12353
+ *
12354
+ * 更新职位信息,该接口为全量更新,若字段没有返回值,则原有值将会被清空。字段的是否必填,将以系统中的「职位字段管理」中的设置为准。
12355
+ */
12356
+ combinedUpdate: (payload, options) => __awaiter(this, void 0, void 0, function* () {
12357
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
12358
+ return httpInstance
12359
+ .request({
12360
+ url: fillApiPath(`${this.domain}/open-apis/hire/v1/jobs/:job_id/combined_update`, path),
12361
+ method: "POST",
12362
+ data,
12363
+ params,
12364
+ headers,
12365
+ })
12366
+ .catch((e) => {
12367
+ this.logger.error(formatErrors(e));
12368
+ throw e;
12369
+ });
12370
+ }),
12001
12371
  /**
12002
12372
  * {@link https://open.feishu.cn/api-explorer?project=hire&resource=job&apiName=config&version=v1 click to debug }
12003
12373
  *
@@ -13118,6 +13488,146 @@ class Client$1 {
13118
13488
  });
13119
13489
  }),
13120
13490
  },
13491
+ /**
13492
+ * chat.menu_item
13493
+ */
13494
+ chatMenuItem: {
13495
+ /**
13496
+ * {@link https://open.feishu.cn/api-explorer?project=im&resource=chat.menu_item&apiName=patch&version=v1 click to debug }
13497
+ *
13498
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_item/patch document }
13499
+ *
13500
+ * 修改群菜单元信息
13501
+ *
13502
+ * 修改某个一级菜单或者二级菜单的元信息。
13503
+ *
13504
+ * 注意事项:;- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。;- 机器人必须在群里。
13505
+ */
13506
+ patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
13507
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
13508
+ return httpInstance
13509
+ .request({
13510
+ url: fillApiPath(`${this.domain}/open-apis/im/v1/chats/:chat_id/menu_items/:menu_item_id`, path),
13511
+ method: "PATCH",
13512
+ data,
13513
+ params,
13514
+ headers,
13515
+ })
13516
+ .catch((e) => {
13517
+ this.logger.error(formatErrors(e));
13518
+ throw e;
13519
+ });
13520
+ }),
13521
+ },
13522
+ /**
13523
+ * 群组 - 群菜单
13524
+ */
13525
+ chatMenuTree: {
13526
+ /**
13527
+ * {@link https://open.feishu.cn/api-explorer?project=im&resource=chat.menu_tree&apiName=create&version=v1 click to debug }
13528
+ *
13529
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/create document }
13530
+ *
13531
+ * 添加群菜单
13532
+ *
13533
+ * 向群内添加群菜单。
13534
+ *
13535
+ * 注意事项:;- 该API是向群内追加菜单,群内原来存在的菜单并不会被覆盖。操作API后,将返回群内所有菜单。;- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。;- 机器人必须在群里。;- 一个群内,一级菜单最多有3个,每个一级菜单最多有5个二级菜单。
13536
+ */
13537
+ create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
13538
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
13539
+ return httpInstance
13540
+ .request({
13541
+ url: fillApiPath(`${this.domain}/open-apis/im/v1/chats/:chat_id/menu_tree`, path),
13542
+ method: "POST",
13543
+ data,
13544
+ params,
13545
+ headers,
13546
+ })
13547
+ .catch((e) => {
13548
+ this.logger.error(formatErrors(e));
13549
+ throw e;
13550
+ });
13551
+ }),
13552
+ /**
13553
+ * {@link https://open.feishu.cn/api-explorer?project=im&resource=chat.menu_tree&apiName=delete&version=v1 click to debug }
13554
+ *
13555
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/delete document }
13556
+ *
13557
+ * 删除群菜单。
13558
+ *
13559
+ * 删除群内菜单。
13560
+ *
13561
+ * 注意事项:;- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。;- 机器人必须在群里。;- 操作API后,将返回群内所有菜单。
13562
+ */
13563
+ delete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
13564
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
13565
+ return httpInstance
13566
+ .request({
13567
+ url: fillApiPath(`${this.domain}/open-apis/im/v1/chats/:chat_id/menu_tree`, path),
13568
+ method: "DELETE",
13569
+ data,
13570
+ params,
13571
+ headers,
13572
+ })
13573
+ .catch((e) => {
13574
+ this.logger.error(formatErrors(e));
13575
+ throw e;
13576
+ });
13577
+ }),
13578
+ /**
13579
+ * {@link https://open.feishu.cn/api-explorer?project=im&resource=chat.menu_tree&apiName=get&version=v1 click to debug }
13580
+ *
13581
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/get document }
13582
+ *
13583
+ * 获取群内菜单
13584
+ *
13585
+ * 通过群ID获取群内菜单。
13586
+ *
13587
+ * 注意事项:;- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。;- 机器人必须在群里。
13588
+ */
13589
+ get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
13590
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
13591
+ return httpInstance
13592
+ .request({
13593
+ url: fillApiPath(`${this.domain}/open-apis/im/v1/chats/:chat_id/menu_tree`, path),
13594
+ method: "GET",
13595
+ data,
13596
+ params,
13597
+ headers,
13598
+ })
13599
+ .catch((e) => {
13600
+ this.logger.error(formatErrors(e));
13601
+ throw e;
13602
+ });
13603
+ }),
13604
+ /**
13605
+ * {@link https://open.feishu.cn/api-explorer?project=im&resource=chat.menu_tree&apiName=sort&version=v1 click to debug }
13606
+ *
13607
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-menu_tree/sort document }
13608
+ *
13609
+ * 排序群菜单
13610
+ *
13611
+ * 给一个群内的一级菜单排序。
13612
+ *
13613
+ * 注意事项:;- 应用需要开启[机器人能力](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability)。;- 机器人必须在群里。;- 操作API后,将返回群内所有菜单。
13614
+ */
13615
+ sort: (payload, options) => __awaiter(this, void 0, void 0, function* () {
13616
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
13617
+ return httpInstance
13618
+ .request({
13619
+ url: fillApiPath(`${this.domain}/open-apis/im/v1/chats/:chat_id/menu_tree/sort`, path),
13620
+ method: "POST",
13621
+ data,
13622
+ params,
13623
+ headers,
13624
+ })
13625
+ .catch((e) => {
13626
+ this.logger.error(formatErrors(e));
13627
+ throw e;
13628
+ });
13629
+ }),
13630
+ },
13121
13631
  /**
13122
13632
  * chat.moderation
13123
13633
  */
@@ -14473,6 +14983,46 @@ class Client$1 {
14473
14983
  * 邮件组成员
14474
14984
  */
14475
14985
  mailgroupMember: {
14986
+ /**
14987
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.member&apiName=batch_create&version=v1 click to debug }
14988
+ *
14989
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_create&project=mail&resource=mailgroup.member&version=v1 document }
14990
+ */
14991
+ batchCreate: (payload, options) => __awaiter(this, void 0, void 0, function* () {
14992
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
14993
+ return httpInstance
14994
+ .request({
14995
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/members/batch_create`, path),
14996
+ method: "POST",
14997
+ data,
14998
+ params,
14999
+ headers,
15000
+ })
15001
+ .catch((e) => {
15002
+ this.logger.error(formatErrors(e));
15003
+ throw e;
15004
+ });
15005
+ }),
15006
+ /**
15007
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.member&apiName=batch_delete&version=v1 click to debug }
15008
+ *
15009
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_delete&project=mail&resource=mailgroup.member&version=v1 document }
15010
+ */
15011
+ batchDelete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15012
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
15013
+ return httpInstance
15014
+ .request({
15015
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/members/batch_delete`, path),
15016
+ method: "DELETE",
15017
+ data,
15018
+ params,
15019
+ headers,
15020
+ })
15021
+ .catch((e) => {
15022
+ this.logger.error(formatErrors(e));
15023
+ throw e;
15024
+ });
15025
+ }),
14476
15026
  /**
14477
15027
  * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.member&apiName=create&version=v1 click to debug }
14478
15028
  *
@@ -14594,20 +15144,65 @@ class Client$1 {
14594
15144
  return Iterable;
14595
15145
  }),
14596
15146
  /**
14597
- * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.member&apiName=list&version=v1 click to debug }
15147
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.member&apiName=list&version=v1 click to debug }
15148
+ *
15149
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/mail-v1/mailgroup-member/list document }
15150
+ *
15151
+ * 批量获取邮件组成员
15152
+ *
15153
+ * 分页批量获取邮件组成员列表
15154
+ */
15155
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15156
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
15157
+ return httpInstance
15158
+ .request({
15159
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/members`, path),
15160
+ method: "GET",
15161
+ data,
15162
+ params,
15163
+ headers,
15164
+ })
15165
+ .catch((e) => {
15166
+ this.logger.error(formatErrors(e));
15167
+ throw e;
15168
+ });
15169
+ }),
15170
+ },
15171
+ /**
15172
+ * 邮件组权限成员
15173
+ */
15174
+ mailgroupPermissionMember: {
15175
+ /**
15176
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.permission_member&apiName=batch_create&version=v1 click to debug }
15177
+ *
15178
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_create&project=mail&resource=mailgroup.permission_member&version=v1 document }
15179
+ */
15180
+ batchCreate: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15181
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
15182
+ return httpInstance
15183
+ .request({
15184
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/permission_members/batch_create`, path),
15185
+ method: "POST",
15186
+ data,
15187
+ params,
15188
+ headers,
15189
+ })
15190
+ .catch((e) => {
15191
+ this.logger.error(formatErrors(e));
15192
+ throw e;
15193
+ });
15194
+ }),
15195
+ /**
15196
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.permission_member&apiName=batch_delete&version=v1 click to debug }
14598
15197
  *
14599
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/mail-v1/mailgroup-member/list document }
14600
- *
14601
- * 批量获取邮件组成员
14602
- *
14603
- * 分页批量获取邮件组成员列表
15198
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_delete&project=mail&resource=mailgroup.permission_member&version=v1 document }
14604
15199
  */
14605
- list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15200
+ batchDelete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
14606
15201
  const { headers, params, data, path } = yield this.formatPayload(payload, options);
14607
15202
  return httpInstance
14608
15203
  .request({
14609
- url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/members`, path),
14610
- method: "GET",
15204
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/mailgroups/:mailgroup_id/permission_members/batch_delete`, path),
15205
+ method: "DELETE",
14611
15206
  data,
14612
15207
  params,
14613
15208
  headers,
@@ -14617,11 +15212,6 @@ class Client$1 {
14617
15212
  throw e;
14618
15213
  });
14619
15214
  }),
14620
- },
14621
- /**
14622
- * 邮件组权限成员
14623
- */
14624
- mailgroupPermissionMember: {
14625
15215
  /**
14626
15216
  * {@link https://open.feishu.cn/api-explorer?project=mail&resource=mailgroup.permission_member&apiName=create&version=v1 click to debug }
14627
15217
  *
@@ -15045,6 +15635,46 @@ class Client$1 {
15045
15635
  * 公共邮箱成员
15046
15636
  */
15047
15637
  publicMailboxMember: {
15638
+ /**
15639
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=public_mailbox.member&apiName=batch_create&version=v1 click to debug }
15640
+ *
15641
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_create&project=mail&resource=public_mailbox.member&version=v1 document }
15642
+ */
15643
+ batchCreate: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15644
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
15645
+ return httpInstance
15646
+ .request({
15647
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/public_mailboxes/:public_mailbox_id/members/batch_create`, path),
15648
+ method: "POST",
15649
+ data,
15650
+ params,
15651
+ headers,
15652
+ })
15653
+ .catch((e) => {
15654
+ this.logger.error(formatErrors(e));
15655
+ throw e;
15656
+ });
15657
+ }),
15658
+ /**
15659
+ * {@link https://open.feishu.cn/api-explorer?project=mail&resource=public_mailbox.member&apiName=batch_delete&version=v1 click to debug }
15660
+ *
15661
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch_delete&project=mail&resource=public_mailbox.member&version=v1 document }
15662
+ */
15663
+ batchDelete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
15664
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
15665
+ return httpInstance
15666
+ .request({
15667
+ url: fillApiPath(`${this.domain}/open-apis/mail/v1/public_mailboxes/:public_mailbox_id/members/batch_delete`, path),
15668
+ method: "DELETE",
15669
+ data,
15670
+ params,
15671
+ headers,
15672
+ })
15673
+ .catch((e) => {
15674
+ this.logger.error(formatErrors(e));
15675
+ throw e;
15676
+ });
15677
+ }),
15048
15678
  /**
15049
15679
  * {@link https://open.feishu.cn/api-explorer?project=mail&resource=public_mailbox.member&apiName=clear&version=v1 click to debug }
15050
15680
  *
@@ -15444,6 +16074,165 @@ class Client$1 {
15444
16074
  return get(res, "data", {});
15445
16075
  }),
15446
16076
  },
16077
+ /**
16078
+ * 指标库
16079
+ */
16080
+ metricSource: {
16081
+ /**
16082
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source&apiName=list&version=v1 click to debug }
16083
+ *
16084
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source/list document }
16085
+ *
16086
+ * 获取指标库
16087
+ *
16088
+ * 获取租户下全部 OKR 指标库(仅限 OKR 企业版使用)
16089
+ */
16090
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16091
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16092
+ return httpInstance
16093
+ .request({
16094
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources`, path),
16095
+ method: "GET",
16096
+ data,
16097
+ params,
16098
+ headers,
16099
+ })
16100
+ .catch((e) => {
16101
+ this.logger.error(formatErrors(e));
16102
+ throw e;
16103
+ });
16104
+ }),
16105
+ },
16106
+ /**
16107
+ * 指标项
16108
+ */
16109
+ metricSourceTableItem: {
16110
+ /**
16111
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source.table.item&apiName=batch_update&version=v1 click to debug }
16112
+ *
16113
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table-item/batch_update document }
16114
+ *
16115
+ * 批量更新指标项
16116
+ *
16117
+ * - 该接口用于批量更新多项指标,单次调用最多更新 100 条记录。接口仅限 OKR 企业版使用。;; 更新成功后 OKR 系统会给以下人员发送消息通知:;; - 首次更新目标值的人员 ;; - 已经将指标添加为 KR、且本次目标值/起始值/支撑的上级有变更的人员,不包含仅更新了进度值的人员
16118
+ */
16119
+ batchUpdate: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16120
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16121
+ return httpInstance
16122
+ .request({
16123
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources/:metric_source_id/tables/:metric_table_id/items/batch_update`, path),
16124
+ method: "PATCH",
16125
+ data,
16126
+ params,
16127
+ headers,
16128
+ })
16129
+ .catch((e) => {
16130
+ this.logger.error(formatErrors(e));
16131
+ throw e;
16132
+ });
16133
+ }),
16134
+ /**
16135
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source.table.item&apiName=get&version=v1 click to debug }
16136
+ *
16137
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table-item/get document }
16138
+ *
16139
+ * 获取指标项详情
16140
+ *
16141
+ * 获取某项指标的具体内容(仅限 OKR 企业版使用)
16142
+ */
16143
+ get: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16144
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16145
+ return httpInstance
16146
+ .request({
16147
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources/:metric_source_id/tables/:metric_table_id/items/:metric_item_id`, path),
16148
+ method: "GET",
16149
+ data,
16150
+ params,
16151
+ headers,
16152
+ })
16153
+ .catch((e) => {
16154
+ this.logger.error(formatErrors(e));
16155
+ throw e;
16156
+ });
16157
+ }),
16158
+ /**
16159
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source.table.item&apiName=list&version=v1 click to debug }
16160
+ *
16161
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table-item/list document }
16162
+ *
16163
+ * 获取指标项
16164
+ *
16165
+ * 获取指定指标表下的所有指标项(仅限 OKR 企业版使用)
16166
+ */
16167
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16168
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16169
+ return httpInstance
16170
+ .request({
16171
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources/:metric_source_id/tables/:metric_table_id/items`, path),
16172
+ method: "GET",
16173
+ data,
16174
+ params,
16175
+ headers,
16176
+ })
16177
+ .catch((e) => {
16178
+ this.logger.error(formatErrors(e));
16179
+ throw e;
16180
+ });
16181
+ }),
16182
+ /**
16183
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source.table.item&apiName=patch&version=v1 click to debug }
16184
+ *
16185
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table-item/patch document }
16186
+ *
16187
+ * 更新指标项
16188
+ *
16189
+ * - 该接口用于更新某项指标,接口仅限 OKR 企业版使用。;; 更新成功后 OKR 系统会给以下人员发送消息通知:;; - 首次更新目标值的人员 ;; - 已经将指标添加为 KR、且本次目标值/起始值/支撑的上级有变更的人员,不包含仅更新了进度值的人员
16190
+ */
16191
+ patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16192
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16193
+ return httpInstance
16194
+ .request({
16195
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources/:metric_source_id/tables/:metric_table_id/items/:metric_item_id`, path),
16196
+ method: "PATCH",
16197
+ data,
16198
+ params,
16199
+ headers,
16200
+ })
16201
+ .catch((e) => {
16202
+ this.logger.error(formatErrors(e));
16203
+ throw e;
16204
+ });
16205
+ }),
16206
+ },
16207
+ /**
16208
+ * 指标表
16209
+ */
16210
+ metricSourceTable: {
16211
+ /**
16212
+ * {@link https://open.feishu.cn/api-explorer?project=okr&resource=metric_source.table&apiName=list&version=v1 click to debug }
16213
+ *
16214
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/okr-v1/metric_source-table/list document }
16215
+ *
16216
+ * 获取指标表
16217
+ *
16218
+ * 获取指定指标库下有哪些指标表(仅限 OKR 企业版使用)
16219
+ */
16220
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
16221
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
16222
+ return httpInstance
16223
+ .request({
16224
+ url: fillApiPath(`${this.domain}/open-apis/okr/v1/metric_sources/:metric_source_id/tables`, path),
16225
+ method: "GET",
16226
+ data,
16227
+ params,
16228
+ headers,
16229
+ })
16230
+ .catch((e) => {
16231
+ this.logger.error(formatErrors(e));
16232
+ throw e;
16233
+ });
16234
+ }),
16235
+ },
15447
16236
  /**
15448
16237
  * OKR
15449
16238
  */
@@ -16538,7 +17327,7 @@ class Client$1 {
16538
17327
  }),
16539
17328
  },
16540
17329
  /**
16541
- * 单元格
17330
+ * 工作表
16542
17331
  */
16543
17332
  spreadsheetSheet: {
16544
17333
  /**
@@ -17794,83 +18583,6 @@ class Client$1 {
17794
18583
  * 视频会议
17795
18584
  */
17796
18585
  this.vc = {
17797
- /**
17798
- * 告警中心
17799
- */
17800
- alert: {
17801
- listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
17802
- const { headers, params, data, path } = yield this.formatPayload(payload, options);
17803
- const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
17804
- const res = yield httpInstance
17805
- .request({
17806
- url: fillApiPath(`${this.domain}/open-apis/vc/v1/alerts`, path),
17807
- method: "GET",
17808
- headers: pickBy(innerPayload.headers, identity),
17809
- params: pickBy(innerPayload.params, identity),
17810
- })
17811
- .catch((e) => {
17812
- this.logger.error(formatErrors(e));
17813
- });
17814
- return res;
17815
- });
17816
- const Iterable = {
17817
- [Symbol.asyncIterator]() {
17818
- return __asyncGenerator(this, arguments, function* _a() {
17819
- let hasMore = true;
17820
- let pageToken;
17821
- while (hasMore) {
17822
- try {
17823
- const res = yield __await(sendRequest({
17824
- headers,
17825
- params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
17826
- data,
17827
- }));
17828
- const _b = get(res, "data") || {}, {
17829
- // @ts-ignore
17830
- has_more,
17831
- // @ts-ignore
17832
- page_token,
17833
- // @ts-ignore
17834
- next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
17835
- yield yield __await(rest);
17836
- hasMore = Boolean(has_more);
17837
- pageToken = page_token || next_page_token;
17838
- }
17839
- catch (e) {
17840
- yield yield __await(null);
17841
- break;
17842
- }
17843
- }
17844
- });
17845
- },
17846
- };
17847
- return Iterable;
17848
- }),
17849
- /**
17850
- * {@link https://open.feishu.cn/api-explorer?project=vc&resource=alert&apiName=list&version=v1 click to debug }
17851
- *
17852
- * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/vc-v1/alert/list document }
17853
- *
17854
- * 获取告警记录
17855
- *
17856
- * 获取特定条件下租户的设备告警记录
17857
- */
17858
- list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
17859
- const { headers, params, data, path } = yield this.formatPayload(payload, options);
17860
- return httpInstance
17861
- .request({
17862
- url: fillApiPath(`${this.domain}/open-apis/vc/v1/alerts`, path),
17863
- method: "GET",
17864
- data,
17865
- params,
17866
- headers,
17867
- })
17868
- .catch((e) => {
17869
- this.logger.error(formatErrors(e));
17870
- throw e;
17871
- });
17872
- }),
17873
- },
17874
18586
  /**
17875
18587
  * 导出
17876
18588
  */
@@ -19697,7 +20409,9 @@ class AppTicketManager {
19697
20409
  var _a;
19698
20410
  return __awaiter(this, void 0, void 0, function* () {
19699
20411
  if (this.appType === AppType.ISV) {
19700
- const appTicket = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CAppTicket));
20412
+ const appTicket = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CAppTicket, {
20413
+ namespace: this.appId
20414
+ }));
19701
20415
  if (!appTicket) {
19702
20416
  this.requestAppTicket();
19703
20417
  }
@@ -19720,7 +20434,9 @@ class AppTicketManager {
19720
20434
  getAppTicket() {
19721
20435
  var _a;
19722
20436
  return __awaiter(this, void 0, void 0, function* () {
19723
- const appTicket = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CAppTicket));
20437
+ const appTicket = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CAppTicket, {
20438
+ namespace: this.appId
20439
+ }));
19724
20440
  if (appTicket) {
19725
20441
  this.logger.debug('use cache app ticket');
19726
20442
  return appTicket;
@@ -19752,7 +20468,9 @@ class TokenManager {
19752
20468
  getCustomTenantAccessToken() {
19753
20469
  var _a, _b;
19754
20470
  return __awaiter(this, void 0, void 0, function* () {
19755
- const cachedTenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CTenantAccessToken));
20471
+ const cachedTenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(CTenantAccessToken, {
20472
+ namespace: this.appId
20473
+ }));
19756
20474
  if (cachedTenantAccessToken) {
19757
20475
  this.logger.debug('use cache token');
19758
20476
  return cachedTenantAccessToken;
@@ -19769,7 +20487,9 @@ class TokenManager {
19769
20487
  });
19770
20488
  yield ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.set(CTenantAccessToken, tenant_access_token,
19771
20489
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
19772
- new Date().getTime() + expire * 1000 - 3 * 60 * 1000));
20490
+ new Date().getTime() + expire * 1000 - 3 * 60 * 1000, {
20491
+ namespace: this.appId
20492
+ }));
19773
20493
  return tenant_access_token;
19774
20494
  });
19775
20495
  }
@@ -19780,7 +20500,9 @@ class TokenManager {
19780
20500
  this.logger.error('market app request need tenant key');
19781
20501
  return undefined;
19782
20502
  }
19783
- const tenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(`larkMarketAccessToken${tenantKey}`));
20503
+ const tenantAccessToken = yield ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.get(`larkMarketAccessToken${tenantKey}`, {
20504
+ namespace: this.appId
20505
+ }));
19784
20506
  if (tenantAccessToken) {
19785
20507
  this.logger.debug('use cache token');
19786
20508
  return tenantAccessToken;
@@ -19817,7 +20539,9 @@ class TokenManager {
19817
20539
  // 设置tenant_access_token
19818
20540
  yield this.cache.set(`larkMarketAccessToken${tenantKey}`, tenant_access_token,
19819
20541
  // Due to the time-consuming network, the expiration time needs to be 3 minutes earlier
19820
- new Date().getTime() + expire * 1000 - 3 * 60 * 1000);
20542
+ new Date().getTime() + expire * 1000 - 3 * 60 * 1000, {
20543
+ namespace: this.appId
20544
+ });
19821
20545
  return tenant_access_token;
19822
20546
  });
19823
20547
  }
@@ -20043,9 +20767,11 @@ class EventDispatcher {
20043
20767
  registerAppTicketHandle() {
20044
20768
  this.register({
20045
20769
  app_ticket: (data) => __awaiter(this, void 0, void 0, function* () {
20046
- const { app_ticket } = data;
20770
+ const { app_ticket, app_id } = data;
20047
20771
  if (app_ticket) {
20048
- yield this.cache.set(CAppTicket, app_ticket);
20772
+ yield this.cache.set(CAppTicket, app_ticket, undefined, {
20773
+ namespace: app_id
20774
+ });
20049
20775
  this.logger.debug('set app ticket');
20050
20776
  }
20051
20777
  else {
@@ -20106,9 +20832,11 @@ class CardActionHandler {
20106
20832
  registerAppTicketHandle() {
20107
20833
  this.register({
20108
20834
  app_ticket: (data) => __awaiter(this, void 0, void 0, function* () {
20109
- const { app_ticket } = data;
20835
+ const { app_ticket, app_id } = data;
20110
20836
  if (app_ticket) {
20111
- yield this.cache.set(CAppTicket, app_ticket);
20837
+ yield this.cache.set(CAppTicket, app_ticket, undefined, {
20838
+ namespace: app_id
20839
+ });
20112
20840
  this.logger.debug('set app ticket');
20113
20841
  }
20114
20842
  else {