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

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

33 lines
933 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
module API
2021-01-03 14:25:43 +05:30
class ProjectStatistics < ::API::Base
2021-01-29 00:20:46 +05:30
feature_category :source_code_management
2019-07-07 11:18:12 +05:30
before do
authenticate!
authorize! :daily_statistics, user_project
end
params do
2023-01-13 00:05:48 +05:30
requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
2019-07-07 11:18:12 +05:30
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
2023-01-13 00:05:48 +05:30
desc 'Get the list of project fetch statistics for the last 30 days' do
success Entities::ProjectDailyStatistics
failure [
{ code: 404, message: '404 Project Not Found' },
{ code: 401, message: '401 Unauthorized' }
]
tags %w[projects]
end
2019-07-07 11:18:12 +05:30
get ":id/statistics" do
statistic_finder = ::Projects::DailyStatisticsFinder.new(user_project)
present statistic_finder, with: Entities::ProjectDailyStatistics
end
end
end
end