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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ab261efc
Commit
ab261efc
authored
Nov 01, 2018
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter epics by state in API
parent
063e8c5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
0 deletions
+22
-0
doc/api/epics.md
doc/api/epics.md
+2
-0
ee/changelogs/unreleased/7615-api-status-filter.yml
ee/changelogs/unreleased/7615-api-status-filter.yml
+5
-0
ee/lib/api/epics.rb
ee/lib/api/epics.rb
+2
-0
ee/spec/requests/api/epics_spec.rb
ee/spec/requests/api/epics_spec.rb
+13
-0
No files found.
doc/api/epics.md
View file @
ab261efc
...
...
@@ -26,6 +26,7 @@ Gets all epics of the requested group and its subgroups.
GET /groups/:id/epics
GET /groups/:id/epics?author_id=5
GET /groups/:id/epics?labels=bug,reproduced
GET /groups/:id/epics?state=opened
```
| Attribute | Type | Required | Description |
...
...
@@ -36,6 +37,7 @@ GET /groups/:id/epics?labels=bug,reproduced
|
`order_by`
| string | no | Return epics ordered by
`created_at`
or
`updated_at`
fields. Default is
`created_at`
|
|
`sort`
| string | no | Return epics sorted in
`asc`
or
`desc`
order. Default is
`desc`
|
|
`search`
| string | no | Search epics against their
`title`
and
`description`
|
|
`state`
| string | no | Search epics against their
`state`
, possible filters:
`opened`
,
`closed`
and
`all`
, default:
`all`
|
```
bash
curl
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/groups/1/epics
...
...
ee/changelogs/unreleased/7615-api-status-filter.yml
0 → 100644
View file @
ab261efc
---
title
:
Filter epics by state in API
merge_request
:
8179
author
:
type
:
added
ee/lib/api/epics.rb
View file @
ab261efc
...
...
@@ -58,6 +58,8 @@ module API
optional
:sort
,
type:
String
,
values:
%w[asc desc]
,
default:
'desc'
,
desc:
'Return epics sorted in `asc` or `desc` order.'
optional
:search
,
type:
String
,
desc:
'Search epics for text present in the title or description'
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'all'
,
desc:
'Return opened, closed, or all epics'
optional
:author_id
,
type:
Integer
,
desc:
'Return epics which are authored by the user with the given ID'
optional
:labels
,
type:
String
,
desc:
'Comma-separated list of label names'
end
...
...
ee/spec/requests/api/epics_spec.rb
View file @
ab261efc
...
...
@@ -92,6 +92,7 @@ describe API::Epics do
let!
(
:epic
)
do
create
(
:epic
,
group:
group
,
state: :closed
,
created_at:
3
.
days
.
ago
,
updated_at:
2
.
days
.
ago
)
end
...
...
@@ -135,6 +136,18 @@ describe API::Epics do
expect_array_response
([
epic2
.
id
])
end
it
'returns epics matching given status'
do
get
api
(
url
,
user
),
state: :opened
expect_array_response
([
epic2
.
id
])
end
it
'returns all epics when state set to all'
do
get
api
(
url
,
user
),
state: :all
expect_array_response
([
epic2
.
id
,
epic
.
id
])
end
it
'sorts by created_at descending by default'
do
get
api
(
url
,
user
)
...
...
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