Commit fd9c3894 authored by Giorgenes Gelatti's avatar Giorgenes Gelatti

Rename package api fields

Rename fields `details` and `destroy` in the _link
section on the package api
parent e1c44cbc
......@@ -74,8 +74,8 @@ Example response:
"version": "1.0-SNAPSHOT",
"package_type": "maven",
"_links": {
"details": "/namespace1/project1/-/packages/1",
"destroy": "/namespace1/project1/-/packages/1"
"web_path": "/namespace1/project1/-/packages/1",
"delete_api_path": "/namespace1/project1/-/packages/1"
}
},
{
......@@ -84,8 +84,8 @@ Example response:
"version": "1.0.3",
"package_type": "npm",
"_links": {
"details": "/namespace1/project1/-/packages/2",
"destroy": "/namespace1/project1/-/packages/2"
"web_path": "/namespace1/project1/-/packages/1",
"delete_api_path": "/namespace1/project1/-/packages/1"
}
}
]
......@@ -95,8 +95,8 @@ By default, the `GET` request will return 20 results, since the API is [paginate
The `_links` object contains the following properties:
- `details`: URL to fetch details about the package.
- `destroy`: URL to destroy the package. Only available if the request user has permission to do so.
- `web_path`: The path which you can visit in GitLab and see the details of the package.
- `delete_api_path`: The API path to delete the package. Only available if the request user has permission to do so.
## Get a project package
......@@ -126,16 +126,16 @@ Example response:
"version": "1.0-SNAPSHOT",
"package_type": "maven",
"_links": {
"details": "/namespace1/project1/-/packages/1",
"destroy": "/namespace1/project1/-/packages/1"
"web_path": "/namespace1/project1/-/packages/1",
"delete_api_path": "/namespace1/project1/-/packages/1"
}
}
```
The `_links` object contains the following properties:
- `details`: URL to fetch details about the package.
- `destroy`: URL to destroy the package. Only available if the request user has permission to do so.
- `web_path`: The path which you can visit in GitLab and see the details of the package.
- `delete_api_path`: The API path to delete the package. Only available if the request user has permission to do so.
## List package files
......
......@@ -860,11 +860,11 @@ module EE
expose :package_type
expose :_links do
expose :details do |package|
expose_url api_v4_projects_packages_path(package_id: package.id, id: package.project_id)
expose :web_path do |package|
::Gitlab::Routing.url_helpers.project_package_path(package.project, package)
end
expose :destroy, if: can_destroy(:package, &:project) do |package|
expose :delete_api_path, if: can_destroy(:package, &:project) do |package|
expose_url api_v4_projects_packages_path(package_id: package.id, id: package.project_id)
end
end
......
......@@ -19,7 +19,7 @@
"_links": {
"type": "object",
"required": [
"details"
"web_path"
],
"properties": {
"details": {
......
......@@ -77,7 +77,7 @@ describe API::ProjectPackages do
it 'returns no destroy url' do
subject
expect(json_response['_links']).not_to include('destroy')
expect(json_response['_links']).not_to include('delete_api_path')
end
end
......@@ -85,7 +85,7 @@ describe API::ProjectPackages do
it 'returns destroy url' do
subject
expect(json_response['_links']['destroy']).to be_present
expect(json_response['_links']['delete_api_path']).to be_present
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment