diff --git a/services.go b/services.go index 41ccee4d3..6c6699687 100644 --- a/services.go +++ b/services.go @@ -1102,12 +1102,15 @@ type JiraService struct { // GitLab API docs: // https://docs.gitlab.com/ee/api/integrations.html#jira type JiraServiceProperties struct { - URL string `json:"url"` - APIURL string `json:"api_url"` - ProjectKey string `json:"project_key" ` - Username string `json:"username" ` - Password string `json:"password" ` - JiraIssueTransitionID string `json:"jira_issue_transition_id"` + URL string `json:"url"` + APIURL string `json:"api_url"` + ProjectKeys []string `json:"project_keys" ` + Username string `json:"username" ` + Password string `json:"password" ` + JiraIssueTransitionID string `json:"jira_issue_transition_id"` + + // Deprecated: This parameter was removed in GitLab 17.0 + ProjectKey string `json:"project_key" ` } // UnmarshalJSON decodes the Jira Service Properties. @@ -1171,16 +1174,17 @@ func (s *ServicesService) GetJiraService(pid interface{}, options ...RequestOpti // GitLab API docs: // https://docs.gitlab.com/ee/api/integrations.html#edit-jira-service type SetJiraServiceOptions struct { - URL *string `url:"url,omitempty" json:"url,omitempty"` - APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"` - ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" ` - Username *string `url:"username,omitempty" json:"username,omitempty" ` - Password *string `url:"password,omitempty" json:"password,omitempty" ` - Active *bool `url:"active,omitempty" json:"active,omitempty"` - JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"` - CommitEvents *bool `url:"commit_events,omitempty" json:"commit_events,omitempty"` - MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` - CommentOnEventEnabled *bool `url:"comment_on_event_enabled,omitempty" json:"comment_on_event_enabled,omitempty"` + URL *string `url:"url,omitempty" json:"url,omitempty"` + APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"` + ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" ` + ProjectKeys *[]string `url:"project_keys,comma,omitempty" json:"project_keys,omitempty" ` + Username *string `url:"username,omitempty" json:"username,omitempty" ` + Password *string `url:"password,omitempty" json:"password,omitempty" ` + Active *bool `url:"active,omitempty" json:"active,omitempty"` + JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"` + CommitEvents *bool `url:"commit_events,omitempty" json:"commit_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + CommentOnEventEnabled *bool `url:"comment_on_event_enabled,omitempty" json:"comment_on_event_enabled,omitempty"` } // SetJiraService sets Jira service for a project diff --git a/services_test.go b/services_test.go index 75ce65bb4..be9c2f913 100644 --- a/services_test.go +++ b/services_test.go @@ -459,6 +459,32 @@ func TestSetJiraService(t *testing.T) { } } +func TestSetJiraServiceProjecKeys(t *testing.T) { + mux, client := setup(t) + + mux.HandleFunc("/api/v4/projects/1/services/jira", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, http.MethodPut) + }) + + opt := &SetJiraServiceOptions{ + URL: Ptr("asd"), + APIURL: Ptr("asd"), + ProjectKeys: Ptr([]string{"as"}), + Username: Ptr("aas"), + Password: Ptr("asd"), + Active: Ptr(true), + JiraIssueTransitionID: Ptr("2,3"), + CommitEvents: Ptr(true), + CommentOnEventEnabled: Ptr(true), + MergeRequestsEvents: Ptr(true), + } + + _, err := client.Services.SetJiraService(1, opt) + if err != nil { + t.Fatalf("Services.SetJiraService returns an error: %v", err) + } +} + func TestDeleteJiraService(t *testing.T) { mux, client := setup(t)