Commit 583972b2 authored by Sander van Harmelen's avatar Sander van Harmelen

Fix two small linter warnings

And make sure we use the same struct field names as the API does.
parent 6568d265
...@@ -144,6 +144,50 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...Optio ...@@ -144,6 +144,50 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...Optio
return s.client.Do(req, nil) return s.client.Do(req, nil)
} }
// DroneCIService represents Drone CI service settings.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#drone-ci
type DroneCIService struct {
Service
Properties *DroneCIServiceProperties `json:"properties"`
}
// DroneCIServiceProperties represents Drone CI specific properties.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#drone-ci
type DroneCIServiceProperties struct {
Token string `json:"token"`
DroneURL string `json:"drone_url"`
EnableSSLVerification bool `json:"enable_ssl_verification"`
}
// GetDroneCIService gets Drone CI service settings for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings
func (s *ServicesService) GetDroneCIService(pid interface{}, options ...OptionFunc) (*DroneCIService, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/services/drone-ci", url.QueryEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
svc := new(DroneCIService)
resp, err := s.client.Do(req, svc)
if err != nil {
return nil, resp, err
}
return svc, resp, err
}
// SetDroneCIServiceOptions represents the available SetDroneCIService() // SetDroneCIServiceOptions represents the available SetDroneCIService()
// options. // options.
// //
...@@ -193,51 +237,19 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...Optio ...@@ -193,51 +237,19 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...Optio
return s.client.Do(req, nil) return s.client.Do(req, nil)
} }
// DroneCIService represents Drone CI service settings. // SlackService represents Slack service settings.
type DroneCIService struct {
Service
Properties *DroneCIServiceProperties `json:"properties"`
}
// DroneCIServiceProperties represents Drone CI specific properties.
type DroneCIServiceProperties struct {
Token string `json:"token"`
DroneURL string `json:"drone_url"`
EnableSSLVerification bool `json:"enable_ssl_verification"`
}
// GetDroneCIService gets Drone CI service settings for a project.
// //
// GitLab API docs: // GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings // https://docs.gitlab.com/ce/api/services.html#slack
func (s *ServicesService) GetDroneCIService(pid interface{}, options ...OptionFunc) (*DroneCIService, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/services/drone-ci", url.QueryEscape(project))
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
svc := new(DroneCIService)
resp, err := s.client.Do(req, svc)
if err != nil {
return nil, resp, err
}
return svc, resp, err
}
// SlackService represents Slack service settings.
type SlackService struct { type SlackService struct {
Service Service
Properties *SlackServiceProperties `json:"properties"` Properties *SlackServiceProperties `json:"properties"`
} }
// SlackServiceProperties represents Slack specific properties. // SlackServiceProperties represents Slack specific properties.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#slack
type SlackServiceProperties struct { type SlackServiceProperties struct {
NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines"` NotifyOnlyBrokenPipelines bool `json:"notify_only_broken_pipelines"`
} }
...@@ -317,18 +329,24 @@ func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionF ...@@ -317,18 +329,24 @@ func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionF
} }
// JiraService represents Jira service settings. // JiraService represents Jira service settings.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#jira
type JiraService struct { type JiraService struct {
Service Service
Properties *JiraServiceProperties `json:"properties"` Properties *JiraServiceProperties `json:"properties"`
} }
// JiraServiceProperties represents Jira specific properties. // JiraServiceProperties represents Jira specific properties.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#jira
type JiraServiceProperties struct { type JiraServiceProperties struct {
Url *string `url:"url,omitempty" json:"url,omitempty"` URL *string `url:"url,omitempty" json:"url,omitempty"`
ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" ` ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" `
Username *string `url:"username,omitempty" json:"username,omitempty" ` Username *string `url:"username,omitempty" json:"username,omitempty" `
Password *string `url:"password,omitempty" json:"password,omitempty" ` Password *string `url:"password,omitempty" json:"password,omitempty" `
IssueTransitionId *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"` JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
} }
// GetJiraService gets Jira service settings for a project. // GetJiraService gets Jira service settings for a project.
......
...@@ -137,11 +137,11 @@ func TestSetJiraService(t *testing.T) { ...@@ -137,11 +137,11 @@ func TestSetJiraService(t *testing.T) {
}) })
opt := &SetJiraServiceOptions{ opt := &SetJiraServiceOptions{
Url: String("asd"), URL: String("asd"),
ProjectKey: String("as"), ProjectKey: String("as"),
Username: String("aas"), Username: String("aas"),
Password: String("asd"), Password: String("asd"),
IssueTransitionId: String("asd"), JiraIssueTransitionID: String("asd"),
} }
_, err := client.Services.SetJiraService(1, opt) _, err := client.Services.SetJiraService(1, opt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment