Commit f6eff3dc authored by Sean Carroll's avatar Sean Carroll
parent 33ccb22e
---
title: Expose `release_links.type` via API
merge_request: 33154
author:
type: changed
...@@ -9,6 +9,7 @@ module API ...@@ -9,6 +9,7 @@ module API
expose :url expose :url
expose :direct_asset_url expose :direct_asset_url
expose :external?, as: :external expose :external?, as: :external
expose :link_type
def direct_asset_url def direct_asset_url
return object.url unless object.filepath return object.url unless object.filepath
......
...@@ -40,6 +40,7 @@ module API ...@@ -40,6 +40,7 @@ module API
requires :name, type: String, desc: 'The name of the link' requires :name, type: String, desc: 'The name of the link'
requires :url, type: String, desc: 'The URL of the link' requires :url, type: String, desc: 'The URL of the link'
optional :filepath, type: String, desc: 'The filepath of the link' optional :filepath, type: String, desc: 'The filepath of the link'
optional :link_type, type: String, desc: 'The link type'
end end
post 'links' do post 'links' do
authorize! :create_release, release authorize! :create_release, release
...@@ -75,6 +76,7 @@ module API ...@@ -75,6 +76,7 @@ module API
optional :name, type: String, desc: 'The name of the link' optional :name, type: String, desc: 'The name of the link'
optional :url, type: String, desc: 'The URL of the link' optional :url, type: String, desc: 'The URL of the link'
optional :filepath, type: String, desc: 'The filepath of the link' optional :filepath, type: String, desc: 'The filepath of the link'
optional :link_type, type: String, desc: 'The link type'
at_least_one_of :name, :url at_least_one_of :name, :url
end end
put do put do
......
...@@ -6,5 +6,6 @@ FactoryBot.define do ...@@ -6,5 +6,6 @@ FactoryBot.define do
sequence(:name) { |n| "release-18.#{n}.dmg" } sequence(:name) { |n| "release-18.#{n}.dmg" }
sequence(:url) { |n| "https://example.com/scrambled-url/app-#{n}.zip" } sequence(:url) { |n| "https://example.com/scrambled-url/app-#{n}.zip" }
sequence(:filepath) { |n| "/binaries/awesome-app-#{n}" } sequence(:filepath) { |n| "/binaries/awesome-app-#{n}" }
link_type { 'other' }
end end
end end
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
"filepath": { "type": "string" }, "filepath": { "type": "string" },
"url": { "type": "string" }, "url": { "type": "string" },
"direct_asset_url": { "type": "string" }, "direct_asset_url": { "type": "string" },
"external": { "type": "boolean" } "external": { "type": "boolean" },
"link_type": { "type": "string" }
}, },
"additionalProperties": false "additionalProperties": false
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment