code: public Branch protectBranch(Object projectIdOrPath, String branchName) throws GitLabApiException {
          Response response = put(Response.Status.OK, null, "projects",
                  getProjectIdOrPath(projectIdOrPath), "repository", "branches", urlEncode(branchName), "protect");
          return (response.readEntity(Branch.class));
      }
docs: Protects a single project repository branch. This is an idempotent function,
  protecting an already protected repository branch will not produce an error.
  
  <pre><code>GitLab Endpoint: PUT /projects/:id/repository/branches/:branch/protect</code></pre>
  
  @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
  @param branchName the name of the branch to protect
  @return the branch info for the protected branch
  @throws GitLabApiException if any exception occurs