code: public ProjectHook addHook(Object projectIdOrPath, String url, boolean doPushEvents,
              boolean doIssuesEvents, boolean doMergeRequestsEvents) throws GitLabApiException {
  
          GitLabApiForm formData = new GitLabApiForm()
                  .withParam("url", url)
                  .withParam("push_events", doPushEvents)
                  .withParam("issues_enabled", doIssuesEvents)
                  .withParam("merge_requests_events", doMergeRequestsEvents);
  
          Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "hooks");
          return (response.readEntity(ProjectHook.class));
      }
docs: Adds a hook to project.
  
  <pre><code>POST /projects/:id/hooks</code></pre>
  
  @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
  @param url the callback URL for the hook
  @param doPushEvents flag specifying whether to do push events
  @param doIssuesEvents flag specifying whether to do issues events
  @param doMergeRequestsEvents flag specifying whether to do merge requests events
  @return the added ProjectHook instance
  @throws GitLabApiException if any exception occurs