labclient 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/labclient.rb +23 -4
- data/lib/labclient/access_levels.rb +24 -30
- data/lib/labclient/branches/branch.rb +25 -0
- data/lib/labclient/branches/create.rb +33 -0
- data/lib/labclient/client.rb +48 -7
- data/lib/labclient/docs.rb +9 -5
- data/lib/labclient/epics/epic.rb +13 -0
- data/lib/labclient/error.rb +1 -0
- data/lib/labclient/files/create.rb +14 -8
- data/lib/labclient/generator/generator.rb +70 -0
- data/lib/labclient/generator/names.rb +68 -0
- data/lib/labclient/generator/template_helper.rb +81 -0
- data/lib/labclient/generator/templates/environments.rb +98 -0
- data/lib/labclient/generator/templates/pages.rb +67 -0
- data/lib/labclient/generator/templates/pipeline_trigger.rb +82 -0
- data/lib/labclient/generator/wizard.rb +142 -0
- data/lib/labclient/groups/group.rb +9 -1
- data/lib/labclient/http.rb +3 -2
- data/lib/labclient/issues/create.rb +2 -0
- data/lib/labclient/issues/issue.rb +31 -1
- data/lib/labclient/issues/update.rb +20 -2
- data/lib/labclient/jobs/delete.rb +1 -1
- data/lib/labclient/jobs/keep.rb +1 -1
- data/lib/labclient/jobs/play.rb +1 -1
- data/lib/labclient/jobs/trace.rb +2 -2
- data/lib/labclient/klass.rb +34 -4
- data/lib/labclient/lab_struct.rb +17 -0
- data/lib/labclient/license/list.rb +2 -2
- data/lib/labclient/members/member.rb +1 -0
- data/lib/labclient/merge_requests/accept.rb +15 -6
- data/lib/labclient/merge_requests/create.rb +12 -0
- data/lib/labclient/merge_requests/merge_request.rb +49 -4
- data/lib/labclient/notes/epics/create.rb +12 -4
- data/lib/labclient/notes/epics/delete.rb +3 -3
- data/lib/labclient/notes/epics/list.rb +21 -4
- data/lib/labclient/notes/epics/show.rb +4 -4
- data/lib/labclient/notes/epics/update.rb +4 -4
- data/lib/labclient/notes/issues/create.rb +11 -1
- data/lib/labclient/notes/issues/list.rb +18 -3
- data/lib/labclient/notes/issues/show.rb +1 -1
- data/lib/labclient/notes/merge_requests/create.rb +8 -0
- data/lib/labclient/notes/merge_requests/list.rb +20 -2
- data/lib/labclient/notes/snippets/create.rb +1 -1
- data/lib/labclient/notes/snippets/list.rb +20 -3
- data/lib/labclient/notes/snippets/show.rb +1 -1
- data/lib/labclient/notifications/update.rb +1 -1
- data/lib/labclient/overview.rb +110 -11
- data/lib/labclient/paginated_response.rb +8 -1
- data/lib/labclient/pipelines/pipeline.rb +41 -0
- data/lib/labclient/projects/methods.rb +71 -2
- data/lib/labclient/projects/reference.rb +14 -0
- data/lib/labclient/projects/snippets/project_snippet.rb +12 -0
- data/lib/labclient/protected_branches/protect.rb +6 -5
- data/lib/labclient/protected_environments/list.rb +29 -0
- data/lib/labclient/protected_environments/protect.rb +53 -0
- data/lib/labclient/protected_environments/protected_environment.rb +22 -0
- data/lib/labclient/protected_environments/show.rb +24 -0
- data/lib/labclient/protected_environments/unprotect.rb +31 -0
- data/lib/labclient/snippets/snippet.rb +2 -2
- data/lib/labclient/users/membership.rb +62 -0
- data/lib/labclient/users/memberships.rb +8 -3
- data/lib/labclient/users/user.rb +13 -1
- data/lib/labclient/version.rb +1 -1
- metadata +37 -9
- data/lib/labclient/open_struct.rb +0 -14
@@ -32,12 +32,12 @@ module LabClient
|
|
32
32
|
:expires_at => "2050-11-14",
|
33
33
|
:historical_max => 0,
|
34
34
|
:maximum_user_count => 48,
|
35
|
-
:licensee =>
|
35
|
+
:licensee => LabStruct {
|
36
36
|
:Name => "GitLab Henley",
|
37
37
|
:Email => "test_user@gitlab.com",
|
38
38
|
:Company => "GitLab, Inc."
|
39
39
|
},
|
40
|
-
:add_ons =>
|
40
|
+
:add_ons => LabStruct {},
|
41
41
|
:expired => false,
|
42
42
|
:overage => 0,
|
43
43
|
:user_limit => 100,
|
@@ -51,6 +51,7 @@ module LabClient
|
|
51
51
|
option 'level', 'Humanized symbol of access level. e.g. :developer'
|
52
52
|
option 'user', 'Collect user object.'
|
53
53
|
option '<permission>?', 'True/False evaluation each guest?, developer? etc'
|
54
|
+
option 'greater_than', 'True/False if user has greater than [Permission Name]'
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|
@@ -7,10 +7,19 @@ module LabClient
|
|
7
7
|
desc 'Merge changes submitted with MR. [Project ID, merge request iid]'
|
8
8
|
|
9
9
|
markdown <<~DOC
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
- <small>if merge request is unable to be accepted (ie: Work in Progress, Closed, Pipeline Pending Completion, or Failed while requiring Success) - you'll get a `405` and the error message 'Method Not Allowed'</small>
|
11
|
+
- <small>If it has some conflicts and can not be merged - you'll get a `406` and the error message 'Branch cannot be merged'</small>
|
12
|
+
- <small>If the `sha` parameter is passed and does not match the HEAD of the source - you'll get a `409` and the error message 'SHA </small>does not match HEAD of source branch'
|
13
|
+
- <small>If you don't have permissions to accept this merge request - you'll get a `401`</small>
|
14
|
+
|
15
|
+
| **Attribute** | **Attribute** |
|
16
|
+
| ---------------------------- | ------------------------------------------------------------------------------------------------- |
|
17
|
+
| merge_commit_message | Custom merge commit message |
|
18
|
+
| squash_commit_message | Custom squash commit message |
|
19
|
+
| squash | if true the commits will be squashed into a single commit on merge |
|
20
|
+
| should_remove_source_branch | if true removes the source branch |
|
21
|
+
| merge_when_pipeline_succeeds | if true the MR is merged when the pipeline succeeds |
|
22
|
+
| sha | if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail |
|
14
23
|
DOC
|
15
24
|
|
16
25
|
example 'client.merge_requests.accept(343, 3)'
|
@@ -29,11 +38,11 @@ module LabClient
|
|
29
38
|
end
|
30
39
|
|
31
40
|
# Accept
|
32
|
-
def accept(project_id, merge_request_id)
|
41
|
+
def accept(project_id, merge_request_id, query = {})
|
33
42
|
project_id = format_id(project_id)
|
34
43
|
merge_request_id = format_id(merge_request_id)
|
35
44
|
|
36
|
-
client.request(:put, "projects/#{project_id}/merge_requests/#{merge_request_id}/merge", MergeRequest)
|
45
|
+
client.request(:put, "projects/#{project_id}/merge_requests/#{merge_request_id}/merge", MergeRequest, query)
|
37
46
|
end
|
38
47
|
end
|
39
48
|
end
|
@@ -41,6 +41,18 @@ module LabClient
|
|
41
41
|
DOC
|
42
42
|
end
|
43
43
|
|
44
|
+
doc 'Create' do
|
45
|
+
desc 'via Project'
|
46
|
+
example <<~DOC
|
47
|
+
project = client.projects.show(264)
|
48
|
+
project.merge_request_create(
|
49
|
+
title: 'New MR!',
|
50
|
+
source_branch: 'sweet-release',
|
51
|
+
target_branch: :master
|
52
|
+
)
|
53
|
+
DOC
|
54
|
+
end
|
55
|
+
|
44
56
|
# Create
|
45
57
|
def create(project_id, query)
|
46
58
|
project_id = format_id(project_id)
|
@@ -51,8 +51,8 @@ module LabClient
|
|
51
51
|
client.merge_requests.delete(project_id, iid)
|
52
52
|
end
|
53
53
|
|
54
|
-
def accept
|
55
|
-
client.merge_requests.accept(project_id, iid)
|
54
|
+
def accept(query = {})
|
55
|
+
client.merge_requests.accept(project_id, iid, query)
|
56
56
|
end
|
57
57
|
|
58
58
|
def merge_ref
|
@@ -99,6 +99,10 @@ module LabClient
|
|
99
99
|
client.notes.merge_requests.list(project_id, iid)
|
100
100
|
end
|
101
101
|
|
102
|
+
def note_create(query)
|
103
|
+
client.notes.merge_requests.create(project_id, iid, query)
|
104
|
+
end
|
105
|
+
|
102
106
|
def todo
|
103
107
|
client.merge_requests.todo(project_id, iid)
|
104
108
|
end
|
@@ -166,9 +170,42 @@ module LabClient
|
|
166
170
|
client.resource_labels.merge_requests.show(project_id, iid, resource_event_id)
|
167
171
|
end
|
168
172
|
|
173
|
+
# Reload
|
174
|
+
def reload
|
175
|
+
update_self client.merge_requests.show(project_id, iid)
|
176
|
+
end
|
177
|
+
|
178
|
+
# Wait for Import / Set a Hard Limit
|
179
|
+
def wait_for_merge_status(total_time = 300, sleep_time = 15)
|
180
|
+
# :unchecked
|
181
|
+
# :cannot_be_merged_recheck
|
182
|
+
# :checking
|
183
|
+
# :cannot_be_merged_rechecking
|
184
|
+
# :can_be_merged
|
185
|
+
# :cannot_be_merged
|
186
|
+
|
187
|
+
# Success
|
188
|
+
# [unchecked, can_be_merged]
|
189
|
+
|
190
|
+
# Fail
|
191
|
+
# [cannot_be_merged cannot_be_merged_recheck]
|
192
|
+
|
193
|
+
Timeout.timeout(total_time) do
|
194
|
+
loop do
|
195
|
+
reload
|
196
|
+
puts "Waiting for Merge Status: #{merge_status}"
|
197
|
+
break if %w[can_be_merged unchecked].include? merge_status
|
198
|
+
raise "Cannot be merged! #{import_error}" if %w[cannot_be_merged cannot_be_merged_recheck].include? merge_status
|
199
|
+
|
200
|
+
sleep sleep_time
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# rubocop:disable Metrics/BlockLength
|
169
206
|
help do
|
170
207
|
subtitle 'MergeRequest'
|
171
|
-
option 'accept', 'Merge changes submitted'
|
208
|
+
option 'accept', 'Merge changes submitted [Hash]'
|
172
209
|
option 'add_time_spent', 'Adds spent time. Accepts Duration or Human Format. (1.hour or "1h")'
|
173
210
|
option 'changes', 'Show merge request changes'
|
174
211
|
option 'closes_issues', 'Show issues that this merge request will close'
|
@@ -176,7 +213,13 @@ module LabClient
|
|
176
213
|
option 'create_pipeline', 'Create new pipeline for this merge request.'
|
177
214
|
option 'delete', 'Delete this merge request.'
|
178
215
|
option 'merge_ref', 'Show Merge Ref'
|
179
|
-
option '
|
216
|
+
option 'reload', 'Reload this merge request object (New API Call)'
|
217
|
+
option 'wait_for_merge_status', 'Looping, wait for merge request status [Timeout, Interval]'
|
218
|
+
|
219
|
+
# Notes
|
220
|
+
option 'notes', 'List notes/comments. [Hash]'
|
221
|
+
option 'note_create', 'Creates a new note. [Hash]'
|
222
|
+
|
180
223
|
option 'participants', 'List participants in this merge request.'
|
181
224
|
option 'pipelines', 'List pipelines in this merge request.'
|
182
225
|
option 'reset_spent_time', 'Resets the spent time'
|
@@ -206,6 +249,8 @@ module LabClient
|
|
206
249
|
option 'resource_labels', 'List of all label events'
|
207
250
|
option 'resource_label', 'Show single label event [Resource Event ID]'
|
208
251
|
end
|
252
|
+
|
253
|
+
# rubocop:enable Metrics/BlockLength
|
209
254
|
end
|
210
255
|
# rubocop:enable Metrics/ClassLength
|
211
256
|
end
|
@@ -4,13 +4,21 @@ module LabClient
|
|
4
4
|
class EpicNotes < Common
|
5
5
|
doc 'Epics' do
|
6
6
|
title 'Create'
|
7
|
-
desc 'Creates a new note for a single
|
7
|
+
desc 'Creates a new note for a single epic [Project, Epic IID]'
|
8
8
|
example 'client.notes.epics.create(16, 2, body: "Hello!")'
|
9
9
|
result <<~DOC
|
10
10
|
=> #<Note id: 44, type: Epic>
|
11
11
|
DOC
|
12
12
|
end
|
13
13
|
|
14
|
+
doc 'Epics' do
|
15
|
+
desc 'Via Epic'
|
16
|
+
example <<~DOC
|
17
|
+
epic = client.epics.show(16, 2)
|
18
|
+
epic.note_create(body: 'There!')
|
19
|
+
DOC
|
20
|
+
end
|
21
|
+
|
14
22
|
doc 'Epics' do
|
15
23
|
markdown <<~DOC
|
16
24
|
| Attribute | Type | Required | Description |
|
@@ -20,13 +28,13 @@ module LabClient
|
|
20
28
|
DOC
|
21
29
|
end
|
22
30
|
|
23
|
-
def create(
|
24
|
-
|
31
|
+
def create(group_id, epic_id, query = {})
|
32
|
+
group_id = format_id(group_id)
|
25
33
|
epic_id = format_id(epic_id)
|
26
34
|
|
27
35
|
query[:created_at] = query[:created_at].to_time.iso8601 if format_time?(query[:created_at])
|
28
36
|
|
29
|
-
client.request(:post, "
|
37
|
+
client.request(:post, "groups/#{group_id}/epics/#{epic_id}/notes", Note, query)
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
@@ -9,12 +9,12 @@ module LabClient
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Delete
|
12
|
-
def delete(
|
13
|
-
|
12
|
+
def delete(group_id, epic_id, note_id)
|
13
|
+
group_id = format_id(group_id)
|
14
14
|
epic_id = format_id(epic_id)
|
15
15
|
note_id = format_id(note_id)
|
16
16
|
|
17
|
-
client.request(:delete, "
|
17
|
+
client.request(:delete, "groups/#{group_id}/epics/#{epic_id}/notes/#{note_id}")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -5,18 +5,35 @@ module LabClient
|
|
5
5
|
@group_name = 'Notes'
|
6
6
|
doc 'Epics' do
|
7
7
|
title 'List'
|
8
|
-
desc 'Gets a list of all notes for a single
|
8
|
+
desc 'Gets a list of all notes for a single epic. [Project ID, Epic IID]'
|
9
|
+
markdown <<~DOC
|
10
|
+
| Attribute | Type | Required | Description |
|
11
|
+
| --------- | ------ | -------- | ------------------------------------------------------------------------------------ |
|
12
|
+
| sort | string | no | Return epic notes sorted in asc or desc order. Default is desc |
|
13
|
+
| order_by | string | no | Return epic notes ordered by created_at or updated_at fields. Default is created_at |
|
14
|
+
DOC
|
15
|
+
end
|
16
|
+
|
17
|
+
doc 'Epics' do
|
9
18
|
example 'client.notes.epics.list(16, 1)'
|
10
19
|
result <<~DOC
|
11
20
|
=> [#<Note id: 21, type: Epic>, #<Note id: 20, type: Epic> .. ]
|
12
21
|
DOC
|
13
22
|
end
|
14
23
|
|
15
|
-
|
16
|
-
|
24
|
+
doc 'Epics' do
|
25
|
+
desc 'Filter or Sort'
|
26
|
+
example 'client.notes.epics.list(16, 1, order_by: :created_at, sort: :asc)'
|
27
|
+
result <<~DOC
|
28
|
+
=> [#<Note id: 21, type: Epic>, #<Note id: 20, type: Epic> .. ]
|
29
|
+
DOC
|
30
|
+
end
|
31
|
+
|
32
|
+
def list(group_id, epic_id, query = {})
|
33
|
+
group_id = format_id(group_id)
|
17
34
|
epic_id = format_id(epic_id)
|
18
35
|
|
19
|
-
client.request(:get, "
|
36
|
+
client.request(:get, "groups/#{group_id}/epics/#{epic_id}/notes", Note, query)
|
20
37
|
end
|
21
38
|
end
|
22
39
|
end
|
@@ -4,19 +4,19 @@ module LabClient
|
|
4
4
|
class EpicNotes < Common
|
5
5
|
doc 'Epics' do
|
6
6
|
title 'Show'
|
7
|
-
desc 'Returns a single note for a given
|
7
|
+
desc 'Returns a single note for a given epic. [Project ID, Epic IID, Note ID]'
|
8
8
|
example 'client.notes.epics.show(16, 1, 43)'
|
9
9
|
result <<~DOC
|
10
10
|
=> #<Note id: 21, type: Epic>
|
11
11
|
DOC
|
12
12
|
end
|
13
13
|
|
14
|
-
def show(
|
15
|
-
|
14
|
+
def show(group_id, epic_id, note_id)
|
15
|
+
group_id = format_id(group_id)
|
16
16
|
epic_id = format_id(epic_id)
|
17
17
|
note_id = format_id(note_id)
|
18
18
|
|
19
|
-
client.request(:get, "
|
19
|
+
client.request(:get, "groups/#{group_id}/epics/#{epic_id}/notes/#{note_id}", Note)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,7 +4,7 @@ module LabClient
|
|
4
4
|
class EpicNotes < Common
|
5
5
|
doc 'Epics' do
|
6
6
|
title 'Update'
|
7
|
-
desc 'Get a single
|
7
|
+
desc 'Get a single group epic. [Project ID, Epic IID, Note ID]'
|
8
8
|
example 'client.notes.epics.update(16, 1, 43, "Updaaate")'
|
9
9
|
result <<~DOC
|
10
10
|
=> #<Note id: 43, type: Epic>
|
@@ -20,13 +20,13 @@ module LabClient
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Show
|
23
|
-
def update(
|
24
|
-
|
23
|
+
def update(group_id, epic_id, note_id, body)
|
24
|
+
group_id = format_id(group_id)
|
25
25
|
epic_id = format_id(epic_id)
|
26
26
|
note_id = format_id(note_id)
|
27
27
|
query = { body: body }
|
28
28
|
|
29
|
-
client.request(:put, "
|
29
|
+
client.request(:put, "groups/#{group_id}/epics/#{epic_id}/notes/#{note_id}", Note, query)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -4,13 +4,21 @@ module LabClient
|
|
4
4
|
class IssueNotes < Common
|
5
5
|
doc 'Issues' do
|
6
6
|
title 'Create'
|
7
|
-
desc 'Creates a new note for a single
|
7
|
+
desc 'Creates a new note for a single issue [Project, Issue IID]'
|
8
8
|
example 'client.notes.issues.create(16, 2, body: "Hello!")'
|
9
9
|
result <<~DOC
|
10
10
|
=> #<Note id: 44, type: Issue>
|
11
11
|
DOC
|
12
12
|
end
|
13
13
|
|
14
|
+
doc 'Issues' do
|
15
|
+
desc 'Via Issue'
|
16
|
+
example <<~DOC
|
17
|
+
issue = client.issues.show(16, 1)
|
18
|
+
issue.note_create(body: 'There!')
|
19
|
+
DOC
|
20
|
+
end
|
21
|
+
|
14
22
|
doc 'Issues' do
|
15
23
|
markdown <<~DOC
|
16
24
|
| Attribute | Type | Required | Description |
|
@@ -26,6 +34,8 @@ module LabClient
|
|
26
34
|
|
27
35
|
query[:created_at] = query[:created_at].to_time.iso8601 if format_time?(query[:created_at])
|
28
36
|
|
37
|
+
# POST /projects/:id/issues/:issue_iid/notes
|
38
|
+
|
29
39
|
client.request(:post, "projects/#{project_id}/issues/#{issue_id}/notes", Note, query)
|
30
40
|
end
|
31
41
|
end
|
@@ -3,20 +3,35 @@ module LabClient
|
|
3
3
|
# Specifics
|
4
4
|
class IssueNotes < Common
|
5
5
|
@group_name = 'Notes'
|
6
|
+
|
6
7
|
doc 'Issues' do
|
7
8
|
title 'List'
|
8
|
-
desc 'Gets a list of all notes for a single
|
9
|
+
desc 'Gets a list of all notes for a single issue. [Project ID, Issue IID]'
|
10
|
+
markdown <<~DOC
|
11
|
+
| Attribute | Type | Required | Description |
|
12
|
+
| --------- | ------ | -------- | ------------------------------------------------------------------------------------ |
|
13
|
+
| sort | string | no | Return issue notes sorted in asc or desc order. Default is desc |
|
14
|
+
| order_by | string | no | Return issue notes ordered by created_at or updated_at fields. Default is created_at |
|
15
|
+
DOC
|
16
|
+
end
|
17
|
+
|
18
|
+
doc 'Issues' do
|
9
19
|
example 'client.notes.issues.list(16, 1)'
|
10
20
|
result <<~DOC
|
11
21
|
=> [#<Note id: 21, type: Issue>, #<Note id: 20, type: Issue> .. ]
|
12
22
|
DOC
|
13
23
|
end
|
14
24
|
|
15
|
-
|
25
|
+
doc 'Issues' do
|
26
|
+
desc 'Sort or Filter'
|
27
|
+
example 'client.notes.issues.list(16, 1, order_by: :created_at, sort: :asc)'
|
28
|
+
end
|
29
|
+
|
30
|
+
def list(project_id, issue_id, query = {})
|
16
31
|
project_id = format_id(project_id)
|
17
32
|
issue_id = format_id(issue_id)
|
18
33
|
|
19
|
-
client.request(:get, "projects/#{project_id}/issues/#{issue_id}/notes", Note)
|
34
|
+
client.request(:get, "projects/#{project_id}/issues/#{issue_id}/notes", Note, query)
|
20
35
|
end
|
21
36
|
end
|
22
37
|
end
|
@@ -4,7 +4,7 @@ module LabClient
|
|
4
4
|
class IssueNotes < Common
|
5
5
|
doc 'Issues' do
|
6
6
|
title 'Show'
|
7
|
-
desc 'Returns a single note for a given
|
7
|
+
desc 'Returns a single note for a given issue. [Project ID, Issue IID, Note ID]'
|
8
8
|
example 'client.notes.issues.show(16, 1, 43)'
|
9
9
|
result <<~DOC
|
10
10
|
=> #<Note id: 21, type: Issue>
|
@@ -11,6 +11,14 @@ module LabClient
|
|
11
11
|
DOC
|
12
12
|
end
|
13
13
|
|
14
|
+
doc 'Merge Request' do
|
15
|
+
desc 'Via Merge Request'
|
16
|
+
example <<~DOC
|
17
|
+
merge_request = client.merge_requests.show(16, 2)
|
18
|
+
merge_request.note_create(body: 'There!')
|
19
|
+
DOC
|
20
|
+
end
|
21
|
+
|
14
22
|
doc 'Merge Requests' do
|
15
23
|
markdown <<~DOC
|
16
24
|
| Attribute | Type | Required | Description |
|
@@ -6,17 +6,35 @@ module LabClient
|
|
6
6
|
doc 'Merge Requests' do
|
7
7
|
title 'List'
|
8
8
|
desc 'Gets a list of all notes for a single merge request. [Project ID, Merge Request IID]'
|
9
|
+
|
10
|
+
markdown <<~DOC
|
11
|
+
| Attribute | Type | Required | Description |
|
12
|
+
| --------- | ------ | -------- | -------------------------------------------------------------------------------------------- |
|
13
|
+
| sort | string | no | Return merge request notes sorted in asc or desc order. Default is desc |
|
14
|
+
| order_by | string | no | Return merge request notes ordered by created_at or updated_at fields. Default is created_at |
|
15
|
+
DOC
|
16
|
+
end
|
17
|
+
|
18
|
+
doc 'Merge Requests' do
|
9
19
|
example 'client.notes.merge_requests.list(16, 1)'
|
10
20
|
result <<~DOC
|
11
21
|
=> [#<Note id: 21, type: MergeRequest>, #<Note id: 20, type: MergeRequest> .. ]
|
12
22
|
DOC
|
13
23
|
end
|
14
24
|
|
15
|
-
|
25
|
+
doc 'Merge Requests' do
|
26
|
+
desc 'Sort or Filter'
|
27
|
+
example 'client.notes.merge_requests.list(16, 1, order_by: :created_at, sort: :asc)'
|
28
|
+
result <<~DOC
|
29
|
+
=> [#<Note id: 21, type: MergeRequest>, #<Note id: 20, type: MergeRequest> .. ]
|
30
|
+
DOC
|
31
|
+
end
|
32
|
+
|
33
|
+
def list(project_id, merge_request_id, query = {})
|
16
34
|
project_id = format_id(project_id)
|
17
35
|
merge_request_id = format_id(merge_request_id)
|
18
36
|
|
19
|
-
client.request(:get, "projects/#{project_id}/merge_requests/#{merge_request_id}/notes", Note)
|
37
|
+
client.request(:get, "projects/#{project_id}/merge_requests/#{merge_request_id}/notes", Note, query)
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|