-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathepic.ts
251 lines (234 loc) · 12.7 KB
/
epic.ts
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
import * as Models from './models';
import * as Parameters from './parameters';
import { Client } from '../clients';
import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';
export class Epic {
constructor(private client: Client) {
}
/**
* Returns all issues that do not belong to any epic.
* This only includes issues that the user has permission to view.
* Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic.
* By default, the returned issues are ordered by rank.
*
* <b>Note:</b> If you are querying a next-gen project, do not use this operation.
* Instead, search for issues that don't belong to an epic by using the
* <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-get">Search for issues using JQL</a>
* operation in the Jira platform REST API. Build your JQL query using the <code>parent is empty</code> clause.
* For more information on the <code>parent</code> JQL field, see <a href="https://confluence.atlassian.com/x/dAiiLQ#Advancedsearching-fieldsreference-Parent">Advanced searching</a>. */
async getIssuesWithoutEpic<T = unknown>(parameters: Parameters.GetIssuesWithoutEpic | undefined, callback: Callback<T>): Promise<void>;
/**
* Returns all issues that do not belong to any epic.
* This only includes issues that the user has permission to view.
* Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic.
* By default, the returned issues are ordered by rank.
*
* <b>Note:</b> If you are querying a next-gen project, do not use this operation.
* Instead, search for issues that don't belong to an epic by using the
* <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-get">Search for issues using JQL</a>
* operation in the Jira platform REST API. Build your JQL query using the <code>parent is empty</code> clause.
* For more information on the <code>parent</code> JQL field, see <a href="https://confluence.atlassian.com/x/dAiiLQ#Advancedsearching-fieldsreference-Parent">Advanced searching</a>. */
async getIssuesWithoutEpic<T = unknown>(parameters?: Parameters.GetIssuesWithoutEpic, callback?: never): Promise<T>;
async getIssuesWithoutEpic<T = unknown>(parameters?: Parameters.GetIssuesWithoutEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: '/agile/1.0/epic/none/issue',
method: 'GET',
params: {
startAt: parameters?.startAt,
maxResults: parameters?.maxResults,
jql: parameters?.jql,
validateQuery: parameters?.validateQuery,
fields: parameters?.fields,
expand: parameters?.expand,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'getIssuesWithoutEpic' });
}
/**
* Removes issues from epics.
* The user needs to have the edit issue permission for all issue they want to remove from epics.
* The maximum number of issues that can be moved in one operation is 50.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects.
* Instead, update the issue using `{ fields: { parent: {} } }` */
async removeIssuesFromEpic<T = void>(parameters: Parameters.RemoveIssuesFromEpic | undefined, callback: Callback<T>): Promise<void>;
/**
* Removes issues from epics.
* The user needs to have the edit issue permission for all issue they want to remove from epics.
* The maximum number of issues that can be moved in one operation is 50.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects.
* Instead, update the issue using `{ fields: { parent: {} } }` */
async removeIssuesFromEpic<T = void>(parameters?: Parameters.RemoveIssuesFromEpic, callback?: never): Promise<T>;
async removeIssuesFromEpic<T = void>(parameters?: Parameters.RemoveIssuesFromEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: '/agile/1.0/epic/none/issue',
method: 'POST',
data: {
issues: parameters?.issues,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'removeIssuesFromEpic' });
}
/**
* Returns searched epics according to provided parameters. */
async searchEpics<T = unknown>(parameters: Parameters.SearchEpics | undefined, callback: Callback<T>): Promise<void>;
/**
* Returns searched epics according to provided parameters. */
async searchEpics<T = unknown>(parameters?: Parameters.SearchEpics, callback?: never): Promise<T>;
async searchEpics<T = unknown>(parameters?: Parameters.SearchEpics, callback?: Callback<T>): Promise<void | T> {
const config = {
url: '/agile/1.0/epic/search',
method: 'GET',
params: {
maxResults: parameters?.maxResults,
excludeDone: parameters?.excludeDone,
query: parameters?.query,
projectKey: parameters?.projectKey,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'searchEpics' });
}
/**
* Returns the epic for a given epic ID. This epic will only be returned if the user has permission to view it.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async getEpic<T = Models.Epic>(parameters: Parameters.GetEpic, callback: Callback<T>): Promise<void>;
/**
* Returns the epic for a given epic ID. This epic will only be returned if the user has permission to view it.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async getEpic<T = Models.Epic>(parameters: Parameters.GetEpic, callback?: never): Promise<T>;
async getEpic<T = Models.Epic>(parameters: Parameters.GetEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/epic/${parameters.epicIdOrKey}`,
method: 'GET',
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'getEpic' });
}
/**
* Performs a partial update of the epic.
* A partial update means that fields not present in the request JSON will not be updated.
* Valid values for color are <code>color_1</code> to <code>color_9</code>.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async partiallyUpdateEpic<T = Models.Epic>(parameters: Parameters.PartiallyUpdateEpic, callback: Callback<T>): Promise<void>;
/**
* Performs a partial update of the epic.
* A partial update means that fields not present in the request JSON will not be updated.
* Valid values for color are <code>color_1</code> to <code>color_9</code>.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async partiallyUpdateEpic<T = Models.Epic>(parameters: Parameters.PartiallyUpdateEpic, callback?: never): Promise<T>;
async partiallyUpdateEpic<T = Models.Epic>(parameters: Parameters.PartiallyUpdateEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/epic/${parameters.epicIdOrKey}`,
method: 'POST',
data: {
name: parameters.name,
summary: parameters.summary,
color: parameters.color,
done: parameters.done,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'partiallyUpdateEpic' });
}
/**
* Returns all issues that belong to the epic, for the given epic ID.
* This only includes issues that the user has permission to view.
* Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic.
* By default, the returned issues are ordered by rank.
*
* <b>Note:</b> If you are querying a next-gen project, do not use this operation.
* Instead, search for issues that belong to an epic by using the
* <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-get">Search for issues using JQL</a>
* operation in the Jira platform REST API. Build your JQL query using the <code>parent</code> clause.
* For more information on the <code>parent</code> JQL field, see <a href="https://confluence.atlassian.com/x/dAiiLQ#Advancedsearching-fieldsreference-Parent">Advanced searching</a>. */
async getIssuesForEpic<T = unknown>(parameters: Parameters.GetIssuesForEpic, callback: Callback<T>): Promise<void>;
/**
* Returns all issues that belong to the epic, for the given epic ID.
* This only includes issues that the user has permission to view.
* Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic.
* By default, the returned issues are ordered by rank.
*
* <b>Note:</b> If you are querying a next-gen project, do not use this operation.
* Instead, search for issues that belong to an epic by using the
* <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-search-get">Search for issues using JQL</a>
* operation in the Jira platform REST API. Build your JQL query using the <code>parent</code> clause.
* For more information on the <code>parent</code> JQL field, see <a href="https://confluence.atlassian.com/x/dAiiLQ#Advancedsearching-fieldsreference-Parent">Advanced searching</a>. */
async getIssuesForEpic<T = unknown>(parameters: Parameters.GetIssuesForEpic, callback?: never): Promise<T>;
async getIssuesForEpic<T = unknown>(parameters: Parameters.GetIssuesForEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/epic/${parameters.epicIdOrKey}/issue`,
method: 'GET',
params: {
startAt: parameters.startAt,
maxResults: parameters.maxResults,
jql: parameters.jql,
validateQuery: parameters.validateQuery,
fields: parameters.fields,
expand: parameters.expand,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'getIssuesForEpic' });
}
/**
* Moves issues to an epic, for a given epic id.
* Issues can be only in a single epic at the same time.
* That means that already assigned issues to an epic, will not be assigned to the previous epic anymore.
* The user needs to have the edit issue permission for all issue they want to move and to the epic.
* The maximum number of issues that can be moved in one operation is 50.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async moveIssuesToEpic<T = void>(parameters: Parameters.MoveIssuesToEpic, callback: Callback<T>): Promise<void>;
/**
* Moves issues to an epic, for a given epic id.
* Issues can be only in a single epic at the same time.
* That means that already assigned issues to an epic, will not be assigned to the previous epic anymore.
* The user needs to have the edit issue permission for all issue they want to move and to the epic.
* The maximum number of issues that can be moved in one operation is 50.
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async moveIssuesToEpic<T = void>(parameters: Parameters.MoveIssuesToEpic, callback?: never): Promise<T>;
async moveIssuesToEpic<T = void>(parameters: Parameters.MoveIssuesToEpic, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/epic/${parameters.epicIdOrKey}/issue`,
method: 'POST',
data: {
issues: parameters.issues,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'moveIssuesToEpic' });
}
/**
* Moves (ranks) an epic before or after a given epic.
*
* <p>
* If rankCustomFieldId is not defined, the default rank field will be used.
* </p>
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async rankEpics<T = void>(parameters: Parameters.RankEpics, callback: Callback<T>): Promise<void>;
/**
* Moves (ranks) an epic before or after a given epic.
*
* <p>
* If rankCustomFieldId is not defined, the default rank field will be used.
* </p>
*
* <b>Note:</b> This operation does not work for epics in next-gen projects. */
async rankEpics<T = void>(parameters: Parameters.RankEpics, callback?: never): Promise<T>;
async rankEpics<T = void>(parameters: Parameters.RankEpics, callback?: Callback<T>): Promise<void | T> {
const config = {
url: `/agile/1.0/epic/${parameters.epicIdOrKey}/rank`,
method: 'PUT',
data: {
rankBeforeEpic: parameters.rankBeforeEpic,
rankAfterEpic: parameters.rankAfterEpic,
rankCustomFieldId: parameters.rankCustomFieldId,
},
} as RequestConfig;
return this.client.sendRequest(config, callback, { methodName: 'rankEpics' });
}
}