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
158abc0f
Commit
158abc0f
authored
Nov 29, 2017
by
Greg Messner
Browse files
Added fork project support (#98).
parent
ed46ded6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
158abc0f
...
@@ -830,6 +830,60 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -830,6 +830,60 @@ public class ProjectApi extends AbstractApi implements Constants {
deleteProject
(
project
.
getId
());
deleteProject
(
project
.
getId
());
}
}
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
*
* POST /projects/:id/fork
*
* @param id the ID of the project to fork
* @param namespace path of the namespace that the project will be forked to
* @throws GitLabApiException if any exception occurs
*/
public
void
forkProject
(
Integer
id
,
String
namespace
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespace
,
true
);
post
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
id
,
"fork"
);
}
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
*
* POST /projects/:id/fork
*
* @param project the project to fork
* @param namespace path of the namespace that the project will be forked to
* @throws GitLabApiException if any exception occurs
*/
public
void
forkProject
(
Project
project
,
String
namespace
)
throws
GitLabApiException
{
forkProject
(
project
.
getId
(),
namespace
);
}
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
*
* POST /projects/:id/fork
*
* @param id the ID of the project to fork
* @param namespaceId ID of the namespace that the project will be forked to
* @throws GitLabApiException if any exception occurs
*/
public
void
forkProject
(
Integer
id
,
Integer
namespaceId
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespaceId
,
true
);
post
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
id
,
"fork"
);
}
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
*
* POST /projects/:id/fork
*
* @param project the project to fork
* @param namespaceId ID of the namespace that the project will be forked to
* @throws GitLabApiException if any exception occurs
*/
public
void
forkProject
(
Project
project
,
Integer
namespaceId
)
throws
GitLabApiException
{
forkProject
(
project
.
getId
(),
namespaceId
);
}
/**
/**
* Get a list of project team members.
* Get a list of project team members.
*
*
...
...
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