@@ -1074,7 +1074,7 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
1074
1074
* Only working with GitLab 16.9 and above.
1075
1075
*
1076
1076
* <pre><code>GitLab Endpoint: GET /projects/:id/avatar</code></pre>
1077
- *
1077
+ *
1078
1078
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
1079
1079
* @return an InputStream to read the raw file from
1080
1080
* @throws GitLabApiException if any exception occurs
@@ -2211,7 +2211,7 @@ public Optional<ProjectHook> getOptionalHook(Object projectIdOrPath, Long hookId
2211
2211
* @throws GitLabApiException if any exception occurs
2212
2212
*/
2213
2213
public ProjectHook addHook (Object projectIdOrPath , String url , ProjectHook enabledHooks ,
2214
- boolean enableSslVerification , String secretToken ) throws GitLabApiException {
2214
+ Boolean enableSslVerification , String secretToken ) throws GitLabApiException {
2215
2215
2216
2216
GitLabApiForm formData = new GitLabApiForm ()
2217
2217
.withParam ("url" , url , true )
@@ -2238,6 +2238,7 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl
2238
2238
2239
2239
/**
2240
2240
* Adds a hook to project.
2241
+ * Convenience method for {@link #addHook(Object, String, ProjectHook, Boolean, String)}
2241
2242
*
2242
2243
* <pre><code>GitLab Endpoint: POST /projects/:id/hooks</code></pre>
2243
2244
*
@@ -2251,15 +2252,32 @@ public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabl
2251
2252
*/
2252
2253
public ProjectHook addHook (Object projectIdOrPath , String url , boolean doPushEvents ,
2253
2254
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 );
2263
2281
}
2264
2282
2265
2283
/**
0 commit comments