2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
module Releases
|
|
|
|
class Link < Grape::Entity
|
2023-01-13 00:05:48 +05:30
|
|
|
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-07-23 23:45:48 +05:30
|
|
|
::Releases::LinkPresenter.new(link).direct_asset_url
|
|
|
|
end
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :external?, documentation: { type: 'boolean' }, as: :external
|
|
|
|
expose :link_type, documentation: { type: 'string', example: 'other' }
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|