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: ...@@ -74,8 +74,8 @@ Example response:
"version": "1.0-SNAPSHOT", "version": "1.0-SNAPSHOT",
"package_type": "maven", "package_type": "maven",
"_links": { "_links": {
"details": "/namespace1/project1/-/packages/1", "web_path": "/namespace1/project1/-/packages/1",
"destroy": "/namespace1/project1/-/packages/1" "delete_api_path": "/namespace1/project1/-/packages/1"
} }
}, },
{ {
...@@ -84,8 +84,8 @@ Example response: ...@@ -84,8 +84,8 @@ Example response:
"version": "1.0.3", "version": "1.0.3",
"package_type": "npm", "package_type": "npm",
"_links": { "_links": {
"details": "/namespace1/project1/-/packages/2", "web_path": "/namespace1/project1/-/packages/1",
"destroy": "/namespace1/project1/-/packages/2" "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 ...@@ -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: The `_links` object contains the following properties:
- `details`: URL to fetch details about the package. - `web_path`: The path which you can visit in GitLab and see the details of the package.
- `destroy`: URL to destroy the package. Only available if the request user has permission to do so. - `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 ## Get a project package
...@@ -126,16 +126,16 @@ Example response: ...@@ -126,16 +126,16 @@ Example response:
"version": "1.0-SNAPSHOT", "version": "1.0-SNAPSHOT",
"package_type": "maven", "package_type": "maven",
"_links": { "_links": {
"details": "/namespace1/project1/-/packages/1", "web_path": "/namespace1/project1/-/packages/1",
"destroy": "/namespace1/project1/-/packages/1" "delete_api_path": "/namespace1/project1/-/packages/1"
} }
} }
``` ```
The `_links` object contains the following properties: The `_links` object contains the following properties:
- `details`: URL to fetch details about the package. - `web_path`: The path which you can visit in GitLab and see the details of the package.
- `destroy`: URL to destroy the package. Only available if the request user has permission to do so. - `delete_api_path`: The API path to delete the package. Only available if the request user has permission to do so.
## List package files ## List package files
......
...@@ -860,11 +860,11 @@ module EE ...@@ -860,11 +860,11 @@ module EE
expose :package_type expose :package_type
expose :_links do expose :_links do
expose :details do |package| expose :web_path do |package|
expose_url api_v4_projects_packages_path(package_id: package.id, id: package.project_id) ::Gitlab::Routing.url_helpers.project_package_path(package.project, package)
end 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) expose_url api_v4_projects_packages_path(package_id: package.id, id: package.project_id)
end end
end end
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"_links": { "_links": {
"type": "object", "type": "object",
"required": [ "required": [
"details" "web_path"
], ],
"properties": { "properties": {
"details": { "details": {
......
...@@ -77,7 +77,7 @@ describe API::ProjectPackages do ...@@ -77,7 +77,7 @@ describe API::ProjectPackages do
it 'returns no destroy url' do it 'returns no destroy url' do
subject subject
expect(json_response['_links']).not_to include('destroy') expect(json_response['_links']).not_to include('delete_api_path')
end end
end end
...@@ -85,7 +85,7 @@ describe API::ProjectPackages do ...@@ -85,7 +85,7 @@ describe API::ProjectPackages do
it 'returns destroy url' do it 'returns destroy url' do
subject subject
expect(json_response['_links']['destroy']).to be_present expect(json_response['_links']['delete_api_path']).to be_present
end end
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