zentao-api 0.1.0 → 0.2.0-beta.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/LICENSE +2 -2
- package/README.md +103 -147
- package/dist/browser/zentao-api.global.js +1 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/client/index.d.ts +37 -0
- package/dist/client/index.js +149 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.js +6 -8
- package/dist/misc/browser-global.d.ts +1 -0
- package/dist/misc/browser-global.js +8 -0
- package/dist/misc/environment.d.ts +6 -0
- package/dist/misc/environment.js +30 -0
- package/dist/misc/errors.d.ts +25 -0
- package/dist/misc/errors.js +35 -0
- package/dist/misc/global-options.d.ts +5 -0
- package/dist/misc/global-options.js +9 -0
- package/dist/modules/generated.d.ts +8 -0
- package/dist/modules/generated.js +4226 -0
- package/dist/modules/registry.d.ts +22 -0
- package/dist/modules/registry.js +129 -0
- package/dist/modules/resolve.d.ts +7 -0
- package/dist/modules/resolve.js +196 -0
- package/dist/request/index.d.ts +7 -0
- package/dist/request/index.js +65 -0
- package/dist/types/index.d.ts +235 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +14 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +4 -0
- package/package.json +43 -77
- package/dist/types.d.ts +0 -70
- package/dist/utils.d.ts +0 -93
- package/dist/zentao-api.cjs.development.js +0 -3619
- package/dist/zentao-api.cjs.development.js.map +0 -1
- package/dist/zentao-api.cjs.production.min.js +0 -2
- package/dist/zentao-api.cjs.production.min.js.map +0 -1
- package/dist/zentao-api.esm.js +0 -3611
- package/dist/zentao-api.esm.js.map +0 -1
- package/dist/zentao-config.d.ts +0 -93
- package/dist/zentao-request-builder.d.ts +0 -120
- package/dist/zentao.d.ts +0 -175
- package/dist/zentao12.d.ts +0 -676
- package/src/index.ts +0 -5
- package/src/types.ts +0 -88
- package/src/utils.ts +0 -216
- package/src/zentao-config.ts +0 -150
- package/src/zentao-request-builder.ts +0 -227
- package/src/zentao.ts +0 -596
- package/src/zentao12.ts +0 -1272
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Sun Hao
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,190 +1,146 @@
|
|
|
1
|
-
#
|
|
1
|
+
# zentao-api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`zentao-api` 是一个面向禅道 API v2 的轻量 JavaScript/TypeScript SDK,可用于 Node.js 18+、浏览器打包工具以及 CDN/script 标签场景。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 安装
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### 安装
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install --save zentao-api
|
|
7
|
+
```sh
|
|
8
|
+
npm install zentao-api
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
通过构建 `Zentao` API 调用实例,你可以使用链式方法 ``zentao.m(moduleName).f(methodName)...get()`` 来非常方便调用禅道任何 API。
|
|
11
|
+
## 客户端
|
|
18
12
|
|
|
19
|
-
```
|
|
20
|
-
import {
|
|
13
|
+
```ts
|
|
14
|
+
import { ZentaoClient } from 'zentao-api';
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
account: 'demo',
|
|
26
|
-
password: '123456'
|
|
16
|
+
const client = new ZentaoClient({
|
|
17
|
+
baseUrl: 'https://zentao.example.com',
|
|
18
|
+
token: 'your-token',
|
|
27
19
|
});
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
const productAllResult = await zentao
|
|
31
|
-
.m('product')
|
|
32
|
-
.f('all')
|
|
33
|
-
.get();
|
|
34
|
-
|
|
35
|
-
// 输出产品列表
|
|
36
|
-
console.log('All products', productAllResult.data.products);
|
|
37
|
-
|
|
38
|
-
// 调用 product-view 获取产品详细信息
|
|
39
|
-
const productViewResult = await zentao
|
|
40
|
-
.m('product')
|
|
41
|
-
.f('view')
|
|
42
|
-
.withParams({productID: 1})
|
|
43
|
-
.get();
|
|
44
|
-
|
|
45
|
-
// 输出产品信息
|
|
46
|
-
console.log('All products', productViewResult.data.prodcut);
|
|
47
|
-
|
|
48
|
-
// 调用 prodcut-add 添加新的产品到禅道
|
|
49
|
-
const productCreateResult = await zentao
|
|
50
|
-
.m('product')
|
|
51
|
-
.f('create')
|
|
52
|
-
.post({
|
|
53
|
-
name: 'New product',
|
|
54
|
-
code: 'new_product_code'
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
if (productCreateResult.status) {
|
|
58
|
-
console.log('"New product" added.');
|
|
59
|
-
}
|
|
21
|
+
const products = await client.get('/products');
|
|
60
22
|
```
|
|
61
23
|
|
|
62
|
-
|
|
24
|
+
`baseUrl` 是禅道站点根地址。SDK 会在内部追加 `/api.php/v2`。
|
|
63
25
|
|
|
64
|
-
|
|
26
|
+
如果还没有 token:
|
|
65
27
|
|
|
66
|
-
|
|
28
|
+
```ts
|
|
29
|
+
const client = new ZentaoClient('https://zentao.example.com');
|
|
30
|
+
const token = await client.login('admin', 'password');
|
|
31
|
+
```
|
|
67
32
|
|
|
68
|
-
|
|
69
|
-
import { Zentao12 } form 'zentao-api';
|
|
33
|
+
## 全局客户端与模块请求
|
|
70
34
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
url: 'https://demo.zentao.net/',
|
|
74
|
-
account: 'demo',
|
|
75
|
-
password: '123456'
|
|
76
|
-
});
|
|
35
|
+
```ts
|
|
36
|
+
import { ZentaoClient, request, setGlobalOptions } from 'zentao-api';
|
|
77
37
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
38
|
+
ZentaoClient.init({
|
|
39
|
+
baseUrl: 'https://zentao.example.com',
|
|
40
|
+
token: 'your-token',
|
|
41
|
+
});
|
|
82
42
|
|
|
83
|
-
|
|
84
|
-
const productViewResult = await zentao.getProduct({productID: 1})
|
|
85
|
-
// 输出产品信息
|
|
86
|
-
console.log('All products', productViewResult.data.prodcut);
|
|
43
|
+
setGlobalOptions({ recPerPage: '50' });
|
|
87
44
|
|
|
88
|
-
|
|
89
|
-
const productCreateResult = await zentao.addProduct({
|
|
90
|
-
name: 'New product',
|
|
91
|
-
code: 'new_product_code'
|
|
92
|
-
});
|
|
93
|
-
if (productCreateResult.status) {
|
|
94
|
-
console.log('"New product" added.');
|
|
95
|
-
}
|
|
45
|
+
const result = await request('product/list', {});
|
|
96
46
|
```
|
|
97
47
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* addProduct
|
|
103
|
-
* addProject
|
|
104
|
-
* addTask
|
|
105
|
-
* addUser
|
|
106
|
-
* finishTask
|
|
107
|
-
* getBug
|
|
108
|
-
* getBugCreateParams
|
|
109
|
-
* getBugList
|
|
110
|
-
* getBugResolveParams
|
|
111
|
-
* getDeptList
|
|
112
|
-
* getProduct
|
|
113
|
-
* getProductCreateParams
|
|
114
|
-
* getProductList
|
|
115
|
-
* getProject
|
|
116
|
-
* getProjectCreateParams
|
|
117
|
-
* getProjectList
|
|
118
|
-
* getTask
|
|
119
|
-
* getTaskCreateParams
|
|
120
|
-
* getTaskFinishParams
|
|
121
|
-
* getTaskList
|
|
122
|
-
* getUserCreateParams
|
|
123
|
-
* getUserList
|
|
124
|
-
* resolveBug
|
|
125
|
-
|
|
126
|
-
`Zentao12` 继承自 `Zentao`,所以你仍然可以在 `Zentao12` 上调用 `zentao.m().f()...get()` 链式方法来请求禅道提供的任何 API。
|
|
127
|
-
|
|
128
|
-
你可以访问 <https://catouse.github.io/zentao-api/> 来查看所有可用 API 和详细示例。
|
|
129
|
-
|
|
130
|
-
## 开发
|
|
131
|
-
|
|
132
|
-
该项目框架基于 [`TSdx`](https://tsdx.io/),完全使用 [TypeScript](https://www.typescriptlang.org/) 开发。
|
|
133
|
-
|
|
134
|
-
如果希望参与本项目开发,可以先了解以下内容。
|
|
135
|
-
|
|
136
|
-
### 启动开发模式
|
|
137
|
-
|
|
138
|
-
在开发目录执行 `npm install` 来安装依赖,然后执行如下命令启动开发模式:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
npm start
|
|
48
|
+
单次调用的选项会覆盖全局选项:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const result = await request('bug/list', { product: 1 }, { limit: '10' });
|
|
142
52
|
```
|
|
143
53
|
|
|
144
|
-
|
|
54
|
+
## 真实环境测试
|
|
145
55
|
|
|
146
|
-
|
|
56
|
+
真实环境测试不会包含在默认 `bun test` 或 `bun run check` 中,需要显式运行:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
bun run test:real
|
|
60
|
+
```
|
|
147
61
|
|
|
148
|
-
|
|
62
|
+
如果需要保留本轮测试创建出的临时数据以便手动检查:
|
|
149
63
|
|
|
150
|
-
```
|
|
151
|
-
|
|
64
|
+
```sh
|
|
65
|
+
bun run test:real -- --keep-test-data
|
|
152
66
|
```
|
|
153
67
|
|
|
154
|
-
|
|
68
|
+
也可以用环境变量开启同样的行为:
|
|
155
69
|
|
|
156
|
-
|
|
70
|
+
```sh
|
|
71
|
+
ZENTAO_KEEP_TEST_DATA=true bun run test:real
|
|
72
|
+
```
|
|
157
73
|
|
|
158
|
-
|
|
159
|
-
|
|
74
|
+
测试会优先读取 `.env.local`,如果不存在则读取 `env.local`。支持的变量:
|
|
75
|
+
|
|
76
|
+
```ini
|
|
77
|
+
ZENTAO_URL=https://zentao.example.com
|
|
78
|
+
ZENTAO_ACCOUNT=admin
|
|
79
|
+
ZENTAO_PASSWORD=password
|
|
80
|
+
# 或直接提供 Token
|
|
81
|
+
ZENTAO_TOKEN=your-token
|
|
82
|
+
# 可选
|
|
83
|
+
ZENTAO_REVIEWER=admin
|
|
84
|
+
ZENTAO_KEEP_TEST_DATA=false
|
|
85
|
+
ZENTAO_TIMEOUT=30000
|
|
86
|
+
ZENTAO_INSECURE=false
|
|
160
87
|
```
|
|
161
88
|
|
|
162
|
-
|
|
89
|
+
`ZENTAO_REVIEWER` 用于启用了需求评审规则的环境;未设置时会复用 `ZENTAO_ACCOUNT`。
|
|
163
90
|
|
|
164
|
-
|
|
91
|
+
运行时会先打印脱敏后的环境信息,然后创建一个名称带 `zentao-api-real-` 前缀的临时产品。后续每个 API 步骤都会打印步骤名、接口名和关键结果。测试会围绕这个产品执行一条可回收的真实写入流程:验证产品详情/列表/更新,创建并查询 3 个需求,创建/更新/查询产品计划并把需求关联到计划,创建/更新项目和执行,基于需求创建 3 个任务并验证任务列表、详情、优先级修改、启动、完成和删除,再创建 3 个 Bug 并验证列表、详情、描述修改和解决。默认清理阶段会按任务、Bug、执行、项目、需求、计划、产品的逆序尽量删除所有临时数据;传入 `--keep-test-data` 时会跳过最终清理并打印保留数据的关键 ID。
|
|
165
92
|
|
|
166
|
-
|
|
167
|
-
npm run doc
|
|
168
|
-
```
|
|
93
|
+
## 扩展模块
|
|
169
94
|
|
|
170
|
-
|
|
95
|
+
生成的模块定义来自 `scripts/update-registry.ts`。你可以在调用 `request()` 前扩展模块,或新增、替换动作。同名模块默认合并定义:同名动作会替换,未知动作会追加;需要整体替换模块时传入 `{ relace: true }`。
|
|
171
96
|
|
|
172
|
-
|
|
97
|
+
```ts
|
|
98
|
+
import { defineModuleActions, defineModules } from 'zentao-api';
|
|
173
99
|
|
|
174
|
-
|
|
175
|
-
|
|
100
|
+
defineModules({
|
|
101
|
+
name: 'custom',
|
|
102
|
+
actions: [
|
|
103
|
+
{
|
|
104
|
+
name: 'list',
|
|
105
|
+
type: 'list',
|
|
106
|
+
method: 'GET',
|
|
107
|
+
path: '/custom',
|
|
108
|
+
resultType: 'list',
|
|
109
|
+
resultGetter: 'items',
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
defineModuleActions('bug', {
|
|
115
|
+
name: 'archive',
|
|
116
|
+
type: 'action',
|
|
117
|
+
method: 'PUT',
|
|
118
|
+
path: '/bugs/{bugID}/archive',
|
|
119
|
+
pathParams: { bugID: 1 },
|
|
120
|
+
resultType: 'text',
|
|
121
|
+
});
|
|
176
122
|
```
|
|
177
123
|
|
|
178
|
-
|
|
124
|
+
如果扩展定义拆分在多个文件中,请在应用启动入口中显式导入这些文件,确保它们在调用 `request()` 前完成注册。
|
|
179
125
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
126
|
+
## 浏览器
|
|
127
|
+
|
|
128
|
+
浏览器打包工具可以正常导入这个包:
|
|
183
129
|
|
|
184
|
-
|
|
130
|
+
```ts
|
|
131
|
+
import { ZentaoClient } from 'zentao-api';
|
|
132
|
+
```
|
|
185
133
|
|
|
186
|
-
|
|
134
|
+
如果使用 script 标签,请使用浏览器构建包,并从 `window.ZentaoAPI` 读取 API:
|
|
187
135
|
|
|
188
|
-
```
|
|
189
|
-
npm
|
|
136
|
+
```html
|
|
137
|
+
<script src="https://cdn.jsdelivr.net/npm/zentao-api@1.0.0/dist/browser/zentao-api.global.js"></script>
|
|
138
|
+
<script>
|
|
139
|
+
console.log(window.ZentaoAPI.VERSION, window.ZentaoAPI.BUILD);
|
|
140
|
+
const client = new window.ZentaoAPI.ZentaoClient('https://zentao.example.com');
|
|
141
|
+
</script>
|
|
190
142
|
```
|
|
143
|
+
|
|
144
|
+
浏览器直接请求要求禅道服务器允许 CORS。浏览器代码也会把 token 暴露给前端;如果这不可接受,请使用后端代理。
|
|
145
|
+
|
|
146
|
+
`insecure` TLS 选项仅适用于 Node.js,在浏览器运行时会抛出错误。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var{defineProperty:w,getOwnPropertyNames:t,getOwnPropertyDescriptor:s}=Object,r=Object.prototype.hasOwnProperty;function o(_){return this[_]}var a=(_)=>{var A=(g??=new WeakMap).get(_),f;if(A)return A;if(A=w({},"__esModule",{value:!0}),_&&typeof _==="object"||typeof _==="function"){for(var R of t(_))if(!r.call(A,R))w(A,R,{get:o.bind(_,R),enumerable:!(f=s(_,R))||f.enumerable})}return g.set(_,A),A},g;var e=(_)=>_;function __(_,A){this[_]=e.bind(null,A)}var v=(_,A)=>{for(var f in A)w(_,f,{get:A[f],enumerable:!0,configurable:!0,set:__.bind(A,f)})};var K_={};v(K_,{setGlobalOptions:()=>C,request:()=>N,getModuleAction:()=>K,getModule:()=>q,getGlobalOptions:()=>Y,defineModules:()=>x,defineModuleActions:()=>k,ZentaoError:()=>D,ZentaoClient:()=>F,VERSION:()=>y,ERRORS:()=>z,BUILD:()=>h});var S={};v(S,{setGlobalOptions:()=>C,request:()=>N,getModuleAction:()=>K,getModule:()=>q,getGlobalOptions:()=>Y,defineModules:()=>x,defineModuleActions:()=>k,ZentaoError:()=>D,ZentaoClient:()=>F,VERSION:()=>y,ERRORS:()=>z,BUILD:()=>h});var z={E_INVALID_BASE_URL:"Invalid ZenTao baseUrl.",E_NO_GLOBAL_CLIENT:"No global client configured. Call ZentaoClient.init() or pass options.client.",E_HTTP_ERROR:"HTTP request failed: {status} {statusText}",E_NETWORK_ERROR:"Network request failed: {message}",E_TIMEOUT:"Request timed out.",E_INSECURE_BROWSER:"The insecure option is only supported in Node.js runtimes.",E_LOGIN_FAILED:"ZenTao login failed.",E_INVALID_MODULE:"Unknown module: {module}",E_INVALID_ACTION:"Unknown action: {module}-{action}",E_INVALID_MODULE_DEFINITION:"Invalid module definition.",E_INVALID_ACTION_DEFINITION:"Invalid module action definition.",E_MISSING_PARAM:"Missing required parameter: {param}",E_INVALID_REQUEST_NAME:'Request name must use the form "moduleName/methodName".'};class D extends Error{code;details;constructor(_,A,f){let R=z[_];if(A)for(let[B,H]of Object.entries(A))R=R.replaceAll(`{${B}}`,String(H));super(R);this.name="ZentaoError",this.code=_,this.details=f}}function A_(){return typeof process<"u"&&Boolean(process.versions?.node)}function U(_){if(_&&!A_())throw new D("E_INSECURE_BROWSER")}async function c(_,A){if(!_)return A();U(_);let f=process.env.NODE_TLS_REJECT_UNAUTHORIZED;process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";try{return await A()}finally{if(f===void 0)delete process.env.NODE_TLS_REJECT_UNAUTHORIZED;else process.env.NODE_TLS_REJECT_UNAUTHORIZED=f}}var V={};function Y(){return{...V}}function C(_){V={...V,..._}}var f_=1e4;function R_(_){let A=_.trim().replace(/\/+$/,"");if(!A)throw new D("E_INVALID_BASE_URL");return A.replace(/\/api\.php\/v2$/i,"")}function O_(_,A,f){let R=A.startsWith("/")?A:`/${A}`,B=new URL(`${_}${R}`);for(let[H,G]of Object.entries(f??{})){if(G===void 0)continue;B.searchParams.set(H,String(G))}return B.toString()}async function B_(_){let A=await _.text();if(A==="")return;try{return JSON.parse(A)}catch{return A}}class F{siteUrl;baseUrl;token;timeout;insecure;constructor(_){let A=typeof _==="string"?{baseUrl:_}:_;this.siteUrl=R_(A.baseUrl),this.baseUrl=`${this.siteUrl}/api.php/v2`,this.token=A.token,this.timeout=A.timeout,this.insecure=A.insecure}async request(_,A={}){let f=Y(),R=A.method??"GET",B=A.timeout??f.timeout??this.timeout??f_,H=A.insecure??f.insecure??this.insecure;U(H);let G=O_(this.baseUrl,_,A.query),J=new AbortController,X=setTimeout(()=>J.abort(),B),M={"Content-Type":"application/json"};if(this.token)M.Token=this.token;let I={method:R,headers:M,signal:J.signal};if(A.body&&R!=="GET")I.body=JSON.stringify(A.body);try{return await c(H,async()=>{let O=await fetch(G,I);if(!O.ok)throw new D("E_HTTP_ERROR",{status:O.status,statusText:O.statusText},{url:O.url,status:O.status,statusText:O.statusText,body:await O.text().catch(()=>{return})});return B_(O)})}catch(O){if(O instanceof D)throw O;if(O instanceof DOMException&&O.name==="AbortError")throw new D("E_TIMEOUT");throw new D("E_NETWORK_ERROR",{message:O.message??String(O)},O)}finally{clearTimeout(X)}}async get(_){return this.request(_,{method:"GET"})}async post(_,A){return this.request(_,{method:"POST",body:A})}async put(_,A){return this.request(_,{method:"PUT",body:A})}async delete(_){return this.request(_,{method:"DELETE"})}async login(_,A){let f=await this.post("/users/login",{account:_,password:A});if(f.status!=="success"||!f.token)throw new D("E_LOGIN_FAILED");return this.token=f.token,f.token}static create(_){return new F(_)}static init(_){let A=new F(_);return C({client:A}),A}}function P(_,A){let f=A.split("."),R=_;for(let B of f){if(R===null||R===void 0||typeof R!=="object")return;R=R[B]}return R}function j(_){return Array.isArray(_)?_:[_]}var d=[{name:"user",display:"用户",description:"用户管理,支持获取用户列表、创建用户、获取用户详情、修改用户信息、删除用户",actions:[{name:"list",display:"获取用户列表",type:"list",method:"get",path:"/users",resultType:"list",pagerGetter:"pager",resultGetter:"users",params:[{name:"browseType",required:!1,type:"string",description:"浏览类型",options:[{value:"inside",label:"内部用户"},{value:"outside",label:"内部用户"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"realname_asc",label:"姓名 升序"},{value:"realname_desc",label:"姓名 降序"},{value:"account_asc",label:"用户名 升序"},{value:"account_desc",label:"用户名 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建用户",type:"create",method:"post",path:"/users",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{account:{type:"string",description:"登录名"},realname:{type:"string",description:"姓名"},password:{type:"string",description:"密码"}},required:["account","realname","password"]}}},{name:"get",display:"获取用户详情",type:"get",method:"get",path:"/users/{userID}",resultType:"object",resultGetter:"user",pathParams:{userID:"用户ID"}},{name:"update",display:"修改用户信息",type:"update",method:"put",path:"/users/{userID}",resultType:"object",pathParams:{userID:"用户ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{realname:{type:"string",description:"真实姓名"},dept:{type:"integer",description:"部门",format:"int32"},join:{type:"string",description:"入职日期"},group:{type:"array",items:{type:"string"},description:"权限分组"},email:{type:"string",description:"邮箱"},visions:{type:"array",items:{type:"string"},description:"界面类型(研发综合界面 rnd | 运营管理界面 lite)"},mobile:{type:"string",description:"手机"},weixin:{type:"string",description:"微信"},password:{type:"string",description:"密码"}}}}},{name:"delete",display:"删除用户",type:"delete",method:"delete",path:"/users/{userID}",resultType:"text",pathParams:{userID:"用户ID"},render:"action"}]},{name:"program",display:"项目集",description:"项目集管理,支持获取项目集列表、创建项目集、获取项目集详情、修改项目集、删除项目集",actions:[{name:"list",display:"获取项目集列表",type:"list",method:"get",path:"/programs",resultType:"list",pagerGetter:"pager",resultGetter:"programs",params:[{name:"status",required:!1,type:"string",description:"状态",options:[{value:"all",label:"全部"},{value:"unclosed",label:"未关闭"},{value:"wait",label:"未开始"},{value:"doing",label:"进行中"},{value:"suspended",label:"已挂起"},{value:"delayed",label:"已延期"},{value:"closed",label:"已关闭"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"name_asc",label:"名称 升序"},{value:"name_desc",label:"名称 降序"},{value:"begin_asc",label:"计划开始 升序"},{value:"begin_desc",label:"计划开始 降序"},{value:"end_asc",label:"计划结束 升序"},{value:"end_desc",label:"计划结束 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建项目集",type:"create",method:"post",path:"/programs",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"项目集名称"},begin:{type:"string",description:"计划开始日期"},end:{type:"string",description:"计划完成日期"},PM:{type:"string",description:"计划完成日期"},desc:{type:"string",description:"项目集描述"}},required:["name","begin","end"]}}},{name:"get",display:"获取项目集详情",type:"get",method:"get",path:"/programs/{programID}",resultType:"object",resultGetter:"program",pathParams:{programID:"项目集ID"}},{name:"update",display:"修改项目集",type:"update",method:"put",path:"/programs/{programID}",resultType:"object",pathParams:{programID:"项目集ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"项目集名称"},begin:{type:"string",description:"计划开始日期"},end:{type:"string",description:"计划完成日期"},PM:{type:"string",description:"计划完成日期"},desc:{type:"string",description:"项目集描述"}},required:["name","begin","end"]}}},{name:"delete",display:"删除项目集",type:"delete",method:"delete",path:"/programs/{programID}",resultType:"text",pathParams:{programID:"项目集ID"},render:"action"}]},{name:"product",display:"产品",description:"产品管理,支持获取产品列表、创建产品、获取产品详情、修改产品、删除产品",actions:[{name:"list",display:"获取产品列表",type:"list",method:"get",path:"/products",resultType:"list",pagerGetter:"pager",resultGetter:"products",params:[{name:"browseType",required:!1,type:"string",description:"浏览类型",options:[{value:"all",label:"全部"},{value:"noclosed",label:"未关闭"},{value:"closed",label:"已结束"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"名称 升序"},{value:"title_desc",label:"名称 降序"},{value:"begin_asc",label:"计划开始 升序"},{value:"begin_desc",label:"计划开始 降序"},{value:"end_asc",label:"计划结束 升序"},{value:"end_desc",label:"计划结束 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建产品",type:"create",method:"post",path:"/products",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"产品名称"},program:{type:"integer",description:"所属项目集",format:"int32"},line:{type:"integer",description:"所属产品线",format:"int32"},type:{type:"string",description:"类型(normal 正常 | branch 多分支 | platform 多平台)"},PO:{type:"string",description:"产品负责人"},reviewer:{type:"array",items:{type:"string"},description:"评审人"},desc:{type:"array",items:{type:"string"},description:"产品描述"},QD:{type:"string",description:"测试负责人"},RD:{type:"string",description:"发布负责人"},acl:{type:"string",description:"访问控制(open 公开 | private 私有)"}},required:["name"]}}},{name:"get",display:"获取产品详情",type:"get",method:"get",path:"/products/{productID}",resultType:"object",resultGetter:"product",pathParams:{productID:"产品ID"}},{name:"update",display:"修改产品",type:"update",method:"put",path:"/products/{productID}",resultType:"object",pathParams:{productID:"产品ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"产品名称"},program:{type:"integer",description:"所属项目集",format:"int32"},line:{type:"integer",description:"所属产品线",format:"int32"},type:{type:"string",description:"类型(normal 正常 | branch 多分支 | platform 多平台)"},PO:{type:"string",description:"产品负责人"},reviewer:{type:"array",items:{type:"string"},description:"评审人"},desc:{type:"array",items:{type:"string"},description:"产品描述"},QD:{type:"string",description:"测试负责人"},RD:{type:"string",description:"发布负责人"},acl:{type:"string",description:"访问控制(open 公开 | private 私有)"}},required:["name"]}}},{name:"delete",display:"删除产品",type:"delete",method:"delete",path:"/products/{productID}",resultType:"text",pathParams:{productID:"产品ID"},render:"action"}]},{name:"project",display:"项目",description:"项目管理,支持获取项目列表、创建项目、修改项目、删除项目",actions:[{name:"list",display:"获取项目列表",type:"list",method:"get",path:"/projects",resultType:"list",pagerGetter:"pager",resultGetter:"projects",params:[{name:"browseType",required:!1,type:"string",description:"项目状态,默认是undone",defaultValue:"undone",options:[{value:"all",label:"全部"},{value:"undone",label:"未完成"},{value:"wait",label:"未开始"},{value:"doing",label:"进行中"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"name_asc",label:"名称 升序"},{value:"name_desc",label:"名称 降序"},{value:"begin_asc",label:"计划开始 升序"},{value:"begin_desc",label:"计划开始 降序"},{value:"end_asc",label:"计划结束 升序"},{value:"end_desc",label:"计划结束 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建项目",type:"create",method:"post",path:"/projects",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"项目名称"},model:{type:"string",description:"项目管理方式(scrum 敏捷 | waterfall 瀑布 | kanban 看板 | agileplus 融合敏捷 | waterfallplus 融合瀑布)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},products:{type:"array",items:{type:"string"},description:"关联产品"},parent:{type:"integer",description:"所属项目集",format:"int32"},workflowGroup:{type:"integer",description:"项目流程,付费版功能,开源版可以不填",format:"int32"},PM:{type:"string",description:"项目负责人"}},required:["name","model","begin","end","workflowGroup"]}}},{name:"update",display:"修改项目",type:"update",method:"put",path:"/projects/{projectID}",resultType:"object",pathParams:{projectID:"项目ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"项目名称"},model:{type:"string",description:"项目管理方式(scrum 敏捷 | waterfall 瀑布 | kanban 看板 | agileplus 融合敏捷 | waterfallplus 融合瀑布)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},products:{type:"array",items:{type:"string"},description:"关联产品"},parent:{type:"integer",description:"所属项目集",format:"int32"},workflowGroup:{type:"integer",description:"项目流程,付费版功能,开源版可以不填",format:"int32"},PM:{type:"string",description:"项目负责人"}},required:["name","model","begin","end","workflowGroup"]}}},{name:"delete",display:"删除项目",type:"delete",method:"delete",path:"/projects/{projectID}",resultType:"text",pathParams:{projectID:"项目ID"},render:"action"}]},{name:"execution",display:"执行",description:"执行管理,支持获取执行列表、创建执行、获取执行详情、修改执行、删除执行",actions:[{name:"list",display:"获取执行列表",type:"list",method:"get",path:"/executions",resultType:"list",pagerGetter:"pager",resultGetter:"executions",params:[{name:"status",required:!1,type:"string",description:"执行状态,默认是undone",defaultValue:"undone",options:[{value:"all",label:"全部"},{value:"undone",label:"未完成"},{value:"wait",label:"未开始"},{value:"doing",label:"进行中"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"rawID_asc",label:"RAWID 升序"},{value:"rawID_desc",label:"RAWID 降序"},{value:"nameCol_asc",label:"名称 升序"},{value:"nameCol_desc",label:"名称 降序"},{value:"begin_asc",label:"计划开始 升序"},{value:"begin_desc",label:"计划开始 降序"},{value:"end_asc",label:"计划结束 升序"},{value:"end_desc",label:"计划结束 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建执行",type:"create",method:"post",path:"/executions",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{project:{type:"integer",description:"所属项目",format:"int32"},name:{type:"string",description:"迭代名称"},lifetime:{type:"string",description:"执行类型(short 短期 | long 长期 | ops 运维)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},days:{type:"integer",description:"可用工作日",format:"int32"},products:{type:"array",items:{type:"string"},description:"关联产品"},plans:{type:"array",items:{type:"string"},description:"关联计划,必须是产品+planID的二维数组"},PO:{type:"string",description:"产品负责人"},QD:{type:"string",description:"测试负责人"},PM:{type:"string",description:"执行负责人"},RD:{type:"string",description:"发布负责人"},acl:{type:"string",description:"访问控制(open 公开 | private 私有)"}},required:["project","name","begin","end"]}}},{name:"get",display:"获取执行详情",type:"get",method:"get",path:"/executions/{executionID}",resultType:"object",resultGetter:"execution",pathParams:{executionID:"执行ID"}},{name:"update",display:"修改执行",type:"update",method:"put",path:"/executions/{executionID}",resultType:"object",pathParams:{executionID:"执行ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{project:{type:"integer",description:"所属项目",format:"int32"},name:{type:"string",description:"迭代名称"},lifetime:{type:"string",description:"执行类型(short 短期 | long 长期 | ops 运维)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},days:{type:"integer",description:"可用工作日",format:"int32"},products:{type:"array",items:{type:"string"},description:"关联产品"},plans:{type:"array",items:{type:"string"},description:"关联计划,必须是产品+planID的二维数组"},PO:{type:"string",description:"产品负责人"},QD:{type:"string",description:"测试负责人"},PM:{type:"string",description:"执行负责人"},RD:{type:"string",description:"发布负责人"},acl:{type:"string",description:"访问控制(open 公开 | private 私有)"}},required:["name","begin","end"]}}},{name:"delete",display:"删除执行",type:"delete",method:"delete",path:"/executions/{executionID}",resultType:"text",pathParams:{executionID:"执行ID"},render:"action"}]},{name:"productplan",display:"产品计划",description:"产品计划管理,支持获取产品计划列表,支持获取产品下的产品计划、创建产品计划、获取产品计划详情、修改产品计划、删除产品计划",actions:[{name:"list",display:"获取产品计划列表,支持获取产品下的产品计划",type:"list",method:"get",path:"/{scope}/{scopeID}/productplans",resultType:"list",pagerGetter:"pager",resultGetter:"productplans",pathParams:{scope:{description:"产品计划范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"执行状态,默认是undone",defaultValue:"undone",options:[{value:"all",label:"全部"},{value:"undone",label:"未完成"},{value:"wait",label:"未开始"},{value:"doing",label:"进行中"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"名称 升序"},{value:"title_desc",label:"名称 降序"},{value:"begin_asc",label:"开始日期 升序"},{value:"begin_desc",label:"开始日期 降序"},{value:"end_asc",label:"结束日期 升序"},{value:"end_desc",label:"结束日期 降序"},{value:"status_asc",label:"状态 升序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建产品计划",type:"create",method:"post",path:"/productplans",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"产品ID",format:"int32"},title:{type:"string",description:"计划名称"},parent:{type:"integer",description:"父计划ID",format:"int32"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},branchID:{type:"integer",description:"分支ID",format:"int32"},desc:{type:"string",description:"计划描述"}},required:["productID","title"]}}},{name:"get",display:"获取产品计划详情",type:"get",method:"get",path:"/productplans/{planID}",resultType:"object",resultGetter:"productplan",pathParams:{planID:"产品计划ID"}},{name:"update",display:"修改产品计划",type:"update",method:"put",path:"/productplans/{productplanID}",resultType:"object",pathParams:{productplanID:"产品计划ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"计划名称"},parent:{type:"integer",description:"父计划",format:"int32"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},branchID:{type:"integer",description:"分支ID",format:"int32"},desc:{type:"string",description:"计划描述"}},required:["title"]}}},{name:"delete",display:"删除产品计划",type:"delete",method:"delete",path:"/productplans/{productplanID}",resultType:"text",pathParams:{productplanID:"产品计划ID"},render:"action"}]},{name:"story",display:"需求",description:"需求管理,支持获取需求列表,支持获取产品/项目/执行下的需求、创建需求、获取需求详情、修改需求、删除需求、激活需求、变更需求、关闭需求",actions:[{name:"list",display:"获取需求列表,支持获取产品/项目/执行下的需求",type:"list",method:"get",path:"/{scope}/{scopeID}/stories",resultType:"list",pagerGetter:"pager",resultGetter:"stories",pathParams:{scope:{description:"需求范围",options:[{value:"products",label:"产品"},{value:"projects",label:"项目"},{value:"executions",label:"执行"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是unclosed",defaultValue:"unclosed",options:[{value:"allstory",label:"全部"},{value:"assignedtome",label:"指派给我"},{value:"openedbyme",label:"我创建"},{value:"reviewbyme",label:"待我评审"},{value:"draftstory",label:"草稿"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建需求",type:"create",method:"post",path:"/stories",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"产品ID",format:"int32"},title:{type:"string"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},spec:{type:"string",description:"需求描述"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},verify:{type:"string",description:"验收标准"},assignedTo:{type:"string",description:"指派给"},reviewer:{type:"array",items:{type:"string"},description:"评审人,如果设置必须评审,必须填写"},project:{type:"integer",description:"所属项目",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"}},required:["productID","title"]}}},{name:"get",display:"获取需求详情",type:"get",method:"get",path:"/stories/{storyID}",resultType:"object",resultGetter:"story",pathParams:{storyID:"需求ID"}},{name:"update",display:"修改需求",type:"update",method:"put",path:"/stories/{storyID}",resultType:"object",pathParams:{storyID:"需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},assignedTo:{type:"string",description:"指派给"}},required:["title"]}}},{name:"delete",display:"删除需求",type:"delete",method:"delete",path:"/stories/{storyID}",resultType:"text",pathParams:{storyID:"需求ID"},render:"action"},{name:"activate",display:"激活需求",type:"action",method:"put",path:"/stories/{storyID}/activate",resultType:"text",pathParams:{storyID:"需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"change",display:"变更需求",type:"action",method:"put",path:"/stories/{storyID}/change",resultType:"text",pathParams:{storyID:"需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"需求名称"},reviewer:{type:"array",items:{type:"string"},description:"评审人员"},spec:{type:"string",description:"需求描述"},verify:{type:"string",description:"验收标准"}},required:["reviewer"]}},render:"action"},{name:"close",display:"关闭需求",type:"action",method:"put",path:"/stories/{storyID}/close",resultType:"text",pathParams:{storyID:"需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{closedReason:{type:"string",description:"关闭原因(done 已完成 | subdivided 已拆分 | duplicate 重复 | postponed 延期 | willnotdo 不做 | cancel 已取消 | bydesign 设计如此)"},comment:{type:"string",description:"备注"}},required:["closedReason"]}},render:"action"}]},{name:"epic",display:"业务需求",description:"业务需求管理,支持获取业务需求列表,支持获取产品下的业务需求、创建业务需求、获取业务需求详情、修改业务需求、删除业务需求、激活业务需求、变更业务需求、关闭业务需求",actions:[{name:"list",display:"获取业务需求列表,支持获取产品下的业务需求",type:"list",method:"get",path:"/{scope}/{scopeID}/epics",resultType:"list",pagerGetter:"pager",resultGetter:"epics",pathParams:{scope:{description:"业务需求范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是unclosed",defaultValue:"unclosed",options:[{value:"allstory",label:"全部"},{value:"assignedtome",label:"指派给我"},{value:"openedbyme",label:"我创建"},{value:"reviewbyme",label:"待我评审"},{value:"draftstory",label:"草稿"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建业务需求",type:"create",method:"post",path:"/epics",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"产品ID",format:"int32"},title:{type:"string"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父业务需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},spec:{type:"string",description:"业务需求描述"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},verify:{type:"string",description:"验收标准"},assignedTo:{type:"string",description:"指派给"},reviewer:{type:"array",items:{type:"string"},description:"评审人,如果设置必须评审,必须填写"}},required:["productID","title"]}}},{name:"get",display:"获取业务需求详情",type:"get",method:"get",path:"/epics/{storyID}",resultType:"object",resultGetter:"epic",pathParams:{storyID:"需求ID"}},{name:"update",display:"修改业务需求",type:"update",method:"put",path:"/epics/{epicID}",resultType:"object",pathParams:{epicID:"业务需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"需求名称"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父业务需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},assignedTo:{type:"string",description:"指派给"}},required:["title"]}}},{name:"delete",display:"删除业务需求",type:"delete",method:"delete",path:"/epics/{epicID}",resultType:"text",pathParams:{epicID:"业务需求ID"},render:"action"},{name:"activate",display:"激活业务需求",type:"action",method:"put",path:"/epics/{epicID}/activate",resultType:"text",pathParams:{epicID:"业务需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"change",display:"变更业务需求",type:"action",method:"put",path:"/epics/{epicID}/change",resultType:"text",pathParams:{epicID:"业务需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"需求名称"},reviewer:{type:"array",items:{type:"string"},description:"评审人员"},spec:{type:"string",description:"需求描述"},verify:{type:"string",description:"验收标准"}},required:["reviewer"]}},render:"action"},{name:"close",display:"关闭业务需求",type:"action",method:"put",path:"/epics/{epicID}/close",resultType:"text",pathParams:{epicID:"业务需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{closedReason:{type:"string",description:"关闭原因(done 已完成 | subdivided 已拆分 | duplicate 重复 | postponed 延期 | willnotdo 不做 | cancel 已取消 | bydesign 设计如此)"},comment:{type:"string",description:"备注"}},required:["closedReason"]}},render:"action"}]},{name:"requirement",display:"用户需求",description:"用户需求管理,支持获取用户需求列表,支持获取产品下的用户需求、创建用户需求、获取用户需求详情、修改用户需求、删除用户需求、激活用户需求、变更用户需求、关闭用户需求",actions:[{name:"list",display:"获取用户需求列表,支持获取产品下的用户需求",type:"list",method:"get",path:"/{scope}/{scopeID}/requirements",resultType:"list",pagerGetter:"pager",resultGetter:"requirements",pathParams:{scope:{description:"用户需求范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是unclosed",defaultValue:"unclosed",options:[{value:"allstory",label:"全部"},{value:"assignedtome",label:"指派给我"},{value:"openedbyme",label:"我创建"},{value:"reviewbyme",label:"待我评审"},{value:"draftstory",label:"草稿"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建用户需求",type:"create",method:"post",path:"/requirements",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"产品ID",format:"int32"},title:{type:"string"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父用户需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},spec:{type:"string",description:"用户需求描述"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},verify:{type:"string",description:"验收标准"},assignedTo:{type:"string",description:"指派给"},reviewer:{type:"array",items:{type:"string"},description:"评审人,如果设置必须评审,必须填写"}},required:["productID","title"]}}},{name:"get",display:"获取用户需求详情",type:"get",method:"get",path:"/requirements/{storyID}",resultType:"object",resultGetter:"requirement",pathParams:{storyID:"需求ID"}},{name:"update",display:"修改用户需求",type:"update",method:"put",path:"/requirements/{requirementID}",resultType:"object",pathParams:{requirementID:"用户需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},parent:{type:"integer",description:"父用户需求",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},category:{type:"integer",description:"类别(feature 功能 | interface 接口 | performance 性能 | safe 安全 | experience 体验 | improve 改进 | other 其他)",format:"int32"},source:{type:"string",description:"来源(customer 客户 | user 用户 | po 产品经理 | market 市场 | service 客服 | operation 运营 | support 技术支持 | competitor 竞争对手 | partner 合作伙伴 | dev 开发人员 | tester 测试人员 | bug Bug | forum 论坛 | other 其他)"},assignedTo:{type:"string",description:"指派给"}},required:["title"]}}},{name:"delete",display:"删除用户需求",type:"delete",method:"delete",path:"/requirements/{requirementID}",resultType:"text",pathParams:{requirementID:"用户需求ID"},render:"action"},{name:"activate",display:"激活用户需求",type:"action",method:"put",path:"/requirements/{requirementID}/activate",resultType:"text",pathParams:{requirementID:"用户需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"change",display:"变更用户需求",type:"action",method:"put",path:"/requirements/{requirementID}/change",resultType:"text",pathParams:{requirementID:"用户需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"需求名称"},spec:{type:"string",description:"需求描述"},verify:{type:"string",description:"验收标准"}}}},render:"action"},{name:"close",display:"关闭用户需求",type:"action",method:"put",path:"/requirements/{requirementID}/close",resultType:"text",pathParams:{requirementID:"用户需求ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{closedReason:{type:"string",description:"关闭原因(done 已完成 | subdivided 已拆分 | duplicate 重复 | postponed 延期 | willnotdo 不做 | cancel 已取消 | bydesign 设计如此)"},comment:{type:"string",description:"备注"}},required:["closedReason"]}},render:"action"}]},{name:"bug",display:"Bug",description:"Bug管理,支持获取Bug列表,支持获取产品/项目/执行下的Bug、创建Bug、获取Bug详情、修改Bug、删除Bug、激活Bug、关闭Bug、解决Bug",actions:[{name:"list",display:"获取Bug列表,支持获取产品/项目/执行下的Bug",type:"list",method:"get",path:"/{scope}/{scopeID}/bugs",resultType:"list",pagerGetter:"pager",resultGetter:"bugs",pathParams:{scope:{description:"Bug范围",options:[{value:"products",label:"产品"},{value:"projects",label:"项目"},{value:"executions",label:"执行"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是unclosed",defaultValue:"unclosed",options:[{value:"all",label:"全部"},{value:"unclosed",label:"未关闭"},{value:"assignedtome",label:"指派给我"},{value:"openedbyme",label:"我创建"},{value:"assignedbyme",label:"由我指派"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建Bug",type:"create",method:"post",path:"/bugs",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"所属产品",format:"int32"},title:{type:"string",description:"Bug标题"},openedBuild:{type:"array",items:{type:"string"},description:"影响版本,主干是trunk,其他版本使用版本ID"},project:{type:"integer",description:"所属项目",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"},severity:{type:"integer",description:"严重程度,默认是3",format:"int32"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},type:{type:"string",description:"Bug类型(codeerror 代码错误 | config 配置相关 | install 安装部署 | security 安全相关 | performance 性能问题 | standard 标准规范 | automation 测试脚本 | designdefect 设计缺陷 | others 其他)"},steps:{type:"string",description:"重现步骤"},story:{type:"integer",description:"相关需求",format:"int32"}},required:["productID","title","openedBuild"]}}},{name:"get",display:"获取Bug详情",type:"get",method:"get",path:"/bugs/{bugID}",resultType:"object",resultGetter:"bug",pathParams:{bugID:"Bug ID"}},{name:"update",display:"修改Bug",type:"update",method:"put",path:"/bugs/{bugID}",resultType:"object",pathParams:{bugID:"Bug ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"Bug标题"},severity:{type:"integer",description:"严重程度,默认是3",format:"int32"},pri:{type:"integer",description:"优先级,默认是3",format:"int32"},type:{type:"string",description:"Bug类型(codeerror 代码错误 | config 配置相关 | install 安装部署 | security 安全相关 | performance 性能问题 | standard 标准规范 | automation 测试脚本 | designdefect 设计缺陷 | others 其他)"},openedBuild:{type:"array",items:{type:"string"},description:"影响版本,主干是trunk,其他版本使用版本ID"},steps:{type:"string",description:"重现步骤"},project:{type:"integer",description:"所属项目",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"},story:{type:"integer",description:"相关需求",format:"int32"}}}}},{name:"delete",display:"删除Bug",type:"delete",method:"delete",path:"/bugs/{bugID}",resultType:"text",pathParams:{bugID:"Bug ID"},render:"action"},{name:"activate",display:"激活Bug",type:"action",method:"put",path:"/bugs/{bugID}/activate",resultType:"text",pathParams:{bugID:"Bug ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{openedBuild:{type:"array",items:{type:"string"},description:"影响版本, trunk为主干"},assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"close",display:"关闭Bug",type:"action",method:"put",path:"/bugs/{bugID}/close",resultType:"text",pathParams:{bugID:"Bug ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{comment:{type:"string",description:"备注"}}}},render:"action"},{name:"resolve",display:"解决Bug",type:"action",method:"put",path:"/bugs/{bugID}/resolve",resultType:"text",pathParams:{bugID:"Bug ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{resolution:{type:"string",description:"fixed 已解决 | notrepro 无法重现 | bydesign 设计如此 | duplicate 重复Bug | external 外部原因| postponed 延期处理 | willnotfix 不予解决 | tostory 转为需求"},resolvedDate:{type:"string",description:"解决日期,默认今天"},resolvedBuild:{type:"string",description:"解决版本, trunk为主干"},assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}},required:["resolution"]}},render:"action"}]},{name:"testcase",display:"测试用例",description:"测试用例管理,支持获取测试用例列表,支持获取产品/项目/执行下的测试用例、创建测试用例、获取测试用例详情、修改测试用例、删除测试用例",actions:[{name:"list",display:"获取测试用例列表,支持获取产品/项目/执行下的测试用例",type:"list",method:"get",path:"/{scope}/{scopeID}/testcases",resultType:"list",pagerGetter:"pager",resultGetter:"testcases",pathParams:{scope:{description:"测试用例范围",options:[{value:"products",label:"产品"},{value:"projects",label:"项目"},{value:"executions",label:"执行"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是all",defaultValue:"all",options:[{value:"all",label:"全部"},{value:"wait",label:"未关闭"},{value:"needconfirm",label:"需求变动"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建测试用例",type:"create",method:"post",path:"/testcases",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"所属产品",format:"int32"},title:{type:"string",description:"用例标题"},module:{type:"integer",description:"所属模块",format:"int32"},story:{type:"integer",description:"相关需求",format:"int32"},pri:{type:"integer",description:"优先级",format:"int32"},type:{type:"string",description:"用例类型(unit 单元测试 | interface 接口测试 | feature 功能测试 | install 安装部署 | config 配置相关 | performance 性能测试 | security 安全相关 | other 其他)"},precondition:{type:"string",description:"前置条件"},steps:{type:"array",items:{type:"string"},description:"用例步骤"},expects:{type:"array",items:{type:"string"},description:"用例步骤期望"},stepType:{type:"array",items:{type:"string"},description:"用例步骤类型(step 步骤 | group 父级步骤)"},project:{type:"integer",description:"所属项目",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"}},required:["productID","title"]}}},{name:"get",display:"获取测试用例详情",type:"get",method:"get",path:"/testcases/{caseID}",resultType:"object",resultGetter:"testcase",pathParams:{caseID:"测试用例ID"}},{name:"update",display:"修改测试用例",type:"update",method:"put",path:"/testcases/{testcasID}",resultType:"object",pathParams:{testcasID:"测试用例ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{title:{type:"string",description:"用例标题"},moudule:{type:"integer",description:"所属模块",format:"int32"},story:{type:"integer",description:"相关需求",format:"int32"},pri:{type:"integer",description:"优先级",format:"int32"},type:{type:"string",description:"用例类型(unit 单元测试 | interface 接口测试 | feature 功能测试 | install 安装部署 | config 配置相关 | performance 性能测试 | security 安全相关 | other 其他)"},precondition:{type:"string",description:"前置条件"},steps:{type:"array",items:{type:"string"},description:"用例步骤"},expects:{type:"array",items:{type:"string"},description:"用例步骤期望"},stepType:{type:"array",items:{type:"string"},description:"用例步骤类型(step 步骤 | group 父级步骤)"}},required:["title"]}}},{name:"delete",display:"删除测试用例",type:"delete",method:"delete",path:"/testcases/{testcasID}",resultType:"text",pathParams:{testcasID:"测试用例ID"},render:"action"}]},{name:"task",display:"任务",description:"任务管理,支持获取任务列表,支持获取执行下的任务、创建任务、获取任务详情、修改任务、删除任务、激活任务、关闭任务、完成任务、启动任务",actions:[{name:"list",display:"获取任务列表,支持获取执行下的任务",type:"list",method:"get",path:"/{scope}/{scopeID}/tasks",resultType:"list",pagerGetter:"pager",resultGetter:"tasks",pathParams:{scope:{description:"任务范围",options:[{value:"executions",label:"执行"}]},scopeID:"范围ID"},params:[{name:"status",required:!1,type:"string",description:"状态,默认是unclosed",defaultValue:"unclosed",options:[{value:"all",label:"全部"},{value:"unclosed",label:"未关闭"},{value:"assignedtome",label:"指派给我"},{value:"assignedtome",label:"指派给我"},{value:"myinvolved",label:"由我参与"},{value:"assignedbyme",label:"由我指派"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"name_asc",label:"名称 升序"},{value:"name_desc",label:"名称 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建任务",type:"create",method:"post",path:"/tasks",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"任务名称"},executionID:{type:"integer",description:"所属执行",format:"int32"},type:{type:"string",description:"任务类型"},assignedTo:{type:"string",description:"指派给"},estStarted:{type:"string",description:"预计开始"},deadline:{type:"string",description:"截止日期"},pri:{type:"integer",description:"优先级",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},module:{type:"integer",description:"所属模块",format:"int32"},story:{type:"integer",description:"相关需求",format:"int32"},desc:{type:"string",description:"任务描述"}},required:["name","executionID"]}}},{name:"get",display:"获取任务详情",type:"get",method:"get",path:"/tasks/{taskID}",resultType:"object",pathParams:{taskID:"任务ID"}},{name:"update",display:"修改任务",type:"update",method:"put",path:"/tasks/{taskID}",resultType:"object",pathParams:{taskID:"任务ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"任务名称"},type:{type:"string",description:"任务类型"},assignedTo:{type:"string",description:"指派给"},estStarted:{type:"string",description:"预计开始"},deadline:{type:"string",description:"截止日期"},pri:{type:"integer",description:"优先级",format:"int32"},estimate:{type:"number",description:"预计工时",format:"float"},module:{type:"integer",description:"所属模块",format:"int32"},story:{type:"integer",description:"相关需求",format:"int32"},desc:{type:"string",description:"任务描述"}}}}},{name:"delete",display:"删除任务",type:"delete",method:"delete",path:"/tasks/{taskID}",resultType:"text",pathParams:{taskID:"任务ID"},render:"action"},{name:"activate",display:"激活任务",type:"action",method:"put",path:"/tasks/{taskID}/activate",resultType:"text",pathParams:{taskID:"任务ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{left:{type:"number",description:"预计剩余",format:"float"},assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"close",display:"关闭任务",type:"action",method:"put",path:"/tasks/{taskID}/close",resultType:"text",pathParams:{taskID:"任务ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{comment:{type:"string",description:"备注"}}}},render:"action"},{name:"finish",display:"完成任务",type:"action",method:"put",path:"/tasks/{taskID}/finish",resultType:"text",pathParams:{taskID:"任务ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{currentConsumed:{type:"number",description:"本次消耗",format:"float"},assignedTo:{type:"string",description:"任务名称"},consumed:{type:"number",description:"总计消耗",format:"float"},realStarted:{type:"string",description:"实际开始"},finishedDate:{type:"string",description:"实际完成"},comment:{type:"string",description:"备注"}},required:["currentConsumed","realStarted","finishedDate"]}},render:"action"},{name:"start",display:"启动任务",type:"action",method:"put",path:"/tasks/{taskID}/start",resultType:"text",pathParams:{taskID:"任务ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"任务名称"},realStarted:{type:"string",description:"实际开始"},consumed:{type:"number",description:"总计消耗",format:"float"},left:{type:"number",description:"预计剩余",format:"float"},comment:{type:"string",description:"备注"}},required:["realStarted"]}},render:"action"}]},{name:"feedback",display:"反馈",description:"反馈管理,支持获取反馈列表,支持获取产品下的反馈、创建反馈、获取反馈详情、修改反馈、删除反馈、激活反馈、关闭反馈",actions:[{name:"list",display:"获取反馈列表,支持获取产品下的反馈",type:"list",method:"get",path:"/{scope}/{scopeID}/feedbacks",resultType:"list",pagerGetter:"pager",resultGetter:"feedbacks",pathParams:{scope:{description:"反馈范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是wait",defaultValue:"wait",options:[{value:"all",label:"全部"},{value:"wait",label:"待处理"},{value:"doing",label:"处理中"},{value:"toclosed",label:"待关闭"},{value:"review",label:"待评审"},{value:"assigntome",label:"指派给我"},{value:"openedbyme",label:"由我反馈"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建反馈",type:"create",method:"post",path:"/feedbacks",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{product:{type:"integer",description:"所属产品",format:"int32"},title:{type:"string",description:"标题"},module:{type:"integer",description:"所属模块",format:"int32"},type:{type:"string",description:"类型(story 需求 | task 任务 | bug Bug | todo 待办 | advice 建议 | issue 问题 | risk 风险 | opportunity 机会)"},desc:{type:"string",description:"描述"},feedbackBy:{type:"string",description:"反馈者"},source:{type:"string",description:"来源"}},required:["product","title"]}}},{name:"get",display:"获取反馈详情",type:"get",method:"get",path:"/feedbacks/{feedbackID}",resultType:"object",resultGetter:"feedback",pathParams:{feedbackID:"反馈ID"}},{name:"update",display:"修改反馈",type:"update",method:"put",path:"/feedbacks/{feedbackID}",resultType:"object",pathParams:{feedbackID:"反馈ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{product:{type:"integer",description:"所属产品",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},title:{type:"string",description:"标题"},type:{type:"string",description:"类型(story 需求 | task 任务 | bug Bug | todo 待办 | advice 建议 | issue 问题 | risk 风险 | opportunity 机会)"},desc:{type:"string",description:"描述"},feedbackBy:{type:"string",description:"反馈者"},source:{type:"string",description:"来源"}},required:["product","title"]}}},{name:"delete",display:"删除反馈",type:"delete",method:"delete",path:"/feedbacks/{feedbackID}",resultType:"text",pathParams:{feedbackID:"反馈ID"},render:"action"},{name:"activate",display:"激活反馈",type:"action",method:"put",path:"/feedbacks/{feedbackID}/activate",resultType:"text",pathParams:{feedbackID:"反馈ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"close",display:"关闭反馈",type:"action",method:"put",path:"/feedbacks/{feedbackID}/close",resultType:"text",pathParams:{feedbackID:"反馈ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{closedReason:{type:"string",description:"关闭原因(commented 已处理 | repeat 重复 | refuse 不予采纳)"},comment:{type:"string",description:"备注"}},required:["closedReason"]}},render:"action"}]},{name:"ticket",display:"工单",description:"工单管理,支持获取工单列表,支持获取产品下的工单、创建工单、获取工单详情、修改工单、删除工单、激活工单、关闭工单",actions:[{name:"list",display:"获取工单列表,支持获取产品下的工单",type:"list",method:"get",path:"/{scope}/{scopeID}/tickets",resultType:"list",pagerGetter:"pager",resultGetter:"tickets",pathParams:{scope:{description:"工单范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"},params:[{name:"browseType",required:!1,type:"string",description:"状态,默认是wait",defaultValue:"wait",options:[{value:"all",label:"全部"},{value:"unclosed",label:"未关闭"},{value:"wait",label:"待处理"},{value:"doing",label:"处理中"},{value:"done",label:"待关闭"},{value:"finishedbyme",label:"由我解决"},{value:"assigntome",label:"指派给我"},{value:"openedbyme",label:"由我创建"}]},{name:"orderBy",required:!1,type:"string",description:"排序",options:[{value:"id_asc",label:"ID 升序"},{value:"id_desc",label:"ID 降序"},{value:"title_asc",label:"标题 升序"},{value:"title_desc",label:"标题 降序"},{value:"status_asc",label:"状态 升序"},{value:"status_desc",label:"状态 降序"}]},{name:"recPerPage",required:!1,type:"number",description:"每页数量,不超过1000"},{name:"pageID",required:!1,type:"number",description:"页码,从第1页开始"}]},{name:"create",display:"创建工单",type:"create",method:"post",path:"/tickets",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{product:{type:"integer",description:"所属产品",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},title:{type:"string",description:"标题"},type:{type:"string",description:"类型(code 程序报错 | data 数据错误 | stuck 流程卡断 | security 安全问题 | affair 事务)"},desc:{type:"string",description:"描述"},assignedTo:{type:"string",description:"指派给"},deadline:{type:"string",description:"截止日期"},openedBuild:{type:"array",items:{type:"string"},description:"影响版本"}},required:["product","title"]}}},{name:"get",display:"获取工单详情",type:"get",method:"get",path:"/tickets/{ticketID}",resultType:"object",resultGetter:"ticket",pathParams:{ticketID:"工单ID"}},{name:"update",display:"修改工单",type:"update",method:"put",path:"/tickets/{ticketID}",resultType:"object",pathParams:{ticketID:"工单ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{product:{type:"integer",description:"所属产品",format:"int32"},module:{type:"integer",description:"所属模块",format:"int32"},title:{type:"string",description:"标题"},type:{type:"string",description:"类型(code 程序报错 | data 数据错误 | stuck 流程卡断 | security 安全问题 | affair 事务)"},desc:{type:"string",description:"描述"},assignedTo:{type:"string",description:"指派给"},deadline:{type:"string",description:"截止日期"},openedBuild:{type:"array",items:{type:"string"},description:"影响版本"}}}}},{name:"delete",display:"删除工单",type:"delete",method:"delete",path:"/tickets/{ticketID}",resultType:"text",pathParams:{ticketID:"工单ID"},render:"action"},{name:"activate",display:"激活工单",type:"action",method:"put",path:"/tickets/{ticketID}/activate",resultType:"text",pathParams:{ticketID:"工单ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{assignedTo:{type:"string",description:"指派给"},comment:{type:"string",description:"备注"}}}},render:"action"},{name:"close",display:"关闭工单",type:"action",method:"put",path:"/tickets/{ticketID}/close",resultType:"text",pathParams:{ticketID:"工单ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{closedReason:{type:"string",description:"关闭原因(commented 已处理 | repeat 重复 | refuse 不予处理)"},comment:{type:"string",description:"备注"}},required:["closedReason","comment"]}},render:"action"}]},{name:"system",display:"应用",description:"应用管理,支持获取应用列表,支持获取产品下的应用、创建应用、修改应用",actions:[{name:"list",display:"获取应用列表,支持获取产品下的应用",type:"list",method:"get",path:"/{scope}/{scopeID}/systems",resultType:"list",pagerGetter:"pager",pathParams:{scope:{description:"应用范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"}},{name:"create",display:"创建应用",type:"create",method:"post",path:"/systems",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"所属产品",format:"int32"},integrated:{type:"integer",description:"是否集成应用(0 否| 1 是)",format:"int32"},children:{type:"array",items:{type:"string"},description:"集成应用需要包含其他应用,非集成应用传空数组[]"},name:{type:"string",description:"应用名称"},desc:{type:"string",description:"描述"}},required:["productID","integrated","children","name"]}}},{name:"update",display:"修改应用",type:"update",method:"put",path:"/systems/{systemID}",resultType:"object",pathParams:{systemID:"应用ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"应用名称"},children:{type:"array",items:{type:"string"},description:"集成应用需要包含其他应用,非集成应用传空数组[]"},desc:{type:"string",description:"描述"}},required:["name","children"]}}}]},{name:"build",display:"版本",description:"版本管理,支持获取版本列表,支持获取项目/执行下的版本、创建版本/构建、修改版本、删除版本",actions:[{name:"list",display:"获取版本列表,支持获取项目/执行下的版本",type:"list",method:"get",path:"/{scope}/{scopeID}/builds",resultType:"list",pagerGetter:"pager",resultGetter:"builds",pathParams:{scope:{description:"版本范围",options:[{value:"projects",label:"项目"},{value:"executions",label:"执行"}]},scopeID:"范围ID"}},{name:"create",display:"创建版本/构建",type:"create",method:"post",path:"/builds",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{executionID:{type:"integer",description:"所属执行/迭代",format:"int32"},product:{type:"integer",description:"所属产品",format:"int32"},name:{type:"string",description:"构建名称"},system:{type:"integer",description:"所属应用",format:"int32"},builder:{type:"string",description:"构建者"},date:{type:"string",description:"打包日期"},scmPath:{type:"string",description:"源代码地址"},filePath:{type:"string",description:"下载地址"},desc:{type:"string",description:"描述"}},required:["executionID","product","name","system","builder","date"]}}},{name:"update",display:"修改版本",type:"update",method:"put",path:"/builds/{buildID}",resultType:"object",pathParams:{buildID:"版本ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{execution:{type:"integer",description:"所属执行/迭代",format:"int32"},product:{type:"integer",description:"所属产品",format:"int32"},name:{type:"string",description:"构建名称"},system:{type:"integer",description:"所属应用",format:"int32"},builder:{type:"string",description:"构建者"},date:{type:"string",description:"打包日期"},scmPath:{type:"string",description:"源代码地址"},filePath:{type:"string",description:"下载地址"},desc:{type:"string",description:"描述"}},required:["execution","product","name","system","builder","date"]}}},{name:"delete",display:"删除版本",type:"delete",method:"delete",path:"/builds/{buildID}",resultType:"text",pathParams:{buildID:"版本ID"},render:"action"}]},{name:"testtask",display:"测试单",description:"测试单管理,支持获取测试单列表,支持获取产品/项目/执行下的测试单、创建测试单、修改测试单、删除测试单",actions:[{name:"list",display:"获取测试单列表,支持获取产品/项目/执行下的测试单",type:"list",method:"get",path:"/{scope}/{scopeID}/testtasks",resultType:"list",pagerGetter:"pager",resultGetter:"testtasks",pathParams:{scope:{description:"测试单范围",options:[{value:"products",label:"产品"},{value:"projects",label:"项目"},{value:"executions",label:"执行"}]},scopeID:"范围ID"}},{name:"create",display:"创建测试单",type:"create",method:"post",path:"/testtasks",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"所属产品ID",format:"int32"},name:{type:"string",description:"测试单名称"},build:{type:"integer",description:"提测构建/版本",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"},type:{type:"array",items:{type:"string"},description:"类型(integrate 集成测试 | system 系统测试 | acceptance 验收测试 | performance 性能测试 | safety 安全测试)"},owner:{type:"string",description:"负责人"},status:{type:"string",description:"状态(wait 未开始 | doing 进行中 | done 已关闭 | blocked 被阻塞)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},desc:{type:"string",description:"描述"}},required:["productID","name","build","begin","end"]}}},{name:"update",display:"修改测试单",type:"update",method:"put",path:"/testtasks/{testtaskID}",resultType:"object",pathParams:{testtaskID:"测试单ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{name:{type:"string",description:"测试单名称"},build:{type:"integer",description:"提测构建/版本",format:"int32"},execution:{type:"integer",description:"所属执行",format:"int32"},type:{type:"array",items:{type:"string"},description:"类型(integrate 集成测试 | system 系统测试 | acceptance 验收测试 | performance 性能测试 | safety 安全测试)"},owner:{type:"string",description:"负责人"},status:{type:"string",description:"状态(wait 未开始 | doing 进行中 | done 已关闭 | blocked 被阻塞)"},begin:{type:"string",description:"开始日期"},end:{type:"string",description:"结束日期"},desc:{type:"string",description:"描述"}},required:["name","build","begin","end"]}}},{name:"delete",display:"删除测试单",type:"delete",method:"delete",path:"/testtasks/{testtaskID}",resultType:"text",pathParams:{testtaskID:"测试单ID"},render:"action"}]},{name:"release",display:"发布",description:"发布管理,支持获取发布列表,支持获取产品下的发布、创建发布、修改发布、删除发布",actions:[{name:"list",display:"获取发布列表,支持获取产品下的发布",type:"list",method:"get",path:"/{scope}/{scopeID}/releases",resultType:"list",pagerGetter:"pager",resultGetter:"releases",pathParams:{scope:{description:"发布范围",options:[{value:"products",label:"产品"}]},scopeID:"范围ID"}},{name:"create",display:"创建发布",type:"create",method:"post",path:"/releases",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{productID:{type:"integer",description:"所属产品",format:"int32"},system:{type:"integer",description:"所属应用",format:"int32"},name:{type:"string",description:"应用版本号"},build:{type:"array",items:{type:"string"},description:"包含构建"},status:{type:"string",description:"状态(wait 未开始 | normal 已发布 | fail 发布失败 | terminate 停止维护)"},date:{type:"string",description:"计划发布日期"},desc:{type:"string",description:"描述"}},required:["productID","system","name","build","date"]}}},{name:"update",display:"修改发布",type:"update",method:"put",path:"/releases/{releasID}",resultType:"object",pathParams:{releasID:"发布ID"},requestBody:{required:!0,type:"object",schema:{type:"object",properties:{system:{type:"integer",description:"所属应用",format:"int32"},name:{type:"string",description:"应用版本号"},build:{type:"array",items:{type:"string"},description:"包含构建"},status:{type:"string",description:"状态(wait 未开始 | normal 已发布 | fail 发布失败 | terminate 停止维护)"},date:{type:"string",description:"计划发布日期"},desc:{type:"string",description:"描述"}},required:["system","name","build","date"]}}},{name:"delete",display:"删除发布",type:"delete",method:"delete",path:"/releases/{releasID}",resultType:"text",pathParams:{releasID:"发布ID"},render:"action"}]},{name:"file",display:"附件",description:"附件管理,支持编辑附件,修改附件的名称、删除附件",actions:[{name:"create",display:"编辑附件,修改附件的名称",type:"create",method:"post",path:"/files",resultType:"object",requestBody:{required:!0,type:"object",schema:{type:"object",properties:{fileName:{type:"string",description:"附件名称"}},required:["fileName"]}}},{name:"delete",display:"删除附件",type:"delete",method:"delete",path:"/files/{fileID}",resultType:"text",pathParams:{fileID:"附件ID"},render:"action"}]}];var T=H_(d),Z=i(T);function E(_){return _.map((A)=>({...A}))}function H_(_){return _.map((A)=>({...A,actions:E(A.actions)}))}function p(_,A){let f=A.toLowerCase();return _.findIndex((R)=>String(R.name).toLowerCase()===f)}function D_(_,A){let f=E(_);for(let R of A){let B=p(f,String(R.name)),H={...R};if(B>=0)f[B]=H;else f.push(H)}return f}function G_(_,A){return{..._,...A,actions:D_(_.actions,A.actions)}}function i(_){return new Map(_.map((A)=>[A.name.toLowerCase(),A]))}function I_(){Z=i(T)}function J_(_){if(!_||typeof _.name!=="string"||!Array.isArray(_.actions))throw new D("E_INVALID_MODULE_DEFINITION")}function Q_(_){if(!_||typeof _.name!=="string"||typeof _.path!=="string"||typeof _.method!=="string")throw new D("E_INVALID_ACTION_DEFINITION")}function x(_,A={}){for(let f of j(_)){J_(f);let R=f.name.toLowerCase(),B=T.findIndex((G)=>G.name.toLowerCase()===R),H={...f,actions:E(f.actions)};if(B>=0)T[B]=A.relace?H:G_(T[B],f);else T.push(H)}I_()}function k(_,A){let f=Z.get(_.toLowerCase());if(!f)throw new D("E_INVALID_MODULE",{module:_});for(let R of j(A)){Q_(R);let B=p(f.actions,String(R.name)),H={...R};if(B>=0)f.actions[B]=H;else f.actions.push(H)}}function q(_){let A=Z.get(_.toLowerCase());if(!A)throw new D("E_INVALID_MODULE",{module:_});return A}function K(_,A){let f=q(_),R=A==="ls"?"list":A,B=f.actions.find((G)=>String(G.name).toLowerCase()===R.toLowerCase());if(B)return B;if(!new Set(["list","get","create","update","delete"]).has(R)){let G=f.actions.find((J)=>J.type==="action"&&String(J.name).toLowerCase()===R.toLowerCase());if(G)return G}throw new D("E_INVALID_ACTION",{module:_,action:A})}var W_={product:"products",project:"projects",execution:"executions"},X_=["execution","project","product"];function $_(_){for(let A of X_){let f=_[A]??_[`${A}ID`];if(f===void 0||f===null||f==="")continue;let R=Number(f);if(!Number.isNaN(R))return{scope:W_[A],scopeID:R}}return}function M_(_,A){return _.path.replace(/\{(\w+)\}/g,(f,R)=>{let B=A[R];if(B===void 0||B==="")throw new D("E_MISSING_PARAM",{param:R});return String(B)})}function Y_(_){if(_===void 0)return;if(typeof _==="string")try{let A=JSON.parse(_);return A&&typeof A==="object"&&!Array.isArray(A)?A:void 0}catch{return}return _&&typeof _==="object"&&!Array.isArray(_)?_:void 0}function F_(_){return Boolean(_)&&typeof _==="object"&&!Array.isArray(_)}function T_(_,A){if(_===void 0)return;if(A==="number"||A==="integer"){let f=Number(_);return Number.isNaN(f)?_:f}if(A==="boolean"){if(_==="true")return!0;if(_==="false")return!1;return Boolean(_)}return _}function u(_,A,f={}){let R=K(_.name,A),B={},H=Object.keys(R.pathParams??{});if(H.includes("scope")){let O=$_(f);if(!O)throw new D("E_MISSING_PARAM",{param:"product/project/execution"});B.scope=O.scope,B.scopeID=O.scopeID}let G=H.find((O)=>O.endsWith("ID")&&O!=="scopeID"),J=f.id??f[`${_.name}ID`]??(G?f[G]:void 0),X=J===void 0?void 0:Number(J);if(G&&X!==void 0&&!Number.isNaN(X))B[G]=X;for(let O of H){if(O==="scope"||O==="scopeID"||B[O]!==void 0)continue;let Q=R.pathParams?.[O],$=f[O];if($!==void 0){B[O]=$;continue}if(typeof Q==="object"){if(Q.defaultValue!==void 0)B[O]=Q.defaultValue;else if(Q.options?.[0]?.value!==void 0)B[O]=Q.options[0].value}if(B[O]===void 0)throw new D("E_MISSING_PARAM",{param:O})}let M={};for(let O of R.params??[]){let Q=f[O.name];if(Q===void 0&&O.name==="pageID")Q=f.page;if(Q===void 0)Q=O.defaultValue??O.options?.[0]?.value;if(Q===void 0&&O.required)throw new D("E_MISSING_PARAM",{param:O.name});if(Q!==void 0)M[O.name]=Q}let I=Y_(f.data);if(R.requestBody?.schema?.type==="object"){I=I?{...I}:{};let O=R.requestBody.schema,Q=new Set(O.required??[]);for(let[$,L]of Object.entries(O.properties??{})){let l=Object.prototype.hasOwnProperty.call(I,$),W=I[$]??f[$]??L.defaultValue;if(W===void 0&&(L.required||Q.has($)))throw new D("E_MISSING_PARAM",{param:$});if(W=T_(W,L.type),L.type==="array"&&W!==void 0&&!Array.isArray(W)){if(typeof W==="string")W=W.split(",");else if(!l||!F_(W))W=[W]}if(W!==void 0)I[$]=W}}return{module:_.name,action:R,params:f,path:M_(R,B),query:M,data:I,id:X===void 0||Number.isNaN(X)?void 0:X}}function m(_,A){let f=_.resultGetter;if(!f)return A.data??A;if(typeof f==="function")return f(A,{});if(typeof f==="string")return P(A,f);let R={};for(let[B,H]of Object.entries(f))R[B]=A[H];return R}function n(_,A){let f=_.pagerGetter;if(!f)return A.pager;if(typeof f==="function")return f(A,{});if(typeof f==="string")return P(A,f);let R=A[f.pageID],B=A[f.recPerPage],H=A[f.recTotal];if(R===void 0||B===void 0||H===void 0)return;return{pageID:Number(R),recPerPage:Number(B),recTotal:Number(H)}}function q_(_){let A=_.indexOf("/");if(A<=0||A===_.length-1)throw new D("E_INVALID_REQUEST_NAME");return{moduleName:_.slice(0,A),actionName:_.slice(A+1)}}function C_(_,A,f){if(!A||typeof A!=="object"||Array.isArray(A))return{status:"success",data:A};let R=A,B=R.status==="fail"?"fail":"success",H=m(_.action,R),G=f===void 0?void 0:Number(f);if(Array.isArray(H)&&G!==void 0&&!Number.isNaN(G))H=H.slice(0,G);let J=n(_.action,R);return{status:B,message:typeof R.message==="string"?R.message:void 0,data:H,pager:J?{total:Number(J.recTotal),page:Number(J.pageID),recPerPage:Number(J.recPerPage)}:void 0}}async function N(_,A={},f={}){let R=Y(),B=f.client??R.client;if(!B)throw new D("E_NO_GLOBAL_CLIENT");let{moduleName:H,actionName:G}=q_(_),J=q(H),X=A.recPerPage??f.recPerPage??R.recPerPage,M=X===void 0?A:{...A,recPerPage:X},I=u(J,G,M),O=await B.request(I.path,{method:String(I.action.method).toUpperCase(),query:I.query,body:I.data,timeout:f.timeout??R.timeout,insecure:f.insecure??R.insecure});return C_(I,O,f.limit??R.limit)}var h="2026-05-10T12:45:54.888Z",y="0.2.0-beta.1";var b=globalThis;b.ZentaoAPI=S;if(b.window)b.window.ZentaoAPI=S;})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './misc/browser-global.js';
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './misc/browser-global.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ClientRequestOptions, ZentaoClientOptions } from '../types/index.js';
|
|
2
|
+
/** 禅道 API 客户端,负责 Token 注入、请求超时、TLS 选项和响应解析。 */
|
|
3
|
+
export declare class ZentaoClient {
|
|
4
|
+
/** 禅道站点根地址,不包含 `/api.php/v2`。 */
|
|
5
|
+
readonly siteUrl: string;
|
|
6
|
+
/** 禅道 API v2 根地址。 */
|
|
7
|
+
readonly baseUrl: string;
|
|
8
|
+
private token?;
|
|
9
|
+
private readonly timeout?;
|
|
10
|
+
private readonly insecure?;
|
|
11
|
+
/** 使用完整配置创建客户端。 */
|
|
12
|
+
constructor(options: ZentaoClientOptions);
|
|
13
|
+
/** 使用站点根地址创建客户端。 */
|
|
14
|
+
constructor(baseUrl: string);
|
|
15
|
+
/**
|
|
16
|
+
* 发起一次原始 API 请求。
|
|
17
|
+
*
|
|
18
|
+
* 默认使用 GET;当服务端返回 `{ status: "fail" }` 时仍按原始内容返回,
|
|
19
|
+
* 只有 HTTP/网络/超时等传输层错误会抛出 {@link ZentaoError}。
|
|
20
|
+
*/
|
|
21
|
+
request(path: string, options?: ClientRequestOptions): Promise<unknown>;
|
|
22
|
+
/** 发起 GET 请求并按调用方指定类型返回。 */
|
|
23
|
+
get<T>(path: string): Promise<T>;
|
|
24
|
+
/** 发起 POST 请求并发送 JSON body。 */
|
|
25
|
+
post<T>(path: string, body: any): Promise<T>;
|
|
26
|
+
/** 发起 PUT 请求并发送 JSON body。 */
|
|
27
|
+
put<T>(path: string, body: any): Promise<T>;
|
|
28
|
+
/** 发起 DELETE 请求。 */
|
|
29
|
+
delete<T>(path: string): Promise<T>;
|
|
30
|
+
/** 使用账号密码登录,成功后把返回 Token 写入当前客户端实例。 */
|
|
31
|
+
login(account: string, password: string): Promise<string>;
|
|
32
|
+
/** 创建客户端实例,语义等同于 `new ZentaoClient(options)`。 */
|
|
33
|
+
static create(options: ZentaoClientOptions): ZentaoClient;
|
|
34
|
+
/** 创建客户端并写入全局选项,供高阶 `request()` 默认使用。 */
|
|
35
|
+
static init(options: ZentaoClientOptions): ZentaoClient;
|
|
36
|
+
}
|
|
37
|
+
export declare function createClient(options: ZentaoClientOptions): ZentaoClient;
|