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
625995db
Commit
625995db
authored
Mar 12, 2016
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38 from thecanadianbaker/add-slack-service
Added support for Slack service
parents
d56ec0d0
08ec8592
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
services.go
services.go
+61
-0
No files found.
services.go
View file @
625995db
...
...
@@ -261,3 +261,64 @@ func (s *ServicesService) GetDroneCIService(pid interface{}) (*DroneCIService, *
return
opt
,
resp
,
err
}
// SetSlackServiceOptions represents the available SetSlackService()
// options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-slack-service
type
SetSlackServiceOptions
struct
{
WebHook
string
`url:"webhook,omitempty" json:"webhook,omitempty" `
Username
string
`url:"username,omitempty" json:"username,omitempty" `
Channel
string
`url:"channel,omitempty" json:"channel,omitempty"`
}
// SetSlackService sets Slack service for a project
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#edit-slack-service
func
(
s
*
ServicesService
)
SetSlackService
(
pid
interface
{},
opt
*
SetSlackServiceOptions
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/services/slack"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
err
}
resp
,
err
:=
s
.
client
.
Do
(
req
,
nil
)
if
err
!=
nil
{
return
resp
,
err
}
return
resp
,
err
}
// DeleteSlackService deletes Slack service for project.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/services.html#delete-slack-service
func
(
s
*
ServicesService
)
DeleteSlackService
(
pid
interface
{})
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/services/slack"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
)
if
err
!=
nil
{
return
nil
,
err
}
resp
,
err
:=
s
.
client
.
Do
(
req
,
nil
)
if
err
!=
nil
{
return
resp
,
err
}
return
resp
,
err
}
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