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
41182514
Commit
41182514
authored
Mar 18, 2014
by
Greg Messner
Browse files
Added getProjetc(STring group, String project).
parent
01303067
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/ProjectApi.java
View file @
41182514
package
com.messners.gitlab.api
;
package
com.messners.gitlab.api
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.List
;
import
com.messners.gitlab.api.models.Event
;
import
com.messners.gitlab.api.models.Event
;
...
@@ -72,6 +74,30 @@ public class ProjectApi extends AbstractApi {
...
@@ -72,6 +74,30 @@ public class ProjectApi extends AbstractApi {
ClientResponse
response
=
get
(
ClientResponse
.
Status
.
OK
,
null
,
"projects"
,
projectId
);
ClientResponse
response
=
get
(
ClientResponse
.
Status
.
OK
,
null
,
"projects"
,
projectId
);
return
(
response
.
getEntity
(
Project
.
class
));
return
(
response
.
getEntity
(
Project
.
class
));
}
}
/**
* Get a specific project, which is owned by the authentication user.
*
* GET /projects/:id
*
* @param group
* @param project
* @return
* @throws GitLabApiException
*/
public
Project
getProject
(
String
group
,
String
project
)
throws
GitLabApiException
{
String
pid
=
null
;
try
{
pid
=
URLEncoder
.
encode
(
group
+
"/"
+
project
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
uee
)
{
throw
(
new
GitLabApiException
(
uee
));
}
ClientResponse
response
=
get
(
ClientResponse
.
Status
.
OK
,
null
,
"projects"
,
pid
);
return
(
response
.
getEntity
(
Project
.
class
));
}
/**
/**
...
@@ -353,6 +379,33 @@ public class ProjectApi extends AbstractApi {
...
@@ -353,6 +379,33 @@ public class ProjectApi extends AbstractApi {
ClientResponse
response
=
post
(
ClientResponse
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"hooks"
);
ClientResponse
response
=
post
(
ClientResponse
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"hooks"
);
return
(
response
.
getEntity
(
ProjectHook
.
class
));
return
(
response
.
getEntity
(
ProjectHook
.
class
));
}
}
/**
* Deletes a hook from the project.
*
* DELETE /projects/:id/hooks/:hook_id
*
* @param projectId
* @param hookId
* @throws GitLabApiException
*/
public
void
deleteHook
(
Integer
projectId
,
Integer
hookId
)
throws
GitLabApiException
{
delete
(
ClientResponse
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"hooks"
,
hookId
);
}
/**
* Deletes a hook from the project.
*
* DELETE /projects/:id/hooks/:hook_id
*
* @param hook
* @throws GitLabApiException
*/
public
void
deleteHook
(
ProjectHook
hook
)
throws
GitLabApiException
{
deleteHook
(
hook
.
getProjectId
(),
hook
.
getId
());
}
/**
/**
...
...
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