Skip to content
Snippets Groups Projects
Commit c36821df authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg
Browse files

Api support for requesting starred projects for user

Fixes #4112
parent a9f7df56
No related branches found
No related tags found
No related merge requests found
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)
Loading
Loading
Loading
Loading
@@ -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).
Loading
Loading
Loading
Loading
@@ -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:
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -471,7 +490,7 @@ describe API::API, api: true do
end
end
 
describe 'PUT /projects/:id/snippets/:shippet_id' do
describe 'PUT /projects/:id/snippets/:snippet_id' do
it 'should update an existing project snippet' do
put api("/projects/#{project.id}/snippets/#{snippet.id}", user),
code: 'updated code'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment