@@ -567,6 +567,7 @@ public Project createProject(Project project) throws GitLabApiException {
567567 * requestAccessEnabled (optional) - Allow users to request member access
568568 * repositoryStorage (optional) - Which storage shard the repository is on. Available only to admins
569569 * approvalsBeforeMerge (optional) - How many approvers should approve merge request by default
570+ * printingMergeRequestLinkEnabled (optional) - Show link to create/view merge request when pushing from the command line
570571 *
571572 * @param project the Project instance with the configuration for the new project
572573 * @param importUrl the URL to import the repository from
@@ -606,7 +607,8 @@ public Project createProject(Project project, String importUrl) throws GitLabApi
606607 .withParam ("request_access_enabled" , project .getRequestAccessEnabled ())
607608 .withParam ("repository_storage" , project .getRepositoryStorage ())
608609 .withParam ("approvals_before_merge" , project .getApprovalsBeforeMerge ())
609- .withParam ("import_url" , importUrl );
610+ .withParam ("import_url" , importUrl )
611+ .withParam ("printing_merge_request_link_enabled" , project .getPrintingMergeRequestLinkEnabled ());
610612
611613 if (isApiVersion (ApiVersion .V3 )) {
612614 boolean isPublic = (project .getPublic () != null ? project .getPublic () : project .getVisibility () == Visibility .PUBLIC );
@@ -670,6 +672,54 @@ public Project createProject(String name, Integer namespaceId, String descriptio
670672 return (response .readEntity (Project .class ));
671673 }
672674
675+ /**
676+ * Creates a Project
677+ *
678+ * @param name The name of the project
679+ * @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user)
680+ * @param description A description for the project, null otherwise
681+ * @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
682+ * @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
683+ * @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
684+ * @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
685+ * @param visibility The visibility of the project, otherwise null indicates to use GitLab default
686+ * @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default
687+ * @param printingMergeRequestLinkEnabled Show link to create/view merge request when pushing from the command line
688+ * @param importUrl The Import URL for the project, otherwise null
689+ * @return the GitLab Project
690+ * @throws GitLabApiException if any exception occurs
691+ */
692+ public Project createProject (String name , Integer namespaceId , String description , Boolean issuesEnabled , Boolean mergeRequestsEnabled ,
693+ Boolean wikiEnabled , Boolean snippetsEnabled , Visibility visibility , Integer visibilityLevel ,
694+ Boolean printingMergeRequestLinkEnabled , String importUrl ) throws GitLabApiException {
695+
696+ if (isApiVersion (ApiVersion .V3 )) {
697+ Boolean isPublic = Visibility .PUBLIC == visibility ;
698+ return (createProject (name , namespaceId , description , issuesEnabled , mergeRequestsEnabled ,
699+ wikiEnabled , snippetsEnabled , isPublic , visibilityLevel , importUrl ));
700+ }
701+
702+ if (name == null || name .trim ().length () == 0 ) {
703+ return (null );
704+ }
705+
706+ GitLabApiForm formData = new GitLabApiForm ()
707+ .withParam ("name" , name , true )
708+ .withParam ("namespace_id" , namespaceId )
709+ .withParam ("description" , description )
710+ .withParam ("issues_enabled" , issuesEnabled )
711+ .withParam ("merge_requests_enabled" , mergeRequestsEnabled )
712+ .withParam ("wiki_enabled" , wikiEnabled )
713+ .withParam ("snippets_enabled" , snippetsEnabled )
714+ .withParam ("visibility_level" , visibilityLevel )
715+ .withParam ("visibility" , visibility )
716+ .withParam ("printing_merge_request_link_enabled" , printingMergeRequestLinkEnabled )
717+ .withParam ("import_url" , importUrl );
718+
719+ Response response = post (Response .Status .CREATED , formData , "projects" );
720+ return (response .readEntity (Project .class ));
721+ }
722+
673723 /**
674724 * Creates a Project
675725 *
@@ -741,6 +791,7 @@ public Project createProject(String name, Integer namespaceId, String descriptio
741791 * requestAccessEnabled (optional) - Allow users to request member access
742792 * repositoryStorage (optional) - Which storage shard the repository is on. Available only to admins
743793 * approvalsBeforeMerge (optional) - How many approvers should approve merge request by default
794+ * printingMergeRequestLinkEnabled (optional) - Show link to create/view merge request when pushing from the command line
744795 *
745796 * NOTE: The following parameters specified by the GitLab API edit project are not supported:
746797 * import_url
@@ -786,7 +837,8 @@ public Project updateProject(Project project) throws GitLabApiException {
786837 .withParam ("lfs_enabled" , project .getLfsEnabled ())
787838 .withParam ("request_access_enabled" , project .getRequestAccessEnabled ())
788839 .withParam ("repository_storage" , project .getRepositoryStorage ())
789- .withParam ("approvals_before_merge" , project .getApprovalsBeforeMerge ());
840+ .withParam ("approvals_before_merge" , project .getApprovalsBeforeMerge ())
841+ .withParam ("printing_merge_request_link_enabled" , project .getPrintingMergeRequestLinkEnabled ());
790842
791843 if (isApiVersion (ApiVersion .V3 )) {
792844 formData .withParam ("visibility_level" , project .getVisibilityLevel ());
0 commit comments