diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
commit | e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch) | |
tree | 2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /lib/api/entities | |
parent | ffda4e7bcac36987f936b4ba515995a6698698f0 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'lib/api/entities')
-rw-r--r-- | lib/api/entities/blob.rb | 7 | ||||
-rw-r--r-- | lib/api/entities/bulk_imports/export_batch_status.rb | 15 | ||||
-rw-r--r-- | lib/api/entities/bulk_imports/export_status.rb | 4 | ||||
-rw-r--r-- | lib/api/entities/ci/runner.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/ci/variable.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/dictionary/table.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/group.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/plan_limit.rb | 5 | ||||
-rw-r--r-- | lib/api/entities/project_hook.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/protected_ref_access.rb | 7 |
10 files changed, 39 insertions, 6 deletions
diff --git a/lib/api/entities/blob.rb b/lib/api/entities/blob.rb index 12700d99865..b4206679ac9 100644 --- a/lib/api/entities/blob.rb +++ b/lib/api/entities/blob.rb @@ -15,6 +15,13 @@ module API expose :ref expose :startline expose :project_id + expose :group_id, if: ->(object) { object.is_a?(Gitlab::Search::FoundWikiPage) } + + private + + def group_id + object.group&.id + end end end end diff --git a/lib/api/entities/bulk_imports/export_batch_status.rb b/lib/api/entities/bulk_imports/export_batch_status.rb new file mode 100644 index 00000000000..6e4a2fc8f93 --- /dev/null +++ b/lib/api/entities/bulk_imports/export_batch_status.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module API + module Entities + module BulkImports + class ExportBatchStatus < Grape::Entity + expose :status, documentation: { type: 'string', example: 'started', values: %w[started finished failed] } + expose :batch_number, documentation: { type: 'integer', example: 1 } + expose :objects_count, documentation: { type: 'integer', example: 100 } + expose :error, documentation: { type: 'string', example: 'Error message' } + expose :updated_at, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' } + end + end + end +end diff --git a/lib/api/entities/bulk_imports/export_status.rb b/lib/api/entities/bulk_imports/export_status.rb index fee983c6fd8..1e5ee6ec210 100644 --- a/lib/api/entities/bulk_imports/export_status.rb +++ b/lib/api/entities/bulk_imports/export_status.rb @@ -8,6 +8,10 @@ module API expose :status, documentation: { type: 'string', example: 'started', values: %w[started finished failed] } expose :error, documentation: { type: 'string', example: 'Error message' } expose :updated_at, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' } + expose :batched, documentation: { type: 'boolean', example: true } + expose :batches_count, documentation: { type: 'integer', example: 2 } + expose :total_objects_count, documentation: { type: 'integer', example: 100 } + expose :batches, if: ->(export, _options) { export.batched? }, using: ExportBatchStatus end end end diff --git a/lib/api/entities/ci/runner.rb b/lib/api/entities/ci/runner.rb index 9361709b6ed..441e1dc1117 100644 --- a/lib/api/entities/ci/runner.rb +++ b/lib/api/entities/ci/runner.rb @@ -6,6 +6,7 @@ module API class Runner < Grape::Entity expose :id, documentation: { type: 'integer', example: 8 } expose :description, documentation: { type: 'string', example: 'test-1-20150125' } + # TODO: return null in 17.0 and remove in v5 https://gitlab.com/gitlab-org/gitlab/-/issues/415159 expose :ip_address, documentation: { type: 'string', example: '127.0.0.1' } # TODO Remove in v5 in favor of `paused` for REST calls, see https://gitlab.com/gitlab-org/gitlab/-/issues/375709 expose :active, documentation: { type: 'boolean', example: true } diff --git a/lib/api/entities/ci/variable.rb b/lib/api/entities/ci/variable.rb index 47597cb77be..4336f82fb5e 100644 --- a/lib/api/entities/ci/variable.rb +++ b/lib/api/entities/ci/variable.rb @@ -14,6 +14,8 @@ module API expose :raw?, as: :raw, if: -> (entity, _) { entity.respond_to?(:raw?) }, documentation: { type: 'boolean' } expose :environment_scope, if: -> (entity, _) { entity.respond_to?(:environment_scope) }, documentation: { type: 'string', example: '*' } + expose :description, if: -> (entity, _) { entity.respond_to?(:description) }, + documentation: { type: 'string', example: 'This variable is being used for ...' } end end end diff --git a/lib/api/entities/dictionary/table.rb b/lib/api/entities/dictionary/table.rb index 8d4e3fb959d..93e82d34b14 100644 --- a/lib/api/entities/dictionary/table.rb +++ b/lib/api/entities/dictionary/table.rb @@ -5,7 +5,7 @@ module API module Dictionary class Table < Grape::Entity expose :table_name, documentation: { type: :string, example: 'users' } - expose :feature_categories, documentation: { type: :array, example: ['database'] } + expose :feature_categories, documentation: { type: :string, is_array: true, example: 'database' } end end end diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb index 246fb819890..9296617dac9 100644 --- a/lib/api/entities/group.rb +++ b/lib/api/entities/group.rb @@ -21,6 +21,7 @@ module API expose :full_name, :full_path expose :created_at expose :parent_id + expose :shared_runners_setting expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes diff --git a/lib/api/entities/plan_limit.rb b/lib/api/entities/plan_limit.rb index 753c595d65f..27b24a60305 100644 --- a/lib/api/entities/plan_limit.rb +++ b/lib/api/entities/plan_limit.rb @@ -14,6 +14,11 @@ module API expose :enforcement_limit, documentation: { type: 'integer', example: 15000 } expose :generic_packages_max_file_size, documentation: { type: 'integer', example: 5368709120 } expose :helm_max_file_size, documentation: { type: 'integer', example: 5242880 } + expose :limits_history, documentation: { + type: 'object', + example: '{"enforcement_limit"=>[{"timestamp"=>1686909124, "user_id"=>1, "username"=>"x", "value"=>5}], + "notification_limit"=>[{"timestamp"=>1686909124, "user_id"=>2, "username"=>"y", "value"=>7}]}' + } expose :maven_max_file_size, documentation: { type: 'integer', example: 3221225472 } expose :notification_limit, documentation: { type: 'integer', example: 15000 } expose :npm_max_file_size, documentation: { type: 'integer', example: 524288000 } diff --git a/lib/api/entities/project_hook.rb b/lib/api/entities/project_hook.rb index bffb057abed..b85d2747226 100644 --- a/lib/api/entities/project_hook.rb +++ b/lib/api/entities/project_hook.rb @@ -14,6 +14,7 @@ module API expose :job_events, documentation: { type: 'boolean' } expose :releases_events, documentation: { type: 'boolean' } expose :push_events_branch_filter, documentation: { type: 'string', example: 'my-branch-*' } + expose :emoji_events, documentation: { type: 'boolean' } end end end diff --git a/lib/api/entities/protected_ref_access.rb b/lib/api/entities/protected_ref_access.rb index 28e0ef540d5..3cac91ccddc 100644 --- a/lib/api/entities/protected_ref_access.rb +++ b/lib/api/entities/protected_ref_access.rb @@ -5,12 +5,9 @@ module API class ProtectedRefAccess < Grape::Entity expose :id, documentation: { type: 'integer', example: 1 } expose :access_level, documentation: { type: 'integer', example: 40 } - expose :access_level_description, - documentation: { type: 'string', example: 'Maintainers' } do |protected_ref_access| - protected_ref_access.humanize - end + expose :humanize, as: :access_level_description, documentation: { type: 'string', example: 'Maintainers' } expose :deploy_key_id, documentation: { type: 'integer', example: 1 }, - if: ->(access) { access.has_attribute?(:deploy_key_id) && access.deploy_key_id } + if: ->(access) { access.has_attribute?(:deploy_key_id) } end end end |