Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
faf95438
Commit
faf95438
authored
Jul 11, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use view=simple for simplifying merge requests API
parent
e17ac570
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
doc/api/merge_requests.md
doc/api/merge_requests.md
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+3
-3
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+1
-1
No files found.
doc/api/merge_requests.md
View file @
faf95438
...
...
@@ -25,7 +25,7 @@ Parameters:
|
`order_by`
| string | no | Return requests ordered by
`created_at`
or
`updated_at`
fields. Default is
`created_at`
|
|
`sort`
| string | no | Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
|
|
`milestone`
| string | no | Return merge requests for a specific milestone |
|
`
simple`
| boolean | no | R
eturns the
`iid`
, URL, title, description, and basic state of merge request |
|
`
view`
| string | no | If
`simple`
, r
eturns the
`iid`
, URL, title, description, and basic state of merge request |
|
`labels`
| string | no | Return merge requests matching a comma separated list of labels |
|
`created_after`
| datetime | no | Return merge requests created after the given time (inclusive) |
|
`created_before`
| datetime | no | Return merge requests created before the given time (inclusive) |
...
...
lib/api/merge_requests.rb
View file @
faf95438
...
...
@@ -48,7 +48,7 @@ module API
merge_requests
=
paginate
(
merge_requests
)
.
preload
(
:target_project
)
return
merge_requests
if
params
[
:simple
]
return
merge_requests
if
args
[
:view
]
==
'simple'
merge_requests
.
preload
(
:notes
,
:author
,
:assignee
,
:milestone
,
:merge_request_diff
,
:labels
)
...
...
@@ -82,7 +82,7 @@ module API
optional
:labels
,
type:
String
,
desc:
'Comma-separated list of label names'
optional
:created_after
,
type:
DateTime
,
desc:
'Return merge requests created after the specified time'
optional
:created_before
,
type:
DateTime
,
desc:
'Return merge requests created before the specified time'
optional
:
simple
,
type:
Boolean
,
default:
false
,
desc:
'R
eturns the `iid`, URL, title, description, and basic state of merge request'
optional
:
view
,
type:
String
,
values:
%w[simple]
,
desc:
'If simple, r
eturns the `iid`, URL, title, description, and basic state of merge request'
use
:pagination
end
get
":id/merge_requests"
do
...
...
@@ -94,7 +94,7 @@ module API
current_user:
current_user
,
project:
user_project
}
if
params
[
:
simple
]
if
params
[
:
view
]
==
'simple'
options
[
:with
]
=
Entities
::
MergeRequestSimple
else
options
[
:issuable_metadata
]
=
issuable_meta_data
(
merge_requests
,
'MergeRequest'
)
...
...
spec/requests/api/merge_requests_spec.rb
View file @
faf95438
...
...
@@ -70,7 +70,7 @@ describe API::MergeRequests do
end
it
"returns an array of all merge_requests using simple mode"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?
simple=tru
e"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?
view=simpl
e"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
...
...
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