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
Tatuya Kamada
gitlab-ce
Commits
039c6d60
Commit
039c6d60
authored
Feb 20, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Moved `DELETE /projects/:id/star` to `POST /projects/:id/unstar`
parent
c89449e6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
8 deletions
+13
-8
changelogs/unreleased/api-star-restful.yml
changelogs/unreleased/api-star-restful.yml
+4
-0
doc/api/projects.md
doc/api/projects.md
+3
-3
doc/api/v3_to_v4.md
doc/api/v3_to_v4.md
+1
-0
lib/api/projects.rb
lib/api/projects.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+4
-4
No files found.
changelogs/unreleased/api-star-restful.yml
0 → 100644
View file @
039c6d60
---
title
:
'
API:
Moved
`DELETE
/projects/:id/star`
to
`POST
/projects/:id/unstar`'
merge_request
:
9328
author
:
Robert Schilling
doc/api/projects.md
View file @
039c6d60
...
@@ -609,7 +609,7 @@ Example response:
...
@@ -609,7 +609,7 @@ Example response:
Unstars a given project. Returns status code
`304`
if the project is not starred.
Unstars a given project. Returns status code
`304`
if the project is not starred.
```
```
DELETE /projects/:id/
star
POST /projects/:id/un
star
```
```
| Attribute | Type | Required | Description |
| Attribute | Type | Required | Description |
...
@@ -617,7 +617,7 @@ DELETE /projects/:id/star
...
@@ -617,7 +617,7 @@ DELETE /projects/:id/star
|
`id`
| integer/string | yes | The ID of the project or NAMESPACE/PROJECT_NAME |
|
`id`
| integer/string | yes | The ID of the project or NAMESPACE/PROJECT_NAME |
```
bash
```
bash
curl
--request
DELETE
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/projects/5/
star"
curl
--request
POST
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
"https://gitlab.example.com/api/v3/projects/5/un
star"
```
```
Example response:
Example response:
...
@@ -1194,4 +1194,4 @@ Parameters:
...
@@ -1194,4 +1194,4 @@ Parameters:
| --------- | ---- | -------- | ----------- |
| --------- | ---- | -------- | ----------- |
|
`query`
| string | yes | A string contained in the project name |
|
`query`
| string | yes | A string contained in the project name |
|
`order_by`
| string | no | Return requests ordered by
`id`
,
`name`
,
`created_at`
or
`last_activity_at`
fields |
|
`order_by`
| string | no | Return requests ordered by
`id`
,
`name`
,
`created_at`
or
`last_activity_at`
fields |
|
`sort`
| string | no | Return requests sorted in
`asc`
or
`desc`
order |
|
`sort`
| string | no | Return requests sorted in
`asc`
or
`desc`
order |
\ No newline at end of file
doc/api/v3_to_v4.md
View file @
039c6d60
...
@@ -13,6 +13,7 @@ changes are in V4:
...
@@ -13,6 +13,7 @@ changes are in V4:
-
Project snippets do not return deprecated field
`expires_at`
-
Project snippets do not return deprecated field
`expires_at`
-
Endpoints under
`projects/:id/keys`
have been removed (use
`projects/:id/deploy_keys`
)
-
Endpoints under
`projects/:id/keys`
have been removed (use
`projects/:id/deploy_keys`
)
-
Status 409 returned for POST
`project/:id/members`
when a member already exists
-
Status 409 returned for POST
`project/:id/members`
when a member already exists
-
Moved
`DELETE /projects/:id/star`
to
`POST /projects/:id/unstar`
-
Removed the following deprecated Templates endpoints (these are still accessible with
`/templates`
prefix)
-
Removed the following deprecated Templates endpoints (these are still accessible with
`/templates`
prefix)
-
`/licences`
-
`/licences`
-
`/licences/:key`
-
`/licences/:key`
...
...
lib/api/projects.rb
View file @
039c6d60
...
@@ -266,7 +266,7 @@ module API
...
@@ -266,7 +266,7 @@ module API
desc
'Unstar a project'
do
desc
'Unstar a project'
do
success
Entities
::
Project
success
Entities
::
Project
end
end
delete
':id/
star'
do
post
':id/un
star'
do
if
current_user
.
starred?
(
user_project
)
if
current_user
.
starred?
(
user_project
)
current_user
.
toggle_star
(
user_project
)
current_user
.
toggle_star
(
user_project
)
user_project
.
reload
user_project
.
reload
...
...
spec/requests/api/projects_spec.rb
View file @
039c6d60
...
@@ -1235,7 +1235,7 @@ describe API::Projects, api: true do
...
@@ -1235,7 +1235,7 @@ describe API::Projects, api: true do
end
end
end
end
describe
'
DELETE /projects/:id/
star'
do
describe
'
POST /projects/:id/un
star'
do
context
'on a starred project'
do
context
'on a starred project'
do
before
do
before
do
user
.
toggle_star
(
project
)
user
.
toggle_star
(
project
)
...
@@ -1243,16 +1243,16 @@ describe API::Projects, api: true do
...
@@ -1243,16 +1243,16 @@ describe API::Projects, api: true do
end
end
it
'unstars the project'
do
it
'unstars the project'
do
expect
{
delete
api
(
"/projects/
#{
project
.
id
}
/
star"
,
user
)
}.
to
change
{
project
.
reload
.
star_count
}.
by
(
-
1
)
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/un
star"
,
user
)
}.
to
change
{
project
.
reload
.
star_count
}.
by
(
-
1
)
expect
(
response
).
to
have_http_status
(
20
0
)
expect
(
response
).
to
have_http_status
(
20
1
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
0
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
0
)
end
end
end
end
context
'on an unstarred project'
do
context
'on an unstarred project'
do
it
'does not modify the star count'
do
it
'does not modify the star count'
do
expect
{
delete
api
(
"/projects/
#{
project
.
id
}
/
star"
,
user
)
}.
not_to
change
{
project
.
reload
.
star_count
}
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/un
star"
,
user
)
}.
not_to
change
{
project
.
reload
.
star_count
}
expect
(
response
).
to
have_http_status
(
304
)
expect
(
response
).
to
have_http_status
(
304
)
end
end
...
...
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