-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEpics.ts
More file actions
76 lines (68 loc) · 2.31 KB
/
Epics.ts
File metadata and controls
76 lines (68 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { Configuration } from "../Configuration";
import { Epic, CreateEpic, UpdateEpic, AddEpicWorkItems, EpicIssue } from "../models/Epic";
import { PaginatedResponse } from "../models/common";
import { BaseResource } from "./BaseResource";
/**
* Epics API resource
* Handles all epic-related operations
*/
export class Epics extends BaseResource {
constructor(config: Configuration) {
super(config);
}
/**
* Create a new epic in the specified project
*/
async create(workspaceSlug: string, projectId: string, data: CreateEpic): Promise<Epic> {
return this.post<Epic>(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/`, data);
}
/**
* Retrieve an epic by ID
*/
async retrieve(workspaceSlug: string, projectId: string, epicId: string): Promise<Epic> {
return this.get<Epic>(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`);
}
/**
* Partially update an existing epic
*/
async update(workspaceSlug: string, projectId: string, epicId: string, data: UpdateEpic): Promise<Epic> {
return this.patch<Epic>(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`, data);
}
/**
* Delete an epic
*/
async delete(workspaceSlug: string, projectId: string, epicId: string): Promise<void> {
return this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`);
}
/**
* List epics with optional filtering
*/
async list(workspaceSlug: string, projectId: string, params?: any): Promise<PaginatedResponse<Epic>> {
return this.get<PaginatedResponse<Epic>>(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/`, params);
}
/**
* List work items under an epic
*/
async listIssues(
workspaceSlug: string,
projectId: string,
epicId: string,
params?: any
): Promise<PaginatedResponse<EpicIssue>> {
return this.get<PaginatedResponse<EpicIssue>>(
`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/issues/`,
params
);
}
/**
* Add work items as sub-issues under an epic
*/
async addIssues(
workspaceSlug: string,
projectId: string,
epicId: string,
data: AddEpicWorkItems
): Promise<EpicIssue[]> {
return this.post<EpicIssue[]>(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/issues/`, data);
}
}