@@ -534,4 +534,220 @@ public void deleteMergeRequestNote(Object projectIdOrPath, Long mergeRequestIid,
534
534
"notes" ,
535
535
noteId );
536
536
}
537
+
538
+ /**
539
+ * Get a list of the epics's notes.
540
+ *
541
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes</code></pre>
542
+ *
543
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
544
+ * @param epicId the epic ID (not the IID!) to get the notes for
545
+ * @return a list of the epics's notes
546
+ * @throws GitLabApiException if any exception occurs
547
+ */
548
+ public List <Note > getEpicNotes (Object groupIdOrPath , Long epicId ) throws GitLabApiException {
549
+ return (getEpicNotes (groupIdOrPath , epicId , getDefaultPerPage ()).all ());
550
+ }
551
+
552
+ /**
553
+ * Get a list of the epic's notes using the specified page and per page settings.
554
+ *
555
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes</code></pre>
556
+ *
557
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
558
+ * @param epicId the epic ID (not the IID!) to get the notes for
559
+ * @param page the page to get
560
+ * @param perPage the number of notes per page
561
+ * @return the list of notes in the specified range
562
+ * @throws GitLabApiException if any exception occurs
563
+ */
564
+ public List <Note > getEpicNotes (Object groupIdOrPath , Long epicId , int page , int perPage ) throws GitLabApiException {
565
+ Response response = get (
566
+ Response .Status .OK ,
567
+ getPageQueryParams (page , perPage ),
568
+ "groups" ,
569
+ getGroupIdOrPath (groupIdOrPath ),
570
+ "epics" ,
571
+ epicId ,
572
+ "notes" );
573
+ return (response .readEntity (new GenericType <List <Note >>() {}));
574
+ }
575
+
576
+ /**
577
+ * Get a Pager of epics's notes.
578
+ *
579
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes</code></pre>
580
+ *
581
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
582
+ * @param epicId the epic ID (not the IID!) to get the notes for
583
+ * @param itemsPerPage the number of notes per page
584
+ * @return the list of notes in the specified range
585
+ * @throws GitLabApiException if any exception occurs
586
+ */
587
+ public Pager <Note > getEpicNotes (Object groupIdOrPath , Long epicId , int itemsPerPage ) throws GitLabApiException {
588
+ return (new Pager <Note >(
589
+ this ,
590
+ Note .class ,
591
+ itemsPerPage ,
592
+ null ,
593
+ "groups" ,
594
+ getGroupIdOrPath (groupIdOrPath ),
595
+ "epics" ,
596
+ epicId ,
597
+ "notes" ));
598
+ }
599
+
600
+ /**
601
+ * Get a Stream of the epics's notes.
602
+ *
603
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes</code></pre>
604
+ *
605
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
606
+ * @param epicId the epic ID (not the IID!) to get the notes for
607
+ * @return a Stream of the epics's notes
608
+ * @throws GitLabApiException if any exception occurs
609
+ */
610
+ public Stream <Note > getEpicNotesStream (Object groupIdOrPath , Long epicId ) throws GitLabApiException {
611
+ return (getEpicNotes (groupIdOrPath , epicId , getDefaultPerPage ()).stream ());
612
+ }
613
+
614
+ /**
615
+ * Get the specified epics's note.
616
+ *
617
+ * <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
618
+ *
619
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
620
+ * @param epicId the epic ID (not the IID!) to get the notes for
621
+ * @param noteId the ID of the Note to get
622
+ * @return a Note instance for the specified IDs
623
+ * @throws GitLabApiException if any exception occurs
624
+ */
625
+ public Note getEpicNote (Object groupIdOrPath , Long epicId , Long noteId ) throws GitLabApiException {
626
+ Response response = get (
627
+ Response .Status .OK ,
628
+ getDefaultPerPageParam (),
629
+ "groups" ,
630
+ getGroupIdOrPath (groupIdOrPath ),
631
+ "epics" ,
632
+ epicId ,
633
+ "notes" ,
634
+ noteId );
635
+ return (response .readEntity (Note .class ));
636
+ }
637
+
638
+ /**
639
+ * Create a epics's note.
640
+ *
641
+ * <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
642
+ *
643
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance @param groupIdOrPath the group ID to create the epics for
644
+ * @param epicId the epic ID (not the IID!) to create the notes for
645
+ * @param body the content of note
646
+ * @return the created Note instance
647
+ * @throws GitLabApiException if any exception occurs
648
+ */
649
+ public Note createEpicNote (Object groupIdOrPath , Long epicId , String body ) throws GitLabApiException {
650
+ return (createEpicNote (groupIdOrPath , epicId , body , null , null ));
651
+ }
652
+
653
+ /**
654
+ * Create a epics's note.
655
+ *
656
+ * <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
657
+ *
658
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
659
+ * @param epicId the epic ID (not the IID!) to create the notes for
660
+ * @param body the content of note
661
+ * @param createdAt the created time of note
662
+ * @return the created Note instance
663
+ * @throws GitLabApiException if any exception occurs
664
+ */
665
+ public Note createEpicNote (Object groupIdOrPath , Long epicId , String body , Date createdAt )
666
+ throws GitLabApiException {
667
+ return (createEpicNote (groupIdOrPath , epicId , body , null , null ));
668
+ }
669
+
670
+ /**
671
+ * Create a epics's note.
672
+ *
673
+ * <pre><code>GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
674
+ *
675
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
676
+ * @param epicId the epic ID (not the IID!) to create the notes for
677
+ * @param body the content of note
678
+ * @param createdAt the created time of note
679
+ * @param internal whether the note shall be marked 'internal'
680
+ * @return the created Note instance
681
+ * @throws GitLabApiException if any exception occurs
682
+ */
683
+ public Note createEpicNote (Object groupIdOrPath , Long epicId , String body , Date createdAt , Boolean internal )
684
+ throws GitLabApiException {
685
+
686
+ GitLabApiForm formData = new GitLabApiForm ()
687
+ .withParam ("body" , body , true )
688
+ .withParam ("created_at" , createdAt )
689
+ .withParam ("internal" , internal );
690
+ ;
691
+ Response response = post (
692
+ Response .Status .CREATED , formData , "groups" , getGroupIdOrPath (groupIdOrPath ), "epics" , epicId , "notes" );
693
+ return (response .readEntity (Note .class ));
694
+ }
695
+
696
+ /**
697
+ * Update the specified epics's note.
698
+ *
699
+ * <pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
700
+ *
701
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
702
+ * @param epicId the epic ID (not the IID!) to update the notes for
703
+ * @param noteId the ID of the node to update
704
+ * @param body the update content for the Note
705
+ * @return the modified Note instance
706
+ * @throws GitLabApiException if any exception occurs
707
+ */
708
+ public Note updateEpicNote (Object groupIdOrPath , Long epicId , Long noteId , String body ) throws GitLabApiException {
709
+
710
+ GitLabApiForm formData = new GitLabApiForm ().withParam ("body" , body , true );
711
+ Response response = put (
712
+ Response .Status .OK ,
713
+ formData .asMap (),
714
+ "groups" ,
715
+ getGroupIdOrPath (groupIdOrPath ),
716
+ "epics" ,
717
+ epicId ,
718
+ "notes" ,
719
+ noteId );
720
+ return (response .readEntity (Note .class ));
721
+ }
722
+
723
+ /**
724
+ * Delete the specified epics's note.
725
+ *
726
+ * <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_id/notes/:note_id</code></pre>
727
+ *
728
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
729
+ * @param epicId the epic ID (not the IID!) to delete the notes for
730
+ * @param noteId the ID of the node to delete
731
+ * @throws GitLabApiException if any exception occurs
732
+ */
733
+ public void deleteEpicNote (Object groupIdOrPath , Long epicId , Long noteId ) throws GitLabApiException {
734
+
735
+ if (epicId == null ) {
736
+ throw new RuntimeException ("epicId cannot be null" );
737
+ }
738
+
739
+ if (noteId == null ) {
740
+ throw new RuntimeException ("noteId cannot be null" );
741
+ }
742
+
743
+ delete (
744
+ Response .Status .NO_CONTENT ,
745
+ getDefaultPerPageParam (),
746
+ "groups" ,
747
+ getGroupIdOrPath (groupIdOrPath ),
748
+ "epics" ,
749
+ epicId ,
750
+ "notes" ,
751
+ noteId );
752
+ }
537
753
}
0 commit comments