diff options
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/api.rb | 8 | ||||
-rw-r--r-- | lib/api/entities/error_tracking.rb | 10 | ||||
-rw-r--r-- | lib/api/entities/package_file.rb | 11 | ||||
-rw-r--r-- | lib/api/error_tracking/project_settings.rb | 30 | ||||
-rw-r--r-- | lib/api/geo.rb | 7 | ||||
-rw-r--r-- | lib/api/package_files.rb | 22 | ||||
-rw-r--r-- | lib/api/topics.rb | 4 |
7 files changed, 66 insertions, 26 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 3857979b67b..d49b11d812b 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -195,11 +195,13 @@ module API mount ::API::DeployTokens mount ::API::Deployments mount ::API::Environments + mount ::API::ErrorTracking::ProjectSettings mount ::API::FeatureFlags mount ::API::FeatureFlagsUserLists mount ::API::Features mount ::API::Files mount ::API::FreezePeriods + mount ::API::Geo mount ::API::GroupAvatar mount ::API::GroupClusters mount ::API::GroupExport @@ -215,6 +217,7 @@ module API mount ::API::MergeRequestDiffs mount ::API::Metadata mount ::API::Metrics::UserStarredDashboards + mount ::API::PackageFiles mount ::API::PersonalAccessTokens::SelfInformation mount ::API::PersonalAccessTokens mount ::API::ProjectClusters @@ -245,6 +248,7 @@ module API mount ::API::Terraform::Modules::V1::Packages mount ::API::Terraform::State mount ::API::Terraform::StateVersion + mount ::API::Topics mount ::API::Unleash mount ::API::UserCounts mount ::API::Wikis @@ -276,10 +280,8 @@ module API mount ::API::Discussions mount ::API::ErrorTracking::ClientKeys mount ::API::ErrorTracking::Collector - mount ::API::ErrorTracking::ProjectSettings mount ::API::Events mount ::API::GenericPackages - mount ::API::Geo mount ::API::GoProxy mount ::API::GroupBoards mount ::API::GroupContainerRepositories @@ -305,7 +307,6 @@ module API mount ::API::NpmProjectPackages mount ::API::NugetGroupPackages mount ::API::NugetProjectPackages - mount ::API::PackageFiles mount ::API::Pages mount ::API::PagesDomains mount ::API::ProjectContainerRepositories @@ -327,7 +328,6 @@ module API mount ::API::Tags mount ::API::Templates mount ::API::Todos - mount ::API::Topics mount ::API::UsageData mount ::API::UsageDataNonSqlMetrics mount ::API::UsageDataQueries diff --git a/lib/api/entities/error_tracking.rb b/lib/api/entities/error_tracking.rb index 163bda92680..27288b8bbe8 100644 --- a/lib/api/entities/error_tracking.rb +++ b/lib/api/entities/error_tracking.rb @@ -4,11 +4,11 @@ module API module Entities module ErrorTracking class ProjectSetting < Grape::Entity - expose :enabled, as: :active - expose :project_name - expose :sentry_external_url - expose :api_url - expose :integrated + expose :enabled, as: :active, documentation: { type: 'boolean' } + expose :project_name, documentation: { type: 'string', example: 'sample sentry project' } + expose :sentry_external_url, documentation: { type: 'string', example: 'https://sentry.io/myawesomeproject/project' } + expose :api_url, documentation: { type: 'string', example: 'https://sentry.io/api/0/projects/myawesomeproject/project' } + expose :integrated, documentation: { type: 'boolean' } def integrated return false unless ::Feature.enabled?(:integrated_error_tracking, object.project) diff --git a/lib/api/entities/package_file.rb b/lib/api/entities/package_file.rb index e34a6a7aa1d..19372b75012 100644 --- a/lib/api/entities/package_file.rb +++ b/lib/api/entities/package_file.rb @@ -3,9 +3,14 @@ module API module Entities class PackageFile < Grape::Entity - expose :id, :package_id, :created_at - expose :file_name, :size - expose :file_md5, :file_sha1, :file_sha256 + expose :id, documentation: { type: 'integer', example: 225 } + expose :package_id, documentation: { type: 'integer', example: 4 } + expose :created_at, documentation: { type: 'dateTime', example: '2018-11-07T15:25:52.199Z' } + expose :file_name, documentation: { type: 'string', example: 'my-app-1.5-20181107.152550-1.jar' } + expose :size, documentation: { type: 'integer', example: '2421' } + expose :file_md5, documentation: { type: 'string', example: '58e6a45a629910c6ff99145a688971ac' } + expose :file_sha1, documentation: { type: 'string', example: 'ebd193463d3915d7e22219f52740056dfd26cbfe' } + expose :file_sha256, documentation: { type: 'string', example: 'a903393463d3915d7e22219f52740056dfd26cbfeff321b' } expose :pipelines, if: ->(package_file) { package_file.pipelines.present? }, using: Package::Pipeline end end diff --git a/lib/api/error_tracking/project_settings.rb b/lib/api/error_tracking/project_settings.rb index 01a55fbbd55..ec1d6a8b87f 100644 --- a/lib/api/error_tracking/project_settings.rb +++ b/lib/api/error_tracking/project_settings.rb @@ -4,6 +4,8 @@ module API class ErrorTracking::ProjectSettings < ::API::Base before { authenticate! } + ERROR_TRACKING_PROJECT_SETTINGS_TAGS = %w[error_tracking_project_settings].freeze + feature_category :error_tracking urgency :low @@ -14,7 +16,8 @@ module API end params do - requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project' + requires :id, types: [String, Integer], + desc: 'The ID or URL-encoded path of the project owned by the authenticated user' end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do @@ -24,22 +27,35 @@ module API not_found!('Error Tracking Setting') unless project_setting end - desc 'Get error tracking settings for the project' do - detail 'This feature was introduced in GitLab 12.7.' + desc 'Get Error Tracking settings' do + detail 'Get error tracking settings for the project. This feature was introduced in GitLab 12.7.' success Entities::ErrorTracking::ProjectSetting + tags ERROR_TRACKING_PROJECT_SETTINGS_TAGS end get ':id/error_tracking/settings' do present project_setting, with: Entities::ErrorTracking::ProjectSetting end - desc 'Enable or disable error tracking settings for the project' do - detail 'This feature was introduced in GitLab 12.8.' + desc 'Enable or disable the Error Tracking project settings' do + detail 'The API allows you to enable or disable the Error Tracking settings for a project.'\ + 'Only for users with the Maintainer role for the project.' success Entities::ErrorTracking::ProjectSetting + failure [ + { code: 400, message: 'Bad request' }, + { code: 401, message: 'Unauthorized' }, + { code: 404, message: 'Not found' } + ] + tags ERROR_TRACKING_PROJECT_SETTINGS_TAGS end params do - requires :active, type: Boolean, desc: 'Specifying whether to enable or disable error tracking settings', allow_blank: false - optional :integrated, type: Boolean, desc: 'Specifying whether to enable or disable integrated error tracking' + requires :active, + type: Boolean, + desc: 'Pass true to enable the already configured Error Tracking settings or false to disable it.', + allow_blank: false + optional :integrated, + type: Boolean, + desc: 'Pass true to enable the integrated Error Tracking backend. Available in GitLab 14.2 and later.' end patch ':id/error_tracking/settings/' do diff --git a/lib/api/geo.rb b/lib/api/geo.rb index cb04d2a4e1e..8798b76b52b 100644 --- a/lib/api/geo.rb +++ b/lib/api/geo.rb @@ -13,6 +13,13 @@ module API end resource :geo do + desc 'Returns a Geo proxy response' do + summary "Determine if a Geo site should proxy requests" + success code: 200 + failure [{ code: 403, message: 'Forbidden' }] + tags %w[geo] + end + # Workhorse calls this to determine if it is a Geo site that should proxy # requests. Workhorse doesn't know if it's in a FOSS/EE context. get '/proxy' do diff --git a/lib/api/package_files.rb b/lib/api/package_files.rb index bf1cd88c18c..bb9f96cdbb1 100644 --- a/lib/api/package_files.rb +++ b/lib/api/package_files.rb @@ -8,19 +8,23 @@ module API authorize_packages_access!(user_project) end + PACKAGE_FILES_TAGS = %w[package_files].freeze + feature_category :package_registry urgency :low helpers ::API::Helpers::PackagesHelpers params do - requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project' - requires :package_id, type: Integer, desc: 'The ID of a package' + requires :id, types: [String, Integer], desc: 'ID or URL-encoded path of the project' + requires :package_id, type: Integer, desc: 'ID of a package' end resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do - desc 'Get all package files' do - detail 'This feature was introduced in GitLab 11.8' + desc 'List package files' do + detail 'Get a list of package files of a single package' success ::API::Entities::PackageFile + is_array true + tags PACKAGE_FILES_TAGS end params do use :pagination @@ -35,11 +39,17 @@ module API present paginate(package_files), with: ::API::Entities::PackageFile end - desc 'Remove a package file' do + desc 'Delete a package file' do detail 'This feature was introduced in GitLab 13.12' + success code: 204 + failure [ + { code: 403, message: 'Forbidden' }, + { code: 404, message: 'Not found' } + ] + tags PACKAGE_FILES_TAGS end params do - requires :package_file_id, type: Integer, desc: 'The ID of a package file' + requires :package_file_id, type: Integer, desc: 'ID of a package file' end delete ':id/packages/:package_id/package_files/:package_file_id' do authorize_destroy_package!(user_project) diff --git a/lib/api/topics.rb b/lib/api/topics.rb index ff28ccde788..b16b40244d4 100644 --- a/lib/api/topics.rb +++ b/lib/api/topics.rb @@ -11,7 +11,9 @@ module API success Entities::Projects::Topic end params do - optional :search, type: String, desc: 'Return list of topics matching the search criteria' + optional :search, type: String, + desc: 'Return list of topics matching the search criteria', + documentation: { example: 'search' } optional :without_projects, type: Boolean, desc: 'Return list of topics without assigned projects' use :pagination end |