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
01a610a1
Commit
01a610a1
authored
Nov 27, 2018
by
Greg Messner
Browse files
Added deleteForkedFromRelationship() (#275).
parent
28000698
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
01a610a1
...
@@ -520,12 +520,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -520,12 +520,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id
* GET /projects/:id
*
*
* @param projectId
the ID of the project to get
* @param projectId
OrPath the project in the form of an Integer(ID), String(path), or Project instance
* @return the specified project
* @return the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
getProject
(
Integer
projectId
)
throws
GitLabApiException
{
public
Project
getProject
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
this
.
getProjectIdOrPath
(
projectId
OrPath
)
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
@@ -534,14 +534,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -534,14 +534,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id
* GET /projects/:id
*
*
* @param projectId
the ID of the project to get
* @param projectId
OrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param statistics include project statistics
* @param statistics include project statistics
* @return the specified project
* @return the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
getProject
(
Integer
projectId
,
Boolean
statistics
)
throws
GitLabApiException
{
public
Project
getProject
(
Object
projectId
OrPath
,
Boolean
statistics
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
().
withParam
(
"statistics"
,
statistics
);
Form
formData
=
new
GitLabApiForm
().
withParam
(
"statistics"
,
statistics
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
this
.
getProjectIdOrPath
(
projectId
OrPath
)
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
@@ -550,12 +550,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -550,12 +550,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id
* GET /projects/:id
*
*
* @param projectId
the ID of the project to get
* @param projectId
OrPath the project in the form of an Integer(ID), String(path), or Project instance
* @return an Optional instance with the specified project as a value
* @return an Optional instance with the specified project as a value
*/
*/
public
Optional
<
Project
>
getOptionalProject
(
Integer
projectId
)
{
public
Optional
<
Project
>
getOptionalProject
(
Object
projectId
OrPath
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getProject
(
projectId
)));
return
(
Optional
.
ofNullable
(
getProject
(
projectId
OrPath
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -1023,29 +1023,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1023,29 +1023,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id
* DELETE /projects/:id
*
*
* @param projectId the project
ID to remov
e
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instanc
e
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
deleteProject
(
Integer
projectId
)
throws
GitLabApiException
{
public
void
deleteProject
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
ACCEPTED
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
ACCEPTED
);
delete
(
expectedStatus
,
null
,
"projects"
,
projectId
);
delete
(
expectedStatus
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
));
}
/**
* Removes project with all resources(issues, merge requests etc).
*
* DELETE /projects/:id
*
* @param project the Project instance to remove
* @throws GitLabApiException if any exception occurs
*/
public
void
deleteProject
(
Project
project
)
throws
GitLabApiException
{
deleteProject
(
project
.
getId
());
}
}
/**
/**
...
@@ -1055,15 +1038,15 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1055,15 +1038,15 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/fork
* POST /projects/:id/fork
*
*
* @param
id the ID of the project to fork
* @param
projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param namespace path of the namespace that the project will be forked to
* @param namespace path of the namespace that the project will be forked to
* @return the newly forked Project instance
* @return the newly forked Project instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
forkProject
(
Integer
id
,
String
namespace
)
throws
GitLabApiException
{
public
Project
forkProject
(
Object
projectIdOrPath
,
String
namespace
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespace
,
true
);
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespace
,
true
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
CREATED
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
CREATED
);
Response
response
=
post
(
expectedStatus
,
formData
,
"projects"
,
id
,
"fork"
);
Response
response
=
post
(
expectedStatus
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
)
,
"fork"
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
@@ -1074,48 +1057,41 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1074,48 +1057,41 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/fork
* POST /projects/:id/fork
*
*
* @param project the project
to fork
* @param project
IdOrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param namespace
path
of the namespace that the project will be forked to
* @param namespace
Id ID
of the namespace that the project will be forked to
* @return the newly forked Project instance
* @return the newly forked Project instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
forkProject
(
Project
project
,
String
namespace
)
throws
GitLabApiException
{
public
Project
forkProject
(
Object
projectIdOrPath
,
Integer
namespaceId
)
throws
GitLabApiException
{
return
(
forkProject
(
project
.
getId
(),
namespace
));
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespaceId
,
true
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
CREATED
);
Response
response
=
post
(
expectedStatus
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"fork"
);
return
(
response
.
readEntity
(
Project
.
class
));
}
}
/**
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
* Create a forked from/to relation between existing projects.
* The forking operation for a project is asynchronous and is completed in a background job.
* The request will return immediately.
*
* POST /projects/:id/fork
*
*
* @param
id the ID of the project to fork
* @param
projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param
namespaceId ID of the namespace that the project will be
forked
to
* @param
forkedFromId the ID of the project that was
forked
from
* @return the
newly fork
ed Project instance
* @return the
updat
ed Project instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
forkProject
(
Integer
id
,
Integer
namespaceId
)
throws
GitLabApiException
{
public
Project
createdForkedFromRelationship
(
Object
projectIdOrPath
,
Integer
forkedFromId
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"namespace"
,
namespaceId
,
true
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
CREATED
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
CREATED
);
Response
response
=
post
(
expectedStatus
,
f
orm
Data
,
"projects"
,
id
,
"fork"
);
Response
response
=
post
(
expectedStatus
,
(
F
orm
)
null
,
"projects"
,
this
.
getProjectIdOrPath
(
projectIdOrPath
),
"fork"
,
forkedFromId
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
/**
/**
* Forks a project into the user namespace of the authenticated user or the one provided.
* Delete an existing forked from relationship.
* The forking operation for a project is asynchronous and is completed in a background job.
* The request will return immediately.
*
*
* POST /projects/:id/fork
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
*
* @param project the project to fork
* @param namespaceId ID of the namespace that the project will be forked to
* @return the newly forked Project instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
forkProject
(
Project
project
,
Integer
namespaceId
)
throws
GitLabApiException
{
public
void
deleteForkedFromRelationship
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
return
(
forkProject
(
project
.
getId
(),
namespaceId
));
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
ACCEPTED
);
delete
(
expectedStatus
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"fork"
);
}
}
/**
/**
...
@@ -1123,12 +1099,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1123,12 +1099,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/members
* GET /projects/:id/members
*
*
* @param projectId
th
e
project
ID to get team members for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @return the members belonging to the specified project
* @return the members belonging to the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Member
>
getMembers
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Member
>
getMembers
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
this
.
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"members"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
this
.
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Member
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Member
>>()
{}));
}
}
...
@@ -1137,14 +1113,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1137,14 +1113,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/members
* GET /projects/:id/members
*
*
* @param projectId
th
e
project
ID to get team members for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param page the page to get
* @param page the page to get
* @param perPage the number of Member instances per page
* @param perPage the number of Member instances per page
* @return the members belonging to the specified project
* @return the members belonging to the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Member
>
getMembers
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Member
>
getMembers
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"members"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Member
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Member
>>()
{}));
}
}
...
@@ -1153,13 +1129,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1153,13 +1129,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/members
* GET /projects/:id/members
*
*
* @param projectId
th
e
project
ID to get team members for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param itemsPerPage the number of Project instances that will be fetched per page
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return the members belonging to the specified project
* @return the members belonging to the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
Member
>
getMembers
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Member
>
getMembers
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Member
>(
this
,
Member
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"members"
));
return
(
new
Pager
<
Member
>(
this
,
Member
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
));
}
}
/**
/**
...
@@ -1167,13 +1143,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1167,13 +1143,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/members/:user_id
* GET /projects/:id/members/:user_id
*
*
* @param projectId
th
e
project
ID to get team member for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member
* @param userId the user ID of the member
* @return the member specified by the project ID/user ID pair
* @return the member specified by the project ID/user ID pair
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
getMember
(
Integer
projectId
,
Integer
userId
)
throws
GitLabApiException
{
public
Member
getMember
(
Object
projectId
OrPath
,
Integer
userId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"members"
,
userId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
,
userId
);
return
(
response
.
readEntity
(
Member
.
class
));
return
(
response
.
readEntity
(
Member
.
class
));
}
}
...
@@ -1182,13 +1158,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1182,13 +1158,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/members/:user_id
* GET /projects/:id/members/:user_id
*
*
* @param projectId
th
e
project
ID to get team member for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member
* @param userId the user ID of the member
* @return the member specified by the project ID/user ID pair
* @return the member specified by the project ID/user ID pair
*/
*/
public
Optional
<
Member
>
getOptionalMember
(
Integer
projectId
,
Integer
userId
)
{
public
Optional
<
Member
>
getOptionalMember
(
Object
projectId
OrPath
,
Integer
userId
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getMember
(
projectId
,
userId
)));
return
(
Optional
.
ofNullable
(
getMember
(
projectId
OrPath
,
userId
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -1201,14 +1177,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1201,14 +1177,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/members
* POST /projects/:id/members
*
*
* @param projectId
th
e
project
ID to add the team member to, required
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to add, required
* @param userId the user ID of the member to add, required
* @param accessLevel the access level for the new member, required
* @param accessLevel the access level for the new member, required
* @return the added member
* @return the added member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
addMember
(
Integer
projectId
,
Integer
userId
,
Integer
accessLevel
)
throws
GitLabApiException
{
public
Member
addMember
(
Object
projectId
OrPath
,
Integer
userId
,
Integer
accessLevel
)
throws
GitLabApiException
{
return
(
addMember
(
projectId
,
userId
,
accessLevel
,
null
));
return
(
addMember
(
projectId
OrPath
,
userId
,
accessLevel
,
null
));
}
}
/**
/**
...
@@ -1218,14 +1194,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1218,14 +1194,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/members
* POST /projects/:id/members
*
*
* @param projectId
th
e
project
ID to add the team member to, required
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to add, required
* @param userId the user ID of the member to add, required
* @param accessLevel the access level for the new member, required
* @param accessLevel the access level for the new member, required
* @return the added member
* @return the added member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
addMember
(
Integer
projectId
,
Integer
userId
,
AccessLevel
accessLevel
)
throws
GitLabApiException
{
public
Member
addMember
(
Object
projectId
OrPath
,
Integer
userId
,
AccessLevel
accessLevel
)
throws
GitLabApiException
{
return
(
addMember
(
projectId
,
userId
,
accessLevel
.
toValue
(),
null
));
return
(
addMember
(
projectId
OrPath
,
userId
,
accessLevel
.
toValue
(),
null
));
}
}
/**
/**
...
@@ -1235,15 +1211,15 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1235,15 +1211,15 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/members
* POST /projects/:id/members
*
*
* @param projectId
th
e
project
ID to add the team member to
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to add
* @param userId the user ID of the member to add
* @param accessLevel the access level for the new member
* @param accessLevel the access level for the new member
* @param expiresAt the date the membership in the group will expire
* @param expiresAt the date the membership in the group will expire
* @return the added member
* @return the added member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
addMember
(
Integer
projectId
,
Integer
userId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
public
Member
addMember
(
Object
projectId
OrPath
,
Integer
userId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
return
(
addMember
(
projectId
,
userId
,
accessLevel
.
toValue
(),
expiresAt
));
return
(
addMember
(
projectId
OrPath
,
userId
,
accessLevel
.
toValue
(),
expiresAt
));
}
}
/**
/**
...
@@ -1253,19 +1229,19 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1253,19 +1229,19 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/members
* POST /projects/:id/members
*
*
* @param projectId
th
e
project
ID to add the team member to
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to add
* @param userId the user ID of the member to add
* @param accessLevel the access level for the new member
* @param accessLevel the access level for the new member
* @param expiresAt the date the membership in the group will expire
* @param expiresAt the date the membership in the group will expire
* @return the added member
* @return the added member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
addMember
(
Integer
projectId
,
Integer
userId
,
Integer
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
public
Member
addMember
(
Object
projectId
OrPath
,
Integer
userId
,
Integer
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"user_id"
,
userId
,
true
)
.
withParam
(
"user_id"
,
userId
,
true
)
.
withParam
(
"access_level"
,
accessLevel
,
true
)
.
withParam
(
"access_level"
,
accessLevel
,
true
)
.
withParam
(
"expires_at"
,
expiresAt
,
false
);
.
withParam
(
"expires_at"
,
expiresAt
,
false
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"members"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
);
return
(
response
.
readEntity
(
Member
.
class
));
return
(
response
.
readEntity
(
Member
.
class
));
}
}
...
@@ -1274,14 +1250,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1274,14 +1250,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* PUT /projects/:projectId/members/:userId
* PUT /projects/:projectId/members/:userId
*
*
* @param projectId the project
ID
the
member belongs to, required
* @param projectId
OrPath projectIdOrPath
the project
in
the
form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to update, required
* @param userId the user ID of the member to update, required
* @param accessLevel the new access level for the member, required
* @param accessLevel the new access level for the member, required
* @return the updated member
* @return the updated member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
updateMember
(
Integer
projectId
,
Integer
userId
,
Integer
accessLevel
)
throws
GitLabApiException
{
public
Member
updateMember
(
Object
projectId
OrPath
,
Integer
userId
,
Integer
accessLevel
)
throws
GitLabApiException
{
return
(
updateMember
(
projectId
,
userId
,
accessLevel
,
null
));
return
(
updateMember
(
projectId
OrPath
,
userId
,
accessLevel
,
null
));
}
}
/**
/**
...
@@ -1289,14 +1265,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1289,14 +1265,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* PUT /projects/:projectId/members/:userId
* PUT /projects/:projectId/members/:userId
*
*
* @param projectId the project
ID
the
member belongs to, required
* @param projectId
OrPath projectIdOrPath
the project
in
the
form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to update, required
* @param userId the user ID of the member to update, required
* @param accessLevel the new access level for the member, required
* @param accessLevel the new access level for the member, required
* @return the updated member
* @return the updated member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
updateMember
(
Integer
projectId
,
Integer
userId
,
AccessLevel
accessLevel
)
throws
GitLabApiException
{
public
Member
updateMember
(
Object
projectId
OrPath
,
Integer
userId
,
AccessLevel
accessLevel
)
throws
GitLabApiException
{
return
(
updateMember
(
projectId
,
userId
,
accessLevel
.
toValue
(),
null
));
return
(
updateMember
(
projectId
OrPath
,
userId
,
accessLevel
.
toValue
(),
null
));
}
}
/**
/**
...
@@ -1304,15 +1280,15 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1304,15 +1280,15 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* PUT /projects/:projectId/members/:userId
* PUT /projects/:projectId/members/:userId
*
*
* @param projectId the project
ID
the
member belongs to, required
* @param projectId
OrPath projectIdOrPath
the project
in
the
form of an Integer(ID), String(path), or Project instance
* @param userId the user ID of the member to update, required
* @param userId the user ID of the member to update, required
* @param accessLevel the new access level for the member, required
* @param accessLevel the new access level for the member, required
* @param expiresAt the date the membership in the group will expire, optional
* @param expiresAt the date the membership in the group will expire, optional
* @return the updated member
* @return the updated member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
updateMember
(
Integer
projectId
,
Integer
userId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
public
Member
updateMember
(
Object
projectId
OrPath
,
Integer
userId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
return
(
updateMember
(
projectId
,
userId
,
accessLevel
.
toValue
(),
expiresAt
));
return
(
updateMember
(
projectId
OrPath
,
userId
,
accessLevel
.
toValue
(),
expiresAt
));
}
}
/**
/**
...
@@ -1320,18 +1296,18 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1320,18 +1296,18 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* PUT /projects/:projectId/members/:userId
* PUT /projects/:projectId/members/:userId
*
*
* @param projectId the project
ID
the
member belongs to
, required
* @param projectId
OrPath projectIdOrPath
the project
in
the
form of an Integer(ID), String(path), or Project instance
, required
* @param userId the user ID of the member to update, required
* @param userId the user ID of the member to update, required
* @param accessLevel the new access level for the member, required
* @param accessLevel the new access level for the member, required
* @param expiresAt the date the membership in the group will expire, optional
* @param expiresAt the date the membership in the group will expire, optional
* @return the updated member
* @return the updated member
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Member
updateMember
(
Integer
projectId
,
Integer
userId
,
Integer
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
public
Member
updateMember
(
Object
projectId
OrPath
,
Integer
userId
,
Integer
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"access_level"
,
accessLevel
,
true
)
.
withParam
(
"access_level"
,
accessLevel
,
true
)
.
withParam
(
"expires_at"
,
expiresAt
,
false
);
.
withParam
(
"expires_at"
,
expiresAt
,
false
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"members"
,
userId
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
,
userId
);
return
(
response
.
readEntity
(
Member
.
class
));
return
(
response
.
readEntity
(
Member
.
class
));
}
}
...
@@ -1340,13 +1316,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1340,13 +1316,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/members/:user_id
* DELETE /projects/:id/members/:user_id
*
*
* @param projectId
the project ID to remove the team member from
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param userId the user ID of the member to remove
* @param userId the user ID of the member to remove
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
removeMember
(
Integer
projectId
,
Integer
userId
)
throws
GitLabApiException
{
public
void
removeMember
(
Object
projectId
OrPath
,
Integer
userId
)
throws
GitLabApiException
{
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
delete
(
expectedStatus
,
null
,
"projects"
,
projectId
,
"members"
,
userId
);
delete
(
expectedStatus
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"members"
,
userId
);
}
}
/**
/**
...
@@ -1354,12 +1330,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1354,12 +1330,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/users
* GET /projects/:id/users
*
*
* @param projectId
the project ID to get users for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return the users belonging to the specified project and its parent groups
* @return the users belonging to the specified project and its parent groups
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
ProjectUser
>
getProjectUsers
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
ProjectUser
>
getProjectUsers
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"users"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"users"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectUser
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectUser
>>()
{}));
}
}
...
@@ -1368,16 +1344,16 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1368,16 +1344,16 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/users
* GET /projects/:id/users
*
*
* @param projectId
the project ID to get users for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param search the string to match specific users
* @param search the string to match specific users
* @return the users matching the search string and belonging to the specified project and its parent groups
* @return the users matching the search string and belonging to the specified project and its parent groups
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
ProjectUser
>
getProjectUsers
(
Integer
projectId
,
String
search
)
throws
GitLabApiException
{
public
List
<
ProjectUser
>
getProjectUsers
(
Object
projectId
OrPath
,
String
search
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"search"
,
search
)
.
withParam
(
"search"
,
search
)
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"users"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"users"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectUser
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectUser
>>()
{}));
}
}
...
@@ -1386,12 +1362,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1386,12 +1362,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/events
* GET /projects/:id/events
*
*
* @param projectId
the project ID to get events for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return the project events for the specified project
* @return the project events for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Event
>
getProjectEvents
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Event
>
getProjectEvents
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"events"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"events"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
}
}
...
@@ -1400,14 +1376,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1400,14 +1376,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/events
* GET /projects/:id/events
*
*
* @param projectId
the project ID to get events for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param page the page to get
* @param page the page to get
* @param perPage the number of Event instances per page
* @param perPage the number of Event instances per page
* @return the project events for the specified project
* @return the project events for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Event
>
getProjectEvents
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Event
>
getProjectEvents
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"events"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"events"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Event
>>()
{}));
}
}
...
@@ -1416,13 +1392,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1416,13 +1392,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/events
* GET /projects/:id/events
*
*
* @param projectId
the project ID to get events for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param itemsPerPage the number of Project instances that will be fetched per page
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return a Pager of project events for the specified project
* @return a Pager of project events for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
Event
>
getProjectEvents
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Event
>
getProjectEvents
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Event
>(
this
,
Event
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"events"
));
return
(
new
Pager
<
Event
>(
this
,
Event
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"events"
));
}
}
/**
/**
...
@@ -1430,12 +1406,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1430,12 +1406,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/hooks
* GET /projects/:id/hooks
*
*
* @param projectId
the project ID to get project hooks for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return a list of project hooks for the specified project
* @return a list of project hooks for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
ProjectHook
>
getHooks
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
ProjectHook
>
getHooks
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"hooks"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectHook
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectHook
>>()
{}));
}
}
...
@@ -1444,14 +1420,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1444,14 +1420,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/hooks
* GET /projects/:id/hooks
*
*
* @param projectId
the project ID to get project hooks for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param page the page to get
* @param page the page to get
* @param perPage the number of ProjectHook instances per page
* @param perPage the number of ProjectHook instances per page
* @return a list of project hooks for the specified project in the specified page range
* @return a list of project hooks for the specified project in the specified page range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
ProjectHook
>
getHooks
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
ProjectHook
>
getHooks
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"hooks"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectHook
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
ProjectHook
>>()
{}));
}
}
...
@@ -1460,13 +1436,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1460,13 +1436,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/hooks
* GET /projects/:id/hooks
*
*
* @param projectId
the project ID to get project hooks for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param itemsPerPage the number of Project instances that will be fetched per page
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return a Pager of project hooks for the specified project
* @return a Pager of project hooks for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
ProjectHook
>
getHooks
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
ProjectHook
>
getHooks
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
ProjectHook
>(
this
,
ProjectHook
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"hooks"
));
return
(
new
Pager
<
ProjectHook
>(
this
,
ProjectHook
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
));
}
}
/**
/**
...
@@ -1474,13 +1450,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1474,13 +1450,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/hooks/:hook_id
* GET /projects/:id/hooks/:hook_id
*
*
* @param projectId
the project ID to get the hook for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param hookId the ID of the hook to get
* @param hookId the ID of the hook to get
* @return the project hook for the specified project ID/hook ID pair
* @return the project hook for the specified project ID/hook ID pair
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
ProjectHook
getHook
(
Integer
projectId
,
Integer
hookId
)
throws
GitLabApiException
{
public
ProjectHook
getHook
(
Object
projectId
OrPath
,
Integer
hookId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"hooks"
,
hookId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
,
hookId
);
return
(
response
.
readEntity
(
ProjectHook
.
class
));
return
(
response
.
readEntity
(
ProjectHook
.
class
));
}
}
...
@@ -1489,13 +1465,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1489,13 +1465,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/hooks/:hook_id
* GET /projects/:id/hooks/:hook_id
*
*
* @param projectId
the project ID to get the hook for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param hookId the ID of the hook to get
* @param hookId the ID of the hook to get
* @return the project hook for the specified project ID/hook ID pair as an Optional instance
* @return the project hook for the specified project ID/hook ID pair as an Optional instance
*/
*/
public
Optional
<
ProjectHook
>
getOptionalHook
(
Integer
projectId
,
Integer
hookId
)
{
public
Optional
<
ProjectHook
>
getOptionalHook
(
Object
projectId
OrPath
,
Integer
hookId
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getHook
(
projectId
,
hookId
)));
return
(
Optional
.
ofNullable
(
getHook
(
projectId
OrPath
,
hookId
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -1514,7 +1490,8 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1514,7 +1490,8 @@ public class ProjectApi extends AbstractApi implements Constants {
* @return the added ProjectHook instance
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
ProjectHook
addHook
(
String
projectName
,
String
url
,
ProjectHook
enabledHooks
,
boolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
public
ProjectHook
addHook
(
String
projectName
,
String
url
,
ProjectHook
enabledHooks
,
boolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
if
(
projectName
==
null
)
{
if
(
projectName
==
null
)
{
return
(
null
);
return
(
null
);
...
@@ -1541,7 +1518,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1541,7 +1518,7 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/hooks
* POST /projects/:id/hooks
*
*
* @param projectId
the project ID to add the project hook to
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param url the callback URL for the hook
* @param url the callback URL for the hook
* @param enabledHooks a ProjectHook instance specifying which hooks to enable
* @param enabledHooks a ProjectHook instance specifying which hooks to enable
* @param enableSslVerification enable SSL verification
* @param enableSslVerification enable SSL verification
...
@@ -1549,11 +1526,8 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1549,11 +1526,8 @@ public class ProjectApi extends AbstractApi implements Constants {
* @return the added ProjectHook instance
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
ProjectHook
addHook
(
Integer
projectId
,
String
url
,
ProjectHook
enabledHooks
,
boolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
public
ProjectHook
addHook
(
Object
projectIdOrPath
,
String
url
,
ProjectHook
enabledHooks
,
boolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
if
(
projectId
==
null
)
{
return
(
null
);
}
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"url"
,
url
,
true
)
.
withParam
(
"url"
,
url
,
true
)
...
@@ -1567,7 +1541,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1567,7 +1541,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"wiki_events"
,
enabledHooks
.
getWikiPageEvents
(),
false
)
.
withParam
(
"wiki_events"
,
enabledHooks
.
getWikiPageEvents
(),
false
)
.
withParam
(
"enable_ssl_verification"
,
enabledHooks
.
getEnableSslVerification
())
.
withParam
(
"enable_ssl_verification"
,
enabledHooks
.
getEnableSslVerification
())
.
withParam
(
"token"
,
secretToken
,
false
);
.
withParam
(
"token"
,
secretToken
,
false
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"hooks"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
);
return
(
response
.
readEntity
(
ProjectHook
.
class
));
return
(
response
.
readEntity
(
ProjectHook
.
class
));
}
}
...
@@ -1576,51 +1550,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1576,51 +1550,7 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/hooks
* POST /projects/:id/hooks
*
*
* @param project the Project instance to add the project hook to
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param url the callback URL for the hook
* @param enabledHooks a ProjectHook instance specifying which hooks to enable
* @param enableSslVerification enable SSL verification
* @param secretToken the secret token to pass back to the hook
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
*/
public
ProjectHook
addHook
(
Project
project
,
String
url
,
ProjectHook
enabledHooks
,
boolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
if
(
project
==
null
)
{
return
(
null
);
}
return
(
addHook
(
project
.
getId
(),
url
,
enabledHooks
,
enableSslVerification
,
secretToken
));
}
/**
* Adds a hook to project.
*
* POST /projects/:id/hooks
*
* @param project the Project instance to add the project hook to
* @param url the callback URL for the hook
* @param doPushEvents flag specifying whether to do push events
* @param doIssuesEvents flag specifying whether to do issues events
* @param doMergeRequestsEvents flag specifying whether to do merge requests events
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
*/
public
ProjectHook
addHook
(
Project
project
,
String
url
,
boolean
doPushEvents
,
boolean
doIssuesEvents
,
boolean
doMergeRequestsEvents
)
throws
GitLabApiException
{
if
(
project
==
null
)
{
return
(
null
);
}
return
(
addHook
(
project
.
getId
(),
url
,
doPushEvents
,
doIssuesEvents
,
doMergeRequestsEvents
));
}
/**
* Adds a hook to project.
*
* POST /projects/:id/hooks
*
* @param projectId the project ID to add the project hook to
* @param url the callback URL for the hook
* @param url the callback URL for the hook
* @param doPushEvents flag specifying whether to do push events
* @param doPushEvents flag specifying whether to do push events
* @param doIssuesEvents flag specifying whether to do issues events
* @param doIssuesEvents flag specifying whether to do issues events
...
@@ -1628,7 +1558,8 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1628,7 +1558,8 @@ public class ProjectApi extends AbstractApi implements Constants {
* @return the added ProjectHook instance
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
ProjectHook
addHook
(
Integer
projectId
,
String
url
,
boolean
doPushEvents
,
boolean
doIssuesEvents
,
boolean
doMergeRequestsEvents
)
throws
GitLabApiException
{
public
ProjectHook
addHook
(
Object
projectIdOrPath
,
String
url
,
boolean
doPushEvents
,
boolean
doIssuesEvents
,
boolean
doMergeRequestsEvents
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"url"
,
url
)
.
withParam
(
"url"
,
url
)
...
@@ -1636,7 +1567,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1636,7 +1567,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"issues_enabled"
,
doIssuesEvents
)
.
withParam
(
"issues_enabled"
,
doIssuesEvents
)
.
withParam
(
"merge_requests_events"
,
doMergeRequestsEvents
);
.
withParam
(
"merge_requests_events"
,
doMergeRequestsEvents
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"hooks"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
);
return
(
response
.
readEntity
(
ProjectHook
.
class
));
return
(
response
.
readEntity
(
ProjectHook
.
class
));
}
}
...
@@ -1645,13 +1576,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1645,13 +1576,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/hooks/:hook_id
* DELETE /projects/:id/hooks/:hook_id
*
*
* @param projectId
th
e
project
ID to delete the project hook from
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param hookId the project hook ID to delete
* @param hookId the project hook ID to delete
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
deleteHook
(
Integer
projectId
,
Integer
hookId
)
throws
GitLabApiException
{
public
void
deleteHook
(
Object
projectId
OrPath
,
Integer
hookId
)
throws
GitLabApiException
{
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
delete
(
expectedStatus
,
null
,
"projects"
,
projectId
,
"hooks"
,
hookId
);
delete
(
expectedStatus
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"hooks"
,
hookId
);
}
}
/**
/**
...
@@ -1699,13 +1630,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1699,13 +1630,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/issues
* GET /projects/:id/issues
*
*
* @param projectId
the project ID to get the issues for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return a list of project's issues
* @return a list of project's issues
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer)}
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer)}
*/
*/
public
List
<
Issue
>
getIssues
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Issue
>
getIssues
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"issues"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Issue
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Issue
>>()
{}));
}
}
...
@@ -1714,15 +1645,15 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1714,15 +1645,15 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/issues
* GET /projects/:id/issues
*
*
* @param projectId
the project ID to get the issues for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param page the page to get
* @param page the page to get
* @param perPage the number of issues per page
* @param perPage the number of issues per page
* @return the list of issues in the specified range
* @return the list of issues in the specified range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int, int)}
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int, int)}
*/
*/
public
List
<
Issue
>
getIssues
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Issue
>
getIssues
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"issues"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"issues"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Issue
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Issue
>>()
{}));
}
}
...
@@ -1731,14 +1662,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1731,14 +1662,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/issues
* GET /projects/:id/issues
*
*
* @param projectId
the project ID to get the issues for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param itemsPerPage the number of issues per page
* @param itemsPerPage the number of issues per page
* @return the list of issues in the specified range
* @return the list of issues in the specified range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int)}
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssues(Integer, int)}
*/
*/
public
Pager
<
Issue
>
getIssues
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Issue
>
getIssues
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Issue
>(
this
,
Issue
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"issues"
));
return
(
new
Pager
<
Issue
>(
this
,
Issue
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"issues"
));
}
}
/**
/**
...
@@ -1746,14 +1677,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1746,14 +1677,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/issues/:issue_iid
* GET /projects/:id/issues/:issue_iid
*
*
* @param projectId
the project ID to get the issue for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param issueId the internal ID of a project's issue
* @param issueId the internal ID of a project's issue
* @return the specified Issue instance
* @return the specified Issue instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssue(Integer, Integer)}
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#getIssue(Integer, Integer)}
*/
*/
public
Issue
getIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
public
Issue
getIssue
(
Object
projectId
OrPath
,
Integer
issueId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
,
issueId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"issues"
,
issueId
);
return
(
response
.
readEntity
(
Issue
.
class
));
return
(
response
.
readEntity
(
Issue
.
class
));
}
}
...
@@ -1762,14 +1693,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1762,14 +1693,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/issues/:issue_iid
* DELETE /projects/:id/issues/:issue_iid
*
*
* @param projectId
the project ID to delete the issue from
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param issueId the internal ID of a project's issue
* @param issueId the internal ID of a project's issue
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#deleteIssue(Integer, Integer)}
* @deprecated Will be removed in version 5.0, replaced by {@link IssuesApi#deleteIssue(Integer, Integer)}
*/
*/
public
void
deleteIssue
(
Integer
projectId
,
Integer
issueId
)
throws
GitLabApiException
{
public
void
deleteIssue
(
Object
projectId
OrPath
,
Integer
issueId
)
throws
GitLabApiException
{
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
delete
(
expectedStatus
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"issues"
,
issueId
);
delete
(
expectedStatus
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"issues"
,
issueId
);
}
}
/**
/**
...
@@ -1777,12 +1708,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1777,12 +1708,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets
* GET /projects/:id/snippets
*
*
* @param projectId
th
e
project
ID to get the snippets for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return a list of project's snippets
* @return a list of project's snippets
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Snippet
>
getSnippets
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Snippet
>
getSnippets
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
return
(
getSnippets
(
projectId
,
1
,
this
.
getDefaultPerPage
()));
return
(
getSnippets
(
projectId
OrPath
,
1
,
this
.
getDefaultPerPage
()));
}
}
/**
/**
...
@@ -1790,14 +1721,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1790,14 +1721,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets
* GET /projects/:id/snippets
*
*
* @param projectId
th
e
project
ID to get the snippets for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param page the page to get
* @param page the page to get
* @param perPage the number of snippets per page
* @param perPage the number of snippets per page
* @return a list of project's snippets for the specified range
* @return a list of project's snippets for the specified range
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Snippet
>
getSnippets
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Snippet
>
getSnippets
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"snippets"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Snippet
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Snippet
>>()
{}));
}
}
...
@@ -1806,13 +1737,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1806,13 +1737,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets
* GET /projects/:id/snippets
*
*
* @param projectId
the project ID to get the issues for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param itemsPerPage the number of snippets per page
* @param itemsPerPage the number of snippets per page
* @return the Pager of snippets
* @return the Pager of snippets
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
Snippet
>
getSnippets
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Snippet
>
getSnippets
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Snippet
>(
this
,
Snippet
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"snippets"
));
return
(
new
Pager
<
Snippet
>(
this
,
Snippet
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
OrPath
,
"snippets"
));
}
}
/**
/**
...
@@ -1820,13 +1751,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1820,13 +1751,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets/:snippet_id
* GET /projects/:id/snippets/:snippet_id
*
*
* @param projectId
the project ID to get the snippet for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param snippetId the ID of the project's snippet
* @param snippetId the ID of the project's snippet
* @return the specified project Snippet
* @return the specified project Snippet
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Snippet
getSnippet
(
Integer
projectId
,
Integer
snippetId
)
throws
GitLabApiException
{
public
Snippet
getSnippet
(
Object
projectId
OrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"snippets"
,
snippetId
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
,
snippetId
);
return
(
response
.
readEntity
(
Snippet
.
class
));
return
(
response
.
readEntity
(
Snippet
.
class
));
}
}
...
@@ -1835,13 +1766,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1835,13 +1766,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets/:snippet_id
* GET /projects/:id/snippets/:snippet_id
*
*
* @param projectId
the project ID to get the snippet for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param snippetId the ID of the project's snippet
* @param snippetId the ID of the project's snippet
* @return the specified project Snippet as an Optional instance
* @return the specified project Snippet as an Optional instance
*/
*/
public
Optional
<
Snippet
>
getOptionalSnippet
(
Integer
projectId
,
Integer
snippetId
)
{
public
Optional
<
Snippet
>
getOptionalSnippet
(
Object
projectId
OrPath
,
Integer
snippetId
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getSnippet
(
projectId
,
snippetId
)));
return
(
Optional
.
ofNullable
(
getSnippet
(
projectId
OrPath
,
snippetId
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -1852,7 +1783,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1852,7 +1783,7 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/snippets
* POST /projects/:id/snippets
*
*
* @param projectId
the ID of the project owned by the authenticated user
, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
, required
* @param title the title of a snippet, required
* @param title the title of a snippet, required
* @param filename the name of a snippet file, required
* @param filename the name of a snippet file, required
* @param description the description of a snippet, optional
* @param description the description of a snippet, optional
...
@@ -1861,7 +1792,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1861,7 +1792,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @return a Snippet instance with info on the created snippet
* @return a Snippet instance with info on the created snippet
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Snippet
createSnippet
(
Integer
projectId
,
String
title
,
String
filename
,
String
description
,
public
Snippet
createSnippet
(
Object
projectId
OrPath
,
String
title
,
String
filename
,
String
description
,
String
code
,
Visibility
visibility
)
throws
GitLabApiException
{
String
code
,
Visibility
visibility
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
...
@@ -1871,7 +1802,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1871,7 +1802,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"code"
,
code
,
true
)
.
withParam
(
"code"
,
code
,
true
)
.
withParam
(
"visibility"
,
visibility
,
true
);
.
withParam
(
"visibility"
,
visibility
,
true
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"snippets"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
);
return
(
response
.
readEntity
(
Snippet
.
class
));
return
(
response
.
readEntity
(
Snippet
.
class
));
}
}
...
@@ -1880,7 +1811,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1880,7 +1811,7 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* PUT /projects/:id/snippets/:snippet_id
* PUT /projects/:id/snippets/:snippet_id
*
*
* @param projectId
the ID of the project owned by the authenticated user
, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
, required
* @param snippetId the ID of a project's snippet, required
* @param snippetId the ID of a project's snippet, required
* @param title the title of a snippet, optional
* @param title the title of a snippet, optional
* @param filename the name of a snippet file, optional
* @param filename the name of a snippet file, optional
...
@@ -1890,7 +1821,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1890,7 +1821,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @return a Snippet instance with info on the updated snippet
* @return a Snippet instance with info on the updated snippet
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Snippet
updateSnippet
(
Integer
projectId
,
Integer
snippetId
,
String
title
,
String
filename
,
String
description
,
public
Snippet
updateSnippet
(
Object
projectId
OrPath
,
Integer
snippetId
,
String
title
,
String
filename
,
String
description
,
String
code
,
Visibility
visibility
)
throws
GitLabApiException
{
String
code
,
Visibility
visibility
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
...
@@ -1900,7 +1831,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1900,7 +1831,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"code"
,
code
)
.
withParam
(
"code"
,
code
)
.
withParam
(
"visibility"
,
visibility
);
.
withParam
(
"visibility"
,
visibility
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"snippets"
,
snippetId
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
,
snippetId
);
return
(
response
.
readEntity
(
Snippet
.
class
));
return
(
response
.
readEntity
(
Snippet
.
class
));
}
}
...
@@ -1910,12 +1841,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1910,12 +1841,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/snippets/:snippet_id
* DELETE /projects/:id/snippets/:snippet_id
*
*
* @param projectId
the project ID of the snippet
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param snippetId the ID of the project's snippet
* @param snippetId the ID of the project's snippet
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
deleteSnippet
(
Integer
projectId
,
Integer
snippetId
)
throws
GitLabApiException
{
public
void
deleteSnippet
(
Object
projectId
OrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
delete
(
Response
.
Status
.
NO_CONTENT
,
null
,
"projects"
,
projectId
,
"snippets"
,
snippetId
);
delete
(
Response
.
Status
.
NO_CONTENT
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
,
snippetId
);
}
}
/**
/**
...
@@ -1923,13 +1854,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1923,13 +1854,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets/:snippet_id/raw
* GET /projects/:id/snippets/:snippet_id/raw
*
*
* @param projectId
the project ID of the snippet
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param snippetId the ID of the project's snippet
* @param snippetId the ID of the project's snippet
* @return the raw project snippet plain text as an Optional instance
* @return the raw project snippet plain text as an Optional instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
String
getRawSnippetContent
(
Integer
projectId
,
Integer
snippetId
)
throws
GitLabApiException
{
public
String
getRawSnippetContent
(
Object
projectId
OrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"snippets"
,
snippetId
,
"raw"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"snippets"
,
snippetId
,
"raw"
);
return
(
response
.
readEntity
(
String
.
class
));
return
(
response
.
readEntity
(
String
.
class
));
}
}
...
@@ -1938,13 +1869,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1938,13 +1869,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/snippets/:snippet_id/raw
* GET /projects/:id/snippets/:snippet_id/raw
*
*
* @param projectId
the project ID of the snippet
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param snippetId the ID of the project's snippet
* @param snippetId the ID of the project's snippet
* @return the raw project snippet plain text as an Optional instance
* @return the raw project snippet plain text as an Optional instance
*/
*/
public
Optional
<
String
>
getOptionalRawSnippetContent
(
Integer
projectId
,
Integer
snippetId
)
{
public
Optional
<
String
>
getOptionalRawSnippetContent
(
Object
projectId
OrPath
,
Integer
snippetId
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getRawSnippetContent
(
projectId
,
snippetId
)));
return
(
Optional
.
ofNullable
(
getRawSnippetContent
(
projectId
OrPath
,
snippetId
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -1955,19 +1886,19 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1955,19 +1886,19 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/share
* POST /projects/:id/share
*
*
* @param projectId
the ID of the project to shar
e, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instanc
e, required
* @param groupId the ID of the group to share with, required
* @param groupId the ID of the group to share with, required
* @param accessLevel the permissions level to grant the group, required
* @param accessLevel the permissions level to grant the group, required
* @param expiresAt the share expiration date, optional
* @param expiresAt the share expiration date, optional
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
shareProject
(
Integer
projectId
,
Integer
groupId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
public
void
shareProject
(
Object
projectId
OrPath
,
Integer
groupId
,
AccessLevel
accessLevel
,
Date
expiresAt
)
throws
GitLabApiException
{
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"group_id"
,
groupId
,
true
)
.
withParam
(
"group_id"
,
groupId
,
true
)
.
withParam
(
"group_access"
,
accessLevel
,
true
)
.
withParam
(
"group_access"
,
accessLevel
,
true
)
.
withParam
(
"expires_at"
,
expiresAt
);
.
withParam
(
"expires_at"
,
expiresAt
);
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"share"
);
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"share"
);
}
}
/**
/**
...
@@ -1975,13 +1906,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1975,13 +1906,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/share/:group_id
* DELETE /projects/:id/share/:group_id
*
*
* @param projectId
the ID of the project to unshar
e, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instanc
e, required
* @param groupId the ID of the group to unshare, required
* @param groupId the ID of the group to unshare, required
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
unshareProject
(
Integer
projectId
,
Integer
groupId
)
throws
GitLabApiException
{
public
void
unshareProject
(
Object
projectId
OrPath
,
Integer
groupId
)
throws
GitLabApiException
{
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
delete
(
expectedStatus
,
null
,
"projects"
,
projectId
,
"share"
,
groupId
);
delete
(
expectedStatus
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"share"
,
groupId
);
}
}
/**
/**
...
@@ -1989,13 +1920,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -1989,13 +1920,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/archive
* POST /projects/:id/archive
*
*
* @param projectId
the ID of the project to archiv
e, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instanc
e, required
* @return the archived GitLab Project
* @return the archived GitLab Project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
archiveProject
(
Integer
projectId
)
public
Project
archiveProject
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
throws
GitLabApiException
{
Response
response
=
post
(
Response
.
Status
.
CREATED
,
(
new
GitLabApiForm
()),
"projects"
,
projectId
,
"archive"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
(
new
GitLabApiForm
()),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"archive"
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
@@ -2004,13 +1935,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2004,13 +1935,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/unarchive
* POST /projects/:id/unarchive
*
*
* @param projectId
the ID of the project to unarchiv
e, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instanc
e, required
* @return the unarchived GitLab Project
* @return the unarchived GitLab Project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Project
unarchiveProject
(
Integer
projectId
)
public
Project
unarchiveProject
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
throws
GitLabApiException
{
Response
response
=
post
(
Response
.
Status
.
CREATED
,
(
new
GitLabApiForm
()),
"projects"
,
projectId
,
"unarchive"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
(
new
GitLabApiForm
()),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"unarchive"
);
return
(
response
.
readEntity
(
Project
.
class
));
return
(
response
.
readEntity
(
Project
.
class
));
}
}
...
@@ -2019,13 +1950,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2019,13 +1950,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/uploads
* POST /projects/:id/uploads
*
*
* @param projectId
the ID of the project to upload the file to
, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
, required
* @param fileToUpload the File instance of the file to upload, required
* @param fileToUpload the File instance of the file to upload, required
* @return a FileUpload instance with information on the just uploaded file
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
FileUpload
uploadFile
(
Integer
projectId
,
File
fileToUpload
)
throws
GitLabApiException
{
public
FileUpload
uploadFile
(
Object
projectId
OrPath
,
File
fileToUpload
)
throws
GitLabApiException
{
return
(
uploadFile
(
projectId
,
fileToUpload
,
null
));
return
(
uploadFile
(
projectId
OrPath
,
fileToUpload
,
null
));
}
}
/**
/**
...
@@ -2033,14 +1964,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2033,14 +1964,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* POST /projects/:id/uploads
* POST /projects/:id/uploads
*
*
* @param projectId
the ID of the project to upload the file to
, required
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
, required
* @param fileToUpload the File instance of the file to upload, required
* @param fileToUpload the File instance of the file to upload, required
* @param mediaType the media type of the file to upload, optional
* @param mediaType the media type of the file to upload, optional
* @return a FileUpload instance with information on the just uploaded file
* @return a FileUpload instance with information on the just uploaded file
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
FileUpload
uploadFile
(
Integer
projectId
,
File
fileToUpload
,
String
mediaType
)
throws
GitLabApiException
{
public
FileUpload
uploadFile
(
Object
projectId
OrPath
,
File
fileToUpload
,
String
mediaType
)
throws
GitLabApiException
{
Response
response
=
upload
(
Response
.
Status
.
CREATED
,
"file"
,
fileToUpload
,
mediaType
,
"projects"
,
projectId
,
"uploads"
);
Response
response
=
upload
(
Response
.
Status
.
CREATED
,
"file"
,
fileToUpload
,
mediaType
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"uploads"
);
return
(
response
.
readEntity
(
FileUpload
.
class
));
return
(
response
.
readEntity
(
FileUpload
.
class
));
}
}
...
@@ -2049,12 +1980,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2049,12 +1980,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/push_rule
* GET /projects/:id/push_rule
*
*
* @param projectId
th
e
project
ID to get the push rules for
* @param projectId
OrPa
th project
IdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return the push rules for the specified project
* @return the push rules for the specified project
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
PushRules
getPushRules
(
Integer
projectId
)
throws
GitLabApiException
{
public
PushRules
getPushRules
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"push_rule"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"push_rule"
);
return
(
response
.
readEntity
(
PushRules
.
class
));
return
(
response
.
readEntity
(
PushRules
.
class
));
}
}
...
@@ -2076,17 +2007,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2076,17 +2007,12 @@ public class ProjectApi extends AbstractApi implements Constants {
* maxFileSize (optional) - Maximum file size (MB
* maxFileSize (optional) - Maximum file size (MB
*</code>
*</code>
*
*
* @param projectId
the project ID to add the push rule to
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param pushRule the PushRule instance containing the push rule configuration to add
* @param pushRule the PushRule instance containing the push rule configuration to add
* @return a PushRules instance with the newly created push rule info
* @return a PushRules instance with the newly created push rule info
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
PushRules
createPushRules
(
Integer
projectId
,
PushRules
pushRule
)
throws
GitLabApiException
{
public
PushRules
createPushRules
(
Object
projectIdOrPath
,
PushRules
pushRule
)
throws
GitLabApiException
{
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"deny_delete_tag"
,
pushRule
.
getDenyDeleteTag
())
.
withParam
(
"deny_delete_tag"
,
pushRule
.
getDenyDeleteTag
())
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
...
@@ -2097,7 +2023,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2097,7 +2023,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
.
withParam
(
"max_file_size"
,
pushRule
.
getMaxFileSize
());
.
withParam
(
"max_file_size"
,
pushRule
.
getMaxFileSize
());
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"push_rule"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"push_rule"
);
return
(
response
.
readEntity
(
PushRules
.
class
));
return
(
response
.
readEntity
(
PushRules
.
class
));
}
}
...
@@ -2119,17 +2045,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2119,17 +2045,12 @@ public class ProjectApi extends AbstractApi implements Constants {
* maxFileSize (optional) - Maximum file size (MB
* maxFileSize (optional) - Maximum file size (MB
*</code>
*</code>
*
*
* @param projectId
the project ID to update the push rule for
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param pushRule the PushRules instance containing the push rule configuration to update
* @param pushRule the PushRules instance containing the push rule configuration to update
* @return a PushRules instance with the newly created push rule info
* @return a PushRules instance with the newly created push rule info
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
PushRules
updatePushRules
(
Integer
projectId
,
PushRules
pushRule
)
throws
GitLabApiException
{
public
PushRules
updatePushRules
(
Object
projectIdOrPath
,
PushRules
pushRule
)
throws
GitLabApiException
{
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"deny_delete_tag"
,
pushRule
.
getDenyDeleteTag
())
.
withParam
(
"deny_delete_tag"
,
pushRule
.
getDenyDeleteTag
())
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
.
withParam
(
"member_check"
,
pushRule
.
getMemberCheck
())
...
@@ -2140,7 +2061,7 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2140,7 +2061,7 @@ public class ProjectApi extends AbstractApi implements Constants {
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
.
withParam
(
"file_name_regex"
,
pushRule
.
getFileNameRegex
())
.
withParam
(
"max_file_size"
,
pushRule
.
getMaxFileSize
());
.
withParam
(
"max_file_size"
,
pushRule
.
getMaxFileSize
());
final
Response
response
=
putWithFormData
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
projectId
,
"push_rule"
);
final
Response
response
=
putWithFormData
(
Response
.
Status
.
OK
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"push_rule"
);
return
(
response
.
readEntity
(
PushRules
.
class
));
return
(
response
.
readEntity
(
PushRules
.
class
));
}
}
...
@@ -2150,16 +2071,11 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2150,16 +2071,11 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* DELETE /projects/:id/push_rule
* DELETE /projects/:id/push_rule
*
*
* @param projectId
the project ID to delete the push rule from
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
void
deletePushRules
(
Integer
projectId
)
throws
GitLabApiException
{
public
void
deletePushRules
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
delete
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"push_rule"
);
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
delete
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"push_rule"
);
}
}
/**
/**
...
@@ -2167,12 +2083,12 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2167,12 +2083,12 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/forks
* GET /projects/:id/forks
*
*
* @param projectId
the ID of the project
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return a List of forked projects
* @return a List of forked projects
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Project
>
getForks
(
Integer
projectId
)
throws
GitLabApiException
{
public
List
<
Project
>
getForks
(
Object
projectId
OrPath
)
throws
GitLabApiException
{
return
(
getForks
(
projectId
,
1
,
getDefaultPerPage
()));
return
(
getForks
(
projectId
OrPath
,
1
,
getDefaultPerPage
()));
}
}
/**
/**
...
@@ -2180,14 +2096,14 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2180,14 +2096,14 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/forks
* GET /projects/:id/forks
*
*
* @param projectId
the ID of the project
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param page the page to get
* @param page the page to get
* @param perPage the number of projects per page
* @param perPage the number of projects per page
* @return a List of forked projects
* @return a List of forked projects
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Project
>
getForks
(
Integer
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Project
>
getForks
(
Object
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
projectId
,
"forks"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getPageQueryParams
(
page
,
perPage
),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"forks"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Project
>>()
{
}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Project
>>()
{
}));
}
}
...
@@ -2196,13 +2112,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2196,13 +2112,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* GET /projects/:id/forks
* GET /projects/:id/forks
*
*
* @param projectId
the ID of the project
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @param itemsPerPage the number of Project instances that will be fetched per page
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return a Pager of projects
* @return a Pager of projects
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
Project
>
getForks
(
Integer
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Project
>
getForks
(
Object
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
new
Pager
<
Project
>(
this
,
Project
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"forks"
);
return
new
Pager
<
Project
>(
this
,
Project
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"forks"
);
}
}
/**
/**
...
@@ -2240,18 +2156,13 @@ public class ProjectApi extends AbstractApi implements Constants {
...
@@ -2240,18 +2156,13 @@ public class ProjectApi extends AbstractApi implements Constants {
*
*
* Get /projects/:id/languages
* Get /projects/:id/languages
*
*
* @param projectId
the ID of the project
* @param projectId
OrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return a Map instance with the language as the key and the percentage as the value
* @return a Map instance with the language as the key and the percentage as the value
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
* @since GitLab 10.8
* @since GitLab 10.8
*/
*/
public
Map
<
String
,
Float
>
getProjectLanguages
(
Integer
projectId
)
throws
GitLabApiException
{
public
Map
<
String
,
Float
>
getProjectLanguages
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"languages"
);
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"languages"
);
return
(
response
.
readEntity
(
new
GenericType
<
Map
<
String
,
Float
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
Map
<
String
,
Float
>>()
{}));
}
}
}
}
\ No newline at end of file
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