code: public MergeRequest cancelMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
  
          if (mergeRequestIid == null) {
              throw new RuntimeException("mergeRequestIid cannot be null");
          }
  
          Response response = put(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "cancel_merge_when_pipeline_succeeds");
          return (response.readEntity(MergeRequest.class));
      }
docs: Cancel merge when pipeline succeeds. If you don't have permissions to accept this merge request,
  you'll get a 401. If the merge request is already merged or closed, you get 405 and
  error message 'Method Not Allowed'. In case the merge request is not set to be merged when the
  pipeline succeeds, you'll also get a 406 error.
  
  <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
  
  <pre><code>GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds</code></pre>
  
  @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
  @param mergeRequestIid the internal ID of the merge request
  @return the updated merge request
  @throws GitLabApiException if any exception occurs