Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
04a31e4b
Commit
04a31e4b
authored
May 12, 2015
by
六幻
Browse files
add createProject method with full params.
parent
f8768167
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/ProjectApi.java
View file @
04a31e4b
...
...
@@ -181,6 +181,45 @@ public class ProjectApi extends AbstractApi {
return
(
response
.
getEntity
(
Project
.
class
));
}
/**
* Creates a Project
*
* @param name The name of the project
* @param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user)
* @param description A description for the project, null otherwise
* @param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
* @param wallEnabled Whether The Wall should be enabled, otherwise null indicates to use GitLab default
* @param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
* @param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
* @param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
* @param publik Whether the project is public or private, if true same as setting visibilityLevel = 20, otherwise null indicates to use GitLab default
* @param visibilityLevel The visibility level of the project, otherwise null indicates to use GitLab default
* @param importUrl The Import URL for the project, otherwise null
* @return the Gitlab Project
* @throws GitLabApiException
*/
public
Project
createProject
(
String
name
,
Integer
namespaceId
,
String
description
,
Boolean
issuesEnabled
,
Boolean
wallEnabled
,
Boolean
mergeRequestsEnabled
,
Boolean
wikiEnabled
,
Boolean
snippetsEnabled
,
Boolean
publik
,
Integer
visibilityLevel
,
String
importUrl
)
throws
GitLabApiException
{
if
(
name
==
null
||
name
.
trim
().
length
()
==
0
)
{
return
(
null
);
}
Form
formData
=
new
Form
();
addFormParam
(
formData
,
"name"
,
name
,
true
);
addFormParam
(
formData
,
"namespace_id"
,
namespaceId
);
addFormParam
(
formData
,
"description"
,
description
);
addFormParam
(
formData
,
"issues_enabled"
,
issuesEnabled
);
addFormParam
(
formData
,
"wall_enabled"
,
wallEnabled
);
addFormParam
(
formData
,
"merge_requests_enabled"
,
mergeRequestsEnabled
);
addFormParam
(
formData
,
"wiki_enabled"
,
wikiEnabled
);
addFormParam
(
formData
,
"snippets_enabled"
,
snippetsEnabled
);
addFormParam
(
formData
,
"public"
,
publik
);
addFormParam
(
formData
,
"visibility_level"
,
visibilityLevel
);
addFormParam
(
formData
,
"import_url"
,
importUrl
);
ClientResponse
response
=
post
(
ClientResponse
.
Status
.
CREATED
,
formData
,
"projects"
);
return
(
response
.
getEntity
(
Project
.
class
));
}
/**
* Removes project with all resources(issues, merge requests etc).
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment