From 79d3c4370d932504ddbef1f108142407d55a8263 Mon Sep 17 00:00:00 2001 From: khvalIvan Date: Wed, 6 Dec 2017 12:48:00 +0300 Subject: [PATCH] "ref_name" was changed to "ref" in APIv4 https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/repositories.md - optional "ref_name" for V3 https://docs.gitlab.com/ce/api/repositories.html - optional "ref" for V4 --- src/main/java/org/gitlab4j/api/RepositoryApi.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gitlab4j/api/RepositoryApi.java b/src/main/java/org/gitlab4j/api/RepositoryApi.java index 93beec00b..b7a63eed2 100644 --- a/src/main/java/org/gitlab4j/api/RepositoryApi.java +++ b/src/main/java/org/gitlab4j/api/RepositoryApi.java @@ -357,7 +357,7 @@ public List getTree(Integer projectId, String filePath, String refName Form formData = new GitLabApiForm() .withParam("id", projectId, true) .withParam("path", filePath, false) - .withParam("ref_name", refName, false) + .withParam(isApiVersion(ApiVersion.V3) ? "ref_name" : "ref", refName, false) .withParam("recursive", recursive, false) .withParam(PER_PAGE_PARAM, getDefaultPerPage()); Response response = get(Response.Status.OK, formData.asMap(), "projects", projectId, "repository", "tree"); @@ -386,7 +386,7 @@ public Pager getTree(Integer projectId, String filePath, String refNam Form formData = new GitLabApiForm() .withParam("id", projectId, true) .withParam("path", filePath, false) - .withParam("ref_name", refName, false) + .withParam(isApiVersion(ApiVersion.V3) ? "ref_name" : "ref", refName, false) .withParam("recursive", recursive, false); return (new Pager(this, TreeItem.class, itemsPerPage, formData.asMap(), "projects", projectId, "repository", "tree")); }