@larksuiteoapi/node-sdk 1.39.0 → 1.40.1

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/es/index.js CHANGED
@@ -13,7 +13,6 @@
13
13
  import get from 'lodash.get';
14
14
  import axios, { AxiosError } from 'axios';
15
15
  import crypto from 'crypto';
16
- import pick from 'lodash.pick';
17
16
  import { stringify } from 'qs';
18
17
  import identity from 'lodash.identity';
19
18
  import pickBy from 'lodash.pickby';
@@ -219,6 +218,19 @@ const assert = (predication, callback) => __awaiter(void 0, void 0, void 0, func
219
218
 
220
219
  const formatUrl = (url) => (url ? url.replace(/^\//, '') : '');
221
220
 
221
+ const pick = (obj, keys = []) => {
222
+ const result = {};
223
+ if (!obj) {
224
+ return result;
225
+ }
226
+ keys.forEach(key => {
227
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
228
+ result[key] = obj[key];
229
+ }
230
+ });
231
+ return result;
232
+ };
233
+
222
234
  const formatErrors = (e) => {
223
235
  if (e instanceof AxiosError) {
224
236
  const { message, response, request, config } = pick(e, [
@@ -1305,7 +1317,7 @@ class Client$_ extends Client$$ {
1305
1317
  constructor() {
1306
1318
  super(...arguments);
1307
1319
  /**
1308
- * 管理后台-行为审计
1320
+ * 管理后台-密码
1309
1321
  */
1310
1322
  this.admin = {
1311
1323
  /**
@@ -3529,6 +3541,81 @@ class Client$Y extends Client$Z {
3529
3541
  throw e;
3530
3542
  });
3531
3543
  }),
3544
+ listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
3545
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
3546
+ const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
3547
+ const res = yield this.httpInstance
3548
+ .request({
3549
+ url: fillApiPath(`${this.domain}/open-apis/application/v6/applications`, path),
3550
+ method: "GET",
3551
+ headers: pickBy(innerPayload.headers, identity),
3552
+ params: pickBy(innerPayload.params, identity),
3553
+ data,
3554
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
3555
+ })
3556
+ .catch((e) => {
3557
+ this.logger.error(formatErrors(e));
3558
+ });
3559
+ return res;
3560
+ });
3561
+ const Iterable = {
3562
+ [Symbol.asyncIterator]() {
3563
+ return __asyncGenerator(this, arguments, function* _a() {
3564
+ let hasMore = true;
3565
+ let pageToken;
3566
+ while (hasMore) {
3567
+ try {
3568
+ const res = yield __await(sendRequest({
3569
+ headers,
3570
+ params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
3571
+ data,
3572
+ }));
3573
+ const _b = get(res, "data") || {}, {
3574
+ // @ts-ignore
3575
+ has_more,
3576
+ // @ts-ignore
3577
+ page_token,
3578
+ // @ts-ignore
3579
+ next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
3580
+ yield yield __await(rest);
3581
+ hasMore = Boolean(has_more);
3582
+ pageToken = page_token || next_page_token;
3583
+ }
3584
+ catch (e) {
3585
+ yield yield __await(null);
3586
+ break;
3587
+ }
3588
+ }
3589
+ });
3590
+ },
3591
+ };
3592
+ return Iterable;
3593
+ }),
3594
+ /**
3595
+ * {@link https://open.feishu.cn/api-explorer?project=application&resource=application&apiName=list&version=v6 click to debug }
3596
+ *
3597
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application/list document }
3598
+ *
3599
+ * 获取企业安装的应用
3600
+ *
3601
+ * 该接口用于查询企业安装的应用列表,只能被企业自建应用调用。
3602
+ */
3603
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
3604
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
3605
+ return this.httpInstance
3606
+ .request({
3607
+ url: fillApiPath(`${this.domain}/open-apis/application/v6/applications`, path),
3608
+ method: "GET",
3609
+ data,
3610
+ params,
3611
+ headers,
3612
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
3613
+ })
3614
+ .catch((e) => {
3615
+ this.logger.error(formatErrors(e));
3616
+ throw e;
3617
+ });
3618
+ }),
3532
3619
  /**
3533
3620
  * {@link https://open.feishu.cn/api-explorer?project=application&resource=application&apiName=patch&version=v6 click to debug }
3534
3621
  *
@@ -4235,6 +4322,83 @@ class Client$Y extends Client$Z {
4235
4322
  throw e;
4236
4323
  });
4237
4324
  }),
4325
+ listWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
4326
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
4327
+ const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
4328
+ const res = yield this.httpInstance
4329
+ .request({
4330
+ url: fillApiPath(`${this.domain}/open-apis/application/v6/applications`, path),
4331
+ method: "GET",
4332
+ headers: pickBy(innerPayload.headers, identity),
4333
+ params: pickBy(innerPayload.params, identity),
4334
+ data,
4335
+ paramsSerializer: (params) => stringify(params, {
4336
+ arrayFormat: "repeat",
4337
+ }),
4338
+ })
4339
+ .catch((e) => {
4340
+ this.logger.error(formatErrors(e));
4341
+ });
4342
+ return res;
4343
+ });
4344
+ const Iterable = {
4345
+ [Symbol.asyncIterator]() {
4346
+ return __asyncGenerator(this, arguments, function* _a() {
4347
+ let hasMore = true;
4348
+ let pageToken;
4349
+ while (hasMore) {
4350
+ try {
4351
+ const res = yield __await(sendRequest({
4352
+ headers,
4353
+ params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
4354
+ data,
4355
+ }));
4356
+ const _b = get(res, "data") || {}, {
4357
+ // @ts-ignore
4358
+ has_more,
4359
+ // @ts-ignore
4360
+ page_token,
4361
+ // @ts-ignore
4362
+ next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
4363
+ yield yield __await(rest);
4364
+ hasMore = Boolean(has_more);
4365
+ pageToken = page_token || next_page_token;
4366
+ }
4367
+ catch (e) {
4368
+ yield yield __await(null);
4369
+ break;
4370
+ }
4371
+ }
4372
+ });
4373
+ },
4374
+ };
4375
+ return Iterable;
4376
+ }),
4377
+ /**
4378
+ * {@link https://open.feishu.cn/api-explorer?project=application&resource=application&apiName=list&version=v6 click to debug }
4379
+ *
4380
+ * {@link https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application/list document }
4381
+ *
4382
+ * 获取企业安装的应用
4383
+ *
4384
+ * 该接口用于查询企业安装的应用列表,只能被企业自建应用调用。
4385
+ */
4386
+ list: (payload, options) => __awaiter(this, void 0, void 0, function* () {
4387
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
4388
+ return this.httpInstance
4389
+ .request({
4390
+ url: fillApiPath(`${this.domain}/open-apis/application/v6/applications`, path),
4391
+ method: "GET",
4392
+ data,
4393
+ params,
4394
+ headers,
4395
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
4396
+ })
4397
+ .catch((e) => {
4398
+ this.logger.error(formatErrors(e));
4399
+ throw e;
4400
+ });
4401
+ }),
4238
4402
  /**
4239
4403
  * {@link https://open.feishu.cn/api-explorer?project=application&resource=application&apiName=patch&version=v6 click to debug }
4240
4404
  *
@@ -4527,7 +4691,7 @@ class Client$X extends Client$Y {
4527
4691
  */
4528
4692
  this.approval = {
4529
4693
  /**
4530
- * 事件
4694
+ * 原生审批定义
4531
4695
  */
4532
4696
  approval: {
4533
4697
  /**
@@ -5324,7 +5488,7 @@ class Client$X extends Client$Y {
5324
5488
  }),
5325
5489
  },
5326
5490
  /**
5327
- * 审批查询
5491
+ * 原生审批任务
5328
5492
  */
5329
5493
  task: {
5330
5494
  /**
@@ -5530,7 +5694,7 @@ class Client$X extends Client$Y {
5530
5694
  },
5531
5695
  v4: {
5532
5696
  /**
5533
- * 事件
5697
+ * 原生审批定义
5534
5698
  */
5535
5699
  approval: {
5536
5700
  /**
@@ -6335,7 +6499,7 @@ class Client$X extends Client$Y {
6335
6499
  }),
6336
6500
  },
6337
6501
  /**
6338
- * 审批查询
6502
+ * 原生审批任务
6339
6503
  */
6340
6504
  task: {
6341
6505
  /**
@@ -17270,7 +17434,7 @@ class Client$L extends Client$M {
17270
17434
  constructor() {
17271
17435
  super(...arguments);
17272
17436
  /**
17273
- * 搜索
17437
+ * 通讯录
17274
17438
  */
17275
17439
  this.contact = {
17276
17440
  /**
@@ -29738,6 +29902,155 @@ class Client$I extends Client$J {
29738
29902
  });
29739
29903
  }),
29740
29904
  },
29905
+ /**
29906
+ * employees.additional_job
29907
+ */
29908
+ employeesAdditionalJob: {
29909
+ batchWithIterator: (payload, options) => __awaiter(this, void 0, void 0, function* () {
29910
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
29911
+ const sendRequest = (innerPayload) => __awaiter(this, void 0, void 0, function* () {
29912
+ const res = yield this.httpInstance
29913
+ .request({
29914
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/employees/additional_jobs/batch`, path),
29915
+ method: "POST",
29916
+ headers: pickBy(innerPayload.headers, identity),
29917
+ params: pickBy(innerPayload.params, identity),
29918
+ data,
29919
+ paramsSerializer: (params) => stringify(params, {
29920
+ arrayFormat: "repeat",
29921
+ }),
29922
+ })
29923
+ .catch((e) => {
29924
+ this.logger.error(formatErrors(e));
29925
+ });
29926
+ return res;
29927
+ });
29928
+ const Iterable = {
29929
+ [Symbol.asyncIterator]() {
29930
+ return __asyncGenerator(this, arguments, function* _a() {
29931
+ let hasMore = true;
29932
+ let pageToken;
29933
+ while (hasMore) {
29934
+ try {
29935
+ const res = yield __await(sendRequest({
29936
+ headers,
29937
+ params: Object.assign(Object.assign({}, params), { page_token: pageToken }),
29938
+ data,
29939
+ }));
29940
+ const _b = get(res, "data") || {}, {
29941
+ // @ts-ignore
29942
+ has_more,
29943
+ // @ts-ignore
29944
+ page_token,
29945
+ // @ts-ignore
29946
+ next_page_token } = _b, rest = __rest(_b, ["has_more", "page_token", "next_page_token"]);
29947
+ yield yield __await(rest);
29948
+ hasMore = Boolean(has_more);
29949
+ pageToken = page_token || next_page_token;
29950
+ }
29951
+ catch (e) {
29952
+ yield yield __await(null);
29953
+ break;
29954
+ }
29955
+ }
29956
+ });
29957
+ },
29958
+ };
29959
+ return Iterable;
29960
+ }),
29961
+ /**
29962
+ * {@link https://open.feishu.cn/api-explorer?project=corehr&resource=employees.additional_job&apiName=batch&version=v2 click to debug }
29963
+ *
29964
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=batch&project=corehr&resource=employees.additional_job&version=v2 document }
29965
+ *
29966
+ * 批量查询兼职信息
29967
+ */
29968
+ batch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
29969
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
29970
+ return this.httpInstance
29971
+ .request({
29972
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/employees/additional_jobs/batch`, path),
29973
+ method: "POST",
29974
+ data,
29975
+ params,
29976
+ headers,
29977
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
29978
+ })
29979
+ .catch((e) => {
29980
+ this.logger.error(formatErrors(e));
29981
+ throw e;
29982
+ });
29983
+ }),
29984
+ /**
29985
+ * {@link https://open.feishu.cn/api-explorer?project=corehr&resource=employees.additional_job&apiName=create&version=v2 click to debug }
29986
+ *
29987
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=corehr&resource=employees.additional_job&version=v2 document }
29988
+ *
29989
+ * 创建兼职
29990
+ */
29991
+ create: (payload, options) => __awaiter(this, void 0, void 0, function* () {
29992
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
29993
+ return this.httpInstance
29994
+ .request({
29995
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/employees/additional_jobs`, path),
29996
+ method: "POST",
29997
+ data,
29998
+ params,
29999
+ headers,
30000
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
30001
+ })
30002
+ .catch((e) => {
30003
+ this.logger.error(formatErrors(e));
30004
+ throw e;
30005
+ });
30006
+ }),
30007
+ /**
30008
+ * {@link https://open.feishu.cn/api-explorer?project=corehr&resource=employees.additional_job&apiName=delete&version=v2 click to debug }
30009
+ *
30010
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=corehr&resource=employees.additional_job&version=v2 document }
30011
+ *
30012
+ * 删除兼职
30013
+ */
30014
+ delete: (payload, options) => __awaiter(this, void 0, void 0, function* () {
30015
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
30016
+ return this.httpInstance
30017
+ .request({
30018
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/employees/additional_jobs/:additional_job_id`, path),
30019
+ method: "DELETE",
30020
+ data,
30021
+ params,
30022
+ headers,
30023
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
30024
+ })
30025
+ .catch((e) => {
30026
+ this.logger.error(formatErrors(e));
30027
+ throw e;
30028
+ });
30029
+ }),
30030
+ /**
30031
+ * {@link https://open.feishu.cn/api-explorer?project=corehr&resource=employees.additional_job&apiName=patch&version=v2 click to debug }
30032
+ *
30033
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=corehr&resource=employees.additional_job&version=v2 document }
30034
+ *
30035
+ * 更新兼职
30036
+ */
30037
+ patch: (payload, options) => __awaiter(this, void 0, void 0, function* () {
30038
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
30039
+ return this.httpInstance
30040
+ .request({
30041
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/employees/additional_jobs/:additional_job_id`, path),
30042
+ method: "PATCH",
30043
+ data,
30044
+ params,
30045
+ headers,
30046
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
30047
+ })
30048
+ .catch((e) => {
30049
+ this.logger.error(formatErrors(e));
30050
+ throw e;
30051
+ });
30052
+ }),
30053
+ },
29741
30054
  /**
29742
30055
  * employees.bp
29743
30056
  */
@@ -30243,6 +30556,32 @@ class Client$I extends Client$J {
30243
30556
  });
30244
30557
  }),
30245
30558
  },
30559
+ /**
30560
+ * offboarding
30561
+ */
30562
+ offboarding: {
30563
+ /**
30564
+ * {@link https://open.feishu.cn/api-explorer?project=corehr&resource=offboarding&apiName=submit_v2&version=v2 click to debug }
30565
+ *
30566
+ * {@link https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=submit_v2&project=corehr&resource=offboarding&version=v2 document }
30567
+ */
30568
+ submitV2: (payload, options) => __awaiter(this, void 0, void 0, function* () {
30569
+ const { headers, params, data, path } = yield this.formatPayload(payload, options);
30570
+ return this.httpInstance
30571
+ .request({
30572
+ url: fillApiPath(`${this.domain}/open-apis/corehr/v2/offboardings/submit_v2`, path),
30573
+ method: "POST",
30574
+ data,
30575
+ params,
30576
+ headers,
30577
+ paramsSerializer: (params) => stringify(params, { arrayFormat: "repeat" }),
30578
+ })
30579
+ .catch((e) => {
30580
+ this.logger.error(formatErrors(e));
30581
+ throw e;
30582
+ });
30583
+ }),
30584
+ },
30246
30585
  /**
30247
30586
  * person
30248
30587
  */
@@ -32850,7 +33189,7 @@ class Client$E extends Client$F {
32850
33189
  }),
32851
33190
  },
32852
33191
  /**
32853
- * 文件夹
33192
+ * 文件
32854
33193
  */
32855
33194
  file: {
32856
33195
  /**
@@ -34670,7 +35009,7 @@ class Client$E extends Client$F {
34670
35009
  }),
34671
35010
  },
34672
35011
  /**
34673
- * 文件夹
35012
+ * 文件
34674
35013
  */
34675
35014
  file: {
34676
35015
  /**
@@ -40106,7 +40445,7 @@ class Client$u extends Client$v {
40106
40445
  }),
40107
40446
  },
40108
40447
  /**
40109
- * 投递
40448
+ * 入职
40110
40449
  */
40111
40450
  application: {
40112
40451
  /**
@@ -45529,7 +45868,7 @@ class Client$u extends Client$v {
45529
45868
  }),
45530
45869
  },
45531
45870
  /**
45532
- * 投递
45871
+ * 入职
45533
45872
  */
45534
45873
  application: {
45535
45874
  /**
@@ -52280,7 +52619,7 @@ class Client$s extends Client$t {
52280
52619
  }),
52281
52620
  },
52282
52621
  /**
52283
- * 消息
52622
+ * 消息加急
52284
52623
  */
52285
52624
  message: {
52286
52625
  /**
@@ -54483,7 +54822,7 @@ class Client$s extends Client$t {
54483
54822
  }),
54484
54823
  },
54485
54824
  /**
54486
- * 消息
54825
+ * 消息加急
54487
54826
  */
54488
54827
  message: {
54489
54828
  /**