|
3 | 3 | import org.gitlab4j.api.GitLabApi.ApiVersion;
|
4 | 4 | import org.gitlab4j.api.services.BugzillaService;
|
5 | 5 | import org.gitlab4j.api.services.CustomIssueTrackerService;
|
| 6 | +import org.gitlab4j.api.services.EmailOnPushService; |
6 | 7 | import org.gitlab4j.api.services.ExternalUncycloService;
|
7 | 8 | import org.gitlab4j.api.services.HipChatService;
|
8 | 9 | import org.gitlab4j.api.services.JiraService;
|
@@ -493,4 +494,60 @@ public void deleteCustomIssueTrackerService(Object projectIdOrPath) throws GitLa
|
493 | 494 | delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "services", "custom-issue-tracker");
|
494 | 495 |
|
495 | 496 | }
|
| 497 | + |
| 498 | + /** |
| 499 | + * Get Emails on push service settings for a project. |
| 500 | + * |
| 501 | + * <pre><code>GitLab Endpoint: GET /projects/:id/services/emails-on-push</code></pre> |
| 502 | + * |
| 503 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 504 | + * @return a EmailOnPushService instance holding the Email on push settings |
| 505 | + * @throws GitLabApiException if any exception occurs |
| 506 | + */ |
| 507 | + public EmailOnPushService getEmailOnPushService(Object projectIdOrPath) throws GitLabApiException { |
| 508 | + Response response = this.get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "services", "emails-on-push"); |
| 509 | + return (response.readEntity(EmailOnPushService.class)); |
| 510 | + } |
| 511 | + |
| 512 | + /** |
| 513 | + * Updates the EmailsOnPush service settings for a project. |
| 514 | + * |
| 515 | + * <pre><code>GitLab Endpoint: PUT /projects/:id/services/emails-on-push</code></pre> |
| 516 | + * |
| 517 | + * The following properties on the EmailOnPushService instance are utilized in the update of the settings: |
| 518 | + * <p> |
| 519 | + * recipients (required), Emails separated by whitespace |
| 520 | + * disable_diffs (optional), Disable code diffs |
| 521 | + * send_from_committer_email (optional), Send from committer |
| 522 | + * push_events (optional), Enable notifications for push events |
| 523 | + * tag_push_events(optional), Enable notifications for tag push events |
| 524 | + * branches_to_be_notified (optional), Branches to send notifications for. Valid options are "all", "default", |
| 525 | + * "protected", and "default_and_protected". Notifications are always fired |
| 526 | + * for tag pushes. The default value is "all" |
| 527 | + * </p> |
| 528 | + * |
| 529 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 530 | + * @param emailsOnPush the EmailOnPushService instance holding the settings |
| 531 | + * @return a EmailOnPushService instance holding the newly updated settings |
| 532 | + * @throws GitLabApiException if any exception occurs |
| 533 | + */ |
| 534 | + public EmailOnPushService updateEmailOnPushService(Object projectIdOrPath, EmailOnPushService emailsOnPush) throws GitLabApiException { |
| 535 | + GitLabApiForm formData = emailsOnPush.servicePropertiesForm(); |
| 536 | + Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "emails-on-push"); |
| 537 | + return (response.readEntity(EmailOnPushService.class)); |
| 538 | + } |
| 539 | + |
| 540 | + /** |
| 541 | + * Deletes the Emails on push service for a project. |
| 542 | + * |
| 543 | + * <pre><code>GitLab Endpoint: DELETE /projects/:id/services/emails-on-push</code></pre> |
| 544 | + * |
| 545 | + * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path |
| 546 | + * @throws GitLabApiException if any exception occurs |
| 547 | + */ |
| 548 | + public void deleteEmailonPushService(Object projectIdOrPath) throws GitLabApiException { |
| 549 | + delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "services", "emails-on-push"); |
| 550 | + |
| 551 | + } |
| 552 | + |
496 | 553 | }
|
0 commit comments