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
0a1a3cf5
Commit
0a1a3cf5
authored
May 16, 2024
by
Jeremie Bresson
Browse files
Merge remote-tracking branch 'origin/main' into 6.x
parents
38862e4d
224f4c5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
0a1a3cf5
...
...
@@ -1074,7 +1074,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* Only working with GitLab 16.9 and above.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/avatar</code></pre>
*
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @return an InputStream to read the raw file from
* @throws GitLabApiException if any exception occurs
...
...
@@ -2211,7 +2211,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @throws GitLabApiException if any exception occurs
*/
public
ProjectHook
addHook
(
Object
projectIdOrPath
,
String
url
,
ProjectHook
enabledHooks
,
b
oolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
B
oolean
enableSslVerification
,
String
secretToken
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"url"
,
url
,
true
)
...
...
@@ -2238,6 +2238,7 @@ public class ProjectApi extends AbstractApi implements Constants {
/**
* Adds a hook to project.
* Convenience method for {@link #addHook(Object, String, ProjectHook, Boolean, String)}
*
* <pre><code>GitLab Endpoint: POST /projects/:id/hooks</code></pre>
*
...
...
@@ -2251,15 +2252,32 @@ public class ProjectApi extends AbstractApi implements Constants {
*/
public
ProjectHook
addHook
(
Object
projectIdOrPath
,
String
url
,
boolean
doPushEvents
,
boolean
doIssuesEvents
,
boolean
doMergeRequestsEvents
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"url"
,
url
)
.
withParam
(
"push_events"
,
doPushEvents
)
.
withParam
(
"issues_events"
,
doIssuesEvents
)
.
withParam
(
"merge_requests_events"
,
doMergeRequestsEvents
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"hooks"
);
return
(
response
.
readEntity
(
ProjectHook
.
class
));
return
addHook
(
projectIdOrPath
,
url
,
doPushEvents
,
doIssuesEvents
,
doMergeRequestsEvents
,
null
);
}
/**
* Adds a hook to project.
* Convenience method for {@link #addHook(Object, String, ProjectHook, Boolean, String)}
*
* <pre><code>GitLab Endpoint: POST /projects/:id/hooks</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance, required
* @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
* @param doNoteEvents flag specifying whether to do note events
* @return the added ProjectHook instance
* @throws GitLabApiException if any exception occurs
*/
public
ProjectHook
addHook
(
Object
projectIdOrPath
,
String
url
,
Boolean
doPushEvents
,
Boolean
doIssuesEvents
,
Boolean
doMergeRequestsEvents
,
Boolean
doNoteEvents
)
throws
GitLabApiException
{
ProjectHook
enabledHooks
=
new
ProjectHook
()
.
withPushEvents
(
doPushEvents
)
.
withIssuesEvents
(
doIssuesEvents
)
.
withMergeRequestsEvents
(
doMergeRequestsEvents
)
.
withNoteEvents
(
doNoteEvents
);
return
addHook
(
projectIdOrPath
,
url
,
enabledHooks
,
null
,
null
);
}
/**
...
...
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