zentao-api 0.1.0 → 0.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +221 -131
  3. package/dist/browser/zentao-api.global.js +2 -0
  4. package/dist/browser.d.ts +1 -0
  5. package/dist/browser.js +1 -0
  6. package/dist/client/index.d.ts +39 -0
  7. package/dist/client/index.js +172 -0
  8. package/dist/index.d.ts +8 -4
  9. package/dist/index.js +7 -8
  10. package/dist/misc/browser-global.d.ts +1 -0
  11. package/dist/misc/browser-global.js +8 -0
  12. package/dist/misc/environment.d.ts +8 -0
  13. package/dist/misc/environment.js +124 -0
  14. package/dist/misc/errors.d.ts +30 -0
  15. package/dist/misc/errors.js +40 -0
  16. package/dist/misc/global-options.d.ts +5 -0
  17. package/dist/misc/global-options.js +9 -0
  18. package/dist/modules/generated.d.ts +8 -0
  19. package/dist/modules/generated.js +4226 -0
  20. package/dist/modules/registry.d.ts +22 -0
  21. package/dist/modules/registry.js +142 -0
  22. package/dist/modules/resolve.d.ts +7 -0
  23. package/dist/modules/resolve.js +206 -0
  24. package/dist/profiles/index.d.ts +14 -0
  25. package/dist/profiles/index.js +205 -0
  26. package/dist/request/index.d.ts +7 -0
  27. package/dist/request/index.js +65 -0
  28. package/dist/types/index.d.ts +296 -0
  29. package/dist/types/index.js +1 -0
  30. package/dist/utils/index.d.ts +6 -0
  31. package/dist/utils/index.js +26 -0
  32. package/dist/version.d.ts +2 -0
  33. package/dist/version.js +4 -0
  34. package/package.json +52 -76
  35. package/dist/types.d.ts +0 -70
  36. package/dist/utils.d.ts +0 -93
  37. package/dist/zentao-api.cjs.development.js +0 -3619
  38. package/dist/zentao-api.cjs.development.js.map +0 -1
  39. package/dist/zentao-api.cjs.production.min.js +0 -2
  40. package/dist/zentao-api.cjs.production.min.js.map +0 -1
  41. package/dist/zentao-api.esm.js +0 -3611
  42. package/dist/zentao-api.esm.js.map +0 -1
  43. package/dist/zentao-config.d.ts +0 -93
  44. package/dist/zentao-request-builder.d.ts +0 -120
  45. package/dist/zentao.d.ts +0 -175
  46. package/dist/zentao12.d.ts +0 -676
  47. package/src/index.ts +0 -5
  48. package/src/types.ts +0 -88
  49. package/src/utils.ts +0 -216
  50. package/src/zentao-config.ts +0 -150
  51. package/src/zentao-request-builder.ts +0 -227
  52. package/src/zentao.ts +0 -596
  53. package/src/zentao12.ts +0 -1272
