@@ -36,15 +36,17 @@ type DraftNote struct {
36
36
// DraftNotesService handles communication with the draft notes related methods
37
37
// of the GitLab API.
38
38
//
39
- // GitLab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
39
+ // GitLab API docs:
40
+ // https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
40
41
type DraftNotesService struct {
41
42
client * Client
42
43
}
43
44
44
45
// ListDraftNotesOptions represents the available ListDraftNotes()
45
46
// options.
46
47
//
47
- // GitLab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
48
+ // GitLab API docs:
49
+ // https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
48
50
type ListDraftNotesOptions struct {
49
51
ListOptions
50
52
OrderBy * string `url:"order_by,omitempty" json:"order_by,omitempty"`
@@ -53,13 +55,13 @@ type ListDraftNotesOptions struct {
53
55
54
56
// ListDraftNotes gets a list of all draft notes for a merge request.
55
57
//
56
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
58
+ // Gitlab API docs:
59
+ // https://docs.gitlab.com/ee/api/draft_notes.html#list-all-merge-request-draft-notes
57
60
func (s * DraftNotesService ) ListDraftNotes (pid interface {}, mergeRequest int , opt * ListDraftNotesOptions , options ... RequestOptionFunc ) ([]* DraftNote , * Response , error ) {
58
61
project , err := parseID (pid )
59
62
if err != nil {
60
63
return nil , nil , err
61
64
}
62
-
63
65
u := fmt .Sprintf ("projects/%s/merge_requests/%d/draft_notes" , PathEscape (project ), mergeRequest )
64
66
65
67
req , err := s .client .NewRequest (http .MethodGet , u , opt , options )
@@ -78,7 +80,8 @@ func (s *DraftNotesService) ListDraftNotes(pid interface{}, mergeRequest int, op
78
80
79
81
// GetDraftNote gets a single draft note for a merge request.
80
82
//
81
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#get-a-single-draft-note
83
+ // Gitlab API docs:
84
+ // https://docs.gitlab.com/ee/api/draft_notes.html#get-a-single-draft-note
82
85
func (s * DraftNotesService ) GetDraftNote (pid interface {}, mergeRequest int , note int , options ... RequestOptionFunc ) (* DraftNote , * Response , error ) {
83
86
project , err := parseID (pid )
84
87
if err != nil {
@@ -103,7 +106,8 @@ func (s *DraftNotesService) GetDraftNote(pid interface{}, mergeRequest int, note
103
106
// CreateDraftNoteOptions represents the available CreateDraftNote()
104
107
// options.
105
108
//
106
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
109
+ // Gitlab API docs:
110
+ // https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
107
111
type CreateDraftNoteOptions struct {
108
112
Note * string `url:"note" json:"note"`
109
113
CommitID * string `url:"commit_id,omitempty" json:"commit_id,omitempty"`
@@ -114,13 +118,13 @@ type CreateDraftNoteOptions struct {
114
118
115
119
// CreateDraftNote creates a draft note for a merge request.
116
120
//
117
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
121
+ // Gitlab API docs:
122
+ // https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
118
123
func (s * DraftNotesService ) CreateDraftNote (pid interface {}, mergeRequest int , opt * CreateDraftNoteOptions , options ... RequestOptionFunc ) (* DraftNote , * Response , error ) {
119
124
project , err := parseID (pid )
120
125
if err != nil {
121
126
return nil , nil , err
122
127
}
123
-
124
128
u := fmt .Sprintf ("projects/%s/merge_requests/%d/draft_notes" , PathEscape (project ), mergeRequest )
125
129
126
130
req , err := s .client .NewRequest (http .MethodPost , u , opt , options )
@@ -140,7 +144,8 @@ func (s *DraftNotesService) CreateDraftNote(pid interface{}, mergeRequest int, o
140
144
// UpdateDraftNoteOptions represents the available UpdateDraftNote()
141
145
// options.
142
146
//
143
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
147
+ // Gitlab API docs:
148
+ // https://docs.gitlab.com/ee/api/draft_notes.html#create-a-draft-note
144
149
type UpdateDraftNoteOptions struct {
145
150
Note * string `url:"note,omitempty" json:"note,omitempty"`
146
151
Position * PositionOptions `url:"position,omitempty" json:"position,omitempty"`
@@ -154,7 +159,6 @@ func (s *DraftNotesService) UpdateDraftNote(pid interface{}, mergeRequest int, n
154
159
if err != nil {
155
160
return nil , nil , err
156
161
}
157
-
158
162
u := fmt .Sprintf ("projects/%s/merge_requests/%d/draft_notes/%d" , PathEscape (project ), mergeRequest , note )
159
163
160
164
req , err := s .client .NewRequest (http .MethodPut , u , opt , options )
@@ -173,7 +177,8 @@ func (s *DraftNotesService) UpdateDraftNote(pid interface{}, mergeRequest int, n
173
177
174
178
// DeleteDraftNote deletes a single draft note for a merge request.
175
179
//
176
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#delete-a-draft-note
180
+ // Gitlab API docs:
181
+ // https://docs.gitlab.com/ee/api/draft_notes.html#delete-a-draft-note
177
182
func (s * DraftNotesService ) DeleteDraftNote (pid interface {}, mergeRequest int , note int , options ... RequestOptionFunc ) (* Response , error ) {
178
183
project , err := parseID (pid )
179
184
if err != nil {
@@ -191,7 +196,8 @@ func (s *DraftNotesService) DeleteDraftNote(pid interface{}, mergeRequest int, n
191
196
192
197
// PublishDraftNote publishes a single draft note for a merge request.
193
198
//
194
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#publish-a-draft-note
199
+ // Gitlab API docs:
200
+ // https://docs.gitlab.com/ee/api/draft_notes.html#publish-a-draft-note
195
201
func (s * DraftNotesService ) PublishDraftNote (pid interface {}, mergeRequest int , note int , options ... RequestOptionFunc ) (* Response , error ) {
196
202
project , err := parseID (pid )
197
203
if err != nil {
@@ -209,13 +215,13 @@ func (s *DraftNotesService) PublishDraftNote(pid interface{}, mergeRequest int,
209
215
210
216
// PublishAllDraftNotes publishes all draft notes for a merge request that belong to the user.
211
217
//
212
- // Gitlab API docs: https://docs.gitlab.com/ee/api/draft_notes.html#publish-a-draft-note
218
+ // Gitlab API docs:
219
+ // https://docs.gitlab.com/ee/api/draft_notes.html#publish-a-draft-note
213
220
func (s * DraftNotesService ) PublishAllDraftNotes (pid interface {}, mergeRequest int , options ... RequestOptionFunc ) (* Response , error ) {
214
221
project , err := parseID (pid )
215
222
if err != nil {
216
223
return nil , err
217
224
}
218
-
219
225
u := fmt .Sprintf ("projects/%s/merge_requests/%d/draft_notes/bulk_publish" , PathEscape (project ), mergeRequest )
220
226
221
227
req , err := s .client .NewRequest (http .MethodPost , u , nil , options )
0 commit comments