summaryrefslogtreecommitdiff
path: root/lib/api/wikis.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/wikis.rb')
-rw-r--r--lib/api/wikis.rb50
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/api/wikis.rb b/lib/api/wikis.rb
index 994074ddc67..9dd7916c480 100644
--- a/lib/api/wikis.rb
+++ b/lib/api/wikis.rb
@@ -7,7 +7,7 @@ module API
{
file_name: attrs[:file][:filename],
file_content: attrs[:file][:tempfile].read,
- branch_name: attrs[:branch]
+ branch_name: attrs[:branch],
}
end
@@ -15,48 +15,48 @@ module API
optional :format,
type: String,
values: ProjectWiki::MARKUPS.values.map(&:to_s),
- default: 'markdown',
- desc: 'Format of a wiki page. Available formats are markdown, rdoc, and asciidoc'
+ default: "markdown",
+ desc: "Format of a wiki page. Available formats are markdown, rdoc, and asciidoc"
end
end
WIKI_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(slug: API::NO_SLASH_URL_PART_REGEX)
resource :projects, requirements: WIKI_ENDPOINT_REQUIREMENTS do
- desc 'Get a list of wiki pages' do
+ desc "Get a list of wiki pages" do
success Entities::WikiPageBasic
end
params do
optional :with_content, type: Boolean, default: false, desc: "Include pages' content"
end
- get ':id/wikis' do
+ get ":id/wikis" do
authorize! :read_wiki, user_project
entity = params[:with_content] ? Entities::WikiPage : Entities::WikiPageBasic
present user_project.wiki.pages, with: entity
end
- desc 'Get a wiki page' do
+ desc "Get a wiki page" do
success Entities::WikiPage
end
params do
- requires :slug, type: String, desc: 'The slug of a wiki page'
+ requires :slug, type: String, desc: "The slug of a wiki page"
end
- get ':id/wikis/:slug' do
+ get ":id/wikis/:slug" do
authorize! :read_wiki, user_project
present wiki_page, with: Entities::WikiPage
end
- desc 'Create a wiki page' do
+ desc "Create a wiki page" do
success Entities::WikiPage
end
params do
- requires :title, type: String, desc: 'Title of a wiki page'
- requires :content, type: String, desc: 'Content of a wiki page'
+ requires :title, type: String, desc: "Title of a wiki page"
+ requires :content, type: String, desc: "Content of a wiki page"
use :common_wiki_page_params
end
- post ':id/wikis' do
+ post ":id/wikis" do
authorize! :create_wiki, user_project
page = WikiPages::CreateService.new(user_project, current_user, params).execute
@@ -68,16 +68,16 @@ module API
end
end
- desc 'Update a wiki page' do
+ desc "Update a wiki page" do
success Entities::WikiPage
end
params do
- optional :title, type: String, desc: 'Title of a wiki page'
- optional :content, type: String, desc: 'Content of a wiki page'
+ optional :title, type: String, desc: "Title of a wiki page"
+ optional :content, type: String, desc: "Content of a wiki page"
use :common_wiki_page_params
at_least_one_of :content, :title, :format
end
- put ':id/wikis/:slug' do
+ put ":id/wikis/:slug" do
authorize! :create_wiki, user_project
page = WikiPages::UpdateService.new(user_project, current_user, params).execute(wiki_page)
@@ -89,31 +89,31 @@ module API
end
end
- desc 'Delete a wiki page'
+ desc "Delete a wiki page"
params do
- requires :slug, type: String, desc: 'The slug of a wiki page'
+ requires :slug, type: String, desc: "The slug of a wiki page"
end
- delete ':id/wikis/:slug' do
+ delete ":id/wikis/:slug" do
authorize! :admin_wiki, user_project
status 204
WikiPages::DestroyService.new(user_project, current_user).execute(wiki_page)
end
- desc 'Upload an attachment to the wiki repository' do
- detail 'This feature was introduced in GitLab 11.3.'
+ desc "Upload an attachment to the wiki repository" do
+ detail "This feature was introduced in GitLab 11.3."
success Entities::WikiAttachment
end
params do
- requires :file, type: ::API::Validations::Types::SafeFile, desc: 'The attachment file to be uploaded'
- optional :branch, type: String, desc: 'The name of the branch'
+ requires :file, type: ::API::Validations::Types::SafeFile, desc: "The attachment file to be uploaded"
+ optional :branch, type: String, desc: "The name of the branch"
end
post ":id/wikis/attachments" do
authorize! :create_wiki, user_project
result = ::Wikis::CreateAttachmentService.new(user_project,
- current_user,
- commit_params(declared_params(include_missing: false))).execute
+ current_user,
+ commit_params(declared_params(include_missing: false))).execute
if result[:status] == :success
status(201)