Skip to content

Commit 2334923

Browse files
committed
Initial commit (#176).
1 parent 782a372 commit 2334923

File tree

2 files changed

+295
-0
lines changed

2 files changed

+295
-0
lines changed
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
package org.gitlab4j.api.services;
2+
3+
import javax.xml.bind.annotation.XmlAccessType;
4+
import javax.xml.bind.annotation.XmlAccessorType;
5+
import javax.xml.bind.annotation.XmlRootElement;
6+
7+
import com.fasterxml.jackson.annotation.JsonIgnore;
8+
9+
@XmlRootElement
10+
@XmlAccessorType(XmlAccessType.FIELD)
11+
public class SlackService extends NotificationService {
12+
13+
public static final String WEBHOOK_PROP = "webhook";
14+
public static final String USERNAME_PROP = "username";
15+
public static final String NOTIFY_ONLY_BROKEN_PIPELINES_PROP = "notify_only_broken_pipelines";
16+
public static final String NOTIFY_ONLY_DEFAULT_BRANCH_PROP = "notify_only_default_branch";
17+
public static final String PUSH_CHANNEL_PROP = "push_channel";
18+
public static final String ISSUE_CHANNEL_PROP = "issue_channel";
19+
public static final String CONFIDENTIAL_ISSUE_CHANNEL_PROP = "confidential_issue_channel";
20+
public static final String MERGE_REQUEST_CHANNEL_PROP = "merge_request_channel";
21+
public static final String NOTE_CHANNEL_PROP = "note_channel";
22+
public static final String CONFIDENTIAL_NOTE_CHANNEL_PROP = "confidential_note_channel";
23+
public static final String TAG_PUSH_CHANNEL_PROP = "tag_push_channel";
24+
public static final String PIPELINE_CHANNEL_PROP = "pipeline_channel";
25+
public static final String WIKI_PAGE_CHANNEL_PROP = "wiki_page_channel";
26+
27+
private String defaultChannel;
28+
29+
public SlackService withPushEvents(Boolean pushEvents) {
30+
return withPushEvents(pushEvents, this);
31+
}
32+
33+
public SlackService withIssuesEvents(Boolean issuesEvents) {
34+
return withIssuesEvents(issuesEvents, this);
35+
}
36+
37+
public SlackService withConfidentialIssuesEvents(Boolean confidentialIssuesEvents) {
38+
return withConfidentialIssuesEvents(confidentialIssuesEvents, this);
39+
}
40+
41+
public SlackService withMergeRequestsEvents(Boolean mergeRequestsEvents) {
42+
return withMergeRequestsEvents(mergeRequestsEvents, this);
43+
}
44+
45+
public SlackService withTagPushEvents(Boolean tagPushEvents) {
46+
return withTagPushEvents(tagPushEvents, this);
47+
}
48+
49+
public SlackService withNoteEvents(Boolean noteEvents) {
50+
return withNoteEvents(noteEvents, this);
51+
}
52+
53+
public SlackService withConfidentialNoteEvents(Boolean confidentialNoteEvents) {
54+
return withConfidentialNoteEvents(confidentialNoteEvents, this);
55+
}
56+
57+
public SlackService withPipelineEvents(Boolean pipelineEvents) {
58+
return withPipelineEvents(pipelineEvents, this);
59+
}
60+
61+
public SlackService withWikiPageEvents(Boolean wikiPageEvents) {
62+
return withWikiPageEvents(wikiPageEvents, this);
63+
}
64+
65+
public SlackService withJobEvents(Boolean jobEvents) {
66+
return withPipelineEvents(jobEvents, this);
67+
}
68+
69+
@JsonIgnore
70+
public String getWebhook() {
71+
return ((String) getProperty(WEBHOOK_PROP));
72+
}
73+
74+
public void setWebhook(String webhook) {
75+
setProperty(WEBHOOK_PROP, webhook);
76+
}
77+
78+
public SlackService withWebhook(String webhook) {
79+
setWebhook(webhook);
80+
return (this);
81+
}
82+
83+
@JsonIgnore
84+
public String getUsername() {
85+
return ((String) getProperty(USERNAME_PROP));
86+
}
87+
88+
public void setUsername(String username) {
89+
setProperty(USERNAME_PROP, username);
90+
}
91+
92+
public SlackService withUsername(String username) {
93+
setUsername(username);
94+
return (this);
95+
}
96+
97+
@JsonIgnore
98+
public String getDefaultChannel() {
99+
return (defaultChannel);
100+
}
101+
102+
public void setDefaultChannel(String defaultChannel) {
103+
this.defaultChannel = defaultChannel;
104+
}
105+
106+
public SlackService withDefaultChannelk(String defaultChannel) {
107+
this.defaultChannel = defaultChannel;
108+
return (this);
109+
}
110+
111+
@JsonIgnore
112+
public Boolean getNotifyOnlyBrokenPipelines() {
113+
return ((Boolean) getProperty(NOTIFY_ONLY_BROKEN_PIPELINES_PROP, Boolean.FALSE));
114+
}
115+
116+
public void setNotifyOnlyBrokenPipelines(Boolean notifyOnlyBrokenPipelines) {
117+
setProperty(NOTIFY_ONLY_BROKEN_PIPELINES_PROP, notifyOnlyBrokenPipelines);
118+
}
119+
120+
public SlackService withNotifyOnlyBrokenPipelines(Boolean notifyOnlyBrokenPipelines) {
121+
setNotifyOnlyBrokenPipelines(notifyOnlyBrokenPipelines);
122+
return (this);
123+
}
124+
125+
@JsonIgnore
126+
public Boolean getNotifyOnlyDefaultBranch() {
127+
return ((Boolean) getProperty(NOTIFY_ONLY_DEFAULT_BRANCH_PROP, Boolean.FALSE));
128+
}
129+
130+
public void setNotifyOnlyDefaultBranch(Boolean notifyOnlyDefaultBranch) {
131+
setProperty(NOTIFY_ONLY_DEFAULT_BRANCH_PROP, notifyOnlyDefaultBranch);
132+
}
133+
134+
public SlackService withNotifyOnlyDefaultBranch(Boolean notifyOnlyDefaultBranch) {
135+
setNotifyOnlyDefaultBranch(notifyOnlyDefaultBranch);
136+
return (this);
137+
}
138+
139+
@JsonIgnore
140+
public String getPushChannel() {
141+
return ((String) getProperty(PUSH_CHANNEL_PROP));
142+
}
143+
144+
public void setPushChannel(String pushChannel) {
145+
setProperty(PUSH_CHANNEL_PROP, pushChannel);
146+
}
147+
148+
public SlackService withPushChannel(String pushChannel) {
149+
setPushChannel(pushChannel);
150+
return (this);
151+
}
152+
153+
@JsonIgnore
154+
public String getIssueChannel() {
155+
return ((String) getProperty(ISSUE_CHANNEL_PROP));
156+
}
157+
158+
public void setIssueChannel(String issueChannel) {
159+
setProperty(ISSUE_CHANNEL_PROP, issueChannel);
160+
}
161+
162+
public SlackService withIssueChannel(String issueChannel) {
163+
setIssueChannel(issueChannel);
164+
return (this);
165+
}
166+
167+
@JsonIgnore
168+
public String getConfidentialIssueChannel() {
169+
return ((String) getProperty(CONFIDENTIAL_ISSUE_CHANNEL_PROP));
170+
}
171+
172+
public void setConfidentialIssueChannel(String confidentialIssueChannel) {
173+
setProperty(CONFIDENTIAL_ISSUE_CHANNEL_PROP, confidentialIssueChannel);
174+
}
175+
176+
public SlackService withConfidentialIssueChannel(String confidentialIssueChannel) {
177+
setConfidentialIssueChannel(confidentialIssueChannel);
178+
return (this);
179+
}
180+
181+
@JsonIgnore
182+
public String getMergeRequestChannel() {
183+
return ((String) getProperty(MERGE_REQUEST_CHANNEL_PROP));
184+
}
185+
186+
public void setMergeRequestChannel(String mergeRequestChannel) {
187+
setProperty(MERGE_REQUEST_CHANNEL_PROP, mergeRequestChannel);
188+
}
189+
190+
public SlackService withMergeRequestChannel(String mergeRequestChannel) {
191+
setMergeRequestChannel(mergeRequestChannel);
192+
return (this);
193+
}
194+
195+
@JsonIgnore
196+
public String getNoteChannel() {
197+
return ((String) getProperty(NOTE_CHANNEL_PROP));
198+
}
199+
200+
public void setNoteChannel(String noteChannel) {
201+
setProperty(NOTE_CHANNEL_PROP, noteChannel);
202+
}
203+
204+
public SlackService withNoteChannel(String noteChannel) {
205+
setNoteChannel(noteChannel);
206+
return (this);
207+
}
208+
209+
@JsonIgnore
210+
public String getConfidentialNoteChannel() {
211+
return ((String) getProperty(CONFIDENTIAL_NOTE_CHANNEL_PROP));
212+
}
213+
214+
public void setConfidentialNoteChannel(String noteChannel) {
215+
setProperty(NOTE_CHANNEL_PROP, noteChannel);
216+
}
217+
218+
public SlackService withConfidentialNoteChannel(String confidentialNoteChannel) {
219+
setConfidentialNoteChannel(confidentialNoteChannel);
220+
return (this);
221+
}
222+
223+
@JsonIgnore
224+
public String getTagPushChannel() {
225+
return ((String) getProperty(TAG_PUSH_CHANNEL_PROP));
226+
}
227+
228+
public void setTagPushChannel(String tagPushChannel) {
229+
setProperty(TAG_PUSH_CHANNEL_PROP, tagPushChannel);
230+
}
231+
232+
public SlackService withTagPushChannel(String tagPushChannel) {
233+
setTagPushChannel(tagPushChannel);
234+
return (this);
235+
}
236+
237+
@JsonIgnore
238+
public String getPipelineChannel() {
239+
return ((String) getProperty(PIPELINE_CHANNEL_PROP));
240+
}
241+
242+
public void setPipelineChannel(String pipelineChannel) {
243+
setProperty(PIPELINE_CHANNEL_PROP, pipelineChannel);
244+
}
245+
246+
public SlackService withPipelineChannel(String pipelineChannel) {
247+
setPipelineChannel(pipelineChannel);
248+
return (this);
249+
}
250+
251+
@JsonIgnore
252+
public String getWikiPageChannel() {
253+
return ((String) getProperty(WIKI_PAGE_CHANNEL_PROP));
254+
}
255+
256+
public void setWikiPageChannel(String wikiPageChannel) {
257+
setProperty(WIKI_PAGE_CHANNEL_PROP, wikiPageChannel);
258+
}
259+
260+
public SlackService withWikiPageChannel(String wikiPageChannel) {
261+
setWikiPageChannel(wikiPageChannel);
262+
return (this);
263+
}
264+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"id": 100,
3+
"title": "Slack notifications",
4+
"created_at": "2018-04-21T17:08:36.759Z",
5+
"updated_at": "2018-04-23T00:12:51.843Z",
6+
"active": true,
7+
"push_events": true,
8+
"issues_events": false,
9+
"confidential_issues_events": false,
10+
"merge_requests_events": false,
11+
"tag_push_events": false,
12+
"note_events": false,
13+
"confidential_note_events": false,
14+
"pipeline_events": false,
15+
"wiki_page_events": false,
16+
"job_events": true,
17+
"properties": {
18+
"webhook": "https://hooks.slack.com/services/AAAA1BBB/ABCDEFGHI/aBCdef1Gerer65ere54gdffd",
19+
"username": "GitLab",
20+
"notify_only_broken_pipelines": false,
21+
"notify_only_default_branch": true,
22+
"push_channel": "pushes",
23+
"issue_channel": "",
24+
"confidential_issue_channel": "",
25+
"merge_request_channel": "",
26+
"note_channel": "",
27+
"tag_push_channel": "",
28+
"pipeline_channel": "",
29+
"wiki_page_channel": ""
30+
}
31+
}

0 commit comments

Comments
 (0)