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
a9c97172
Unverified
Commit
a9c97172
authored
Sep 27, 2018
by
Sander van Harmelen
Committed by
GitHub
Sep 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add (us)subscribe to/from issues (#479)
And extend the MergeEvent struct.
parent
c5f12546
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
5 deletions
+78
-5
event_types.go
event_types.go
+18
-0
issues.go
issues.go
+54
-0
merge_requests.go
merge_requests.go
+6
-5
No files found.
event_types.go
View file @
a9c97172
...
@@ -490,6 +490,24 @@ type MergeEvent struct {
...
@@ -490,6 +490,24 @@ type MergeEvent struct {
Username
string
`json:"username"`
Username
string
`json:"username"`
AvatarURL
string
`json:"avatar_url"`
AvatarURL
string
`json:"avatar_url"`
}
`json:"assignee"`
}
`json:"assignee"`
Changes
struct
{
AssigneeID
struct
{
Previous
int
`json:"previous"`
Current
int
`json:"current"`
}
`json:"assignee_id"`
Description
struct
{
Previous
string
`json:"previous"`
Current
string
`json:"current"`
}
`json:"description"`
Labels
struct
{
Previous
[]
Label
`json:"previous"`
Current
[]
Label
`json:"current"`
}
`json:"labels"`
UpdatedByID
struct
{
Previous
int
`json:"previous"`
Current
int
`json:"current"`
}
`json:"updated_by_id"`
}
`json:"changes"`
}
}
// WikiPageEvent represents a wiki page event.
// WikiPageEvent represents a wiki page event.
...
...
issues.go
View file @
a9c97172
...
@@ -363,6 +363,60 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Optio
...
@@ -363,6 +363,60 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Optio
return
s
.
client
.
Do
(
req
,
nil
)
return
s
.
client
.
Do
(
req
,
nil
)
}
}
// SubscribeToIssue subscribes the authenticated user to the given issue to
// receive notifications. If the user is already subscribed to the issue, the
// status code 304 is returned.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
func
(
s
*
IssuesService
)
SubscribeToIssue
(
pid
interface
{},
issue
int
,
options
...
OptionFunc
)
(
*
Issue
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/issues/%d/subscribe"
,
url
.
QueryEscape
(
project
),
issue
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
i
:=
new
(
Issue
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
i
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
i
,
resp
,
err
}
// UnsubscribeFromIssue unsubscribes the authenticated user from the given
// issue to not receive notifications from that merge request. If the user
// is not subscribed to the issue, status code 304 is returned.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
func
(
s
*
IssuesService
)
UnsubscribeFromIssue
(
pid
interface
{},
issue
int
,
options
...
OptionFunc
)
(
*
Issue
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/issues/%d/unsubscribe"
,
url
.
QueryEscape
(
project
),
issue
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
i
:=
new
(
Issue
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
i
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
i
,
resp
,
err
}
// ListMergeRequestsClosingIssueOptions represents the available
// ListMergeRequestsClosingIssueOptions represents the available
// ListMergeRequestsClosingIssue() options.
// ListMergeRequestsClosingIssue() options.
//
//
...
...
merge_requests.go
View file @
a9c97172
...
@@ -684,8 +684,8 @@ func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{},
...
@@ -684,8 +684,8 @@ func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{},
return
v
,
resp
,
err
return
v
,
resp
,
err
}
}
// SubscribeToMergeRequest subscribes the authenticated user to the given merge
request
// SubscribeToMergeRequest subscribes the authenticated user to the given merge
// to receive notifications. If the user is already subscribed to the
//
request
to receive notifications. If the user is already subscribed to the
// merge request, the status code 304 is returned.
// merge request, the status code 304 is returned.
//
//
// GitLab API docs:
// GitLab API docs:
...
@@ -711,9 +711,10 @@ func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeReq
...
@@ -711,9 +711,10 @@ func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeReq
return
m
,
resp
,
err
return
m
,
resp
,
err
}
}
// UnsubscribeFromMergeRequest unsubscribes the authenticated user from the given merge request
// UnsubscribeFromMergeRequest unsubscribes the authenticated user from the
// to not receive notifications from that merge request. If the user is
// given merge request to not receive notifications from that merge request.
// not subscribed to the merge request, status code 304 is returned.
// If the user is not subscribed to the merge request, status code 304 is
// returned.
//
//
// GitLab API docs:
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
...
...
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