2020-02-13 00:08:46 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
module Releases
|
|
|
|
class Link < Grape::Entity
|
2022-11-03 15:11:31 +00:00
|
|
|
expose :id, documentation: { type: 'integer', example: 1 }
|
|
|
|
expose :name, documentation: { type: 'string', example: 'app-v1.0.dmg' }
|
|
|
|
expose :url, documentation:
|
|
|
|
{
|
|
|
|
type: 'string',
|
|
|
|
example: 'https://gitlab.example.com/root/app/-/jobs/688/artifacts/raw/bin/app-v1.0.dmg'
|
|
|
|
}
|
|
|
|
expose :direct_asset_url, documentation:
|
|
|
|
{
|
|
|
|
type: 'string',
|
|
|
|
example: 'https://gitlab.example.com/root/app/-/releases/v1.0/downloads/app-v1.0.dmg'
|
|
|
|
} do |link|
|
2022-06-10 12:09:36 +00:00
|
|
|
::Releases::LinkPresenter.new(link).direct_asset_url
|
|
|
|
end
|
2022-11-03 15:11:31 +00:00
|
|
|
expose :external?, documentation: { type: 'boolean' }, as: :external
|
|
|
|
expose :link_type, documentation: { type: 'string', example: 'other' }
|
2020-02-13 00:08:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|