@@ -315,3 +315,88 @@ func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionF
315
315
316
316
return s .client .Do (req , nil )
317
317
}
318
+
319
+ // JiraService represents Jira service settings.
320
+ type JiraService struct {
321
+ Service
322
+ Properties * JiraServiceProperties `json:"properties"`
323
+ }
324
+
325
+ // JiraServiceProperties represents Jira specific properties.
326
+ type JiraServiceProperties struct {
327
+ Url * string `url:"url,omitempty" json:"url,omitempty"`
328
+ ProjectKey * string `url:"project_key,omitempty" json:"project_key,omitempty" `
329
+ Username * string `url:"username,omitempty" json:"username,omitempty" `
330
+ Password * string `url:"password,omitempty" json:"password,omitempty" `
331
+ IssueTransitionId * string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
332
+ }
333
+
334
+ // GetJiraService gets Jira service settings for a project.
335
+ //
336
+ // GitLab API docs:
337
+ // https://docs.gitlab.com/ce/api/services.html#get-jira-service-settings
338
+ func (s * ServicesService ) GetJiraService (pid interface {}, options ... OptionFunc ) (* JiraService , * Response , error ) {
339
+ project , err := parseID (pid )
340
+ if err != nil {
341
+ return nil , nil , err
342
+ }
343
+ u := fmt .Sprintf ("projects/%s/services/jira" , url .QueryEscape (project ))
344
+
345
+ req , err := s .client .NewRequest ("GET" , u , nil , options )
346
+ if err != nil {
347
+ return nil , nil , err
348
+ }
349
+
350
+ svc := new (JiraService )
351
+ resp , err := s .client .Do (req , svc )
352
+ if err != nil {
353
+ return nil , resp , err
354
+ }
355
+
356
+ return svc , resp , err
357
+ }
358
+
359
+ // SetJiraServiceOptions represents the available SetJiraService()
360
+ // options.
361
+ //
362
+ // GitLab API docs:
363
+ // https://docs.gitlab.com/ce/api/services.html#edit-jira-service
364
+ type SetJiraServiceOptions JiraServiceProperties
365
+
366
+ // SetJiraService sets Jira service for a project
367
+ //
368
+ // GitLab API docs:
369
+ // https://docs.gitlab.com/ce/api/services.html#edit-jira-service
370
+ func (s * ServicesService ) SetJiraService (pid interface {}, opt * SetJiraServiceOptions , options ... OptionFunc ) (* Response , error ) {
371
+ project , err := parseID (pid )
372
+ if err != nil {
373
+ return nil , err
374
+ }
375
+ u := fmt .Sprintf ("projects/%s/services/jira" , url .QueryEscape (project ))
376
+
377
+ req , err := s .client .NewRequest ("PUT" , u , opt , options )
378
+ if err != nil {
379
+ return nil , err
380
+ }
381
+
382
+ return s .client .Do (req , nil )
383
+ }
384
+
385
+ // DeleteJiraService deletes Jira service for project.
386
+ //
387
+ // GitLab API docs:
388
+ // https://docs.gitlab.com/ce/api/services.html#delete-jira-service
389
+ func (s * ServicesService ) DeleteJiraService (pid interface {}, options ... OptionFunc ) (* Response , error ) {
390
+ project , err := parseID (pid )
391
+ if err != nil {
392
+ return nil , err
393
+ }
394
+ u := fmt .Sprintf ("projects/%s/services/jira" , url .QueryEscape (project ))
395
+
396
+ req , err := s .client .NewRequest ("DELETE" , u , nil , options )
397
+ if err != nil {
398
+ return nil , err
399
+ }
400
+
401
+ return s .client .Do (req , nil )
402
+ }
0 commit comments