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
c36821df
Commit
c36821df
authored
Dec 16, 2015
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Api support for requesting starred projects for user
Fixes #4112
parent
a9f7df56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
CHANGELOG
CHANGELOG
+1
-0
doc/api/projects.md
doc/api/projects.md
+15
-0
lib/api/projects.rb
lib/api/projects.rb
+11
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+20
-1
No files found.
CHANGELOG
View file @
c36821df
Please view this file on the master branch, on stable branches it's out of date.
v 8.3.0 (unreleased)
- API support for starred projects for authorized user (Zeger-Jan van de Weg)
- Add open_issues_count to project API (Stan Hu)
- Expand character set of usernames created by Omniauth (Corey Hinshaw)
- Add button to automatically merge a merge request when the build succeeds (Zeger-Jan van de Weg)
...
...
doc/api/projects.md
View file @
c36821df
...
...
@@ -139,6 +139,21 @@ Parameters:
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
### List starred projects
Get a list of projects which are starred by the authenticated user.
```
GET /projects/starred
```
Parameters:
-
`archived`
(optional) - if passed, limit by archived status
-
`order_by`
(optional) - Return requests ordered by
`id`
,
`name`
,
`path`
,
`created_at`
,
`updated_at`
or
`last_activity_at`
fields. Default is
`created_at`
-
`sort`
(optional) - Return requests sorted in
`asc`
or
`desc`
order. Default is
`desc`
-
`search`
(optional) - Return list of authorized projects according to a search criteria
### List ALL projects
Get a list of all GitLab projects (admin only).
...
...
lib/api/projects.rb
View file @
c36821df
...
...
@@ -39,6 +39,17 @@ module API
present
@projects
,
with:
Entities
::
Project
end
# Gets starred project for the authenticated user
#
# Example Request:
# GET /projects/starred
get
'/starred'
do
@projects
=
current_user
.
starred_projects
@projects
=
filter_projects
(
@projects
)
@projects
=
paginate
@projects
present
@projects
,
with:
Entities
::
Project
end
# Get all projects for admin user
#
# Example Request:
...
...
spec/requests/api/projects_spec.rb
View file @
c36821df
...
...
@@ -139,6 +139,25 @@ describe API::API, api: true do
end
end
describe
'GET /projects/starred'
do
before
do
admin
.
starred_projects
<<
project
admin
.
save!
end
it
'should return the starred projects'
do
get
api
(
'/projects/all'
,
admin
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
satisfy
do
|
response
|
response
.
one?
do
|
entry
|
entry
[
'name'
]
==
project
.
name
end
end
end
end
describe
'POST /projects'
do
context
'maximum number of projects reached'
do
it
'should not create new project and respond with 403'
do
...
...
@@ -471,7 +490,7 @@ describe API::API, api: true do
end
end
describe
'PUT /projects/:id/snippets/:s
h
ippet_id'
do
describe
'PUT /projects/:id/snippets/:s
n
ippet_id'
do
it
'should update an existing project snippet'
do
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
"
,
user
),
code:
'updated code'
...
...
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