From 72472908d99dccaf47379ced211902566ba841b3 Mon Sep 17 00:00:00 2001 From: Greg Messner <greg@messners.com> Date: Fri, 3 May 2019 17:17:16 -0700 Subject: [PATCH] Added transferProject() (#311). --- src/main/java/org/gitlab4j/api/GroupApi.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gitlab4j/api/GroupApi.java b/src/main/java/org/gitlab4j/api/GroupApi.java index 0f388bbc..ce5f7e15 100644 --- a/src/main/java/org/gitlab4j/api/GroupApi.java +++ b/src/main/java/org/gitlab4j/api/GroupApi.java @@ -1124,7 +1124,7 @@ public class GroupApi extends AbstractApi { /** * Deletes a group variable. * - * <pre><code>DELETE /groups/:id/variables/:key</code></pre> + * <pre><code>GitLab Endpoint: DELETE /groups/:id/variables/:key</code></pre> * * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required * @param key the key of an existing variable, required @@ -1133,4 +1133,20 @@ public class GroupApi extends AbstractApi { public void deleteVariable(Object groupIdOrPath, String key) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "variables", key); } + + /** + * Transfer a project to the Group namespace. Available only for admin users. + * + * <pre><code>GitLab Endpoint: POST /groups/:id/projects/:project_id</code></pre> + * + * @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required + * @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required + * @return the transfered Project instance + * @throws GitLabApiException if any exception occurs during execution + */ + public Project transferProject(Object groupIdOrPath, Object projectIdOrPath) throws GitLabApiException { + Response response = post(Response.Status.CREATED, (Form)null, "groups", getGroupIdOrPath(groupIdOrPath), + "projects", getProjectIdOrPath(projectIdOrPath)); + return (response.readEntity(Project.class)); + } } -- GitLab