1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package gitlab
18
19 import (
20 "encoding/json"
21 "fmt"
22 "net/http"
23 "strconv"
24 "time"
25 )
26
27
28
29
30
31 type ServicesService struct {
32 client *Client
33 }
34
35
36
37
38 type Service struct {
39 ID int `json:"id"`
40 Title string `json:"title"`
41 Slug string `json:"slug"`
42 CreatedAt *time.Time `json:"created_at"`
43 UpdatedAt *time.Time `json:"updated_at"`
44 Active bool `json:"active"`
45 PushEvents bool `json:"push_events"`
46 IssuesEvents bool `json:"issues_events"`
47 AlertEvents bool `json:"alert_events"`
48 ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
49 CommitEvents bool `json:"commit_events"`
50 MergeRequestsEvents bool `json:"merge_requests_events"`
51 CommentOnEventEnabled bool `json:"comment_on_event_enabled"`
52 TagPushEvents bool `json:"tag_push_events"`
53 NoteEvents bool `json:"note_events"`
54 ConfidentialNoteEvents bool `json:"confidential_note_events"`
55 PipelineEvents bool `json:"pipeline_events"`
56 JobEvents bool `json:"job_events"`
57 WikiPageEvents bool `json:"wiki_page_events"`
58 VulnerabilityEvents bool `json:"vulnerability_events"`
59 DeploymentEvents bool `json:"deployment_events"`
60 }
61
62
63
64
65 func (s *ServicesService) ListServices(pid interface{}, options ...RequestOptionFunc) ([]*Service, *Response, error) {
66 project, err := parseID(pid)
67 if err != nil {
68 return nil, nil, err
69 }
70 u := fmt.Sprintf("projects/%s/services", PathEscape(project))
71
72 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
73 if err != nil {
74 return nil, nil, err
75 }
76
77 var svcs []*Service
78 resp, err := s.client.Do(req, &svcs)
79 if err != nil {
80 return nil, resp, err
81 }
82
83 return svcs, resp, nil
84 }
85
86
87
88
89
90 type CustomIssueTrackerService struct {
91 Service
92 Properties *CustomIssueTrackerServiceProperties `json:"properties"`
93 }
94
95
96
97
98
99 type CustomIssueTrackerServiceProperties struct {
100 ProjectURL string `json:"project_url,omitempty"`
101 IssuesURL string `json:"issues_url,omitempty"`
102 NewIssueURL string `json:"new_issue_url,omitempty"`
103 }
104
105
106
107
108
109 func (s *ServicesService) GetCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*CustomIssueTrackerService, *Response, error) {
110 project, err := parseID(pid)
111 if err != nil {
112 return nil, nil, err
113 }
114 u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", PathEscape(project))
115
116 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
117 if err != nil {
118 return nil, nil, err
119 }
120
121 svc := new(CustomIssueTrackerService)
122 resp, err := s.client.Do(req, svc)
123 if err != nil {
124 return nil, resp, err
125 }
126
127 return svc, resp, nil
128 }
129
130
131
132
133
134
135 type SetCustomIssueTrackerServiceOptions struct {
136 NewIssueURL *string `url:"new_issue_url,omitempty" json:"new_issue_url,omitempty"`
137 IssuesURL *string `url:"issues_url,omitempty" json:"issues_url,omitempty"`
138 ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"`
139 Description *string `url:"description,omitempty" json:"description,omitempty"`
140 Title *string `url:"title,omitempty" json:"title,omitempty"`
141 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
142 }
143
144
145
146
147
148 func (s *ServicesService) SetCustomIssueTrackerService(pid interface{}, opt *SetCustomIssueTrackerServiceOptions, options ...RequestOptionFunc) (*Response, error) {
149 project, err := parseID(pid)
150 if err != nil {
151 return nil, err
152 }
153 u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", PathEscape(project))
154
155 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
156 if err != nil {
157 return nil, err
158 }
159
160 return s.client.Do(req, nil)
161 }
162
163
164
165
166
167 func (s *ServicesService) DeleteCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
168 project, err := parseID(pid)
169 if err != nil {
170 return nil, err
171 }
172 u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", PathEscape(project))
173
174 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
175 if err != nil {
176 return nil, err
177 }
178
179 return s.client.Do(req, nil)
180 }
181
182
183
184
185
186 type DataDogService struct {
187 Service
188 Properties *DataDogServiceProperties `json:"properties"`
189 }
190
191
192
193
194
195 type DataDogServiceProperties struct {
196 APIURL string `url:"api_url,omitempty" json:"api_url,omitempty"`
197 DataDogEnv string `url:"datadog_env,omitempty" json:"datadog_env,omitempty"`
198 DataDogService string `url:"datadog_service,omitempty" json:"datadog_service,omitempty"`
199 DataDogSite string `url:"datadog_site,omitempty" json:"datadog_site,omitempty"`
200 DataDogTags string `url:"datadog_tags,omitempty" json:"datadog_tags,omitempty"`
201 ArchiveTraceEvents bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
202 }
203
204
205
206
207
208 func (s *ServicesService) GetDataDogService(pid interface{}, options ...RequestOptionFunc) (*DataDogService, *Response, error) {
209 project, err := parseID(pid)
210 if err != nil {
211 return nil, nil, err
212 }
213 u := fmt.Sprintf("projects/%s/services/datadog", PathEscape(project))
214
215 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
216 if err != nil {
217 return nil, nil, err
218 }
219
220 svc := new(DataDogService)
221 resp, err := s.client.Do(req, svc)
222 if err != nil {
223 return nil, resp, err
224 }
225
226 return svc, resp, nil
227 }
228
229
230
231
232
233
234 type SetDataDogServiceOptions struct {
235 APIKey *string `url:"api_key,omitempty" json:"api_key,omitempty"`
236 APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
237 DataDogEnv *string `url:"datadog_env,omitempty" json:"datadog_env,omitempty"`
238 DataDogService *string `url:"datadog_service,omitempty" json:"datadog_service,omitempty"`
239 DataDogSite *string `url:"datadog_site,omitempty" json:"datadog_site,omitempty"`
240 DataDogTags *string `url:"datadog_tags,omitempty" json:"datadog_tags,omitempty"`
241 ArchiveTraceEvents *bool `url:"archive_trace_events,omitempty" json:"archive_trace_events,omitempty"`
242 }
243
244
245
246
247
248 func (s *ServicesService) SetDataDogService(pid interface{}, opt *SetDataDogServiceOptions, options ...RequestOptionFunc) (*Response, error) {
249 project, err := parseID(pid)
250 if err != nil {
251 return nil, err
252 }
253 u := fmt.Sprintf("projects/%s/services/datadog", PathEscape(project))
254
255 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
256 if err != nil {
257 return nil, err
258 }
259
260 return s.client.Do(req, nil)
261 }
262
263
264
265
266
267 func (s *ServicesService) DeleteDataDogService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
268 project, err := parseID(pid)
269 if err != nil {
270 return nil, err
271 }
272 u := fmt.Sprintf("projects/%s/services/datadog", PathEscape(project))
273
274 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
275 if err != nil {
276 return nil, err
277 }
278
279 return s.client.Do(req, nil)
280 }
281
282
283
284
285
286 type DiscordService struct {
287 Service
288 Properties *DiscordServiceProperties `json:"properties"`
289 }
290
291
292
293
294
295 type DiscordServiceProperties struct {
296 BranchesToBeNotified string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
297 NotifyOnlyBrokenPipelines bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
298 }
299
300
301
302
303
304 func (s *ServicesService) GetDiscordService(pid interface{}, options ...RequestOptionFunc) (*DiscordService, *Response, error) {
305 project, err := parseID(pid)
306 if err != nil {
307 return nil, nil, err
308 }
309 u := fmt.Sprintf("projects/%s/services/discord", PathEscape(project))
310
311 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
312 if err != nil {
313 return nil, nil, err
314 }
315
316 svc := new(DiscordService)
317 resp, err := s.client.Do(req, svc)
318 if err != nil {
319 return nil, resp, err
320 }
321
322 return svc, resp, nil
323 }
324
325
326
327
328
329
330 type SetDiscordServiceOptions struct {
331 WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
332 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
333 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
334 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
335 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
336 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
337 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
338 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
339 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
340 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
341 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
342 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
343 }
344
345
346
347
348
349 func (s *ServicesService) SetDiscordService(pid interface{}, opt *SetDiscordServiceOptions, options ...RequestOptionFunc) (*Response, error) {
350 project, err := parseID(pid)
351 if err != nil {
352 return nil, err
353 }
354 u := fmt.Sprintf("projects/%s/services/discord", PathEscape(project))
355
356 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
357 if err != nil {
358 return nil, err
359 }
360
361 return s.client.Do(req, nil)
362 }
363
364
365
366
367
368 func (s *ServicesService) DeleteDiscordService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
369 project, err := parseID(pid)
370 if err != nil {
371 return nil, err
372 }
373 u := fmt.Sprintf("projects/%s/services/discord", PathEscape(project))
374
375 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
376 if err != nil {
377 return nil, err
378 }
379
380 return s.client.Do(req, nil)
381 }
382
383
384
385
386
387 type DroneCIService struct {
388 Service
389 Properties *DroneCIServiceProperties `json:"properties"`
390 }
391
392
393
394
395
396 type DroneCIServiceProperties struct {
397 DroneURL string `json:"drone_url"`
398 EnableSSLVerification bool `json:"enable_ssl_verification"`
399 }
400
401
402
403
404
405 func (s *ServicesService) GetDroneCIService(pid interface{}, options ...RequestOptionFunc) (*DroneCIService, *Response, error) {
406 project, err := parseID(pid)
407 if err != nil {
408 return nil, nil, err
409 }
410 u := fmt.Sprintf("projects/%s/services/drone-ci", PathEscape(project))
411
412 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
413 if err != nil {
414 return nil, nil, err
415 }
416
417 svc := new(DroneCIService)
418 resp, err := s.client.Do(req, svc)
419 if err != nil {
420 return nil, resp, err
421 }
422
423 return svc, resp, nil
424 }
425
426
427
428
429
430
431 type SetDroneCIServiceOptions struct {
432 Token *string `url:"token,omitempty" json:"token,omitempty"`
433 DroneURL *string `url:"drone_url,omitempty" json:"drone_url,omitempty"`
434 EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
435 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
436 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
437 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
438 }
439
440
441
442
443
444 func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServiceOptions, options ...RequestOptionFunc) (*Response, error) {
445 project, err := parseID(pid)
446 if err != nil {
447 return nil, err
448 }
449 u := fmt.Sprintf("projects/%s/services/drone-ci", PathEscape(project))
450
451 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
452 if err != nil {
453 return nil, err
454 }
455
456 return s.client.Do(req, nil)
457 }
458
459
460
461
462
463 func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
464 project, err := parseID(pid)
465 if err != nil {
466 return nil, err
467 }
468 u := fmt.Sprintf("projects/%s/services/drone-ci", PathEscape(project))
469
470 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
471 if err != nil {
472 return nil, err
473 }
474
475 return s.client.Do(req, nil)
476 }
477
478
479
480
481
482 type EmailsOnPushService struct {
483 Service
484 Properties *EmailsOnPushServiceProperties `json:"properties"`
485 }
486
487
488
489
490
491 type EmailsOnPushServiceProperties struct {
492 Recipients string `json:"recipients"`
493 DisableDiffs bool `json:"disable_diffs"`
494 SendFromCommitterEmail bool `json:"send_from_committer_email"`
495 PushEvents bool `json:"push_events"`
496 TagPushEvents bool `json:"tag_push_events"`
497 BranchesToBeNotified string `json:"branches_to_be_notified"`
498 }
499
500
501
502
503
504 func (s *ServicesService) GetEmailsOnPushService(pid interface{}, options ...RequestOptionFunc) (*EmailsOnPushService, *Response, error) {
505 project, err := parseID(pid)
506 if err != nil {
507 return nil, nil, err
508 }
509 u := fmt.Sprintf("projects/%s/integrations/emails-on-push", PathEscape(project))
510
511 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
512 if err != nil {
513 return nil, nil, err
514 }
515
516 svc := new(EmailsOnPushService)
517 resp, err := s.client.Do(req, svc)
518 if err != nil {
519 return nil, resp, err
520 }
521
522 return svc, resp, nil
523 }
524
525
526
527
528
529
530 type SetEmailsOnPushServiceOptions struct {
531 Recipients *string `url:"recipients,omitempty" json:"recipients,omitempty"`
532 DisableDiffs *bool `url:"disable_diffs,omitempty" json:"disable_diffs,omitempty"`
533 SendFromCommitterEmail *bool `url:"send_from_committer_email,omitempty" json:"send_from_committer_email,omitempty"`
534 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
535 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
536 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
537 }
538
539
540
541
542
543 func (s *ServicesService) SetEmailsOnPushService(pid interface{}, opt *SetEmailsOnPushServiceOptions, options ...RequestOptionFunc) (*Response, error) {
544 project, err := parseID(pid)
545 if err != nil {
546 return nil, err
547 }
548 u := fmt.Sprintf("projects/%s/integrations/emails-on-push", PathEscape(project))
549
550 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
551 if err != nil {
552 return nil, err
553 }
554
555 return s.client.Do(req, nil)
556 }
557
558
559
560
561
562 func (s *ServicesService) DeleteEmailsOnPushService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
563 project, err := parseID(pid)
564 if err != nil {
565 return nil, err
566 }
567 u := fmt.Sprintf("projects/%s/integrations/emails-on-push", PathEscape(project))
568
569 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
570 if err != nil {
571 return nil, err
572 }
573
574 return s.client.Do(req, nil)
575 }
576
577
578
579
580
581 type ExternalWikiService struct {
582 Service
583 Properties *ExternalWikiServiceProperties `json:"properties"`
584 }
585
586
587
588
589
590 type ExternalWikiServiceProperties struct {
591 ExternalWikiURL string `json:"external_wiki_url"`
592 }
593
594
595
596
597
598 func (s *ServicesService) GetExternalWikiService(pid interface{}, options ...RequestOptionFunc) (*ExternalWikiService, *Response, error) {
599 project, err := parseID(pid)
600 if err != nil {
601 return nil, nil, err
602 }
603 u := fmt.Sprintf("projects/%s/services/external-wiki", PathEscape(project))
604
605 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
606 if err != nil {
607 return nil, nil, err
608 }
609
610 svc := new(ExternalWikiService)
611 resp, err := s.client.Do(req, svc)
612 if err != nil {
613 return nil, resp, err
614 }
615
616 return svc, resp, nil
617 }
618
619
620
621
622
623
624 type SetExternalWikiServiceOptions struct {
625 ExternalWikiURL *string `url:"external_wiki_url,omitempty" json:"external_wiki_url,omitempty"`
626 }
627
628
629
630
631
632 func (s *ServicesService) SetExternalWikiService(pid interface{}, opt *SetExternalWikiServiceOptions, options ...RequestOptionFunc) (*Response, error) {
633 project, err := parseID(pid)
634 if err != nil {
635 return nil, err
636 }
637 u := fmt.Sprintf("projects/%s/services/external-wiki", PathEscape(project))
638
639 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
640 if err != nil {
641 return nil, err
642 }
643
644 return s.client.Do(req, nil)
645 }
646
647
648
649
650
651 func (s *ServicesService) DeleteExternalWikiService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
652 project, err := parseID(pid)
653 if err != nil {
654 return nil, err
655 }
656 u := fmt.Sprintf("projects/%s/services/external-wiki", PathEscape(project))
657
658 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
659 if err != nil {
660 return nil, err
661 }
662
663 return s.client.Do(req, nil)
664 }
665
666
667
668
669
670 type GithubService struct {
671 Service
672 Properties *GithubServiceProperties `json:"properties"`
673 }
674
675
676
677
678
679 type GithubServiceProperties struct {
680 RepositoryURL string `json:"repository_url"`
681 StaticContext bool `json:"static_context"`
682 }
683
684
685
686
687
688 func (s *ServicesService) GetGithubService(pid interface{}, options ...RequestOptionFunc) (*GithubService, *Response, error) {
689 project, err := parseID(pid)
690 if err != nil {
691 return nil, nil, err
692 }
693 u := fmt.Sprintf("projects/%s/services/github", PathEscape(project))
694
695 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
696 if err != nil {
697 return nil, nil, err
698 }
699
700 svc := new(GithubService)
701 resp, err := s.client.Do(req, svc)
702 if err != nil {
703 return nil, resp, err
704 }
705
706 return svc, resp, nil
707 }
708
709
710
711
712
713
714 type SetGithubServiceOptions struct {
715 Token *string `url:"token,omitempty" json:"token,omitempty"`
716 RepositoryURL *string `url:"repository_url,omitempty" json:"repository_url,omitempty"`
717 StaticContext *bool `url:"static_context,omitempty" json:"static_context,omitempty"`
718 }
719
720
721
722
723
724 func (s *ServicesService) SetGithubService(pid interface{}, opt *SetGithubServiceOptions, options ...RequestOptionFunc) (*Response, error) {
725 project, err := parseID(pid)
726 if err != nil {
727 return nil, err
728 }
729 u := fmt.Sprintf("projects/%s/services/github", PathEscape(project))
730
731 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
732 if err != nil {
733 return nil, err
734 }
735
736 return s.client.Do(req, nil)
737 }
738
739
740
741
742
743 func (s *ServicesService) DeleteGithubService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
744 project, err := parseID(pid)
745 if err != nil {
746 return nil, err
747 }
748 u := fmt.Sprintf("projects/%s/services/github", PathEscape(project))
749
750 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
751 if err != nil {
752 return nil, err
753 }
754
755 return s.client.Do(req, nil)
756 }
757
758
759
760
761
762 type SlackApplication struct {
763 Service
764 Properties *SlackApplicationProperties `json:"properties"`
765 }
766
767
768
769
770
771 type SlackApplicationProperties struct {
772 Channel string `json:"channel"`
773 NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines"`
774 BranchesToBeNotified string `json:"branches_to_be_notified"`
775 AlertEvents bool `json:"alert_events"`
776 IssuesEvents bool `json:"issues_events"`
777 ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
778 MergeRequestsEvents bool `json:"merge_requests_events"`
779 NoteEvents bool `json:"note_events"`
780 ConfidentialNoteEvents bool `json:"confidential_note_events"`
781 DeploymentEvents bool `json:"deployment_events"`
782 IncidentsEvents bool `json:"incidents_events"`
783 PipelineEvents bool `json:"pipeline_events"`
784 PushEvents bool `json:"push_events"`
785 TagPushEvents bool `json:"tag_push_events"`
786 VulnerabilityEvents bool `json:"vulnerability_events"`
787 WikiPageEvents bool `json:"wiki_page_events"`
788
789
790 NotifyOnlyDefaultBranch bool `json:"notify_only_default_branch"`
791 }
792
793
794
795
796
797
798 func (s *ServicesService) GetSlackApplication(pid interface{}, options ...RequestOptionFunc) (*SlackApplication, *Response, error) {
799 project, err := parseID(pid)
800 if err != nil {
801 return nil, nil, err
802 }
803 u := fmt.Sprintf("projects/%s/integrations/gitlab-slack-application", PathEscape(project))
804
805 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
806 if err != nil {
807 return nil, nil, err
808 }
809
810 svc := new(SlackApplication)
811 resp, err := s.client.Do(req, svc)
812 if err != nil {
813 return nil, resp, err
814 }
815
816 return svc, resp, nil
817 }
818
819
820
821
822
823
824 type SetSlackApplicationOptions struct {
825 Channel *string `url:"channel,omitempty" json:"channel,omitempty"`
826 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
827 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
828 AlertEvents *bool `url:"alert_events,omitempty" json:"alert_events,omitempty"`
829 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
830 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
831 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
832 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
833 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
834 DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
835 IncidentsEvents *bool `url:"incidents_events,omitempty" json:"incidents_events,omitempty"`
836 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
837 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
838 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
839 VulnerabilityEvents *bool `url:"vulnerability_events,omitempty" json:"vulnerability_events,omitempty"`
840 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
841
842
843 NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
844 }
845
846
847
848
849
850 func (s *ServicesService) SetSlackApplication(pid interface{}, opt *SetSlackApplicationOptions, options ...RequestOptionFunc) (*Response, error) {
851 project, err := parseID(pid)
852 if err != nil {
853 return nil, err
854 }
855 u := fmt.Sprintf("projects/%s/integrations/gitlab-slack-application", PathEscape(project))
856
857 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
858 if err != nil {
859 return nil, err
860 }
861
862 return s.client.Do(req, nil)
863 }
864
865
866
867
868
869 func (s *ServicesService) DisableSlackApplication(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
870 project, err := parseID(pid)
871 if err != nil {
872 return nil, err
873 }
874 u := fmt.Sprintf("projects/%s/integrations/gitlab-slack-application", PathEscape(project))
875
876 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
877 if err != nil {
878 return nil, err
879 }
880
881 return s.client.Do(req, nil)
882 }
883
884
885
886
887
888
889 type SetGitLabCIServiceOptions struct {
890 Token *string `url:"token,omitempty" json:"token,omitempty"`
891 ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"`
892 }
893
894
895
896
897
898 func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCIServiceOptions, options ...RequestOptionFunc) (*Response, error) {
899 project, err := parseID(pid)
900 if err != nil {
901 return nil, err
902 }
903 u := fmt.Sprintf("projects/%s/services/gitlab-ci", PathEscape(project))
904
905 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
906 if err != nil {
907 return nil, err
908 }
909
910 return s.client.Do(req, nil)
911 }
912
913
914
915
916
917 func (s *ServicesService) DeleteGitLabCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
918 project, err := parseID(pid)
919 if err != nil {
920 return nil, err
921 }
922 u := fmt.Sprintf("projects/%s/services/gitlab-ci", PathEscape(project))
923
924 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
925 if err != nil {
926 return nil, err
927 }
928
929 return s.client.Do(req, nil)
930 }
931
932
933
934
935
936
937 type SetHipChatServiceOptions struct {
938 Token *string `url:"token,omitempty" json:"token,omitempty" `
939 Room *string `url:"room,omitempty" json:"room,omitempty"`
940 }
941
942
943
944
945
946 func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServiceOptions, options ...RequestOptionFunc) (*Response, error) {
947 project, err := parseID(pid)
948 if err != nil {
949 return nil, err
950 }
951 u := fmt.Sprintf("projects/%s/services/hipchat", PathEscape(project))
952
953 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
954 if err != nil {
955 return nil, err
956 }
957
958 return s.client.Do(req, nil)
959 }
960
961
962
963
964
965 func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
966 project, err := parseID(pid)
967 if err != nil {
968 return nil, err
969 }
970 u := fmt.Sprintf("projects/%s/services/hipchat", PathEscape(project))
971
972 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
973 if err != nil {
974 return nil, err
975 }
976
977 return s.client.Do(req, nil)
978 }
979
980
981
982
983
984 type JenkinsCIService struct {
985 Service
986 Properties *JenkinsCIServiceProperties `json:"properties"`
987 }
988
989
990
991
992
993 type JenkinsCIServiceProperties struct {
994 URL string `json:"jenkins_url"`
995 EnableSSLVerification bool `json:"enable_ssl_verification"`
996 ProjectName string `json:"project_name"`
997 Username string `json:"username"`
998 }
999
1000
1001
1002
1003
1004 func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...RequestOptionFunc) (*JenkinsCIService, *Response, error) {
1005 project, err := parseID(pid)
1006 if err != nil {
1007 return nil, nil, err
1008 }
1009 u := fmt.Sprintf("projects/%s/services/jenkins", PathEscape(project))
1010
1011 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1012 if err != nil {
1013 return nil, nil, err
1014 }
1015
1016 svc := new(JenkinsCIService)
1017 resp, err := s.client.Do(req, svc)
1018 if err != nil {
1019 return nil, resp, err
1020 }
1021
1022 return svc, resp, nil
1023 }
1024
1025
1026
1027
1028
1029
1030 type SetJenkinsCIServiceOptions struct {
1031 URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"`
1032 EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
1033 ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"`
1034 Username *string `url:"username,omitempty" json:"username,omitempty"`
1035 Password *string `url:"password,omitempty" json:"password,omitempty"`
1036 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
1037 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
1038 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
1039 }
1040
1041
1042
1043
1044
1045 func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCIServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1046 project, err := parseID(pid)
1047 if err != nil {
1048 return nil, err
1049 }
1050 u := fmt.Sprintf("projects/%s/services/jenkins", PathEscape(project))
1051
1052 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1053 if err != nil {
1054 return nil, err
1055 }
1056
1057 return s.client.Do(req, nil)
1058 }
1059
1060
1061
1062
1063
1064 func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1065 project, err := parseID(pid)
1066 if err != nil {
1067 return nil, err
1068 }
1069 u := fmt.Sprintf("projects/%s/services/jenkins", PathEscape(project))
1070
1071 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1072 if err != nil {
1073 return nil, err
1074 }
1075
1076 return s.client.Do(req, nil)
1077 }
1078
1079
1080
1081
1082
1083 type JiraService struct {
1084 Service
1085 Properties *JiraServiceProperties `json:"properties"`
1086 }
1087
1088
1089
1090
1091
1092 type JiraServiceProperties struct {
1093 URL string `json:"url"`
1094 APIURL string `json:"api_url"`
1095 ProjectKey string `json:"project_key" `
1096 Username string `json:"username" `
1097 Password string `json:"password" `
1098 JiraIssueTransitionID string `json:"jira_issue_transition_id"`
1099 }
1100
1101
1102
1103
1104 func (p *JiraServiceProperties) UnmarshalJSON(b []byte) error {
1105 type Alias JiraServiceProperties
1106 raw := struct {
1107 *Alias
1108 JiraIssueTransitionID interface{} `json:"jira_issue_transition_id"`
1109 }{
1110 Alias: (*Alias)(p),
1111 }
1112
1113 if err := json.Unmarshal(b, &raw); err != nil {
1114 return err
1115 }
1116
1117 switch id := raw.JiraIssueTransitionID.(type) {
1118 case nil:
1119
1120 case string:
1121 p.JiraIssueTransitionID = id
1122 case float64:
1123 p.JiraIssueTransitionID = strconv.Itoa(int(id))
1124 default:
1125 return fmt.Errorf("failed to unmarshal JiraTransitionID of type: %T", id)
1126 }
1127
1128 return nil
1129 }
1130
1131
1132
1133
1134
1135 func (s *ServicesService) GetJiraService(pid interface{}, options ...RequestOptionFunc) (*JiraService, *Response, error) {
1136 project, err := parseID(pid)
1137 if err != nil {
1138 return nil, nil, err
1139 }
1140 u := fmt.Sprintf("projects/%s/services/jira", PathEscape(project))
1141
1142 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1143 if err != nil {
1144 return nil, nil, err
1145 }
1146
1147 svc := new(JiraService)
1148 resp, err := s.client.Do(req, svc)
1149 if err != nil {
1150 return nil, resp, err
1151 }
1152
1153 return svc, resp, nil
1154 }
1155
1156
1157
1158
1159
1160
1161 type SetJiraServiceOptions struct {
1162 URL *string `url:"url,omitempty" json:"url,omitempty"`
1163 APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
1164 ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" `
1165 Username *string `url:"username,omitempty" json:"username,omitempty" `
1166 Password *string `url:"password,omitempty" json:"password,omitempty" `
1167 Active *bool `url:"active,omitempty" json:"active,omitempty"`
1168 JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
1169 CommitEvents *bool `url:"commit_events,omitempty" json:"commit_events,omitempty"`
1170 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
1171 CommentOnEventEnabled *bool `url:"comment_on_event_enabled,omitempty" json:"comment_on_event_enabled,omitempty"`
1172 }
1173
1174
1175
1176
1177
1178 func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1179 project, err := parseID(pid)
1180 if err != nil {
1181 return nil, err
1182 }
1183 u := fmt.Sprintf("projects/%s/services/jira", PathEscape(project))
1184
1185 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1186 if err != nil {
1187 return nil, err
1188 }
1189
1190 return s.client.Do(req, nil)
1191 }
1192
1193
1194
1195
1196
1197 func (s *ServicesService) DeleteJiraService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1198 project, err := parseID(pid)
1199 if err != nil {
1200 return nil, err
1201 }
1202 u := fmt.Sprintf("projects/%s/services/jira", PathEscape(project))
1203
1204 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1205 if err != nil {
1206 return nil, err
1207 }
1208
1209 return s.client.Do(req, nil)
1210 }
1211
1212
1213
1214
1215
1216 type MattermostService struct {
1217 Service
1218 Properties *MattermostServiceProperties `json:"properties"`
1219 }
1220
1221
1222
1223
1224
1225 type MattermostServiceProperties struct {
1226 WebHook string `json:"webhook"`
1227 Username string `json:"username"`
1228 Channel string `json:"channel"`
1229 NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"`
1230 BranchesToBeNotified string `json:"branches_to_be_notified"`
1231 ConfidentialIssueChannel string `json:"confidential_issue_channel"`
1232 ConfidentialNoteChannel string `json:"confidential_note_channel"`
1233 IssueChannel string `json:"issue_channel"`
1234 MergeRequestChannel string `json:"merge_request_channel"`
1235 NoteChannel string `json:"note_channel"`
1236 TagPushChannel string `json:"tag_push_channel"`
1237 PipelineChannel string `json:"pipeline_channel"`
1238 PushChannel string `json:"push_channel"`
1239 VulnerabilityChannel string `json:"vulnerability_channel"`
1240 WikiPageChannel string `json:"wiki_page_channel"`
1241 }
1242
1243
1244
1245
1246
1247 func (s *ServicesService) GetMattermostService(pid interface{}, options ...RequestOptionFunc) (*MattermostService, *Response, error) {
1248 project, err := parseID(pid)
1249 if err != nil {
1250 return nil, nil, err
1251 }
1252 u := fmt.Sprintf("projects/%s/services/mattermost", PathEscape(project))
1253
1254 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1255 if err != nil {
1256 return nil, nil, err
1257 }
1258
1259 svc := new(MattermostService)
1260 resp, err := s.client.Do(req, svc)
1261 if err != nil {
1262 return nil, resp, err
1263 }
1264
1265 return svc, resp, nil
1266 }
1267
1268
1269
1270
1271
1272
1273 type SetMattermostServiceOptions struct {
1274 WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
1275 Username *string `url:"username,omitempty" json:"username,omitempty"`
1276 Channel *string `url:"channel,omitempty" json:"channel,omitempty"`
1277 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
1278 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
1279 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
1280 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
1281 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
1282 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
1283 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
1284 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
1285 ConfidentialNoteChannel *string `url:"confidential_note_channel,omitempty" json:"confidential_note_channel,omitempty"`
1286 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
1287 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
1288 PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"`
1289 IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"`
1290 ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"`
1291 MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"`
1292 NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"`
1293 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
1294 TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"`
1295 PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"`
1296 WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"`
1297 }
1298
1299
1300
1301
1302
1303 type MattermostSlashCommandsService struct {
1304 Service
1305 Properties *MattermostSlashCommandsProperties `json:"properties"`
1306 }
1307
1308
1309
1310
1311
1312 type MattermostSlashCommandsProperties struct {
1313 Token string `json:"token"`
1314 Username string `json:"username,omitempty"`
1315 }
1316
1317
1318
1319
1320
1321 func (s *ServicesService) GetMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*MattermostSlashCommandsService, *Response, error) {
1322 project, err := parseID(pid)
1323 if err != nil {
1324 return nil, nil, err
1325 }
1326 u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project))
1327
1328 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1329 if err != nil {
1330 return nil, nil, err
1331 }
1332
1333 svc := new(MattermostSlashCommandsService)
1334 resp, err := s.client.Do(req, svc)
1335 if err != nil {
1336 return nil, resp, err
1337 }
1338
1339 return svc, resp, nil
1340 }
1341
1342
1343
1344
1345
1346
1347 type SetMattermostSlashCommandsServiceOptions struct {
1348 Token *string `url:"token,omitempty" json:"token,omitempty"`
1349 Username *string `url:"username,omitempty" json:"username,omitempty"`
1350 }
1351
1352
1353
1354
1355
1356 func (s *ServicesService) SetMattermostSlashCommandsService(pid interface{}, opt *SetMattermostSlashCommandsServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1357 project, err := parseID(pid)
1358 if err != nil {
1359 return nil, err
1360 }
1361 u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project))
1362
1363 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1364 if err != nil {
1365 return nil, err
1366 }
1367
1368 return s.client.Do(req, nil)
1369 }
1370
1371
1372
1373
1374
1375 func (s *ServicesService) DeleteMattermostSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1376 project, err := parseID(pid)
1377 if err != nil {
1378 return nil, err
1379 }
1380 u := fmt.Sprintf("projects/%s/services/mattermost-slash-commands", PathEscape(project))
1381
1382 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1383 if err != nil {
1384 return nil, err
1385 }
1386
1387 return s.client.Do(req, nil)
1388 }
1389
1390
1391
1392
1393
1394 func (s *ServicesService) SetMattermostService(pid interface{}, opt *SetMattermostServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1395 project, err := parseID(pid)
1396 if err != nil {
1397 return nil, err
1398 }
1399 u := fmt.Sprintf("projects/%s/services/mattermost", PathEscape(project))
1400
1401 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1402 if err != nil {
1403 return nil, err
1404 }
1405
1406 return s.client.Do(req, nil)
1407 }
1408
1409
1410
1411
1412
1413 func (s *ServicesService) DeleteMattermostService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1414 project, err := parseID(pid)
1415 if err != nil {
1416 return nil, err
1417 }
1418 u := fmt.Sprintf("projects/%s/services/mattermost", PathEscape(project))
1419
1420 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1421 if err != nil {
1422 return nil, err
1423 }
1424
1425 return s.client.Do(req, nil)
1426 }
1427
1428
1429
1430
1431
1432 type MicrosoftTeamsService struct {
1433 Service
1434 Properties *MicrosoftTeamsServiceProperties `json:"properties"`
1435 }
1436
1437
1438
1439
1440
1441 type MicrosoftTeamsServiceProperties struct {
1442 WebHook string `json:"webhook"`
1443 NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"`
1444 BranchesToBeNotified string `json:"branches_to_be_notified"`
1445 IssuesEvents BoolValue `json:"issues_events"`
1446 ConfidentialIssuesEvents BoolValue `json:"confidential_issues_events"`
1447 MergeRequestsEvents BoolValue `json:"merge_requests_events"`
1448 TagPushEvents BoolValue `json:"tag_push_events"`
1449 NoteEvents BoolValue `json:"note_events"`
1450 ConfidentialNoteEvents BoolValue `json:"confidential_note_events"`
1451 PipelineEvents BoolValue `json:"pipeline_events"`
1452 WikiPageEvents BoolValue `json:"wiki_page_events"`
1453 }
1454
1455
1456
1457
1458
1459 func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...RequestOptionFunc) (*MicrosoftTeamsService, *Response, error) {
1460 project, err := parseID(pid)
1461 if err != nil {
1462 return nil, nil, err
1463 }
1464 u := fmt.Sprintf("projects/%s/services/microsoft-teams", PathEscape(project))
1465
1466 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1467 if err != nil {
1468 return nil, nil, err
1469 }
1470
1471 svc := new(MicrosoftTeamsService)
1472 resp, err := s.client.Do(req, svc)
1473 if err != nil {
1474 return nil, resp, err
1475 }
1476
1477 return svc, resp, nil
1478 }
1479
1480
1481
1482
1483
1484
1485 type SetMicrosoftTeamsServiceOptions struct {
1486 WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
1487 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
1488 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
1489 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
1490 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
1491 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
1492 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
1493 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
1494 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
1495 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
1496 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
1497 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
1498 }
1499
1500
1501
1502
1503
1504 func (s *ServicesService) SetMicrosoftTeamsService(pid interface{}, opt *SetMicrosoftTeamsServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1505 project, err := parseID(pid)
1506 if err != nil {
1507 return nil, err
1508 }
1509 u := fmt.Sprintf("projects/%s/services/microsoft-teams", PathEscape(project))
1510
1511 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1512 if err != nil {
1513 return nil, err
1514 }
1515 return s.client.Do(req, nil)
1516 }
1517
1518
1519
1520
1521
1522 func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1523 project, err := parseID(pid)
1524 if err != nil {
1525 return nil, err
1526 }
1527 u := fmt.Sprintf("projects/%s/services/microsoft-teams", PathEscape(project))
1528
1529 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1530 if err != nil {
1531 return nil, err
1532 }
1533
1534 return s.client.Do(req, nil)
1535 }
1536
1537
1538
1539
1540
1541 type PipelinesEmailService struct {
1542 Service
1543 Properties *PipelinesEmailProperties `json:"properties"`
1544 }
1545
1546
1547
1548
1549
1550 type PipelinesEmailProperties struct {
1551 Recipients string `json:"recipients"`
1552 NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"`
1553 NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch"`
1554 BranchesToBeNotified string `json:"branches_to_be_notified"`
1555 }
1556
1557
1558
1559
1560
1561 func (s *ServicesService) GetPipelinesEmailService(pid interface{}, options ...RequestOptionFunc) (*PipelinesEmailService, *Response, error) {
1562 project, err := parseID(pid)
1563 if err != nil {
1564 return nil, nil, err
1565 }
1566 u := fmt.Sprintf("projects/%s/services/pipelines-email", PathEscape(project))
1567
1568 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1569 if err != nil {
1570 return nil, nil, err
1571 }
1572
1573 svc := new(PipelinesEmailService)
1574 resp, err := s.client.Do(req, svc)
1575 if err != nil {
1576 return nil, resp, err
1577 }
1578
1579 return svc, resp, nil
1580 }
1581
1582
1583
1584
1585
1586
1587 type SetPipelinesEmailServiceOptions struct {
1588 Recipients *string `url:"recipients,omitempty" json:"recipients,omitempty"`
1589 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
1590 NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
1591 AddPusher *bool `url:"add_pusher,omitempty" json:"add_pusher,omitempty"`
1592 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
1593 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
1594 }
1595
1596
1597
1598
1599
1600 func (s *ServicesService) SetPipelinesEmailService(pid interface{}, opt *SetPipelinesEmailServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1601 project, err := parseID(pid)
1602 if err != nil {
1603 return nil, err
1604 }
1605 u := fmt.Sprintf("projects/%s/services/pipelines-email", PathEscape(project))
1606
1607 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1608 if err != nil {
1609 return nil, err
1610 }
1611
1612 return s.client.Do(req, nil)
1613 }
1614
1615
1616
1617
1618
1619 func (s *ServicesService) DeletePipelinesEmailService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1620 project, err := parseID(pid)
1621 if err != nil {
1622 return nil, err
1623 }
1624 u := fmt.Sprintf("projects/%s/services/pipelines-email", PathEscape(project))
1625
1626 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1627 if err != nil {
1628 return nil, err
1629 }
1630
1631 return s.client.Do(req, nil)
1632 }
1633
1634
1635
1636
1637
1638 type PrometheusService struct {
1639 Service
1640 Properties *PrometheusServiceProperties `json:"properties"`
1641 }
1642
1643
1644
1645
1646
1647 type PrometheusServiceProperties struct {
1648 APIURL string `json:"api_url"`
1649 GoogleIAPAudienceClientID string `json:"google_iap_audience_client_id"`
1650 GoogleIAPServiceAccountJSON string `json:"google_iap_service_account_json"`
1651 }
1652
1653
1654
1655
1656
1657 func (s *ServicesService) GetPrometheusService(pid interface{}, options ...RequestOptionFunc) (*PrometheusService, *Response, error) {
1658 project, err := parseID(pid)
1659 if err != nil {
1660 return nil, nil, err
1661 }
1662 u := fmt.Sprintf("projects/%s/services/prometheus", PathEscape(project))
1663
1664 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1665 if err != nil {
1666 return nil, nil, err
1667 }
1668
1669 svc := new(PrometheusService)
1670 resp, err := s.client.Do(req, svc)
1671 if err != nil {
1672 return nil, resp, err
1673 }
1674
1675 return svc, resp, nil
1676 }
1677
1678
1679
1680
1681
1682
1683 type SetPrometheusServiceOptions struct {
1684 APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
1685 GoogleIAPAudienceClientID *string `url:"google_iap_audience_client_id,omitempty" json:"google_iap_audience_client_id,omitempty"`
1686 GoogleIAPServiceAccountJSON *string `url:"google_iap_service_account_json,omitempty" json:"google_iap_service_account_json,omitempty"`
1687 }
1688
1689
1690
1691
1692
1693 func (s *ServicesService) SetPrometheusService(pid interface{}, opt *SetPrometheusServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1694 project, err := parseID(pid)
1695 if err != nil {
1696 return nil, err
1697 }
1698 u := fmt.Sprintf("projects/%s/services/prometheus", PathEscape(project))
1699
1700 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1701 if err != nil {
1702 return nil, err
1703 }
1704
1705 return s.client.Do(req, nil)
1706 }
1707
1708
1709
1710
1711
1712 func (s *ServicesService) DeletePrometheusService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1713 project, err := parseID(pid)
1714 if err != nil {
1715 return nil, err
1716 }
1717 u := fmt.Sprintf("projects/%s/services/prometheus", PathEscape(project))
1718
1719 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1720 if err != nil {
1721 return nil, err
1722 }
1723
1724 return s.client.Do(req, nil)
1725 }
1726
1727
1728
1729
1730
1731 type SlackService struct {
1732 Service
1733 Properties *SlackServiceProperties `json:"properties"`
1734 }
1735
1736
1737
1738
1739
1740 type SlackServiceProperties struct {
1741 WebHook string `json:"webhook"`
1742 Username string `json:"username"`
1743 Channel string `json:"channel"`
1744 NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines"`
1745 NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch"`
1746 BranchesToBeNotified string `json:"branches_to_be_notified"`
1747 AlertChannel string `json:"alert_channel"`
1748 ConfidentialIssueChannel string `json:"confidential_issue_channel"`
1749 ConfidentialNoteChannel string `json:"confidential_note_channel"`
1750 DeploymentChannel string `json:"deployment_channel"`
1751 IssueChannel string `json:"issue_channel"`
1752 MergeRequestChannel string `json:"merge_request_channel"`
1753 NoteChannel string `json:"note_channel"`
1754 TagPushChannel string `json:"tag_push_channel"`
1755 PipelineChannel string `json:"pipeline_channel"`
1756 PushChannel string `json:"push_channel"`
1757 VulnerabilityChannel string `json:"vulnerability_channel"`
1758 WikiPageChannel string `json:"wiki_page_channel"`
1759 }
1760
1761
1762
1763
1764
1765 func (s *ServicesService) GetSlackService(pid interface{}, options ...RequestOptionFunc) (*SlackService, *Response, error) {
1766 project, err := parseID(pid)
1767 if err != nil {
1768 return nil, nil, err
1769 }
1770 u := fmt.Sprintf("projects/%s/services/slack", PathEscape(project))
1771
1772 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1773 if err != nil {
1774 return nil, nil, err
1775 }
1776
1777 svc := new(SlackService)
1778 resp, err := s.client.Do(req, svc)
1779 if err != nil {
1780 return nil, resp, err
1781 }
1782
1783 return svc, resp, nil
1784 }
1785
1786
1787
1788
1789
1790
1791 type SetSlackServiceOptions struct {
1792 WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
1793 Username *string `url:"username,omitempty" json:"username,omitempty"`
1794 Channel *string `url:"channel,omitempty" json:"channel,omitempty"`
1795 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
1796 NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
1797 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
1798 AlertChannel *string `url:"alert_channel,omitempty" json:"alert_channel,omitempty"`
1799 AlertEvents *bool `url:"alert_events,omitempty" json:"alert_events,omitempty"`
1800 ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"`
1801 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
1802 ConfidentialNoteChannel *string `url:"confidential_note_channel,omitempty" json:"confidential_note_channel,omitempty"`
1803 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
1804 DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"`
1805 DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
1806 IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"`
1807 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
1808 MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"`
1809 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
1810 NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"`
1811 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
1812 PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"`
1813 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
1814 PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"`
1815 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
1816 TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"`
1817 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
1818 WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"`
1819 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
1820 }
1821
1822
1823
1824
1825
1826 func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1827 project, err := parseID(pid)
1828 if err != nil {
1829 return nil, err
1830 }
1831 u := fmt.Sprintf("projects/%s/services/slack", PathEscape(project))
1832
1833 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1834 if err != nil {
1835 return nil, err
1836 }
1837
1838 return s.client.Do(req, nil)
1839 }
1840
1841
1842
1843
1844
1845 func (s *ServicesService) DeleteSlackService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1846 project, err := parseID(pid)
1847 if err != nil {
1848 return nil, err
1849 }
1850 u := fmt.Sprintf("projects/%s/services/slack", PathEscape(project))
1851
1852 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1853 if err != nil {
1854 return nil, err
1855 }
1856
1857 return s.client.Do(req, nil)
1858 }
1859
1860
1861
1862
1863
1864 type SlackSlashCommandsService struct {
1865 Service
1866 Properties *SlackSlashCommandsProperties `json:"properties"`
1867 }
1868
1869
1870
1871
1872
1873 type SlackSlashCommandsProperties struct {
1874 Token string `json:"token"`
1875 }
1876
1877
1878
1879
1880
1881 func (s *ServicesService) GetSlackSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*SlackSlashCommandsService, *Response, error) {
1882 project, err := parseID(pid)
1883 if err != nil {
1884 return nil, nil, err
1885 }
1886 u := fmt.Sprintf("projects/%s/services/slack-slash-commands", PathEscape(project))
1887
1888 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1889 if err != nil {
1890 return nil, nil, err
1891 }
1892
1893 svc := new(SlackSlashCommandsService)
1894 resp, err := s.client.Do(req, svc)
1895 if err != nil {
1896 return nil, resp, err
1897 }
1898
1899 return svc, resp, nil
1900 }
1901
1902
1903
1904
1905
1906
1907 type SetSlackSlashCommandsServiceOptions struct {
1908 Token *string `url:"token,omitempty" json:"token,omitempty"`
1909 }
1910
1911
1912
1913
1914
1915 func (s *ServicesService) SetSlackSlashCommandsService(pid interface{}, opt *SetSlackSlashCommandsServiceOptions, options ...RequestOptionFunc) (*Response, error) {
1916 project, err := parseID(pid)
1917 if err != nil {
1918 return nil, err
1919 }
1920 u := fmt.Sprintf("projects/%s/services/slack-slash-commands", PathEscape(project))
1921
1922 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
1923 if err != nil {
1924 return nil, err
1925 }
1926
1927 return s.client.Do(req, nil)
1928 }
1929
1930
1931
1932
1933
1934 func (s *ServicesService) DeleteSlackSlashCommandsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
1935 project, err := parseID(pid)
1936 if err != nil {
1937 return nil, err
1938 }
1939 u := fmt.Sprintf("projects/%s/services/slack-slash-commands", PathEscape(project))
1940
1941 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
1942 if err != nil {
1943 return nil, err
1944 }
1945
1946 return s.client.Do(req, nil)
1947 }
1948
1949
1950
1951
1952
1953 type TelegramService struct {
1954 Service
1955 Properties *TelegramServiceProperties `json:"properties"`
1956 }
1957
1958
1959
1960
1961
1962 type TelegramServiceProperties struct {
1963 Room string `json:"room"`
1964 NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines"`
1965 BranchesToBeNotified string `json:"branches_to_be_notified"`
1966 }
1967
1968
1969
1970
1971
1972 func (s *ServicesService) GetTelegramService(pid interface{}, options ...RequestOptionFunc) (*TelegramService, *Response, error) {
1973 project, err := parseID(pid)
1974 if err != nil {
1975 return nil, nil, err
1976 }
1977 u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project))
1978
1979 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
1980 if err != nil {
1981 return nil, nil, err
1982 }
1983
1984 svc := new(TelegramService)
1985 resp, err := s.client.Do(req, svc)
1986 if err != nil {
1987 return nil, resp, err
1988 }
1989
1990 return svc, resp, nil
1991 }
1992
1993
1994
1995
1996
1997
1998 type SetTelegramServiceOptions struct {
1999 Token *string `url:"token,omitempty" json:"token,omitempty"`
2000 Room *string `url:"room,omitempty" json:"room,omitempty"`
2001 NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
2002 BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"`
2003 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
2004 IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
2005 ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
2006 MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
2007 TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
2008 NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
2009 ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
2010 PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
2011 WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
2012 }
2013
2014
2015
2016
2017
2018 func (s *ServicesService) SetTelegramService(pid interface{}, opt *SetTelegramServiceOptions, options ...RequestOptionFunc) (*Response, error) {
2019 project, err := parseID(pid)
2020 if err != nil {
2021 return nil, err
2022 }
2023 u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project))
2024
2025 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
2026 if err != nil {
2027 return nil, err
2028 }
2029
2030 return s.client.Do(req, nil)
2031 }
2032
2033
2034
2035
2036
2037 func (s *ServicesService) DeleteTelegramService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
2038 project, err := parseID(pid)
2039 if err != nil {
2040 return nil, err
2041 }
2042 u := fmt.Sprintf("projects/%s/services/telegram", PathEscape(project))
2043
2044 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
2045 if err != nil {
2046 return nil, err
2047 }
2048
2049 return s.client.Do(req, nil)
2050 }
2051
2052
2053
2054
2055
2056 type YouTrackService struct {
2057 Service
2058 Properties *YouTrackServiceProperties `json:"properties"`
2059 }
2060
2061
2062
2063
2064
2065 type YouTrackServiceProperties struct {
2066 IssuesURL string `json:"issues_url"`
2067 ProjectURL string `json:"project_url"`
2068 Description string `json:"description"`
2069 PushEvents bool `json:"push_events"`
2070 }
2071
2072
2073
2074
2075
2076 func (s *ServicesService) GetYouTrackService(pid interface{}, options ...RequestOptionFunc) (*YouTrackService, *Response, error) {
2077 project, err := parseID(pid)
2078 if err != nil {
2079 return nil, nil, err
2080 }
2081 u := fmt.Sprintf("projects/%s/services/youtrack", PathEscape(project))
2082
2083 req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
2084 if err != nil {
2085 return nil, nil, err
2086 }
2087
2088 svc := new(YouTrackService)
2089 resp, err := s.client.Do(req, svc)
2090 if err != nil {
2091 return nil, resp, err
2092 }
2093
2094 return svc, resp, nil
2095 }
2096
2097
2098
2099
2100
2101
2102 type SetYouTrackServiceOptions struct {
2103 IssuesURL *string `url:"issues_url,omitempty" json:"issues_url,omitempty"`
2104 ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"`
2105 Description *string `url:"description,omitempty" json:"description,omitempty"`
2106 PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
2107 }
2108
2109
2110
2111
2112
2113 func (s *ServicesService) SetYouTrackService(pid interface{}, opt *SetYouTrackServiceOptions, options ...RequestOptionFunc) (*Response, error) {
2114 project, err := parseID(pid)
2115 if err != nil {
2116 return nil, err
2117 }
2118 u := fmt.Sprintf("projects/%s/services/youtrack", PathEscape(project))
2119
2120 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
2121 if err != nil {
2122 return nil, err
2123 }
2124
2125 return s.client.Do(req, nil)
2126 }
2127
2128
2129
2130
2131
2132 func (s *ServicesService) DeleteYouTrackService(pid interface{}, options ...RequestOptionFunc) (*Response, error) {
2133 project, err := parseID(pid)
2134 if err != nil {
2135 return nil, err
2136 }
2137 u := fmt.Sprintf("projects/%s/services/youtrack", PathEscape(project))
2138
2139 req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
2140 if err != nil {
2141 return nil, err
2142 }
2143
2144 return s.client.Do(req, nil)
2145 }
2146
View as plain text