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
bfc0d7b1
Commit
bfc0d7b1
authored
Oct 11, 2018
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a few small style tweaks
parent
f47feaec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
81 deletions
+109
-81
discussions.go
discussions.go
+105
-76
notes.go
notes.go
+4
-5
No files found.
discussions.go
View file @
bfc0d7b1
...
...
@@ -19,11 +19,10 @@ package gitlab
import
(
"fmt"
"net/url"
"time"
)
// DiscussionsService handles communication with the discussions related
methods
// of the GitLab API.
// DiscussionsService handles communication with the discussions related
//
methods
of the GitLab API.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/discussions.html
type
DiscussionsService
struct
{
...
...
@@ -43,19 +42,19 @@ func (d Discussion) String() string {
return
Stringify
(
d
)
}
// List
ProjectIssueDiscussionsOptions represents the available
//
ListIssueDiscussions()
options.
// List
IssueDiscussionsOptions represents the available ListIssueDiscussions()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussions
type
List
Project
IssueDiscussionsOptions
ListOptions
type
ListIssueDiscussionsOptions
ListOptions
// List
Project
IssueDiscussions gets a list of all discussions for a single
// ListIssueDiscussions gets a list of all discussions for a single
// issue.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussions
func
(
s
*
DiscussionsService
)
List
ProjectIssueDiscussions
(
pid
interface
{},
issue
int
,
opt
*
ListProjec
tIssueDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
func
(
s
*
DiscussionsService
)
List
IssueDiscussions
(
pid
interface
{},
issue
int
,
opt
*
Lis
tIssueDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -88,7 +87,8 @@ func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, disc
u
:=
fmt
.
Sprintf
(
"projects/%s/issues/%d/discussions/%s"
,
url
.
QueryEscape
(
project
),
issue
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -110,8 +110,8 @@ func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, disc
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-discussion
type
CreateIssueDiscussionOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// CreateIssueDiscussion creates a new discussion to a single project issue.
...
...
@@ -139,14 +139,14 @@ func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, o
return
d
,
resp
,
err
}
// AddIssueDiscussionNoteOptions represents the available
//
AddIssueDiscussionNote()
options.
// AddIssueDiscussionNoteOptions represents the available
AddIssueDiscussionNote()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-discussion
type
AddIssueDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// AddIssueDiscussionNote creates a new discussion to a single project issue.
...
...
@@ -161,7 +161,8 @@ func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int,
u
:=
fmt
.
Sprintf
(
"projects/%s/issues/%d/discussions/%s/notes"
,
url
.
QueryEscape
(
project
),
issue
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -183,8 +184,8 @@ func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int,
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-discussion-note
type
UpdateIssueDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// UpdateIssueDiscussionNote modifies existing discussion of an issue.
...
...
@@ -200,7 +201,8 @@ func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue in
url
.
QueryEscape
(
project
),
issue
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -229,7 +231,8 @@ func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue in
url
.
QueryEscape
(
project
),
issue
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -239,19 +242,19 @@ func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue in
return
s
.
client
.
Do
(
req
,
nil
)
}
// List
ProjectSnippetDiscussionsOptions represents the available
//
ListSnippetDiscussions()
options.
// List
SnippetDiscussionsOptions represents the available ListSnippetDiscussions()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-all-snippet-discussions
type
List
Project
SnippetDiscussionsOptions
ListOptions
type
ListSnippetDiscussionsOptions
ListOptions
// List
Project
SnippetDiscussions gets a list of all discussions for a single
// ListSnippetDiscussions gets a list of all discussions for a single
// snippet. Snippet discussions are comments users can post to a snippet.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-all-snippet-discussions
func
(
s
*
DiscussionsService
)
List
ProjectSnippetDiscussions
(
pid
interface
{},
snippet
int
,
opt
*
ListProjec
tSnippetDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
func
(
s
*
DiscussionsService
)
List
SnippetDiscussions
(
pid
interface
{},
snippet
int
,
opt
*
Lis
tSnippetDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -284,7 +287,8 @@ func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int,
u
:=
fmt
.
Sprintf
(
"projects/%s/snippets/%d/discussions/%s"
,
url
.
QueryEscape
(
project
),
snippet
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -306,8 +310,8 @@ func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int,
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-discussion
type
CreateSnippetDiscussionOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// CreateSnippetDiscussion creates a new discussion for a single snippet.
...
...
@@ -342,8 +346,8 @@ func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet in
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-discussion
type
AddSnippetDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// AddSnippetDiscussionNote creates a new discussion to a single project
...
...
@@ -359,7 +363,8 @@ func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet i
u
:=
fmt
.
Sprintf
(
"projects/%s/snippets/%d/discussions/%s/notes"
,
url
.
QueryEscape
(
project
),
snippet
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -381,8 +386,8 @@ func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet i
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-discussion-note
type
UpdateSnippetDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// UpdateSnippetDiscussionNote modifies existing discussion of a snippet.
...
...
@@ -398,7 +403,8 @@ func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippe
url
.
QueryEscape
(
project
),
snippet
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -427,7 +433,8 @@ func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippe
url
.
QueryEscape
(
project
),
snippet
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -456,7 +463,8 @@ func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int,
}
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions"
,
url
.
QueryEscape
(
group
),
epic
)
epic
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -484,7 +492,8 @@ func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discus
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions/%s"
,
url
.
QueryEscape
(
group
),
epic
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -506,8 +515,8 @@ func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discus
// GitLab API docs:
// https://docs.gitlab.com/ee/api/discussions.html#create-new-epic-discussion
type
CreateEpicDiscussionOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// CreateEpicDiscussion creates a new discussion for a single epic. Epic
...
...
@@ -522,7 +531,8 @@ func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt
}
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions"
,
url
.
QueryEscape
(
group
),
epic
)
epic
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -544,8 +554,8 @@ func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt
// GitLab API docs:
// https://docs.gitlab.com/ee/api/discussions.html#add-note-to-existing-epic-discussion
type
AddEpicDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// AddEpicDiscussionNote creates a new discussion to a single project epic.
...
...
@@ -560,7 +570,8 @@ func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, di
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions/%s/notes"
,
url
.
QueryEscape
(
group
),
epic
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -576,14 +587,14 @@ func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, di
return
d
,
resp
,
err
}
// UpdateEpicDiscussionNoteOptions represents the available
//
UpdateEpicDiscussion()
options.
// UpdateEpicDiscussionNoteOptions represents the available
UpdateEpicDiscussion()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/discussions.html#modify-existing-epic-discussion-note
type
UpdateEpicDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// UpdateEpicDiscussionNote modifies existing discussion of a epic.
...
...
@@ -598,7 +609,9 @@ func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int,
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions/%s/notes/%d"
,
url
.
QueryEscape
(
group
),
epic
,
discussion
,
note
)
discussion
,
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -626,7 +639,9 @@ func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int,
u
:=
fmt
.
Sprintf
(
"groups/%s/epics/%d/discussions/%s/notes/%d"
,
url
.
QueryEscape
(
group
),
epic
,
discussion
,
note
)
discussion
,
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -655,7 +670,8 @@ func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeR
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/discussions"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
mergeRequest
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -684,7 +700,8 @@ func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeReq
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/discussions/%s"
,
url
.
QueryEscape
(
project
),
mergeRequest
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -707,7 +724,7 @@ func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeReq
// https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-discussion
type
CreateMergeRequestDiscussionOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
CreatedAt
*
ISOTime
`url:"created_at,omitempty" json:"created_at,omitempty"`
Position
*
NotePosition
`url:"position,omitempty" json:"position,omitempty"`
}
...
...
@@ -723,7 +740,8 @@ func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, merge
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/discussions"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
mergeRequest
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -760,7 +778,9 @@ func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, merg
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/discussions/%s"
,
url
.
QueryEscape
(
project
),
mergeRequest
,
discussion
)
mergeRequest
,
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -782,8 +802,8 @@ func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, merg
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion
type
AddMergeRequestDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// AddMergeRequestDiscussionNote creates a new discussion to a single project
...
...
@@ -799,7 +819,8 @@ func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, merg
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_requests/%d/discussions/%s/notes"
,
url
.
QueryEscape
(
project
),
mergeRequest
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -821,8 +842,8 @@ func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, merg
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note
type
UpdateMergeRequestDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// UpdateMergeRequestDiscussionNote modifies existing discussion of a merge
...
...
@@ -839,7 +860,8 @@ func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, m
url
.
QueryEscape
(
project
),
mergeRequest
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -869,7 +891,8 @@ func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, m
url
.
QueryEscape
(
project
),
mergeRequest
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -879,26 +902,27 @@ func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, m
return
s
.
client
.
Do
(
req
,
nil
)
}
// List
Project
CommitDiscussionsOptions represents the available
// ListCommitDiscussionsOptions represents the available
// ListCommitDiscussions() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussions
type
List
Project
CommitDiscussionsOptions
ListOptions
type
ListCommitDiscussionsOptions
ListOptions
// List
Project
CommitDiscussions gets a list of all discussions for a single
// ListCommitDiscussions gets a list of all discussions for a single
// commit.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussions
func
(
s
*
DiscussionsService
)
List
ProjectCommitDiscussions
(
pid
interface
{},
commit
string
,
opt
*
ListProjec
tCommitDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
func
(
s
*
DiscussionsService
)
List
CommitDiscussions
(
pid
interface
{},
commit
string
,
opt
*
Lis
tCommitDiscussionsOptions
,
options
...
OptionFunc
)
([]
*
Discussion
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/discussions"
,
url
.
QueryEscape
(
project
),
commit
)
commit
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -927,7 +951,8 @@ func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string,
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/discussions/%s"
,
url
.
QueryEscape
(
project
),
commit
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
@@ -950,7 +975,7 @@ func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string,
// https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-discussion
type
CreateCommitDiscussionOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
CreatedAt
*
ISOTime
`url:"created_at,omitempty" json:"created_at,omitempty"`
Position
*
NotePosition
`url:"position,omitempty" json:"position,omitempty"`
}
...
...
@@ -965,7 +990,8 @@ func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit stri
}
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/discussions"
,
url
.
QueryEscape
(
project
),
commit
)
commit
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -987,8 +1013,8 @@ func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit stri
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-discussion
type
AddCommitDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// AddCommitDiscussionNote creates a new discussion to a single project commit.
...
...
@@ -1003,7 +1029,8 @@ func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit str
u
:=
fmt
.
Sprintf
(
"projects/%s/repository/commits/%s/discussions/%s/notes"
,
url
.
QueryEscape
(
project
),
commit
,
discussion
)
discussion
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"POST"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -1025,8 +1052,8 @@ func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit str
// GitLab API docs:
// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-commit-discussion-note
type
UpdateCommitDiscussionNoteOptions
struct
{
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
time
.
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
Body
*
string
`url:"body,omitempty" json:"body,omitempty"`
CreatedAt
*
ISO
Time
`url:"created_at,omitempty" json:"created_at,omitempty"`
}
// UpdateCommitDiscussionNote modifies existing discussion of an commit.
...
...
@@ -1042,7 +1069,8 @@ func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit
url
.
QueryEscape
(
project
),
commit
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"PUT"
,
u
,
opt
,
options
)
if
err
!=
nil
{
...
...
@@ -1071,7 +1099,8 @@ func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit
url
.
QueryEscape
(
project
),
commit
,
discussion
,
note
)
note
,
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
...
...
notes.go
View file @
bfc0d7b1
...
...
@@ -19,7 +19,6 @@ package gitlab
import
(
"fmt"
"net/url"
"time"
)
// NotesService handles communication with the notes related methods
...
...
@@ -49,9 +48,9 @@ type Note struct {
WebURL
string
`json:"web_url"`
}
`json:"author"`
System
bool
`json:"system"`
ExpiresAt
*
time
.
Time
`json:"expires_at"`
UpdatedAt
*
time
.
Time
`json:"updated_at"`
CreatedAt
*
time
.
Time
`json:"created_at"`
ExpiresAt
*
ISOTime
`json:"expires_at"`
UpdatedAt
*
ISOTime
`json:"updated_at"`
CreatedAt
*
ISOTime
`json:"created_at"`
NoteableID
int
`json:"noteable_id"`
NoteableType
string
`json:"noteable_type"`
Position
*
NotePosition
`json:"position"`
...
...
@@ -69,7 +68,7 @@ type Note struct {
NoteableIID
int
`json:"noteable_iid"`
}
// NotePosition represents the
"position" attributes on a note
// NotePosition represents the
position attributes of a note.
type
NotePosition
struct
{
BaseSHA
string
`json:"base_sha"`
StartSHA
string
`json:"start_sha"`
...
...
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