Commit 9aba3a90 authored by Kamil Trzciński's avatar Kamil Trzciński

Add Unleash API compatible interface

parent 00eb49d0
......@@ -158,6 +158,7 @@ module API
mount ::API::Templates
mount ::API::Todos
mount ::API::Triggers
mount ::API::Unleash
mount ::API::Users
mount ::API::Variables
mount ::API::Version
......
......@@ -1515,6 +1515,40 @@ module API
end
expose :label, using: Entities::LabelBasic
expose :action
class UnleashIssue < Grape::Entity
expose :name
expose :title, as: :description
expose :enabled
expose :strategies
private
def name
"\##{object.iid}"
end
def enabled
true
end
def strategies
[{ name: 'default' }]
end
end
class UnleashFeatureResponse < Grape::Entity
expose :version
expose :features, with: UnleashIssue
private
def version
1
end
def features
end
end
end
end
......
module API
class Unleash < Grape::API
include PaginationParams
#before { authenticate! }
params do
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::PROJECT_ENDPOINT_REQUIREMENTS do
get ':id/unleash/features' do
issues = IssuesFinder.new(current_user, project_id: user_project.id, label_name: 'rollout')
present issues, with: Entities::UnleashFeatureResponse
end
post ':id/unleash/client/register' do
status :ok
end
post ':id/unleash/client/metrics' do
status :ok
end
end
end
end
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