summaryrefslogtreecommitdiff
path: root/lib/api/pages.rb
blob: 79a6b527581ea120fd5a5dcb62f83967688fa289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module API
  class Pages < Grape::API::Instance
    before do
      require_pages_config_enabled!
      authenticated_with_can_read_all_resources!
    end

    params do
      requires :id, type: String, desc: 'The ID of a project'
    end
    resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      desc 'Unpublish pages' do
        detail 'This feature was introduced in GitLab 12.6'
      end
      delete ':id/pages' do
        authorize! :remove_pages, user_project

        ::Pages::DeleteService.new(user_project, current_user).execute

        no_content!
      end
    end
  end
end