@tapd/tapd-node-sdk 1.31.0 → 1.32.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,29 +4,16 @@
4
4
  > 推荐版本: NodeJs 12.13.0+
5
5
 
6
6
  ## Install
7
- 设置npm工具使用软件源的registry
8
- ```
9
- npm config set registry https://mirrors.tencent.com/npm/
10
- ```
11
7
  安装SDK包
12
8
  ```
13
- npm install @tencent/tapd-node-sdk
9
+ npm install @tapd/tapd-node-sdk
14
10
  ```
15
11
 
16
12
  ## Usage
17
13
 
18
- #### 申请应用
19
- 1. 申请和使用应用
20
- https://o.tapd.woa.com/document/api-doc/API%E6%96%87%E6%A1%A3/%E5%BC%80%E6%94%BE%E5%B9%B3%E5%8F%B0%E5%BA%94%E7%94%A8API%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95.html
21
-
22
- 2. 复制应用ID和密钥
23
- https://o.tapd.woa.com/admin/{你的应用标识}/dashboard
24
- ![Alt](https://o.tapd.woa.com/document/img/tapd_20417300_1638862843_15.png)
25
-
26
-
27
14
  #### DEMO
28
15
  ```javascript
29
- const SDK = require('@tencent/tapd-node-sdk');
16
+ const SDK = require('@tapd/tapd-node-sdk');
30
17
 
31
18
  const api = new SDK({
32
19
  client: 'gggg123', // 你的应用CODE
@@ -70,30 +57,4 @@ api.uploadImage({
70
57
  }).catch(e => console.log(e));
71
58
  ```
72
59
 
73
- #### [查看所有SDK方法和参数](https://o.tapd.woa.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/)
74
-
75
- #### IDC 网络的使用
76
- 1. 怎看自己是不是IDC网络, 查看这个[链接](https://iwiki.woa.com/tencent/static/iwiki-editor-pro/dist/preview.html?space=&page=1227785302&id=131410&name=6997554869969258912(1).MP4&size=1160018&language=zh)
77
-
78
- 2. 如果是IDC网络怎么设置
79
- ```javascript
80
- const SDK = require('@tencent/tapd-node-sdk');
81
-
82
- const api = new SDK({
83
- client: 'gggg123', // 你的应用CODE
84
- secret: '112A5B9F-D7B9-EC9C-B688-24E44F5043C4', // 密钥 注意保密
85
- env: 'idc'
86
- });
87
-
88
- ```
89
-
90
-
91
- ## Artifact
92
- https://mirrors.tencent.com/#/private/npm/detail?repo_id=537&project_name=%40tencent%2Ftapd-node-sdk&search_label=package_name&search_value=tapd-node-sdk&page_num=1
93
-
94
- ## 其他问题
95
-
96
- 提issue可能看不到,找tapd客服解决反馈。
97
-
98
- ## Contributions
99
- 欢迎参与SDK共建!开发&共建流程,请参照 [contributing.md](https://git.woa.com/tapd-plugin-core/tplugin-sdk/blob/dev/CONTRIBUTING.md)。
60
+ #### [查看所有SDK方法和参数](https://o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapd/tapd-node-sdk",
3
- "version": "1.31.0",
3
+ "version": "1.32.0-beta.10",
4
4
  "description": "node sdk for open tapd ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -1566,6 +1566,24 @@ module.exports = class API extends SDK {
1566
1566
  );
1567
1567
  }
1568
1568
 
1569
+ /**
1570
+ * @description 获取单个图片下载链接
1571
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/attachment/get_image.html
1572
+ * @scope attachment#r
1573
+
1574
+ * @params - {integer} workspace_id 项目ID
1575
+ * @params - {string} image_path 图片路径, 支持完整url地址, 图片所属项目必须和传入的项目id一致
1576
+ */
1577
+ getImage(...args) {
1578
+ return this.oAuthRequest.apply(
1579
+ this, [
1580
+ '/files/get_image',
1581
+ 'GET',
1582
+ ...args
1583
+ ]
1584
+ );
1585
+ }
1586
+
1569
1587
  /**
1570
1588
  * @description 复制缺陷
1571
1589
  * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/bug/copy_bug.html
@@ -7435,6 +7453,390 @@ module.exports = class API extends SDK {
7435
7453
  );
7436
7454
  }
7437
7455
 
7456
+ /**
7457
+ * @description 项目集关联项目
7458
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/program/program_relate_workspace.html
7459
+ * @scope program#w
7460
+
7461
+ */
7462
+ programRelateWorkspace(...args) {
7463
+ return this.oAuthRequest.apply(
7464
+ this, [
7465
+ '/program/program_relate_workspace',
7466
+ 'POST',
7467
+ ...args
7468
+ ]
7469
+ );
7470
+ }
7471
+
7472
+ /**
7473
+ * @description 项目集批量关联/取消关联业务对象
7474
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/program/program_bind_entities.html
7475
+ * @scope program#w
7476
+
7477
+ */
7478
+ programBindEntities(...args) {
7479
+ return this.oAuthRequest.apply(
7480
+ this, [
7481
+ '/program/program_bind_entities',
7482
+ 'POST',
7483
+ ...args
7484
+ ]
7485
+ );
7486
+ }
7487
+
7488
+ /**
7489
+ * @description 添加工作项
7490
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/add_mini_item.html
7491
+ * @scope mini_item#w
7492
+
7493
+ */
7494
+ addMiniItem(...args) {
7495
+ return this.oAuthRequest.apply(
7496
+ this, [
7497
+ '/mini_items',
7498
+ 'POST',
7499
+ ...args
7500
+ ]
7501
+ );
7502
+ }
7503
+
7504
+ /**
7505
+ * @description 更新工作项
7506
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/update_mini_item.html
7507
+ * @scope mini_item#w
7508
+
7509
+ */
7510
+ updateMiniItem(...args) {
7511
+ return this.oAuthRequest.apply(
7512
+ this, [
7513
+ '/mini_items',
7514
+ 'POST',
7515
+ ...args
7516
+ ]
7517
+ );
7518
+ }
7519
+
7520
+ /**
7521
+ * @description 获取工作项
7522
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_items.html
7523
+ * @scope mini_item#r
7524
+
7525
+ */
7526
+ getMiniItems(...args) {
7527
+ return this.oAuthRequest.apply(
7528
+ this, [
7529
+ '/mini_items',
7530
+ 'GET',
7531
+ ...args
7532
+ ]
7533
+ );
7534
+ }
7535
+
7536
+ /**
7537
+ * @description 获取工作项数量
7538
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_items_count.html
7539
+ * @scope mini_item#r
7540
+
7541
+ */
7542
+ getMiniItemsCount(...args) {
7543
+ return this.oAuthRequest.apply(
7544
+ this, [
7545
+ '/mini_items/count',
7546
+ 'GET',
7547
+ ...args
7548
+ ]
7549
+ );
7550
+ }
7551
+
7552
+ /**
7553
+ * @description 创建分组
7554
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/add_mini_item_category.html
7555
+ * @scope mini_item#w
7556
+
7557
+ */
7558
+ addMiniItemCategory(...args) {
7559
+ return this.oAuthRequest.apply(
7560
+ this, [
7561
+ '/mini_item_categories',
7562
+ 'POST',
7563
+ ...args
7564
+ ]
7565
+ );
7566
+ }
7567
+
7568
+ /**
7569
+ * @description 更新分组
7570
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/update_mini_item_category.html
7571
+ * @scope mini_item#w
7572
+
7573
+ */
7574
+ updateMiniItemCategory(...args) {
7575
+ return this.oAuthRequest.apply(
7576
+ this, [
7577
+ '/mini_item_categories',
7578
+ 'POST',
7579
+ ...args
7580
+ ]
7581
+ );
7582
+ }
7583
+
7584
+ /**
7585
+ * @description 获取分组
7586
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_categories.html
7587
+ * @scope mini_item#r
7588
+
7589
+ */
7590
+ getMiniItemCategories(...args) {
7591
+ return this.oAuthRequest.apply(
7592
+ this, [
7593
+ '/mini_item_categories',
7594
+ 'GET',
7595
+ ...args
7596
+ ]
7597
+ );
7598
+ }
7599
+
7600
+ /**
7601
+ * @description 获取分组数量
7602
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_categories_count.html
7603
+ * @scope mini_item#r
7604
+
7605
+ */
7606
+ getMiniItemCategoriesCount(...args) {
7607
+ return this.oAuthRequest.apply(
7608
+ this, [
7609
+ '/mini_item_categories/count',
7610
+ 'GET',
7611
+ ...args
7612
+ ]
7613
+ );
7614
+ }
7615
+
7616
+ /**
7617
+ * @description 获取工作项动态
7618
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_changes.html
7619
+ * @scope mini_item#r
7620
+
7621
+ */
7622
+ getMiniItemChanges(...args) {
7623
+ return this.oAuthRequest.apply(
7624
+ this, [
7625
+ '/mini_item_changes',
7626
+ 'GET',
7627
+ ...args
7628
+ ]
7629
+ );
7630
+ }
7631
+
7632
+ /**
7633
+ * @description 获取工作项动态数量
7634
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_changes_count.html
7635
+ * @scope mini_item#r
7636
+
7637
+ */
7638
+ getMiniItemChangesCount(...args) {
7639
+ return this.oAuthRequest.apply(
7640
+ this, [
7641
+ '/mini_item_changes/count',
7642
+ 'GET',
7643
+ ...args
7644
+ ]
7645
+ );
7646
+ }
7647
+
7648
+ /**
7649
+ * @description 获取工作项自定义字段配置
7650
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_custom_fields_settings.html
7651
+ * @scope mini_item#r
7652
+
7653
+ */
7654
+ getMiniItemCustomFieldsSettings(...args) {
7655
+ return this.oAuthRequest.apply(
7656
+ this, [
7657
+ '/mini_items/custom_fields_settings',
7658
+ 'GET',
7659
+ ...args
7660
+ ]
7661
+ );
7662
+ }
7663
+
7664
+ /**
7665
+ * @description 获取工作项所有字段的标签
7666
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_fields_label.html
7667
+ * @scope mini_item#r
7668
+
7669
+ */
7670
+ getMiniItemFieldsLabel(...args) {
7671
+ return this.oAuthRequest.apply(
7672
+ this, [
7673
+ '/mini_items/get_fields_label',
7674
+ 'GET',
7675
+ ...args
7676
+ ]
7677
+ );
7678
+ }
7679
+
7680
+ /**
7681
+ * @description 创建工作项与其他业务对象的关联关系
7682
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/create_mini_item_relation.html
7683
+ * @scope mini_item#w
7684
+
7685
+ */
7686
+ createMiniItemRelation(...args) {
7687
+ return this.oAuthRequest.apply(
7688
+ this, [
7689
+ '/mini_items/create_mini_item_relation',
7690
+ 'POST',
7691
+ ...args
7692
+ ]
7693
+ );
7694
+ }
7695
+
7696
+ /**
7697
+ * @description 获取工作项与需求的所有关联关系
7698
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_link_stories.html
7699
+ * @scope mini_item#r
7700
+
7701
+ */
7702
+ getMiniItemLinkStories(...args) {
7703
+ return this.oAuthRequest.apply(
7704
+ this, [
7705
+ '/mini_items/get_link_stories',
7706
+ 'GET',
7707
+ ...args
7708
+ ]
7709
+ );
7710
+ }
7711
+
7712
+ /**
7713
+ * @description 获取工作项与缺陷的所有关联关系
7714
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_mini_item_related_bugs.html
7715
+ * @scope mini_item#r
7716
+
7717
+ */
7718
+ getMiniItemRelatedBugs(...args) {
7719
+ return this.oAuthRequest.apply(
7720
+ this, [
7721
+ '/mini_items/get_related_bugs',
7722
+ 'GET',
7723
+ ...args
7724
+ ]
7725
+ );
7726
+ }
7727
+
7728
+ /**
7729
+ * @description 解除工作项与缺陷关联关系
7730
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/remove_mini_item_bug_relation.html
7731
+ * @scope mini_item#w
7732
+
7733
+ */
7734
+ removeMiniItemBugRelation(...args) {
7735
+ return this.oAuthRequest.apply(
7736
+ this, [
7737
+ '/mini_items/remove_mini_item_bug_relation',
7738
+ 'POST',
7739
+ ...args
7740
+ ]
7741
+ );
7742
+ }
7743
+
7744
+ /**
7745
+ * @description 获取回收站的工作项
7746
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_item/get_removed_mini_items.html
7747
+ * @scope mini_item#r
7748
+
7749
+ */
7750
+ getRemovedMiniItems(...args) {
7751
+ return this.oAuthRequest.apply(
7752
+ this, [
7753
+ '/mini_items/get_removed_mini_items',
7754
+ 'GET',
7755
+ ...args
7756
+ ]
7757
+ );
7758
+ }
7759
+
7760
+ /**
7761
+ * @description 获取空间信息
7762
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_project/get_mini_project_info.html
7763
+ * @scope mini_project#r
7764
+
7765
+ */
7766
+ getMiniProjectInfo(...args) {
7767
+ return this.oAuthRequest.apply(
7768
+ this, [
7769
+ '/workspaces/get_workspace_info',
7770
+ 'GET',
7771
+ ...args
7772
+ ]
7773
+ );
7774
+ }
7775
+
7776
+ /**
7777
+ * @description 添加空间成员
7778
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_project/add_mini_project_member.html
7779
+ * @scope mini_project#w
7780
+
7781
+ */
7782
+ addMiniProjectMember(...args) {
7783
+ return this.oAuthRequest.apply(
7784
+ this, [
7785
+ '/workspaces/add_workspace_member',
7786
+ 'POST',
7787
+ ...args
7788
+ ]
7789
+ );
7790
+ }
7791
+
7792
+ /**
7793
+ * @description 获取空间成员列表
7794
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_project/get_mini_project_users.html
7795
+ * @scope mini_project#r
7796
+
7797
+ */
7798
+ getMiniProjectUsers(...args) {
7799
+ return this.oAuthRequest.apply(
7800
+ this, [
7801
+ '/workspaces/users',
7802
+ 'GET',
7803
+ ...args
7804
+ ]
7805
+ );
7806
+ }
7807
+
7808
+ /**
7809
+ * @description 新建空间
7810
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_project/create_mini_project_oa.html
7811
+ * @scope mini_project#w
7812
+
7813
+ */
7814
+ createMiniProjectOa(...args) {
7815
+ return this.oAuthRequest.apply(
7816
+ this, [
7817
+ '/workspaces/create_mini_project_oa',
7818
+ 'POST',
7819
+ ...args
7820
+ ]
7821
+ );
7822
+ }
7823
+
7824
+ /**
7825
+ * @description 获取用户所有参与的空间
7826
+ * @link o.tapd.tencent.com/document/api-doc/API%E6%96%87%E6%A1%A3/api_reference/mini_project/get_mini_project_list_with_permission.html
7827
+ * @scope mini_project#r
7828
+
7829
+ */
7830
+ getMiniProjectListWithPermission(...args) {
7831
+ return this.oAuthRequest.apply(
7832
+ this, [
7833
+ '/workspaces/get_mini_project_list_with_permission',
7834
+ 'POST',
7835
+ ...args
7836
+ ]
7837
+ );
7838
+ }
7839
+
7438
7840
 
7439
7841
  }
7440
7842
  module.exports.FILE = FILE;
package/src/sdk.js CHANGED
@@ -12,11 +12,15 @@ class SDK {
12
12
  address = '',
13
13
  accessToken = '',
14
14
  authType = '',
15
+ corpid = '',
16
+ corpsecret = '',
15
17
  } = {}) {
16
18
  this.client = client;
17
19
  this.secret = secret;
18
20
  this.address = address;
19
21
  this.axios = Axios(this.address);
22
+ this.corpid = corpid;
23
+ this.corpsecret = corpsecret;
20
24
 
21
25
  if (authType !== '') {
22
26
  this.authType = authType;
@@ -129,6 +133,12 @@ class SDK {
129
133
  const authHeader = this.isOauth() ? `Bearer ${accessToken}` : `Basic ${Base64.encode(`${this.client}:${this.secret}`)}`;
130
134
  const upperMethod = method.toUpperCase();
131
135
 
136
+ // 添加企微数据
137
+ if (this.corpid && this.corpsecret) {
138
+ params.corpid = this.corpid;
139
+ params.corpsecret = this.corpsecret;
140
+ }
141
+
132
142
  const config = {
133
143
  ...args,
134
144
  method,