debian-mirror-gitlab/lib/api/version.rb

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

35 lines
808 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-11-03 12:29:30 +05:30
module API
2021-01-03 14:25:43 +05:30
class Version < ::API::Base
2019-07-07 11:18:12 +05:30
helpers ::API::Helpers::GraphqlHelpers
2020-04-08 14:13:33 +05:30
include APIGuard
2021-03-11 19:13:27 +05:30
allow_access_with_scope :read_user, if: -> (request) { request.get? || request.head? }
2019-07-07 11:18:12 +05:30
2016-11-03 12:29:30 +05:30
before { authenticate! }
2022-06-21 17:19:12 +05:30
feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
2021-01-29 00:20:46 +05:30
2019-07-07 11:18:12 +05:30
METADATA_QUERY = <<~EOF
{
metadata {
version
revision
}
}
EOF
2016-11-03 12:29:30 +05:30
desc 'Get the version information of the GitLab instance.' do
detail 'This feature was introduced in GitLab 8.13.'
end
get '/version' do
2019-12-21 20:55:43 +05:30
run_graphql!(
2019-07-07 11:18:12 +05:30
query: METADATA_QUERY,
context: { current_user: current_user },
2019-12-21 20:55:43 +05:30
transform: ->(result) { result.dig('data', 'metadata') }
2019-07-07 11:18:12 +05:30
)
2016-11-03 12:29:30 +05:30
end
end
end