debian-mirror-gitlab/lib/api/entities/wiki_attachment.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
932 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module API
module Entities
class WikiAttachment < Grape::Entity
include Gitlab::FileMarkdownLinkBuilder
2023-01-13 00:05:48 +05:30
expose :file_name, documentation: { type: 'string', example: 'dk.png' }
expose :file_path, documentation: { type: 'string', example: 'uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png' }
expose :branch, documentation: { type: 'string', example: 'main' }
2020-03-13 15:44:24 +05:30
expose :link do
2023-01-13 00:05:48 +05:30
expose :file_path, as: :url, documentation: {
type: 'string', example: 'uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png'
}
expose :markdown, documentation: {
type: 'string', example: '![dk](uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png)'
} do |_entity|
2020-03-13 15:44:24 +05:30
self.markdown_link
end
end
def filename
2022-06-21 17:19:12 +05:30
object[:file_name]
2020-03-13 15:44:24 +05:30
end
def secure_url
2022-06-21 17:19:12 +05:30
object[:file_path]
2020-03-13 15:44:24 +05:30
end
end
end
end