Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
583972b2
Commit
583972b2
authored
Oct 26, 2017
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix two small linter warnings
And make sure we use the same struct field names as the API does.
parent
6568d265
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
41 deletions
+59
-41
services.go
services.go
+57
-39
services_test.go
services_test.go
+2
-2
No files found.
services.go
View file @
583972b2
...
@@ -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
{
U
rl
*
string
`url:"url,omitempty" json:"url,omitempty"`
U
RL
*
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.
...
...
services_test.go
View file @
583972b2
...
@@ -137,11 +137,11 @@ func TestSetJiraService(t *testing.T) {
...
@@ -137,11 +137,11 @@ func TestSetJiraService(t *testing.T) {
})
})
opt
:=
&
SetJiraServiceOptions
{
opt
:=
&
SetJiraServiceOptions
{
U
rl
:
String
(
"asd"
),
U
RL
:
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment