99import  jakarta .ws .rs .core .GenericType ;
1010import  jakarta .ws .rs .core .Response ;
1111
12+ import  org .gitlab4j .api .Constants .StateEvent ;
1213import  org .gitlab4j .api .models .ChildEpic ;
1314import  org .gitlab4j .api .models .CreatedChildEpic ;
1415import  org .gitlab4j .api .models .Epic ;
@@ -259,15 +260,38 @@ public Optional<Epic> getOptionalEpic(Object groupIdOrPath, Long epicIid) {
259260     * @param endDate the end date of the epic (optional) 
260261     * @return an Epic instance containing info on the newly created epic 
261262     * @throws GitLabApiException if any exception occurs 
263+      * @deprecated use {@link #createEpic(Object, String, String, String, Date, Date, Date)} instead 
262264     */ 
265+     @ Deprecated 
263266    public  Epic  createEpic (Object  groupIdOrPath , String  title , String  labels , String  description ,
264267            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  {
265288        Form  formData  = new  GitLabApiForm ()
266289                .withParam ("title" , title , true )
267290                .withParam ("labels" , labels )
268291                .withParam ("description" , description )
269292                .withParam ("start_date" , startDate )
270-                 .withParam ("end_date" , endDate );
293+                 .withParam ("end_date" , endDate )
294+                 .withParam ("created_at" , createdAt );
271295        Response  response  = post (Response .Status .CREATED , formData .asMap (),
272296                "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" );
273297        return  (response .readEntity (Epic .class ));
@@ -297,7 +321,8 @@ public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiExceptio
297321                .withParam ("labels" , epic .getLabels ())
298322                .withParam ("description" , epic .getDescription ())
299323                .withParam ("start_date" , epic .getStartDate ())
300-                 .withParam ("end_date" , epic .getEndDate ());
324+                 .withParam ("end_date" , epic .getEndDate ())
325+                 .withParam ("created_at" , epic .getCreatedAt ());
301326        Response  response  = post (Response .Status .CREATED , formData .asMap (),
302327                "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" );
303328        return  (response .readEntity (Epic .class ));
@@ -317,15 +342,43 @@ public Epic createEpic(Object groupIdOrPath, Epic epic) throws GitLabApiExceptio
317342     * @param endDate the end date of the epic (optional) 
318343     * @return an Epic instance containing info on the newly created epic 
319344     * @throws GitLabApiException if any exception occurs 
345+      * @deprecated use {@link #updateEpic(Object, Long, String, String, String, Date, Date, StateEvent, Boolean, Long)} instead 
320346     */ 
347+     @ Deprecated 
321348    public  Epic  updateEpic (Object  groupIdOrPath , Long  epicIid , String  title , String  labels , String  description ,
322349            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  {
323373        Form  formData  = new  GitLabApiForm ()
324374                .withParam ("title" , title , true )
325375                .withParam ("labels" , labels )
326376                .withParam ("description" , description )
327377                .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 );
329382        Response  response  = put (Response .Status .OK , formData .asMap (),
330383                "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
331384        return  (response .readEntity (Epic .class ));
@@ -355,7 +408,8 @@ public Epic updateEpic(Object groupIdOrPath, Long epicIid, Epic epic) throws Git
355408                .withParam ("labels" , epic .getLabels ())
356409                .withParam ("description" , epic .getDescription ())
357410                .withParam ("start_date" , epic .getStartDate ())
358-                 .withParam ("end_date" , epic .getEndDate ());
411+                 .withParam ("end_date" , epic .getEndDate ())
412+                 .withParam ("parent_id" , epic .getParentId ());
359413        Response  response  = put (Response .Status .OK , formData .asMap (),
360414                "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicIid );
361415        return  (response .readEntity (Epic .class ));
0 commit comments