9
9
import javax .ws .rs .core .GenericType ;
10
10
import javax .ws .rs .core .Response ;
11
11
12
+ import org .gitlab4j .api .Constants .StateEvent ;
12
13
import org .gitlab4j .api .models .ChildEpic ;
13
14
import org .gitlab4j .api .models .CreatedChildEpic ;
14
15
import org .gitlab4j .api .models .Epic ;
@@ -259,15 +260,38 @@ public Optional<Epic> getOptionalEpic(Object groupIdOrPath, Long epicIid) {
259
260
* @param endDate the end date of the epic (optional)
260
261
* @return an Epic instance containing info on the newly created epic
261
262
* @throws GitLabApiException if any exception occurs
263
+ * @deprecated use {@link #createEpic(Object, String, String, String, Date, Date, Date)} instead
262
264
*/
265
+ @ Deprecated
263
266
public Epic createEpic (Object groupIdOrPath , String title , String labels , String description ,
264
267
Date startDate , Date endDate ) throws GitLabApiException {
268
+ return createEpic (groupIdOrPath , title , labels , description , startDate , endDate , null );
269
+ }
270
+
271
+ /**
272
+ * Creates a new epic.
273
+ *
274
+ * <pre><code>GitLab Endpoint: POST /groups/:id/epics</code></pre>
275
+ *
276
+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
277
+ * @param title the title of the epic (required)
278
+ * @param labels comma separated list of labels (optional)
279
+ * @param description the description of the epic (optional)
280
+ * @param startDate the start date of the epic (optional)
281
+ * @param endDate the end date of the epic (optional)
282
+ * @param createdAt the end date when the epic was created. Requires administrator or project/group owner privileges (optional)
283
+ * @return an Epic instance containing info on the newly created epic
284
+ * @throws GitLabApiException if any exception occurs
285
+ */
286
+ public Epic createEpic (Object groupIdOrPath , String title , String labels , String description ,
287
+ Date startDate , Date endDate , Date createdAt ) throws GitLabApiException {
265
288
Form formData = new GitLabApiForm ()
266
289
.withParam ("title" , title , true )
267
290
.withParam ("labels" , labels )
268
291
.withParam ("description" , description )
269
292
.withParam ("start_date" , startDate )
270
- .withParam ("end_date" , endDate );
293
+ .withParam ("end_date" , endDate )
294
+ .withParam ("created_at" , createdAt );
271
295
Response response = post (Response .Status .CREATED , formData .asMap (),
272
296
"groups" , getGroupIdOrPath (groupIdOrPath ), "epics" );
273
297
return (response .readEntity (Epic .class ));
@@ -297,7 +321,8 @@ public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiExceptio
297
321
.withParam ("labels" , epic .getLabels ())
298
322
.withParam ("description" , epic .getDescription ())
299
323
.withParam ("start_date" , epic .getStartDate ())
300
- .withParam ("end_date" , epic .getEndDate ());
324
+ .withParam ("end_date" , epic .getEndDate ())
325
+ .withParam ("created_at" , epic .getCreatedAt ());
301
326
Response response = post (Response .Status .CREATED , formData .asMap (),
302
327
"groups" , getGroupIdOrPath (groupIdOrPath ), "epics" );
303
328
return (response .readEntity (Epic .class ));
@@ -317,15 +342,43 @@ public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiExceptio
317
342
* @param endDate the end date of the epic (optional)
318
343
* @return an Epic instance containing info on the newly created epic
319
344
* @throws GitLabApiException if any exception occurs
345
+ * @deprecated use {@link #updateEpic(Object, Long, String, String, String, Date, Date, StateEvent, Boolean, Long)} instead
320
346
*/
347
+ @ Deprecated
321
348
public Epic updateEpic (Object groupIdOrPath , Long epicIid , String title , String labels , String description ,
322
349
Date startDate , Date endDate ) throws GitLabApiException {
350
+ return updateEpic (groupIdOrPath , epicIid , title , labels , description , startDate , endDate , null , null , null );
351
+ }
352
+
353
+ /**
354
+ * Updates an existing epic.
355
+ *
356
+ * <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid</code></pre>
357
+ *
358
+ * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
359
+ * @param epicIid the IID of the epic to update
360
+ * @param title the title of the epic (optional)
361
+ * @param labels comma separated list of labels (optional)
362
+ * @param description the description of the epic (optional)
363
+ * @param startDate the start date of the epic (optional)
364
+ * @param endDate the end date of the epic (optional)
365
+ * @param stateEvent State event for an epic. Set close to {@link StateEvent#CLOSE}L the epic and {@link StateEvent#REOPEN} to reopen it (optional)
366
+ * @param confidential Whether the epic should be confidential (optional)
367
+ * @param parentId The ID of a parent epic (optional)
368
+ * @return an Epic instance containing info on the newly created epic
369
+ * @throws GitLabApiException if any exception occurs
370
+ */
371
+ public Epic updateEpic (Object groupIdOrPath , Long epicIid , String title , String labels , String description ,
372
+ Date startDate , Date endDate , StateEvent stateEvent , Boolean confidential , Long parentId ) throws GitLabApiException {
323
373
Form formData = new GitLabApiForm ()
324
374
.withParam ("title" , title , true )
325
375
.withParam ("labels" , labels )
326
376
.withParam ("description" , description )
327
377
.withParam ("start_date" , startDate )
328
- .withParam ("end_date" , endDate );
378
+ .withParam ("end_date" , endDate )
379
+ .withParam ("state_event" , stateEvent )
380
+ .withParam ("confidential" , confidential )
381
+ .withParam ("parent_id" , parentId );
329
382
Response response = put (Response .Status .OK , formData .asMap (),
330
383
"groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
331
384
return (response .readEntity (Epic .class ));
@@ -355,7 +408,8 @@ public Epic updateEpic(Object groupIdOrPath, Long epicIid, Epic epic) throws Git
355
408
.withParam ("labels" , epic .getLabels ())
356
409
.withParam ("description" , epic .getDescription ())
357
410
.withParam ("start_date" , epic .getStartDate ())
358
- .withParam ("end_date" , epic .getEndDate ());
411
+ .withParam ("end_date" , epic .getEndDate ())
412
+ .withParam ("parent_id" , epic .getParentId ());
359
413
Response response = put (Response .Status .OK , formData .asMap (),
360
414
"groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
361
415
return (response .readEntity (Epic .class ));
0 commit comments