Skip to content

Commit b2d92ba

Browse files
committed
Support name field in ProjectHook
Expose the GitLab project hook 'name' field (getter/setter + fluent withName), add fluent withDescription, and send the 'name' param in ProjectApi.addHook / modifyHook. Also remove a duplicated deployment_events param in addHook.
1 parent ad73110 commit b2d92ba

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

gitlab4j-api/src/main/java/org/gitlab4j/api/ProjectApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,7 @@ public ProjectHook addHook(
24972497
.withParam("repository_update_events", enabledHooks.getRepositoryUpdateEvents(), false)
24982498
.withParam("deployment_events", enabledHooks.getDeploymentEvents(), false)
24992499
.withParam("releases_events", enabledHooks.getReleasesEvents(), false)
2500-
.withParam("deployment_events", enabledHooks.getDeploymentEvents(), false)
2500+
.withParam("name", enabledHooks.getName(), false)
25012501
.withParam("description", enabledHooks.getDescription(), false)
25022502
.withParam("token", secretToken, false);
25032503
Response response =
@@ -2613,6 +2613,7 @@ public ProjectHook modifyHook(ProjectHook hook) throws GitLabApiException {
26132613
.withParam("repository_update_events", hook.getRepositoryUpdateEvents(), false)
26142614
.withParam("releases_events", hook.getReleasesEvents(), false)
26152615
.withParam("deployment_events", hook.getDeploymentEvents(), false)
2616+
.withParam("name", hook.getName(), false)
26162617
.withParam("description", hook.getDescription(), false)
26172618
.withParam("token", hook.getToken(), false);
26182619

gitlab4j-models/src/main/java/org/gitlab4j/api/models/ProjectHook.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class ProjectHook implements Serializable {
3232
private Boolean deploymentEvents;
3333
private Boolean releasesEvents;
3434

35+
private String name;
3536
private String description;
3637

3738
public Boolean getBuildEvents() {
@@ -178,6 +179,14 @@ public void setReleasesEvents(Boolean releasesEvents) {
178179
this.releasesEvents = releasesEvents;
179180
}
180181

182+
public String getName() {
183+
return name;
184+
}
185+
186+
public void setName(String name) {
187+
this.name = name;
188+
}
189+
181190
public String getDescription() {
182191
return description;
183192
}
@@ -280,6 +289,16 @@ public ProjectHook withReleasesEvents(Boolean releasesEvents) {
280289
return (this);
281290
}
282291

292+
public ProjectHook withName(String name) {
293+
this.name = name;
294+
return (this);
295+
}
296+
297+
public ProjectHook withDescription(String description) {
298+
this.description = description;
299+
return (this);
300+
}
301+
283302
@Override
284303
public String toString() {
285304
return (JacksonJson.toJsonString(this));

gitlab4j-models/src/test/resources/org/gitlab4j/models/hook.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"wiki_page_events": true,
1717
"enable_ssl_verification": true,
1818
"created_at": "2012-10-12T17:04:47Z",
19+
"name": "hook name",
1920
"description": "hook description"
2021
}

0 commit comments

Comments
 (0)