@@ -1,676 +0,0 @@
1
- import { ZentaoApiResult } from './types';
2
- import Zentao from './zentao';
3
- /**
4
- * 禅道 API 请求类
5
- *
6
- * @example
7
- * ```js
8
- * import {ZentaoApi} from 'zentao-api';
9
- * const zentao = new ZentaoApi({
10
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
11
- * });
12
- * // TODO: 使用 zentao 调用其他 API
13
- * ```
14
- */
15
- export default class ZentaoApi extends Zentao {
16
- /**
17
- * 调用指定名称的 API
18
- * @param apiName API 名称
19
- * @param params 请求参数
20
- * @returns 调用结果
21
- * @example
22
- * ```js
23
- * import {ZentaoApi} from 'zentao-api';
24
- * const zentao = new ZentaoApi({
25
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
26
- * });
27
- *
28
- * const res = await zentao.call('getProductList', {status: 'noclosed'});
29
- * ```
30
- */
31
- call(apiName: Exclude<keyof ZentaoApi, 'call' | keyof Zentao>, params?: Record<string, any>): Promise<ZentaoApiResult>;
32
- /**
33
- * 获取当前已添加部门列表数据
34
- *
35
- * @param {{deptID?: number, extraFields?: string[]}} [params] 请求参数,`params.deptID` 用于指定部门ID,`params.extraFields` 指定额外要返回的字段
36
- * @returns 请求结果
37
- * @example
38
- * ```js
39
- * import { ZentaoApi } from 'zentao-api';
40
- * const zentao = new ZentaoApi({
41
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
42
- * });
43
- * const result = await zentao.getDeptList({deptID: 1, extraFields: 'sons'});
44
- * if (result.status) {
45
- * console.log('当前部门的直属下级部门列表', result.result.sons);
46
- * }
47
- * ```
48
- */
49
- getDeptList(params?: {
50
- deptID?: number;
51
- extraFields?: string[];
52
- }): Promise<ZentaoApiResult>;
53
- /**
54
- * 批量添加部门
55
- *
56
- * @param params 请求参数,其中 `params.parentDeptID` 为所属上级部门ID,`params.depts` 为新增部门名称列表
57
- * @returns 请求结果
58
- * @example
59
- * import { ZentaoApi } from 'zentao-api';
60
- * const zentao = new ZentaoApi({
61
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
62
- * });
63
- *
64
- * // 在部门 ID 为 3 的部门下添加两个子部门:开发部、测试部
65
- * const result = await zentao.addDept({parentDeptID: 3, depts: ['开发部', '测试部']});
66
- * if (result.status) {
67
- * console.log('部门添加成功');
68
- * }
69
- */
70
- addDept(params: {
71
- parentDeptID?: number;
72
- depts: string[];
73
- }): Promise<ZentaoApiResult>;
74
- /**
75
- * 获取用户列表,可以指定用户所属部门
76
- *
77
- * @param {{deptID?: number, orderBy?: string, recTotal?: number, recPerPage?: number, pageID?: number, extraFields?: string[]}} [params] 请求参数,`params.deptID` 用于指定部门ID(如果不指定则获取所有用户数据),`params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
78
- * @returns 请求结果
79
- * @example
80
- * ```js
81
- * import { ZentaoApi } from 'zentao-api';
82
- * const zentao = new ZentaoApi({
83
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
84
- * });
85
- * const result = await zentao.getUserList({deptID: 1});
86
- * if (result.status) {
87
- * console.log('当前部门的用户列表数据为', result.result.users);
88
- * }
89
- * ```
90
- */
91
- getUserList(params?: {
92
- deptID?: number;
93
- orderBy?: string;
94
- recTotal?: number;
95
- recPerPage?: number;
96
- pageID?: number;
97
- extraFields?: string[];
98
- }): Promise<ZentaoApiResult>;
99
- /**
100
- * 添加用户时如果需要为新用 户分配部门、职位、权限,请求该方法即可返回相关可用数据
101
- *
102
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
103
- * @returns 请求结果
104
- * @example
105
- * ```js
106
- * import { ZentaoApi } from 'zentao-api';
107
- * const zentao = new ZentaoApi({
108
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
109
- * });
110
- * const result = await zentao.getUserCreateParams();
111
- * ```
112
- */
113
- getUserCreateParams(params?: {
114
- extraFields?: string[];
115
- }): Promise<ZentaoApiResult>;
116
- /**
117
- * 向系统添加一个用户
118
- * @param params 用户信息参数
119
- * @returns
120
- * @example
121
- * ```js
122
- * import { ZentaoApi } from 'zentao-api';
123
- * const zentao = new ZentaoApi({
124
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
125
- * });
126
- * const result = await zentao.addUser({
127
- * account: 'Jack10', // 必填参数 用户名
128
- * password: '123456', // 必填参数 密码
129
- * realname: 'Jack10', // 必填参数 真实姓名
130
- * dept: 1, // 选填参数 所属部门【部门ID】
131
- * join: '2019-11-11', // 选填参数 入职日期【格式:2019-11-19】
132
- * role: 'dev', // 选填参数 职位【权限标识,例如:'dev','qd'】
133
- * group: 2, // 选填参数 权限分组【分组ID】
134
- * email: 'jack@gmail.com', // 选填参数 邮箱
135
- * commiter: 'Jack10', // 选填参数 源代码账号
136
- * gender: 'm', // 选填参数 性别【m:男|f:女】
137
- * });
138
- * if (result.status) {
139
- * console.log('用户创建成功');
140
- * }
141
- * ```
142
- */
143
- addUser(params: {
144
- account: string;
145
- password: string;
146
- realname: string;
147
- dept?: number;
148
- join?: string;
149
- role?: string;
150
- group?: number;
151
- email?: string;
152
- commiter?: string;
153
- gender?: 'm' | 'f';
154
- }): Promise<ZentaoApiResult>;
155
- /**
156
- * 获取产品列表
157
- * @param {{productID?: number, line?: number, status?: 'noclosed'|'closed'|'involved'|'all', orderBy?: string, recTotal?: number, recPerPage?: number, pageID?: number, extraFields?: string[]}} [params] 请求参数,`params.productID` 用于指定所属产品,`params.status` 用于指定产品状态,`params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
158
- * @returns 请求结果
159
- * @example
160
- * ```js
161
- * import { ZentaoApi } from 'zentao-api';
162
- * const zentao = new ZentaoApi({
163
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
164
- * });
165
- * const result = await zentao.getProductList({status: 'noclosed'});
166
- * if (result.status) {
167
- * console.log('产品列表', result.result.products);
168
- * }
169
- * ```
170
- */
171
- getProductList(params?: {
172
- productID?: number;
173
- line?: number;
174
- status?: 'noclosed' | 'closed' | 'involved' | 'all';
175
- orderBy?: string;
176
- recTotal?: number;
177
- recPerPage?: number;
178
- pageID?: number;
179
- extraFields?: string[];
180
- }): Promise<ZentaoApiResult>;
181
- /**
182
- * 获取指定的产品信息
183
- * @param {{productID: number, extraFields?: string[]}} [params] 请求参数,`params.productID` 用于指定产品 ID,params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
184
- * @returns 请求结果
185
- * @example
186
- * ```js
187
- * import { ZentaoApi } from 'zentao-api';
188
- * const zentao = new ZentaoApi({
189
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
190
- * });
191
- * const result = await zentao.getProduct({productID: 1});
192
- * if (result.status) {
193
- * console.log('产品信息为', result.result.product);
194
- * }
195
- * ```
196
- */
197
- getProduct(params: {
198
- productID: number;
199
- extraFields?: string[];
200
- }): Promise<ZentaoApiResult>;
201
- /**
202
- * 获取添加产品时所需要一些数据,例如产品线数据列表、产品负责人数据列表等数据,添加产品时,可以为其绑定这些信息
203
- *
204
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
205
- * @returns 请求结果
206
- * @example
207
- * ```js
208
- * import { ZentaoApi } from 'zentao-api';
209
- * const zentao = new ZentaoApi({
210
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
211
- * });
212
- * const result = await zentao.getProductCreateParams();
213
- * ```
214
- */
215
- getProductCreateParams(params?: {
216
- extraFields?: string[];
217
- }): Promise<ZentaoApiResult>;
218
- /**
219
- * 向系统添加一个产品,添加新产品时可以指定相关负责人,设置产品类型和访问权限。注意:假如参数 acl = custom ,可以额外传递参数,例如: 'whitelist' => array(1, 2) ,添加白名单为权限分组列表中 ID
220
- * @param params 产品信息参数
221
- * @returns
222
- * @example
223
- * ```js
224
- * import { ZentaoApi } from 'zentao-api';
225
- * const zentao = new ZentaoApi({
226
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
227
- * });
228
- * const result = await zentao.addProduct({
229
- * name: '登月行动', // 必填参数 产品名称
230
- * code: 'to_the_moon', // 必填参数 产品代号
231
- * line: 0, // 选填参数 产品线ID
232
- * PO: 'admin', // 选填参数 产品负责人账号
233
- * QD: 'jim', // 选填参数 测试负责人账号
234
- * RD: 'lilei', // 选填参数 发布负责人账号
235
- * type: normal', // 选填参数 产品类型【normal正常|branch多分支|platform多平台】
236
- * desc: '登月行动,刻不容缓', // 选填参数 产品描述
237
- * acl: 'custom', // 选填参数 访问控制【open默认|private私有|custom白名单】
238
- * whitelist: [], // 选填参数 白名单,权限分组列表中 ID
239
- * });
240
- * if (result.status) {
241
- * console.log('产品创建成功');
242
- * }
243
- * ```
244
- */
245
- addProduct(params: {
246
- name: string;
247
- code: string;
248
- line?: number;
249
- PO?: string;
250
- QD?: string;
251
- RD?: string;
252
- type?: 'normal' | 'branch' | 'platform';
253
- desc?: string;
254
- acl?: 'open' | 'custom' | 'private';
255
- whitelist?: number[];
256
- }): Promise<ZentaoApiResult>;
257
- /**
258
- * 获取项目列表
259
- * @param {{status?: 'undone'|'wait'|'doing'|'suspended'|'closed'|'all', projectID?: number, orderBy?: string, productID?: number, recTotal?: number, recPerPage?: number, pageID?: number, extraFields?: string[]}} [params] 请求参数,`params.productID` 用于指定所属产品,`params.status` 用于指定项目状态,`params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
260
- * @returns 请求结果
261
- * @example
262
- * ```js
263
- * import { ZentaoApi } from 'zentao-api';
264
- * const zentao = new ZentaoApi({
265
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
266
- * });
267
- * const result = await zentao.getProjectList({status: 'undone'});
268
- * if (result.status) {
269
- * console.log('项目列表', result.result.products);
270
- * }
271
- * ```
272
- */
273
- getProjectList(params?: {
274
- status?: 'undone' | 'wait' | 'doing' | 'suspended' | 'closed' | 'all';
275
- projectID?: number;
276
- orderBy?: string;
277
- productID?: number;
278
- recTotal?: number;
279
- recPerPage?: number;
280
- pageID?: number;
281
- extraFields?: string[];
282
- }): Promise<ZentaoApiResult>;
283
- /**
284
- * 获取指定的项目信息
285
- * @param {{projectID: number, extraFields?: string[]}} [params] 请求参数,`params.projectID` 用于指定项目 ID,params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
286
- * @returns 请求结果
287
- * @example
288
- * ```js
289
- * import { ZentaoApi } from 'zentao-api';
290
- * const zentao = new ZentaoApi({
291
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
292
- * });
293
- * const result = await zentao.getProject({projectID: 1});
294
- * if (result.status) {
295
- * console.log('项目信息为', result.result.project);
296
- * }
297
- * ```
298
- */
299
- getProject(params: {
300
- projectID: number;
301
- extraFields?: string[];
302
- }): Promise<ZentaoApiResult>;
303
- /**
304
- * 获取添加项目时所需要一些数据,例如获取正常状态产品列表信息,用于添加项目时为其绑定产品,从而用于项目与产品需求关联。还可获取权限分组列表,用于项目绑定访问控制权限
305
- *
306
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
307
- * @returns 请求结果
308
- * @example
309
- * ```js
310
- * import { ZentaoApi } from 'zentao-api';
311
- * const zentao = new ZentaoApi({
312
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
313
- * });
314
- * const result = await zentao.getProjectCreateParams();
315
- * ```
316
- */
317
- getProjectCreateParams(params?: {
318
- extraFields?: string[];
319
- }): Promise<ZentaoApiResult>;
320
- /**
321
- * 向系统添加一个项目,添加新项目时可以指定相关负责人,设置产品类型和访问权限
322
- * @param params 项目信息参数
323
- * @returns
324
- * @example
325
- * ```js
326
- * import { ZentaoApi } from 'zentao-api';
327
- * const zentao = new ZentaoApi({
328
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
329
- * });
330
- * const result = await zentao.addProject({
331
- * name: '禅道项目管理开发', // 必填参数 项目名称
332
- * code: 'zentao', // 必填参数 项目代号
333
- * begin: '2020-01-01', // 必填参数 起始日期【时间格式:2019-11-20】
334
- * end: '2020-06-06', // 必填参数 结束日期【时间格式:2019-11-20】
335
- * days: '100', // 选填参数 可用工作日
336
- * team: '禅道开发团队', // 选填参数 团队名称
337
- * type: 'sprint', // 选填参数 项目类型【sprint短期项目|waterfall长期项目|ops运维项目】
338
- * desc: '专业的研发项目管理软件。', // 选填参数 项目描述
339
- * acl: 'custom', // 选填参数 访问控制【open默认设置|private私有项目|custom白名单】
340
- * whitelist: [1, 2], // 选填参数 白名单中的权限分组 ID
341
- * products: [4, 5], // 选填参数 关联产品 ID
342
- * plans: [5, 6] // 选填参数 关联产品 ID 所属计划 ID
343
- * });
344
- * if (result.status) {
345
- * console.log('项目创建成功');
346
- * }
347
- * ```
348
- */
349
- addProject(params: {
350
- name: string;
351
- code: string;
352
- begin: string;
353
- end: string;
354
- days?: number;
355
- team?: string;
356
- type?: 'sprint' | 'waterfall' | 'ops';
357
- desc?: string;
358
- acl?: 'open' | 'custom' | 'private';
359
- whitelist?: number[];
360
- products?: number[];
361
- plans?: number[];
362
- }): Promise<ZentaoApiResult>;
363
- /**
364
- * 获取项目任务列表
365
- * @param {{projectID: number, status?: 'unclosed'|'assignedtome'|'myinvolved'|'delayed'|'needconfirm'|'wait'|'doing'|'undone'|'finishedbyme'|'done'|'closed'|'cancel'|'all', param?: number, orderBy?: string, recTotal?: number, recPerPage?: number, pageID?: number, extraFields?: string[]}} [params] 请求参数,`params.projectID` 用于指定所属项目,`params.status` 用于指定任务状态,`params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
366
- * @returns 请求结果
367
- * @example
368
- * ```js
369
- * import { ZentaoApi } from 'zentao-api';
370
- * const zentao = new ZentaoApi({
371
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
372
- * });
373
- * const result = await zentao.getProjectList({projectID: 1, status: 'undone'});
374
- * if (result.status) {
375
- * console.log('任务列表', result.result.tasks);
376
- * }
377
- * ```
378
- */
379
- getTaskList(params: {
380
- projectID: number;
381
- status?: 'unclosed' | 'assignedtome' | 'myinvolved' | 'delayed' | 'needconfirm' | 'wait' | 'doing' | 'undone' | 'finishedbyme' | 'done' | 'closed' | 'cancel' | 'all';
382
- param?: number;
383
- orderBy?: string;
384
- recTotal?: number;
385
- recPerPage?: number;
386
- pageID?: number;
387
- extraFields?: string[];
388
- }): Promise<ZentaoApiResult>;
389
- /**
390
- * 获取指定的任务信息
391
- * @param {{taskID: number, extraFields?: string[]}} [params] 请求参数,`params.taskID` 用于指定任务 ID,params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
392
- * @returns 请求结果
393
- * @example
394
- * ```js
395
- * import { ZentaoApi } from 'zentao-api';
396
- * const zentao = new ZentaoApi({
397
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
398
- * });
399
- * const result = await zentao.getTask({taskID: 1});
400
- * if (result.status) {
401
- * console.log('任务信息为', result.result.products);
402
- * }
403
- * ```
404
- */
405
- getTask(params: {
406
- taskID: number;
407
- extraFields?: string[];
408
- }): Promise<ZentaoApiResult>;
409
- /**
410
- * 添加单个任务时,可以先通 过此方法,获取添加任务中所需要的相关信息
411
- *
412
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
413
- * @returns 请求结果
414
- * @example
415
- * ```js
416
- * import { ZentaoApi } from 'zentao-api';
417
- * const zentao = new ZentaoApi({
418
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
419
- * });
420
- * const result = await zentao.getTaskCreateParams();
421
- * ```
422
- */
423
- getTaskCreateParams(params?: {
424
- extraFields?: string[];
425
- }): Promise<ZentaoApiResult>;
426
- /**
427
- * 向系统添加一个任务
428
- * @param params 任务信息参数
429
- * @returns
430
- * @example
431
- * ```js
432
- * import { ZentaoApi } from 'zentao-api';
433
- * const zentao = new ZentaoApi({
434
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
435
- * });
436
- * const result = await zentao.addTask({
437
- * project: 1, // 必填参数 所属项目ID
438
- * type: 'ui', // 必填参数 任务类型【design设计|devel开发|test测试|study研究|discuss讨论|ui界面|affair事务|misc其他】
439
- * module: 0, // 选填参数 所属模块ID
440
- * assignedTo: 'lisa', // 选填参数 指派用户,示例:'assignedTo' => array('zhangsan')
441
- * color: '', // 选填参数 任务颜色【示例:#ff4e3e】
442
- * name: '设计界面', // 必填参数 任务名称
443
- * pri: 2, // 选填参数 优先级【分为 1、2、3、4级】
444
- * estimate: 1, // 选填参数 预计时间【小时】
445
- * desc: '设计界面描述', // 选填参数 任务描述
446
- * estStarted: '2021-01-11', // 选填参数 日程规划开始【格式:2019-11-20】
447
- * deadline: '2021-11-12', // 选填参数 日程规划结束【格式:2019-11-28】
448
- * mailto: 'lisa' // 选填参数 抄送用户,示例:'mailto' => array('lisi', 'niuqi', 'zhangsan'), 代表同时抄送给 3 个用户。
449
- * });
450
- * if (result.status) {
451
- * console.log('任务创建成功');
452
- * }
453
- * ```
454
- */
455
- addTask(params: {
456
- project: number;
457
- name: string;
458
- type?: 'design' | 'devel' | 'test' | 'study' | 'discuss' | 'ui' | 'affair' | 'misc';
459
- module?: number;
460
- color?: string;
461
- pri?: number;
462
- estimate?: number;
463
- desc?: string;
464
- estStarted?: string;
465
- deadline?: string;
466
- assignedTo?: string[];
467
- mailto?: string[];
468
- }): Promise<ZentaoApiResult>;
469
- /**
470
- * 获取该任务的所属项目详情、任务详情、任务操作记录,同时获取用于指派完成的用户列表
471
- *
472
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
473
- * @returns 请求结果
474
- * @example
475
- * ```js
476
- * import { ZentaoApi } from 'zentao-api';
477
- * const zentao = new ZentaoApi({
478
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
479
- * });
480
- * const result = await zentao.getTaskFinishParams({taskID: 1});
481
- * ```
482
- */
483
- getTaskFinishParams(params: {
484
- taskID: number;
485
- extraFields?: string[];
486
- }): Promise<ZentaoApiResult>;
487
- /**
488
- * 完成一个任务
489
- * @param params 任务信息参数
490
- * @returns
491
- * @example
492
- * ```js
493
- * import { ZentaoApi } from 'zentao-api';
494
- * const zentao = new ZentaoApi({
495
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
496
- * });
497
- * const result = await zentao.finishTask({taskID: 1, currentConsumed: 1});
498
- * if (result.status) {
499
- * console.log('任务完成');
500
- * }
501
- * ```
502
- */
503
- finishTask(params: {
504
- taskID: number;
505
- currentConsumed: number;
506
- consumed?: number;
507
- assignedTo?: string;
508
- finishedDate?: string;
509
- comment?: string;
510
- }): Promise<ZentaoApiResult>;
511
- /**
512
- * 获取产品 Bug 列表
513
- * @param {{productID: number, branch?: number, browseType?: 'all'|'unclosed'|'openedbyme'|'assigntome'|'resolvedbyme'|'toclosed'|'unresolved'|'unconfirmed'|'longlifebugs'|'postponedbugs'|'overduebugs'|'needconfirm', param?: number, orderBy?: string, recTotal?: number, recPerPage?: number, pageID?: number, extraFields?: string[]}} [params] 请求参数,`params.productID` 用于指定所属产品,`params.browseType` 用于指定 bug 列表类型,`params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
514
- * @returns 请求结果
515
- * @example
516
- * ```js
517
- * import { ZentaoApi } from 'zentao-api';
518
- * const zentao = new ZentaoApi({
519
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
520
- * });
521
- * const result = await zentao.getProjectList({projectID: 1, status: 'undone'});
522
- * if (result.status) {
523
- * console.log('Bug列表', result.result.bugs);
524
- * }
525
- * ```
526
- */
527
- getBugList(params: {
528
- productID: number;
529
- branch?: number;
530
- browseType?: 'all' | 'unclosed' | 'openedbyme' | 'assigntome' | 'resolvedbyme' | 'toclosed' | 'unresolved' | 'unconfirmed' | 'longlifebugs' | 'postponedbugs' | 'overduebugs' | 'needconfirm';
531
- param?: number;
532
- orderBy?: string;
533
- recTotal?: number;
534
- recPerPage?: number;
535
- pageID?: number;
536
- extraFields?: string[];
537
- }): Promise<ZentaoApiResult>;
538
- /**
539
- * 获取指定的 Bug 信息
540
- * @param {{bugID: number, extraFields?: string[]}} [params] 请求参数,`params.bugID` 用于指定Bug ID,params.extraFields` 指定额外要返回的字段,其他字段指定分页信息
541
- * @returns 请求结果
542
- * ```js
543
- * import { ZentaoApi } from 'zentao-api';
544
- * const zentao = new ZentaoApi({
545
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
546
- * });
547
- * const result = await zentao.getBug({bugID: 1});
548
- * if (result.status) {
549
- * console.log('Bug 信息为', result.result.bug);
550
- * }
551
- * ```
552
- */
553
- getBug(params: {
554
- bugID: number;
555
- extraFields?: string[];
556
- }): Promise<ZentaoApiResult>;
557
- /**
558
- * 用 于为指定的产品添加 Bug 之前,获取添加 Bug 时可能需要用到的一些相关信息。
559
- *
560
- * @param {{extraFields?: string[]}} [params] 请求参数,`params.extraFields` 指定额外要返回的字段
561
- * @returns 请求结果
562
- * @example
563
- * ```js
564
- * import { ZentaoApi } from 'zentao-api';
565
- * const zentao = new ZentaoApi({
566
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
567
- * });
568
- * const result = await zentao.getBugCreateParams();
569
- * ```
570
- */
571
- getBugCreateParams(params: {
572
- productID: number;
573
- extraFields?: string[];
574
- }): Promise<ZentaoApiResult>;
575
- /**
576
- * 向系统添加一个 Bug
577
- * @param params Bug 信息参数
578
- * @returns
579
- * @example
580
- * ```js
581
- * import { ZentaoApi } from 'zentao-api';
582
- * const zentao = new ZentaoApi({
583
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
584
- * });
585
- * const result = await zentao.addBug({
586
- * product: 1, // 必填参数 所属产品ID
587
- * module: 2, // 选填参数 所属模块ID
588
- * project: 1, // 选填参数 所属项目ID
589
- * openedBuild: ['trunk', 3, 2], // 选填参数 影响版本ID【添加单个 Bug 可选信息结果中 builds 记录的 key 值】
590
- * assignedTo: 'lisi', // 选填参数 当前指派【用户账号】
591
- * deadline: '2019-11-21', // 选填参数 截止日期【格式示例:2019-11-11】
592
- * type: 'codeerror', // 选填参数 BUG类型【codeerror代码错误|config配置相关|install安装部署|security安全相关|performance性能问题|standard标准规范|automation测试脚本|designdefect设计缺陷|others其他
593
- * os: 'windows', // 选填参数 选填参数|操作系统【all-全部|windows-Windows|win10-Windows 10|win8-Windows 8|win7-Windows 7|vista-Windows Vista|winxp-Windows XP|win2012-Windows 2012|win2008-Windows 2008|win2003-Windows 2003|win2000-Windows 2000|android-Android|ios-IOS|wp8-WP8|wp7-WP7|symbian-Symbian|linux-Linux|freebsd-FreeBSD|osx-OS X|unix-Unix|others-其他】
594
- * browser: 'ie11', // 选填参数|浏览器【all-全部|ie-IE系列|ie11-IE11|ie10-IE10|ie9-IE9|ie8-IE8|ie7-IE7|ie6-IE6|chrome-Chrome|firefox-firefox系列|firefox4-firefox4|firefox3-firefox3|firefox2-firefox2|opera-opera系列|oprea11-oprea11|oprea10-opera10|opera9-opera9|safari-safari|maxthon-傲游|uc-UC|other-其他】
595
- * title: '添加bug测试四', // BUG标题
596
- * color: '#2dbdb2', // BUG颜色【示例:#2dbdb2】
597
- * severity: 2, // 严重程度【1~4】
598
- * pri: 1, // 优先级【1~4】
599
- * steps: '重现步骤描述', // 重现步骤
600
- * story: 0, // 重现步骤描述
601
- * task: 0, // 相关需求ID
602
- * mailto: ['lisi', '张三'], // 抄送
603
- * keywords: 'bug4' // BUG关键词
604
- * });
605
- * if (result.status) {
606
- * console.log('Bug 创建成功');
607
- * }
608
- * ```
609
- */
610
- addBug(params: {
611
- product: number;
612
- title: string;
613
- module?: number;
614
- project?: number;
615
- openedBuild?: any[];
616
- assignedTo?: string;
617
- deadline?: string;
618
- type?: 'codeerror' | 'config' | 'install' | 'security' | 'performance' | 'standard' | 'automation' | 'designdefect' | 'others';
619
- os?: 'all' | 'windows' | 'win10' | 'win8' | 'win7' | 'vista' | 'winxp' | 'win2012' | 'win2008' | 'win2003' | 'win2000' | 'android' | 'ios' | 'wp8' | 'wp7' | 'symbian' | 'linux' | 'freebsd' | 'osx' | 'unix' | 'others';
620
- browser?: 'all' | 'ie' | 'ie11' | 'ie10' | 'ie9' | 'ie8' | 'ie7' | 'ie6' | 'chrome' | 'firefox' | 'firefox4' | 'firefox3' | 'firefox2' | 'opera' | 'oprea11' | 'oprea10' | 'opera' | 'safari' | 'maxthon' | 'uc' | 'other';
621
- color?: string;
622
- severity?: number;
623
- pri?: number;
624
- steps?: string;
625
- story?: number;
626
- task?: number;
627
- keywords?: string;
628
- mailto?: string[];
629
- }): Promise<ZentaoApiResult>;
630
- /**
631
- * 获取当前 Bug 详细信息以及确认 Bug 解决时可能用到的信息。
632
- *
633
- * @param {{bugID: number, extraFields?: string[]}} params 请求参数,`params.extraFields` 指定额外要返回的字段
634
- * @returns 请求结果
635
- * @example
636
- * ```js
637
- * import { ZentaoApi } from 'zentao-api';
638
- * const zentao = new ZentaoApi({
639
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
640
- * });
641
- * const result = await zentao.getBugResolveParams({bugID: 1});
642
- * ```
643
- */
644
- getBugResolveParams(params: {
645
- bugID: number;
646
- extraFields?: string[];
647
- }): Promise<ZentaoApiResult>;
648
- /**
649
- * 解决一个 Bug
650
- * @param params 任务信息参数
651
- * @returns
652
- * @example
653
- * ```js
654
- * import { ZentaoApi } from 'zentao-api';
655
- * const zentao = new ZentaoApi({
656
- * url: 'https://pro.demo.zentao.net/', account: 'demo', password: '123456'
657
- * });
658
- * const result = await zentao.resolveBug({bugID: 1, resolution: 'fixed'});
659
- * if (result.status) {
660
- * console.log('bug 已解决');
661
- * }
662
- * ```
663
- */
664
- resolveBug(params: {
665
- bugID: number;
666
- resolution?: 'bydesign' | 'duplicate' | 'external' | 'fixed' | 'notrepro' | 'postponed' | 'willnotfix';
667
- resolvedBuild?: string;
668
- resolvedDate?: string;
669
- assignedTo?: string;
670
- comment?: string;
671
- buildProject?: number;
672
- buildName?: string;
673
- createBuild?: 0 | 1;
674
- duplicateBug?: number;
675
- }): Promise<ZentaoApiResult>;
676
- }
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- import * as utils from './utils';
2
- import Zentao from './zentao';
3
- import Zentao12 from './zentao12';
4
-
5
- export {utils, Zentao, Zentao12};