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
a11605e2
Commit
a11605e2
authored
Dec 19, 2017
by
Michael Lihs
Committed by
Sander van Harmelen
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for labels: subscribeTo / unsubscribeFrom (#287)
parent
7602fb35
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
labels.go
labels.go
+56
-0
No files found.
labels.go
View file @
a11605e2
...
@@ -162,3 +162,59 @@ func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, op
...
@@ -162,3 +162,59 @@ func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, op
return
l
,
resp
,
err
return
l
,
resp
,
err
}
}
// SubscribeToLabel subscribes the authenticated user to a label to receive
// notifications. If the user is already subscribed to the label,
// the status code 304 is returned.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/labels.html#subscribe-to-a-label
func
(
s
*
LabelsService
)
SubscribeToLabel
(
pid
interface
{},
labelID
interface
{},
options
...
OptionFunc
)
(
*
Label
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
label
,
err
:=
parseID
(
labelID
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/labels/%s/subscribe"
,
url
.
QueryEscape
(
project
),
label
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
l
:=
new
(
Label
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
l
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
l
,
resp
,
err
}
// UnsubscribeFromLabel unsubscribes the authenticated user from a label
// to not receive notifications from it. If the user is not subscribed
// to the label, the status code 304 is returned.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/labels.html#unsubscribe-from-a-label
func
(
s
*
LabelsService
)
UnsubscribeFromLabel
(
pid
interface
{},
labelID
interface
{},
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
label
,
err
:=
parseID
(
labelID
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/labels/%s/unsubscribe"
,
url
.
QueryEscape
(
project
),
label
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
err
}
return
s
.
client
.
Do
(
req
,
nil
)
}
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