@zzp123/mcp-zentao 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/zentaoApi.d.ts +134 -21
- package/dist/api/zentaoApi.js +906 -1
- package/dist/index.js +758 -0
- package/dist/services/programService.d.ts +8 -0
- package/dist/services/programService.js +49 -0
- package/dist/types/zentao.d.ts +555 -0
- package/package.json +2 -2
package/dist/api/zentaoApi.js
CHANGED
|
@@ -7,7 +7,7 @@ export class ZentaoAPI {
|
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.config = config;
|
|
9
9
|
this.client = axios.create({
|
|
10
|
-
baseURL: `${this.config.url}/api.php/${this.config.apiVersion}`,
|
|
10
|
+
baseURL: `${this.config.url}/zentao/api.php/${this.config.apiVersion}`,
|
|
11
11
|
timeout: 10000,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
@@ -227,4 +227,909 @@ export class ZentaoAPI {
|
|
|
227
227
|
throw error;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
+
async getPrograms(order) {
|
|
231
|
+
try {
|
|
232
|
+
console.log('正在获取项目集列表...');
|
|
233
|
+
const params = order ? { order } : undefined;
|
|
234
|
+
const response = await this.request('GET', '/programs', params);
|
|
235
|
+
console.log('项目集列表响应:', response);
|
|
236
|
+
if (Array.isArray(response)) {
|
|
237
|
+
return response;
|
|
238
|
+
}
|
|
239
|
+
else if (response && typeof response === 'object') {
|
|
240
|
+
if (Array.isArray(response.programs)) {
|
|
241
|
+
return response.programs;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
throw new Error(`获取项目集列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.error('获取项目集列表失败:', error);
|
|
248
|
+
throw error;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async getProductPlans(productId, branch, begin, end, status, parent) {
|
|
252
|
+
try {
|
|
253
|
+
console.log(`正在获取产品 ${productId} 的计划列表...`);
|
|
254
|
+
const data = {};
|
|
255
|
+
if (branch !== undefined)
|
|
256
|
+
data.branch = branch;
|
|
257
|
+
if (begin)
|
|
258
|
+
data.begin = begin;
|
|
259
|
+
if (end)
|
|
260
|
+
data.end = end;
|
|
261
|
+
if (status)
|
|
262
|
+
data.status = status;
|
|
263
|
+
if (parent !== undefined)
|
|
264
|
+
data.parent = parent;
|
|
265
|
+
const response = await this.request('POST', `/products/${productId}/plans`, undefined, data);
|
|
266
|
+
console.log('产品计划列表响应:', response);
|
|
267
|
+
if (Array.isArray(response)) {
|
|
268
|
+
return response;
|
|
269
|
+
}
|
|
270
|
+
else if (response && typeof response === 'object') {
|
|
271
|
+
if (Array.isArray(response.plans)) {
|
|
272
|
+
return response.plans;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
throw new Error(`获取产品计划列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.error('获取产品计划列表失败:', error);
|
|
279
|
+
throw error;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
async createStory(story) {
|
|
283
|
+
try {
|
|
284
|
+
console.log('正在创建新需求...');
|
|
285
|
+
const response = await this.request('POST', '/stories', undefined, story);
|
|
286
|
+
console.log('创建需求响应:', response);
|
|
287
|
+
return response;
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
console.error('创建需求失败:', error);
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async getPlanDetail(planId) {
|
|
295
|
+
try {
|
|
296
|
+
console.log(`正在获取计划 ${planId} 的详情...`);
|
|
297
|
+
const response = await this.request('GET', `/products/plans/${planId}`);
|
|
298
|
+
console.log('计划详情响应:', response);
|
|
299
|
+
if (response && typeof response === 'object') {
|
|
300
|
+
if ('plan' in response) {
|
|
301
|
+
return response.plan;
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// 如果响应本身就是计划对象
|
|
305
|
+
return response;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
throw new Error(`获取计划详情失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
console.error('获取计划详情失败:', error);
|
|
312
|
+
throw error;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
async updatePlan(planId, update) {
|
|
316
|
+
try {
|
|
317
|
+
console.log(`正在更新计划 ${planId}...`);
|
|
318
|
+
const response = await this.request('PUT', `/products/plans/${planId}`, undefined, update);
|
|
319
|
+
console.log('更新计划响应:', response);
|
|
320
|
+
return response;
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
console.error('更新计划失败:', error);
|
|
324
|
+
throw error;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
async deletePlan(planId) {
|
|
328
|
+
try {
|
|
329
|
+
console.log(`正在删除计划 ${planId}...`);
|
|
330
|
+
const response = await this.request('DELETE', `/products/plans/${planId}`);
|
|
331
|
+
console.log('删除计划响应:', response);
|
|
332
|
+
return response;
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
console.error('删除计划失败:', error);
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
async linkStoriesToPlan(planId, storyIds) {
|
|
340
|
+
try {
|
|
341
|
+
console.log(`正在为计划 ${planId} 关联需求...`);
|
|
342
|
+
const response = await this.request('POST', `/productplans/${planId}/linkstories`, undefined, {
|
|
343
|
+
stories: storyIds
|
|
344
|
+
});
|
|
345
|
+
console.log('关联需求响应:', response);
|
|
346
|
+
return response;
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
console.error('关联需求失败:', error);
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
async unlinkStoriesFromPlan(planId, storyIds) {
|
|
354
|
+
try {
|
|
355
|
+
console.log(`正在为计划 ${planId} 取消关联需求...`);
|
|
356
|
+
const response = await this.request('POST', `/productplans/${planId}/unlinkstories`, undefined, {
|
|
357
|
+
stories: storyIds
|
|
358
|
+
});
|
|
359
|
+
console.log('取消关联需求响应:', response);
|
|
360
|
+
return response;
|
|
361
|
+
}
|
|
362
|
+
catch (error) {
|
|
363
|
+
console.error('取消关联需求失败:', error);
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async linkBugsToPlan(planId, bugIds) {
|
|
368
|
+
try {
|
|
369
|
+
console.log(`正在为计划 ${planId} 关联Bug...`);
|
|
370
|
+
const response = await this.request('POST', `/products/${planId}/linkBugs`, undefined, {
|
|
371
|
+
bugs: bugIds
|
|
372
|
+
});
|
|
373
|
+
console.log('关联Bug响应:', response);
|
|
374
|
+
return response;
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
console.error('关联Bug失败:', error);
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
async unlinkBugsFromPlan(planId, bugIds) {
|
|
382
|
+
try {
|
|
383
|
+
console.log(`正在为计划 ${planId} 取消关联Bug...`);
|
|
384
|
+
const response = await this.request('POST', `/productplans/${planId}/unlinkbugs`, undefined, {
|
|
385
|
+
bugs: bugIds
|
|
386
|
+
});
|
|
387
|
+
console.log('取消关联Bug响应:', response);
|
|
388
|
+
return response;
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
console.error('取消关联Bug失败:', error);
|
|
392
|
+
throw error;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
async getProjectReleases(projectId) {
|
|
396
|
+
try {
|
|
397
|
+
console.log(`正在获取项目 ${projectId} 的发布列表...`);
|
|
398
|
+
const response = await this.request('GET', `/projects/${projectId}/releases`);
|
|
399
|
+
console.log('发布列表响应:', response);
|
|
400
|
+
if (Array.isArray(response)) {
|
|
401
|
+
return response;
|
|
402
|
+
}
|
|
403
|
+
else if (response && typeof response === 'object') {
|
|
404
|
+
if (Array.isArray(response.releases)) {
|
|
405
|
+
return response.releases;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
throw new Error(`获取发布列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
409
|
+
}
|
|
410
|
+
catch (error) {
|
|
411
|
+
console.error('获取发布列表失败:', error);
|
|
412
|
+
throw error;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
async getStoryDetail(storyId) {
|
|
416
|
+
try {
|
|
417
|
+
console.log(`正在获取需求 ${storyId} 的详情...`);
|
|
418
|
+
const response = await this.request('GET', `/stories/${storyId}`);
|
|
419
|
+
console.log('需求详情响应:', response);
|
|
420
|
+
if (response && typeof response === 'object') {
|
|
421
|
+
if ('story' in response) {
|
|
422
|
+
return response.story;
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
return response;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
throw new Error(`获取需求详情失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
console.error('获取需求详情失败:', error);
|
|
432
|
+
throw error;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
async createBug(productId, bug) {
|
|
436
|
+
try {
|
|
437
|
+
console.log(`正在为产品 ${productId} 创建Bug...`);
|
|
438
|
+
const response = await this.request('POST', `/products/${productId}/bugs`, undefined, bug);
|
|
439
|
+
console.log('创建Bug响应:', response);
|
|
440
|
+
return response;
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
console.error('创建Bug失败:', error);
|
|
444
|
+
throw error;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
async getProjectExecutions(projectId) {
|
|
448
|
+
try {
|
|
449
|
+
console.log(`正在获取项目 ${projectId} 的执行列表...`);
|
|
450
|
+
const response = await this.request('GET', `/projects/${projectId}/executions`);
|
|
451
|
+
console.log('执行列表响应:', response);
|
|
452
|
+
if (Array.isArray(response)) {
|
|
453
|
+
return response;
|
|
454
|
+
}
|
|
455
|
+
else if (response && typeof response === 'object') {
|
|
456
|
+
if (Array.isArray(response.executions)) {
|
|
457
|
+
return response.executions;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
throw new Error(`获取执行列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
461
|
+
}
|
|
462
|
+
catch (error) {
|
|
463
|
+
console.error('获取执行列表失败:', error);
|
|
464
|
+
throw error;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
async createPlan(productId, plan) {
|
|
468
|
+
try {
|
|
469
|
+
console.log(`正在为产品 ${productId} 创建计划...`);
|
|
470
|
+
const response = await this.request('POST', `/products/${productId}/plans`, undefined, plan);
|
|
471
|
+
console.log('创建计划响应:', response);
|
|
472
|
+
return response;
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
console.error('创建计划失败:', error);
|
|
476
|
+
throw error;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
async getProjects(page, limit) {
|
|
480
|
+
try {
|
|
481
|
+
console.log('正在获取项目列表...');
|
|
482
|
+
const params = {};
|
|
483
|
+
if (page)
|
|
484
|
+
params.page = page;
|
|
485
|
+
if (limit)
|
|
486
|
+
params.limit = limit;
|
|
487
|
+
const response = await this.request('GET', '/projects', params);
|
|
488
|
+
console.log('项目列表响应:', response);
|
|
489
|
+
if (Array.isArray(response)) {
|
|
490
|
+
return response;
|
|
491
|
+
}
|
|
492
|
+
else if (response && typeof response === 'object') {
|
|
493
|
+
if (Array.isArray(response.projects)) {
|
|
494
|
+
return response.projects;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
throw new Error(`获取项目列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
console.error('获取项目列表失败:', error);
|
|
501
|
+
throw error;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
async updateStory(storyId, update) {
|
|
505
|
+
try {
|
|
506
|
+
console.log(`正在更新需求 ${storyId}...`);
|
|
507
|
+
const response = await this.request('PUT', `/stories/${storyId}`, undefined, update);
|
|
508
|
+
console.log('更新需求响应:', response);
|
|
509
|
+
return response;
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
console.error('更新需求失败:', error);
|
|
513
|
+
throw error;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
async deleteTask(taskId) {
|
|
517
|
+
try {
|
|
518
|
+
console.log(`正在删除任务 ${taskId}...`);
|
|
519
|
+
const response = await this.request('DELETE', `/tasks/${taskId}`);
|
|
520
|
+
console.log('删除任务响应:', response);
|
|
521
|
+
return response;
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
console.error('删除任务失败:', error);
|
|
525
|
+
throw error;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
async getProductStories(productId) {
|
|
529
|
+
try {
|
|
530
|
+
console.log(`正在获取产品 ${productId} 的需求列表...`);
|
|
531
|
+
const response = await this.request('GET', `/products/${productId}/stories`);
|
|
532
|
+
console.log('产品需求列表响应:', response);
|
|
533
|
+
if (Array.isArray(response)) {
|
|
534
|
+
return response;
|
|
535
|
+
}
|
|
536
|
+
else if (response && typeof response === 'object') {
|
|
537
|
+
if (Array.isArray(response.stories)) {
|
|
538
|
+
return response.stories;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
throw new Error(`获取产品需求列表失败: 响应格式不正确 ${JSON.stringify(response)}`);
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
console.error('获取产品需求列表失败:', error);
|
|
545
|
+
throw error;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// 项目集相关接口
|
|
549
|
+
async getProgramDetail(programId) {
|
|
550
|
+
try {
|
|
551
|
+
console.log(`正在获取项目集 ${programId} 的详情...`);
|
|
552
|
+
const response = await this.request('GET', `/programs/${programId}`);
|
|
553
|
+
console.log('项目集详情响应:', response);
|
|
554
|
+
return response;
|
|
555
|
+
}
|
|
556
|
+
catch (error) {
|
|
557
|
+
console.error('获取项目集详情失败:', error);
|
|
558
|
+
throw error;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async createProgram(program) {
|
|
562
|
+
try {
|
|
563
|
+
console.log('正在创建项目集...');
|
|
564
|
+
const response = await this.request('POST', '/programs', undefined, program);
|
|
565
|
+
console.log('创建项目集响应:', response);
|
|
566
|
+
return response;
|
|
567
|
+
}
|
|
568
|
+
catch (error) {
|
|
569
|
+
console.error('创建项目集失败:', error);
|
|
570
|
+
throw error;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
async updateProgram(programId, update) {
|
|
574
|
+
try {
|
|
575
|
+
console.log(`正在更新项目集 ${programId}...`);
|
|
576
|
+
const response = await this.request('PUT', `/programs/${programId}`, undefined, update);
|
|
577
|
+
console.log('更新项目集响应:', response);
|
|
578
|
+
return response;
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
console.error('更新项目集失败:', error);
|
|
582
|
+
throw error;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
async deleteProgram(programId) {
|
|
586
|
+
try {
|
|
587
|
+
console.log(`正在删除项目集 ${programId}...`);
|
|
588
|
+
const response = await this.request('DELETE', `/programs/${programId}`);
|
|
589
|
+
console.log('删除项目集响应:', response);
|
|
590
|
+
return response;
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
console.error('删除项目集失败:', error);
|
|
594
|
+
throw error;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
// 产品相关接口
|
|
598
|
+
async getProductDetail(productId) {
|
|
599
|
+
try {
|
|
600
|
+
console.log(`正在获取产品 ${productId} 的详情...`);
|
|
601
|
+
const response = await this.request('GET', `/products/${productId}`);
|
|
602
|
+
console.log('产品详情响应:', response);
|
|
603
|
+
return response;
|
|
604
|
+
}
|
|
605
|
+
catch (error) {
|
|
606
|
+
console.error('获取产品详情失败:', error);
|
|
607
|
+
throw error;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
async createProduct(product) {
|
|
611
|
+
try {
|
|
612
|
+
console.log('正在创建产品...');
|
|
613
|
+
const response = await this.request('POST', '/products', undefined, product);
|
|
614
|
+
console.log('创建产品响应:', response);
|
|
615
|
+
return response;
|
|
616
|
+
}
|
|
617
|
+
catch (error) {
|
|
618
|
+
console.error('创建产品失败:', error);
|
|
619
|
+
throw error;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
async updateProduct(productId, update) {
|
|
623
|
+
try {
|
|
624
|
+
console.log(`正在更新产品 ${productId}...`);
|
|
625
|
+
const response = await this.request('PUT', `/product/${productId}`, undefined, update);
|
|
626
|
+
console.log('更新产品响应:', response);
|
|
627
|
+
return response;
|
|
628
|
+
}
|
|
629
|
+
catch (error) {
|
|
630
|
+
console.error('更新产品失败:', error);
|
|
631
|
+
throw error;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
async deleteProduct(productId) {
|
|
635
|
+
try {
|
|
636
|
+
console.log(`正在删除产品 ${productId}...`);
|
|
637
|
+
const response = await this.request('DELETE', `/product/${productId}`);
|
|
638
|
+
console.log('删除产品响应:', response);
|
|
639
|
+
return response;
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
console.error('删除产品失败:', error);
|
|
643
|
+
throw error;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
// 项目相关接口
|
|
647
|
+
async getProjectDetail(projectId) {
|
|
648
|
+
try {
|
|
649
|
+
console.log(`正在获取项目 ${projectId} 的详情...`);
|
|
650
|
+
const response = await this.request('GET', `/projects/${projectId}`);
|
|
651
|
+
console.log('项目详情响应:', response);
|
|
652
|
+
return response;
|
|
653
|
+
}
|
|
654
|
+
catch (error) {
|
|
655
|
+
console.error('获取项目详情失败:', error);
|
|
656
|
+
throw error;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
async createProject(project) {
|
|
660
|
+
try {
|
|
661
|
+
console.log('正在创建项目...');
|
|
662
|
+
const response = await this.request('POST', '/projects', undefined, project);
|
|
663
|
+
console.log('创建项目响应:', response);
|
|
664
|
+
return response;
|
|
665
|
+
}
|
|
666
|
+
catch (error) {
|
|
667
|
+
console.error('创建项目失败:', error);
|
|
668
|
+
throw error;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
async updateProject(projectId, update) {
|
|
672
|
+
try {
|
|
673
|
+
console.log(`正在更新项目 ${projectId}...`);
|
|
674
|
+
const response = await this.request('PUT', `/projects/${projectId}`, undefined, update);
|
|
675
|
+
console.log('更新项目响应:', response);
|
|
676
|
+
return response;
|
|
677
|
+
}
|
|
678
|
+
catch (error) {
|
|
679
|
+
console.error('更新项目失败:', error);
|
|
680
|
+
throw error;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
async deleteProject(projectId) {
|
|
684
|
+
try {
|
|
685
|
+
console.log(`正在删除项目 ${projectId}...`);
|
|
686
|
+
const response = await this.request('DELETE', `/projects/${projectId}`);
|
|
687
|
+
console.log('删除项目响应:', response);
|
|
688
|
+
return response;
|
|
689
|
+
}
|
|
690
|
+
catch (error) {
|
|
691
|
+
console.error('删除项目失败:', error);
|
|
692
|
+
throw error;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
// 执行相关接口
|
|
696
|
+
async createExecution(projectId, execution) {
|
|
697
|
+
try {
|
|
698
|
+
console.log(`正在为项目 ${projectId} 创建执行...`);
|
|
699
|
+
const response = await this.request('POST', `/projects/${projectId}/executions`, undefined, execution);
|
|
700
|
+
console.log('创建执行响应:', response);
|
|
701
|
+
return response;
|
|
702
|
+
}
|
|
703
|
+
catch (error) {
|
|
704
|
+
console.error('创建执行失败:', error);
|
|
705
|
+
throw error;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
async getExecutionDetail(executionId) {
|
|
709
|
+
try {
|
|
710
|
+
console.log(`正在获取执行 ${executionId} 的详情...`);
|
|
711
|
+
const response = await this.request('GET', `/executions/${executionId}`);
|
|
712
|
+
console.log('执行详情响应:', response);
|
|
713
|
+
return response;
|
|
714
|
+
}
|
|
715
|
+
catch (error) {
|
|
716
|
+
console.error('获取执行详情失败:', error);
|
|
717
|
+
throw error;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
async updateExecution(executionId, update) {
|
|
721
|
+
try {
|
|
722
|
+
console.log(`正在更新执行 ${executionId}...`);
|
|
723
|
+
const response = await this.request('PUT', `/executions/${executionId}`, undefined, update);
|
|
724
|
+
console.log('更新执行响应:', response);
|
|
725
|
+
return response;
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
console.error('更新执行失败:', error);
|
|
729
|
+
throw error;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
async deleteExecution(executionId) {
|
|
733
|
+
try {
|
|
734
|
+
console.log(`正在删除执行 ${executionId}...`);
|
|
735
|
+
const response = await this.request('DELETE', `/executions/${executionId}`);
|
|
736
|
+
console.log('删除执行响应:', response);
|
|
737
|
+
return response;
|
|
738
|
+
}
|
|
739
|
+
catch (error) {
|
|
740
|
+
console.error('删除执行失败:', error);
|
|
741
|
+
throw error;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
// 需求相关接口
|
|
745
|
+
async deleteStory(storyId) {
|
|
746
|
+
try {
|
|
747
|
+
console.log(`正在删除需求 ${storyId}...`);
|
|
748
|
+
const response = await this.request('DELETE', `/stories/${storyId}`);
|
|
749
|
+
console.log('删除需求响应:', response);
|
|
750
|
+
return response;
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
console.error('删除需求失败:', error);
|
|
754
|
+
throw error;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
// Bug相关接口
|
|
758
|
+
async updateBug(bugId, update) {
|
|
759
|
+
try {
|
|
760
|
+
console.log(`正在更新Bug ${bugId}...`);
|
|
761
|
+
const response = await this.request('PUT', `/bugs/${bugId}`, undefined, update);
|
|
762
|
+
console.log('更新Bug响应:', response);
|
|
763
|
+
return response;
|
|
764
|
+
}
|
|
765
|
+
catch (error) {
|
|
766
|
+
console.error('更新Bug失败:', error);
|
|
767
|
+
throw error;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
async deleteBug(bugId) {
|
|
771
|
+
try {
|
|
772
|
+
console.log(`正在删除Bug ${bugId}...`);
|
|
773
|
+
const response = await this.request('DELETE', `/bugs/${bugId}`);
|
|
774
|
+
console.log('删除Bug响应:', response);
|
|
775
|
+
return response;
|
|
776
|
+
}
|
|
777
|
+
catch (error) {
|
|
778
|
+
console.error('删除Bug失败:', error);
|
|
779
|
+
throw error;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
// 反馈模块接口
|
|
783
|
+
async getFeedbacks(params) {
|
|
784
|
+
try {
|
|
785
|
+
console.log('正在获取反馈列表...');
|
|
786
|
+
const response = await this.request('GET', '/feedbacks', params);
|
|
787
|
+
console.log('获取反馈列表响应:', response);
|
|
788
|
+
return response;
|
|
789
|
+
}
|
|
790
|
+
catch (error) {
|
|
791
|
+
console.error('获取反馈列表失败:', error);
|
|
792
|
+
throw error;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
async getFeedbackDetail(feedbackId) {
|
|
796
|
+
try {
|
|
797
|
+
console.log(`正在获取反馈 ${feedbackId} 的详情...`);
|
|
798
|
+
const response = await this.request('GET', `/feedbacks/${feedbackId}`);
|
|
799
|
+
console.log('获取反馈详情响应:', response);
|
|
800
|
+
return response;
|
|
801
|
+
}
|
|
802
|
+
catch (error) {
|
|
803
|
+
console.error('获取反馈详情失败:', error);
|
|
804
|
+
throw error;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
async createFeedback(feedback) {
|
|
808
|
+
try {
|
|
809
|
+
console.log('正在创建反馈...');
|
|
810
|
+
const response = await this.request('POST', '/feedbacks', undefined, feedback);
|
|
811
|
+
console.log('创建反馈响应:', response);
|
|
812
|
+
return response;
|
|
813
|
+
}
|
|
814
|
+
catch (error) {
|
|
815
|
+
console.error('创建反馈失败:', error);
|
|
816
|
+
throw error;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
async updateFeedback(feedbackId, update) {
|
|
820
|
+
try {
|
|
821
|
+
console.log(`正在更新反馈 ${feedbackId}...`);
|
|
822
|
+
const response = await this.request('PUT', `/feedbacks/${feedbackId}`, undefined, update);
|
|
823
|
+
console.log('更新反馈响应:', response);
|
|
824
|
+
return response;
|
|
825
|
+
}
|
|
826
|
+
catch (error) {
|
|
827
|
+
console.error('更新反馈失败:', error);
|
|
828
|
+
throw error;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
async deleteFeedback(feedbackId) {
|
|
832
|
+
try {
|
|
833
|
+
console.log(`正在删除反馈 ${feedbackId}...`);
|
|
834
|
+
const response = await this.request('DELETE', `/feedbacks/${feedbackId}`);
|
|
835
|
+
console.log('删除反馈响应:', response);
|
|
836
|
+
return response;
|
|
837
|
+
}
|
|
838
|
+
catch (error) {
|
|
839
|
+
console.error('删除反馈失败:', error);
|
|
840
|
+
throw error;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
async assignFeedback(feedbackId, assign) {
|
|
844
|
+
try {
|
|
845
|
+
console.log(`正在指派反馈 ${feedbackId}...`);
|
|
846
|
+
const response = await this.request('POST', `/feedbacks/${feedbackId}/assign`, undefined, assign);
|
|
847
|
+
console.log('指派反馈响应:', response);
|
|
848
|
+
return response;
|
|
849
|
+
}
|
|
850
|
+
catch (error) {
|
|
851
|
+
console.error('指派反馈失败:', error);
|
|
852
|
+
throw error;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
async closeFeedback(feedbackId, close) {
|
|
856
|
+
try {
|
|
857
|
+
console.log(`正在关闭反馈 ${feedbackId}...`);
|
|
858
|
+
const response = await this.request('POST', `/feedbacks/${feedbackId}/close`, undefined, close);
|
|
859
|
+
console.log('关闭反馈响应:', response);
|
|
860
|
+
return response;
|
|
861
|
+
}
|
|
862
|
+
catch (error) {
|
|
863
|
+
console.error('关闭反馈失败:', error);
|
|
864
|
+
throw error;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
// 测试用例模块接口
|
|
868
|
+
async getProductTestCases(productId) {
|
|
869
|
+
try {
|
|
870
|
+
console.log(`正在获取产品 ${productId} 的测试用例列表...`);
|
|
871
|
+
const response = await this.request('GET', `/products/${productId}/testcases`);
|
|
872
|
+
console.log('获取测试用例列表响应:', response);
|
|
873
|
+
return response;
|
|
874
|
+
}
|
|
875
|
+
catch (error) {
|
|
876
|
+
console.error('获取测试用例列表失败:', error);
|
|
877
|
+
throw error;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
async createTestCase(productId, testCase) {
|
|
881
|
+
try {
|
|
882
|
+
console.log(`正在为产品 ${productId} 创建测试用例...`);
|
|
883
|
+
const response = await this.request('POST', `/products/${productId}/testcases`, undefined, testCase);
|
|
884
|
+
console.log('创建测试用例响应:', response);
|
|
885
|
+
return response;
|
|
886
|
+
}
|
|
887
|
+
catch (error) {
|
|
888
|
+
console.error('创建测试用例失败:', error);
|
|
889
|
+
throw error;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
async getTestCaseDetail(testCaseId) {
|
|
893
|
+
try {
|
|
894
|
+
console.log(`正在获取测试用例 ${testCaseId} 的详情...`);
|
|
895
|
+
const response = await this.request('GET', `/testcases/${testCaseId}`);
|
|
896
|
+
console.log('获取测试用例详情响应:', response);
|
|
897
|
+
return response;
|
|
898
|
+
}
|
|
899
|
+
catch (error) {
|
|
900
|
+
console.error('获取测试用例详情失败:', error);
|
|
901
|
+
throw error;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
async updateTestCase(testCaseId, update) {
|
|
905
|
+
try {
|
|
906
|
+
console.log(`正在更新测试用例 ${testCaseId}...`);
|
|
907
|
+
const response = await this.request('PUT', `/testcases/${testCaseId}`, undefined, update);
|
|
908
|
+
console.log('更新测试用例响应:', response);
|
|
909
|
+
return response;
|
|
910
|
+
}
|
|
911
|
+
catch (error) {
|
|
912
|
+
console.error('更新测试用例失败:', error);
|
|
913
|
+
throw error;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
async deleteTestCase(testCaseId) {
|
|
917
|
+
try {
|
|
918
|
+
console.log(`正在删除测试用例 ${testCaseId}...`);
|
|
919
|
+
const response = await this.request('DELETE', `/testcases/${testCaseId}`);
|
|
920
|
+
console.log('删除测试用例响应:', response);
|
|
921
|
+
return response;
|
|
922
|
+
}
|
|
923
|
+
catch (error) {
|
|
924
|
+
console.error('删除测试用例失败:', error);
|
|
925
|
+
throw error;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
// 版本/构建模块接口
|
|
929
|
+
async getProjectBuilds(projectId) {
|
|
930
|
+
try {
|
|
931
|
+
console.log(`正在获取项目 ${projectId} 的版本列表...`);
|
|
932
|
+
const response = await this.request('GET', `/projects/${projectId}/builds`);
|
|
933
|
+
console.log('获取版本列表响应:', response);
|
|
934
|
+
return response;
|
|
935
|
+
}
|
|
936
|
+
catch (error) {
|
|
937
|
+
console.error('获取版本列表失败:', error);
|
|
938
|
+
throw error;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
async getExecutionBuilds(executionId) {
|
|
942
|
+
try {
|
|
943
|
+
console.log(`正在获取执行 ${executionId} 的版本列表...`);
|
|
944
|
+
const response = await this.request('GET', `/executions/${executionId}/builds`);
|
|
945
|
+
console.log('获取版本列表响应:', response);
|
|
946
|
+
return response;
|
|
947
|
+
}
|
|
948
|
+
catch (error) {
|
|
949
|
+
console.error('获取版本列表失败:', error);
|
|
950
|
+
throw error;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
async createBuild(projectId, build) {
|
|
954
|
+
try {
|
|
955
|
+
console.log(`正在为项目 ${projectId} 创建版本...`);
|
|
956
|
+
const response = await this.request('POST', `/projects/${projectId}/builds`, undefined, build);
|
|
957
|
+
console.log('创建版本响应:', response);
|
|
958
|
+
return response;
|
|
959
|
+
}
|
|
960
|
+
catch (error) {
|
|
961
|
+
console.error('创建版本失败:', error);
|
|
962
|
+
throw error;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
async getBuildDetail(buildId) {
|
|
966
|
+
try {
|
|
967
|
+
console.log(`正在获取版本 ${buildId} 的详情...`);
|
|
968
|
+
const response = await this.request('GET', `/builds/${buildId}`);
|
|
969
|
+
console.log('获取版本详情响应:', response);
|
|
970
|
+
return response;
|
|
971
|
+
}
|
|
972
|
+
catch (error) {
|
|
973
|
+
console.error('获取版本详情失败:', error);
|
|
974
|
+
throw error;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
async updateBuild(buildId, update) {
|
|
978
|
+
try {
|
|
979
|
+
console.log(`正在更新版本 ${buildId}...`);
|
|
980
|
+
const response = await this.request('PUT', `/builds/${buildId}`, undefined, update);
|
|
981
|
+
console.log('更新版本响应:', response);
|
|
982
|
+
return response;
|
|
983
|
+
}
|
|
984
|
+
catch (error) {
|
|
985
|
+
console.error('更新版本失败:', error);
|
|
986
|
+
throw error;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
async deleteBuild(buildId) {
|
|
990
|
+
try {
|
|
991
|
+
console.log(`正在删除版本 ${buildId}...`);
|
|
992
|
+
const response = await this.request('DELETE', `/builds/${buildId}`);
|
|
993
|
+
console.log('删除版本响应:', response);
|
|
994
|
+
return response;
|
|
995
|
+
}
|
|
996
|
+
catch (error) {
|
|
997
|
+
console.error('删除版本失败:', error);
|
|
998
|
+
throw error;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
// 用户模块接口
|
|
1002
|
+
async getUserDetail(userId) {
|
|
1003
|
+
try {
|
|
1004
|
+
console.log(`正在获取用户 ${userId} 的详情...`);
|
|
1005
|
+
const response = await this.request('GET', `/users/${userId}`);
|
|
1006
|
+
console.log('获取用户详情响应:', response);
|
|
1007
|
+
return response;
|
|
1008
|
+
}
|
|
1009
|
+
catch (error) {
|
|
1010
|
+
console.error('获取用户详情失败:', error);
|
|
1011
|
+
throw error;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
async getMyProfile() {
|
|
1015
|
+
try {
|
|
1016
|
+
console.log('正在获取我的个人信息...');
|
|
1017
|
+
const response = await this.request('GET', '/user');
|
|
1018
|
+
console.log('获取个人信息响应:', response);
|
|
1019
|
+
return response;
|
|
1020
|
+
}
|
|
1021
|
+
catch (error) {
|
|
1022
|
+
console.error('获取个人信息失败:', error);
|
|
1023
|
+
throw error;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
async getUsers(params) {
|
|
1027
|
+
try {
|
|
1028
|
+
console.log('正在获取用户列表...');
|
|
1029
|
+
const response = await this.request('GET', '/users', params);
|
|
1030
|
+
console.log('获取用户列表响应:', response);
|
|
1031
|
+
return response;
|
|
1032
|
+
}
|
|
1033
|
+
catch (error) {
|
|
1034
|
+
console.error('获取用户列表失败:', error);
|
|
1035
|
+
throw error;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
async createUser(user) {
|
|
1039
|
+
try {
|
|
1040
|
+
console.log('正在创建用户...');
|
|
1041
|
+
const response = await this.request('POST', '/users', undefined, user);
|
|
1042
|
+
console.log('创建用户响应:', response);
|
|
1043
|
+
return response;
|
|
1044
|
+
}
|
|
1045
|
+
catch (error) {
|
|
1046
|
+
console.error('创建用户失败:', error);
|
|
1047
|
+
throw error;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
async updateUser(userId, update) {
|
|
1051
|
+
try {
|
|
1052
|
+
console.log(`正在更新用户 ${userId}...`);
|
|
1053
|
+
const response = await this.request('PUT', `/users/${userId}`, undefined, update);
|
|
1054
|
+
console.log('更新用户响应:', response);
|
|
1055
|
+
return response;
|
|
1056
|
+
}
|
|
1057
|
+
catch (error) {
|
|
1058
|
+
console.error('更新用户失败:', error);
|
|
1059
|
+
throw error;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
async deleteUser(userId) {
|
|
1063
|
+
try {
|
|
1064
|
+
console.log(`正在删除用户 ${userId}...`);
|
|
1065
|
+
const response = await this.request('DELETE', `/users/${userId}`);
|
|
1066
|
+
console.log('删除用户响应:', response);
|
|
1067
|
+
return response;
|
|
1068
|
+
}
|
|
1069
|
+
catch (error) {
|
|
1070
|
+
console.error('删除用户失败:', error);
|
|
1071
|
+
throw error;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
// 工单模块接口
|
|
1075
|
+
async getTickets(params) {
|
|
1076
|
+
try {
|
|
1077
|
+
console.log('正在获取工单列表...');
|
|
1078
|
+
const response = await this.request('GET', '/tickets', params);
|
|
1079
|
+
console.log('获取工单列表响应:', response);
|
|
1080
|
+
return response;
|
|
1081
|
+
}
|
|
1082
|
+
catch (error) {
|
|
1083
|
+
console.error('获取工单列表失败:', error);
|
|
1084
|
+
throw error;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
async getTicketDetail(ticketId) {
|
|
1088
|
+
try {
|
|
1089
|
+
console.log(`正在获取工单 ${ticketId} 的详情...`);
|
|
1090
|
+
const response = await this.request('GET', `/tickets/${ticketId}`);
|
|
1091
|
+
console.log('获取工单详情响应:', response);
|
|
1092
|
+
return response;
|
|
1093
|
+
}
|
|
1094
|
+
catch (error) {
|
|
1095
|
+
console.error('获取工单详情失败:', error);
|
|
1096
|
+
throw error;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
async createTicket(ticket) {
|
|
1100
|
+
try {
|
|
1101
|
+
console.log('正在创建工单...');
|
|
1102
|
+
const response = await this.request('POST', '/tickets', undefined, ticket);
|
|
1103
|
+
console.log('创建工单响应:', response);
|
|
1104
|
+
return response;
|
|
1105
|
+
}
|
|
1106
|
+
catch (error) {
|
|
1107
|
+
console.error('创建工单失败:', error);
|
|
1108
|
+
throw error;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
async updateTicket(ticketId, update) {
|
|
1112
|
+
try {
|
|
1113
|
+
console.log(`正在更新工单 ${ticketId}...`);
|
|
1114
|
+
const response = await this.request('PUT', `/tickets/${ticketId}`, undefined, update);
|
|
1115
|
+
console.log('更新工单响应:', response);
|
|
1116
|
+
return response;
|
|
1117
|
+
}
|
|
1118
|
+
catch (error) {
|
|
1119
|
+
console.error('更新工单失败:', error);
|
|
1120
|
+
throw error;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
async deleteTicket(ticketId) {
|
|
1124
|
+
try {
|
|
1125
|
+
console.log(`正在删除工单 ${ticketId}...`);
|
|
1126
|
+
const response = await this.request('DELETE', `/tickets/${ticketId}`);
|
|
1127
|
+
console.log('删除工单响应:', response);
|
|
1128
|
+
return response;
|
|
1129
|
+
}
|
|
1130
|
+
catch (error) {
|
|
1131
|
+
console.error('删除工单失败:', error);
|
|
1132
|
+
throw error;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
230
1135
|
}
|