2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
2021-01-03 14:25:43 +05:30
|
|
|
class Pages < ::API::Base
|
2021-01-29 00:20:46 +05:30
|
|
|
feature_category :pages
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
before do
|
|
|
|
require_pages_config_enabled!
|
|
|
|
authenticated_with_can_read_all_resources!
|
|
|
|
end
|
|
|
|
|
|
|
|
params do
|
2023-06-09 08:11:10 +05:30
|
|
|
requires :id, types: [String, Integer],
|
|
|
|
desc: 'The ID or URL-encoded path of the project owned by the authenticated user'
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
|
|
|
|
desc 'Unpublish pages' do
|
2023-06-09 08:11:10 +05:30
|
|
|
detail 'Remove pages. The user must have administrator access. This feature was introduced in GitLab 12.6'
|
|
|
|
success code: 204
|
|
|
|
failure [
|
|
|
|
{ code: 401, message: 'Unauthorized' },
|
|
|
|
{ code: 404, message: 'Not Found' }
|
|
|
|
]
|
|
|
|
tags %w[pages]
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
delete ':id/pages' do
|
|
|
|
authorize! :remove_pages, user_project
|
|
|
|
|
|
|
|
::Pages::DeleteService.new(user_project, current_user).execute
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
no_content!
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|