diff --git a/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java b/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java index 3f296323c..2530db960 100644 --- a/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java +++ b/gitlab4j-api/src/main/java/org/gitlab4j/api/NotesApi.java @@ -534,4 +534,220 @@ public void deleteMergeRequestNote(Object projectIdOrPath, Long mergeRequestIid, "notes", noteId); } + + /** + * Get a list of the epics's notes. + * + *
GitLab Endpoint: GET /groups/:id/epics/:epic_id/notes
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to get the notes for
+ * @return a list of the epics's notes
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ListGitLab Endpoint: GET /groups/:id/epics/:epic_id/notes
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to get the notes for
+ * @param page the page to get
+ * @param perPage the number of notes per page
+ * @return the list of notes in the specified range
+ * @throws GitLabApiException if any exception occurs
+ */
+ public ListGitLab Endpoint: GET /groups/:id/epics/:epic_id/notes
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to get the notes for
+ * @param itemsPerPage the number of notes per page
+ * @return the list of notes in the specified range
+ * @throws GitLabApiException if any exception occurs
+ */
+ public PagerGitLab Endpoint: GET /groups/:id/epics/:epic_id/notes
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to get the notes for
+ * @return a Stream of the epics's notes
+ * @throws GitLabApiException if any exception occurs
+ */
+ public StreamGitLab Endpoint: GET /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to get the notes for
+ * @param noteId the ID of the Note to get
+ * @return a Note instance for the specified IDs
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Note getEpicNote(Object groupIdOrPath, Long epicId, Long noteId) throws GitLabApiException {
+ Response response = get(
+ Response.Status.OK,
+ getDefaultPerPageParam(),
+ "groups",
+ getGroupIdOrPath(groupIdOrPath),
+ "epics",
+ epicId,
+ "notes",
+ noteId);
+ return (response.readEntity(Note.class));
+ }
+
+ /**
+ * Create a epics's note.
+ *
+ * GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @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
+ * @param epicId the epic ID (not the IID!) to create the notes for
+ * @param body the content of note
+ * @return the created Note instance
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Note createEpicNote(Object groupIdOrPath, Long epicId, String body) throws GitLabApiException {
+ return (createEpicNote(groupIdOrPath, epicId, body, null, null));
+ }
+
+ /**
+ * Create a epics's note.
+ *
+ * GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to create the notes for
+ * @param body the content of note
+ * @param createdAt the created time of note
+ * @return the created Note instance
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Note createEpicNote(Object groupIdOrPath, Long epicId, String body, Date createdAt)
+ throws GitLabApiException {
+ return (createEpicNote(groupIdOrPath, epicId, body, null, null));
+ }
+
+ /**
+ * Create a epics's note.
+ *
+ * GitLab Endpoint: POST /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to create the notes for
+ * @param body the content of note
+ * @param createdAt the created time of note
+ * @param internal whether the note shall be marked 'internal'
+ * @return the created Note instance
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Note createEpicNote(Object groupIdOrPath, Long epicId, String body, Date createdAt, Boolean internal)
+ throws GitLabApiException {
+
+ GitLabApiForm formData = new GitLabApiForm()
+ .withParam("body", body, true)
+ .withParam("created_at", createdAt)
+ .withParam("internal", internal);
+ ;
+ Response response = post(
+ Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicId, "notes");
+ return (response.readEntity(Note.class));
+ }
+
+ /**
+ * Update the specified epics's note.
+ *
+ * GitLab Endpoint: PUT /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to update the notes for
+ * @param noteId the ID of the node to update
+ * @param body the update content for the Note
+ * @return the modified Note instance
+ * @throws GitLabApiException if any exception occurs
+ */
+ public Note updateEpicNote(Object groupIdOrPath, Long epicId, Long noteId, String body) throws GitLabApiException {
+
+ GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true);
+ Response response = put(
+ Response.Status.OK,
+ formData.asMap(),
+ "groups",
+ getGroupIdOrPath(groupIdOrPath),
+ "epics",
+ epicId,
+ "notes",
+ noteId);
+ return (response.readEntity(Note.class));
+ }
+
+ /**
+ * Delete the specified epics's note.
+ *
+ * GitLab Endpoint: DELETE /groups/:id/epics/:epic_id/notes/:note_id
+ *
+ * @param groupIdOrPath the group in the form of an Long(ID), String(path), or Group instance
+ * @param epicId the epic ID (not the IID!) to delete the notes for
+ * @param noteId the ID of the node to delete
+ * @throws GitLabApiException if any exception occurs
+ */
+ public void deleteEpicNote(Object groupIdOrPath, Long epicId, Long noteId) throws GitLabApiException {
+
+ if (epicId == null) {
+ throw new RuntimeException("epicId cannot be null");
+ }
+
+ if (noteId == null) {
+ throw new RuntimeException("noteId cannot be null");
+ }
+
+ delete(
+ Response.Status.NO_CONTENT,
+ getDefaultPerPageParam(),
+ "groups",
+ getGroupIdOrPath(groupIdOrPath),
+ "epics",
+ epicId,
+ "notes",
+ noteId);
+ }
}