@@ -1074,7 +1074,7 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
10741074 * Only working with GitLab 16.9 and above.
10751075 *
10761076 * <pre><code>GitLab Endpoint: GET /projects/:id/avatar</code></pre>
1077- *
1077+ *
10781078 * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
10791079 * @return an InputStream to read the raw file from
10801080 * @throws GitLabApiException if any exception occurs
@@ -2211,7 +2211,7 @@ public Optional<ProjectHook> getOptionalHook(Object projectIdOrPath, Long hookId
22112211 * @throws GitLabApiException if any exception occurs
22122212 */
22132213 public ProjectHook addHook (Object projectIdOrPath , String url , ProjectHook enabledHooks ,
2214- boolean enableSslVerification , String secretToken ) throws GitLabApiException {
2214+ Boolean enableSslVerification , String secretToken ) throws GitLabApiException {
22152215
22162216 GitLabApiForm formData = new GitLabApiForm ()
22172217 .withParam ("url" , url , true )
@@ -2238,6 +2238,7 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl
22382238
22392239 /**
22402240 * Adds a hook to project.
2241+ * Convenience method for {@link #addHook(Object, String, ProjectHook, Boolean, String)}
22412242 *
22422243 * <pre><code>GitLab Endpoint: POST /projects/:id/hooks</code></pre>
22432244 *
@@ -2251,15 +2252,32 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl
22512252 */
22522253 public ProjectHook addHook (Object projectIdOrPath , String url , boolean doPushEvents ,
22532254 boolean doIssuesEvents , boolean doMergeRequestsEvents ) throws GitLabApiException {
2254-
2255- GitLabApiForm formData = new GitLabApiForm ()
2256- .withParam ("url" , url )
2257- .withParam ("push_events" , doPushEvents )
2258- .withParam ("issues_events" , doIssuesEvents )
2259- .withParam ("merge_requests_events" , doMergeRequestsEvents );
2260-
2261- Response response = post (Response .Status .CREATED , formData , "projects" , getProjectIdOrPath (projectIdOrPath ), "hooks" );
2262- return (response .readEntity (ProjectHook .class ));
2255+ return addHook (projectIdOrPath , url , doPushEvents , doIssuesEvents , doMergeRequestsEvents , null );
2256+ }
2257+
2258+ /**
2259+ * Adds a hook to project.
2260+ * Convenience method for {@link #addHook(Object, String, ProjectHook, Boolean, String)}
2261+ *
2262+ * <pre><code>GitLab Endpoint: POST /projects/:id/hooks</code></pre>
2263+ *
2264+ * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
2265+ * @param url the callback URL for the hook
2266+ * @param doPushEvents flag specifying whether to do push events
2267+ * @param doIssuesEvents flag specifying whether to do issues events
2268+ * @param doMergeRequestsEvents flag specifying whether to do merge requests events
2269+ * @param doNoteEvents flag specifying whether to do note events
2270+ * @return the added ProjectHook instance
2271+ * @throws GitLabApiException if any exception occurs
2272+ */
2273+ public ProjectHook addHook (Object projectIdOrPath , String url , Boolean doPushEvents ,
2274+ Boolean doIssuesEvents , Boolean doMergeRequestsEvents , Boolean doNoteEvents ) throws GitLabApiException {
2275+ ProjectHook enabledHooks = new ProjectHook ()
2276+ .withPushEvents (doPushEvents )
2277+ .withIssuesEvents (doIssuesEvents )
2278+ .withMergeRequestsEvents (doMergeRequestsEvents )
2279+ .withNoteEvents (doNoteEvents );
2280+ return addHook (projectIdOrPath , url , enabledHooks , null , null );
22632281 }
22642282
22652283 /**
0 commit comments