99
1010/**
1111 * This class implements the client side API for the GitLab Award Emoji API calls.
12- *
12+ *
1313 * @see <a href="https://docs.gitlab.com/ce/api/award_emoji.html">GitLab Award Emoji API Documentaion</a>
1414 * @since v4.8.31
1515 */
@@ -68,7 +68,7 @@ public List<AwardEmoji> getSnippetAwardEmojis(Object projectIdOrPath, Integer sn
6868 }
6969
7070 /**
71- * Get a list of award emoji for the specified note.
71+ * Get a list of award emoji for the specified issue note.
7272 *
7373 * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji</code></pre>
7474 *
@@ -78,9 +78,26 @@ public List<AwardEmoji> getSnippetAwardEmojis(Object projectIdOrPath, Integer sn
7878 * @return a list of AwardEmoji for the specified note
7979 * @throws GitLabApiException if any exception occurs
8080 */
81- public List <AwardEmoji > getNoteAwardEmojis (Object projectIdOrPath , Integer issueIid , Integer noteId ) throws GitLabApiException {
81+ public List <AwardEmoji > getIssueNoteAwardEmojis (Object projectIdOrPath , Integer issueIid , Integer noteId ) throws GitLabApiException {
8282 Response response = get (Response .Status .OK , getPageQueryParams (1 , getDefaultPerPage ()),
83- "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" );
83+ "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" );
84+ return response .readEntity (new GenericType <List <AwardEmoji >>() {});
85+ }
86+
87+ /**
88+ * Get a list of award emoji for the specified merge request note.
89+ *
90+ * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji</code></pre>
91+ *
92+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
93+ * @param mergeRequestIid the merge request IID of the merge request that owns the note
94+ * @param noteId the note ID to get the award emojis for
95+ * @return a list of AwardEmoji for the specified note
96+ * @throws GitLabApiException if any exception occurs
97+ */
98+ public List <AwardEmoji > getMergeRequestNoteAwardEmojis (Object projectIdOrPath , Integer mergeRequestIid , Integer noteId ) throws GitLabApiException {
99+ Response response = get (Response .Status .OK , getPageQueryParams (1 , getDefaultPerPage ()),
100+ "projects" , getProjectIdOrPath (projectIdOrPath ), "merge_requests" , mergeRequestIid , "notes" , noteId , "award_emoji" );
84101 return response .readEntity (new GenericType <List <AwardEmoji >>() {});
85102 }
86103
@@ -92,7 +109,7 @@ public List<AwardEmoji> getNoteAwardEmojis(Object projectIdOrPath, Integer issue
92109 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
93110 * @param issueIid the issue IID to get the award emoji for
94111 * @param awardId the ID of the award emoji to get
95- * @return an AwardEmoji instance for the specified award emoji
112+ * @return an AwardEmoji instance for the specified award emoji
96113 * @throws GitLabApiException if any exception occurs
97114 */
98115 public AwardEmoji getIssueAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer awardId ) throws GitLabApiException {
@@ -109,7 +126,7 @@ public AwardEmoji getIssueAwardEmoji(Object projectIdOrPath, Integer issueIid, I
109126 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
110127 * @param mergeRequestIid the merge request IID to get the award emoji for
111128 * @param awardId the ID of the award emoji to get
112- * @return an AwardEmoji instance for the specified award emoji
129+ * @return an AwardEmoji instance for the specified award emoji
113130 * @throws GitLabApiException if any exception occurs
114131 */
115132 public AwardEmoji getMergeRequestAwardEmoji (Object projectIdOrPath , Integer mergeRequestIid , Integer awardId ) throws GitLabApiException {
@@ -126,7 +143,7 @@ public AwardEmoji getMergeRequestAwardEmoji(Object projectIdOrPath, Integer merg
126143 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
127144 * @param snippetId the snippet ID to get the award emoji for
128145 * @param awardId the ID of the award emoji to get
129- * @return an AwardEmoji instance for the specified award emoji
146+ * @return an AwardEmoji instance for the specified award emoji
130147 * @throws GitLabApiException if any exception occurs
131148 */
132149 public AwardEmoji getSnippetAwardEmoji (Object projectIdOrPath , Integer snippetId , Integer awardId ) throws GitLabApiException {
@@ -136,20 +153,38 @@ public AwardEmoji getSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId
136153 }
137154
138155 /**
139- * Get the specified award emoji for the specified note.
156+ * Get the specified award emoji for the specified issue note.
140157 *
141158 * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre>
142159 *
143160 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
144161 * @param issueIid the issue IID of the issue that owns the note
145162 * @param noteId the note ID to get the award emoji from
146163 * @param awardId the ID of the award emoji to get
147- * @return an AwardEmoji instance for the specified award emoji
164+ * @return an AwardEmoji instance for the specified award emoji
148165 * @throws GitLabApiException if any exception occurs
149166 */
150- public AwardEmoji getNoteAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer noteId , Integer awardId ) throws GitLabApiException {
167+ public AwardEmoji getIssueNoteAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer noteId , Integer awardId ) throws GitLabApiException {
151168 Response response = get (Response .Status .OK , getPageQueryParams (1 , getDefaultPerPage ()),
152- "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" , awardId );
169+ "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" , awardId );
170+ return (response .readEntity (AwardEmoji .class ));
171+ }
172+
173+ /**
174+ * Get the specified award emoji for the specified merge request note.
175+ *
176+ * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji/:award_id</code></pre>
177+ *
178+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
179+ * @param mergeRequestIid the merge request IID of the merge request that owns the note
180+ * @param noteId the note ID to get the award emoji from
181+ * @param awardId the ID of the award emoji to get
182+ * @return an AwardEmoji instance for the specified award emoji
183+ * @throws GitLabApiException if any exception occurs
184+ */
185+ public AwardEmoji getMergeRequestNoteAwardEmoji (Object projectIdOrPath , Integer mergeRequestIid , Integer noteId , Integer awardId ) throws GitLabApiException {
186+ Response response = get (Response .Status .OK , getPageQueryParams (1 , getDefaultPerPage ()),
187+ "projects" , getProjectIdOrPath (projectIdOrPath ), "merge_requests" , mergeRequestIid , "notes" , noteId , "award_emoji" , awardId );
153188 return (response .readEntity (AwardEmoji .class ));
154189 }
155190
@@ -161,7 +196,7 @@ public AwardEmoji getNoteAwardEmoji(Object projectIdOrPath, Integer issueIid, In
161196 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
162197 * @param issueIid the issue IID to add the award emoji to
163198 * @param name the name of the award emoji to add
164- * @return an AwardEmoji instance for the added award emoji
199+ * @return an AwardEmoji instance for the added award emoji
165200 * @throws GitLabApiException if any exception occurs
166201 */
167202 public AwardEmoji addIssueAwardEmoji (Object projectIdOrPath , Integer issueIid , String name ) throws GitLabApiException {
@@ -179,7 +214,7 @@ public AwardEmoji addIssueAwardEmoji(Object projectIdOrPath, Integer issueIid, S
179214 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
180215 * @param mergeRequestIid the merge request IID to add the award emoji to
181216 * @param name the name of the award emoji to add
182- * @return an AwardEmoji instance for the added award emoji
217+ * @return an AwardEmoji instance for the added award emoji
183218 * @throws GitLabApiException if any exception occurs
184219 */
185220 public AwardEmoji addMergeRequestAwardEmoji (Object projectIdOrPath , Integer mergeRequestIid , String name ) throws GitLabApiException {
@@ -197,7 +232,7 @@ public AwardEmoji addMergeRequestAwardEmoji(Object projectIdOrPath, Integer merg
197232 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
198233 * @param snippetId the snippet ID to add the award emoji to
199234 * @param name the name of the award emoji to add
200- * @return an AwardEmoji instance for the added award emoji
235+ * @return an AwardEmoji instance for the added award emoji
201236 * @throws GitLabApiException if any exception occurs
202237 */
203238 public AwardEmoji addSnippetAwardEmoji (Object projectIdOrPath , Integer snippetId , String name ) throws GitLabApiException {
@@ -208,21 +243,40 @@ public AwardEmoji addSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId
208243 }
209244
210245 /**
211- * Add an award emoji for the specified note.
246+ * Add an award emoji for the specified issue note.
212247 *
213248 * <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/notes/:noteId/award_emoji</code></pre>
214249 *
215250 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
216251 * @param issueIid the issue IID of the issue that owns the note
217252 * @param noteId the note ID to add the award emoji to
218253 * @param name the name of the award emoji to add
219- * @return an AwardEmoji instance for the added award emoji
254+ * @return an AwardEmoji instance for the added award emoji
220255 * @throws GitLabApiException if any exception occurs
221256 */
222- public AwardEmoji addNoteAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer noteId , String name ) throws GitLabApiException {
257+ public AwardEmoji addIssueNoteAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer noteId , String name ) throws GitLabApiException {
223258 GitLabApiForm form = new GitLabApiForm ().withParam ("name" , name , true );
224259 Response response = post (Response .Status .CREATED , form .asMap (),
225- "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" );
260+ "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" );
261+ return (response .readEntity (AwardEmoji .class ));
262+ }
263+
264+ /**
265+ * Add an award emoji for the specified merge request note.
266+ *
267+ * <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/notes/:noteId/award_emoji</code></pre>
268+ *
269+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
270+ * @param mergeRequestIid the merge request IID of the merge request that owns the note
271+ * @param noteId the note ID to add the award emoji to
272+ * @param name the name of the award emoji to add
273+ * @return an AwardEmoji instance for the added award emoji
274+ * @throws GitLabApiException if any exception occurs
275+ */
276+ public AwardEmoji addNoteAwardEmoji (Object projectIdOrPath , Integer mergeRequestIid , Integer noteId , String name ) throws GitLabApiException {
277+ GitLabApiForm form = new GitLabApiForm ().withParam ("name" , name , true );
278+ Response response = post (Response .Status .CREATED , form .asMap (),
279+ "projects" , getProjectIdOrPath (projectIdOrPath ), "merge_requests" , mergeRequestIid , "notes" , noteId , "award_emoji" );
226280 return (response .readEntity (AwardEmoji .class ));
227281 }
228282
@@ -269,10 +323,10 @@ public void deleteMergeRequestAwardEmoji(Object projectIdOrPath, Integer mergeRe
269323 public void deleteSnippetAwardEmoji (Object projectIdOrPath , Integer snippetId , Integer awardId ) throws GitLabApiException {
270324 delete (Response .Status .NO_CONTENT , null ,
271325 "projects" , getProjectIdOrPath (projectIdOrPath ), "snippets" , snippetId , "award_emoji" , awardId );
272- }
326+ }
273327
274328 /**
275- * Delete an award emoji from the specified note.
329+ * Delete an award emoji from the specified issue note.
276330 *
277331 * <pre><code>GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre>
278332 *
@@ -284,6 +338,22 @@ public void deleteSnippetAwardEmoji(Object projectIdOrPath, Integer snippetId, I
284338 */
285339 public void deleteNoteAwardEmoji (Object projectIdOrPath , Integer issueIid , Integer noteId , Integer awardId ) throws GitLabApiException {
286340 delete (Response .Status .NO_CONTENT , null ,
287- "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" , awardId );
341+ "projects" , getProjectIdOrPath (projectIdOrPath ), "issues" , issueIid , "notes" , noteId , "award_emoji" , awardId );
342+ }
343+
344+ /**
345+ * Delete an award emoji from the specified merge request note.
346+ *
347+ * <pre><code>GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji/:award_id</code></pre>
348+ *
349+ * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
350+ * @param mergeRequestIid the merge request IID of the merge request that owns the note
351+ * @param noteId the note ID of the note to delete the award emoji from
352+ * @param awardId the ID of the award emoji to delete
353+ * @throws GitLabApiException if any exception occurs
354+ */
355+ public void deleteNoteAwardEmoji (Object projectIdOrPath , Integer mergeRequestIid , Integer noteId , Integer awardId ) throws GitLabApiException {
356+ delete (Response .Status .NO_CONTENT , null ,
357+ "projects" , getProjectIdOrPath (projectIdOrPath ), "merge_requests" , mergeRequestIid , "notes" , noteId , "award_emoji" , awardId );
288358 }
289359}
0 commit comments