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