@@ -1196,6 +1196,30 @@ public Project createProject(String name, Integer namespaceId, String descriptio
11961196 return (response .readEntity (Project .class ));
11971197 }
11981198
1199+ /**
1200+ * Create a new project from a template, belonging to the namespace ID. A namespace ID is either a user or group ID.
1201+ *
1202+ * @param namespaceId the namespace ID to create the project under
1203+ * @param projectName the name of the project top create
1204+ * @param groupWithProjectTemplatesId Id of the Gitlab Group, which contains the relevant templates.
1205+ * @param templateName name of the template to use
1206+ * @param visibility Visibility of the new create project
1207+ * @return the created project
1208+ * @throws GitLabApiException if any exception occurs
1209+ */
1210+ public Project createProjectFromTemplate (Integer namespaceId , String projectName , Integer groupWithProjectTemplatesId , String templateName , Visibility visibility ) throws GitLabApiException {
1211+ GitLabApiForm formData = new GitLabApiForm ()
1212+ .withParam ("namespace_id" , namespaceId )
1213+ .withParam ("name" , projectName , true )
1214+ .withParam ("use_custom_template" , true )
1215+ .withParam ("group_with_project_templates_id" , groupWithProjectTemplatesId , true )
1216+ .withParam ("template_name" , templateName , true )
1217+ .withParam ("visibility" , visibility )
1218+ ;
1219+ Response response = post (Response .Status .CREATED , formData , "projects" );
1220+ return (response .readEntity (Project .class ));
1221+ }
1222+
11991223 /**
12001224 * Updates a project. The following properties on the Project instance
12011225 * are utilized in the edit of the project, null values are not updated:
0 commit comments