Skip to content

Commit b760f14

Browse files
committed
Brought into spec with GitLab API docs (#352).
1 parent e9c998a commit b760f14

File tree

1 file changed

+7
-39
lines changed

1 file changed

+7
-39
lines changed

src/main/java/org/gitlab4j/api/ProjectApi.java

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,42 +1706,6 @@ public Optional<ProjectHook> getOptionalHook(Object projectIdOrPath, Integer hoo
17061706
}
17071707
}
17081708

1709-
/**
1710-
* Adds a hook to project.
1711-
*
1712-
* <pre><code>POST /projects/:id/hooks</code></pre>
1713-
*
1714-
* @param projectName the name of the project
1715-
* @param url the callback URL for the hook
1716-
* @param enabledHooks a ProjectHook instance specifying which hooks to enable
1717-
* @param enableSslVerification enable SSL verification
1718-
* @param secretToken the secret token to pass back to the hook
1719-
* @return the added ProjectHook instance
1720-
* @throws GitLabApiException if any exception occurs
1721-
*/
1722-
public ProjectHook addHook(String projectName, String url, ProjectHook enabledHooks, boolean enableSslVerification, String secretToken)
1723-
throws GitLabApiException {
1724-
1725-
if (projectName == null) {
1726-
return (null);
1727-
}
1728-
1729-
GitLabApiForm formData = new GitLabApiForm()
1730-
.withParam("url", url, true)
1731-
.withParam("push_events", enabledHooks.getPushEvents(), false)
1732-
.withParam("issues_events", enabledHooks.getIssuesEvents(), false)
1733-
.withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false)
1734-
.withParam("tag_push_events", enabledHooks.getTagPushEvents(), false)
1735-
.withParam("note_events", enabledHooks.getNoteEvents(), false)
1736-
.withParam("job_events", enabledHooks.getJobEvents(), false)
1737-
.withParam("pipeline_events", enabledHooks.getPipelineEvents(), false)
1738-
.withParam("wiki_events", enabledHooks.getWikiPageEvents(), false)
1739-
.withParam("enable_ssl_verification", enabledHooks.getEnableSslVerification())
1740-
.withParam("token", secretToken, false);
1741-
Response response = post(Response.Status.CREATED, formData, "projects", projectName, "hooks");
1742-
return (response.readEntity(ProjectHook.class));
1743-
}
1744-
17451709
/**
17461710
* Adds a hook to project.
17471711
*
@@ -1755,20 +1719,24 @@ public ProjectHook addHook(String projectName, String url, ProjectHook enabledHo
17551719
* @return the added ProjectHook instance
17561720
* @throws GitLabApiException if any exception occurs
17571721
*/
1758-
public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabledHooks, boolean enableSslVerification, String secretToken)
1759-
throws GitLabApiException {
1722+
public ProjectHook addHook(Object projectIdOrPath, String url, ProjectHook enabledHooks,
1723+
boolean enableSslVerification, String secretToken) throws GitLabApiException {
17601724

17611725
GitLabApiForm formData = new GitLabApiForm()
17621726
.withParam("url", url, true)
17631727
.withParam("push_events", enabledHooks.getPushEvents(), false)
1728+
.withParam("push_events_branch_filter", enabledHooks.getPushEventsBranchFilter(), false)
17641729
.withParam("issues_events", enabledHooks.getIssuesEvents(), false)
1730+
.withParam("confidential_issues_events", enabledHooks.getConfidentialIssuesEvents(), false)
17651731
.withParam("merge_requests_events", enabledHooks.getMergeRequestsEvents(), false)
17661732
.withParam("tag_push_events", enabledHooks.getTagPushEvents(), false)
17671733
.withParam("note_events", enabledHooks.getNoteEvents(), false)
1734+
.withParam("confidential_note_events", enabledHooks.getConfidentialNoteEvents(), false)
17681735
.withParam("job_events", enabledHooks.getJobEvents(), false)
17691736
.withParam("pipeline_events", enabledHooks.getPipelineEvents(), false)
17701737
.withParam("wiki_events", enabledHooks.getWikiPageEvents(), false)
1771-
.withParam("enable_ssl_verification", enabledHooks.getEnableSslVerification())
1738+
.withParam("enable_ssl_verification", enabledHooks.getEnableSslVerification(), false)
1739+
.withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false)
17721740
.withParam("token", secretToken, false);
17731741
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks");
17741742
return (response.readEntity(ProjectHook.class));

0 commit comments

Comments
 (0)