Commit bfe2a24d authored by Bob Van Landuyt's avatar Bob Van Landuyt

Add feature categories to the API B -> G

This adds a feature category to API classes from B -> G
parent d4e08b04
......@@ -8,6 +8,8 @@ module API
helpers ::API::Helpers::BadgesHelpers
feature_category :continuous_integration
helpers do
def find_source_if_admin(source_type)
source = find_source(source_type, params[:id])
......
......@@ -9,6 +9,8 @@ module API
before { authenticate! }
feature_category :boards
helpers do
def board_parent
user_project
......
......@@ -10,6 +10,8 @@ module API
after_validation { content_type "application/json" }
feature_category :source_code_management
before do
require_repository_enabled!
authorize! :download_code, user_project
......
......@@ -4,6 +4,8 @@ module API
class BroadcastMessages < ::API::Base
include PaginationParams
feature_category :navigation
resource :broadcast_messages do
helpers do
def find_message
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :continuous_integration
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
......@@ -7,6 +7,8 @@ module API
before { authenticate_non_get! }
feature_category :continuous_integration
params do
requires :id, type: String, desc: 'The project ID'
end
......
......@@ -7,6 +7,8 @@ module API
content_type :txt, 'text/plain'
feature_category :continuous_integration
resource :runners do
desc 'Registers a new Runner' do
success Entities::RunnerRegistrationDetails
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :continuous_integration
resource :runners do
desc 'Get runners available for user' do
success Entities::Runner
......
......@@ -4,6 +4,8 @@ require 'mime/types'
module API
class CommitStatuses < ::API::Base
feature_category :continuous_integration
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
......@@ -6,6 +6,8 @@ module API
class Commits < ::API::Base
include PaginationParams
feature_category :source_code_management
before do
require_repository_enabled!
authorize! :download_code, user_project
......
......@@ -4,6 +4,8 @@ module API
class ContainerRegistryEvent < ::API::Base
DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json'
feature_category :package_registry
before { authenticate_registry_notification! }
resource :container_registry_event do
......
......@@ -6,6 +6,8 @@ module API
before { authenticate! }
feature_category :continuous_delivery
helpers do
def add_deploy_keys_project(project, attrs = {})
project.deploy_keys_projects.create(attrs)
......
......@@ -4,6 +4,8 @@ module API
class DeployTokens < ::API::Base
include PaginationParams
feature_category :continuous_delivery
helpers do
def scope_params
scopes = params.delete(:scopes)
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :continuous_delivery
params do
requires :id, type: String, desc: 'The project ID'
end
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :continuous_delivery
params do
requires :id, type: String, desc: 'The project ID'
end
......
......@@ -4,6 +4,8 @@ module API
class ErrorTracking < ::API::Base
before { authenticate! }
feature_category :error_tracking
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
......@@ -8,6 +8,8 @@ module API
allow_access_with_scope :read_user, if: -> (request) { request.get? }
feature_category :users
resource :events do
desc "List currently authenticated user's events" do
detail 'This feature was introduced in GitLab 9.3.'
......
......@@ -7,6 +7,8 @@ module API
ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS
.merge(environment_scope: API::NO_SLASH_URL_PART_REGEX)
feature_category :feature_flags
before do
authorize_read_feature_flags!
end
......
......@@ -7,6 +7,8 @@ module API
FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
.merge(name: API::NO_SLASH_URL_PART_REGEX)
feature_category :feature_flags
before do
authorize_read_feature_flags!
end
......
......@@ -8,6 +8,8 @@ module API
message.is_a?(String) ? { message: message }.to_json : message.to_json
}
feature_category :feature_flags
before do
authorize_admin_feature_flags_user_lists!
end
......
......@@ -4,6 +4,8 @@ module API
class Features < ::API::Base
before { authenticated_as_admin! }
feature_category :feature_flags
helpers do
def gate_value(params)
case params[:value]
......
......@@ -9,6 +9,8 @@ module API
# Prevents returning plain/text responses for files with .txt extension
after_validation { content_type "application/json" }
feature_category :source_code_management
helpers ::API::Helpers::HeadersHelpers
helpers do
......
......@@ -6,6 +6,8 @@ module API
before { authenticate! }
feature_category :continuous_delivery
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
......@@ -7,6 +7,8 @@ module API
prepend_if_ee('EE::API::BoardsResponses') # rubocop: disable Cop/InjectEnterpriseEditionModule
feature_category :boards
before do
authenticate!
end
......
......@@ -6,6 +6,8 @@ module API
before { authenticate! }
feature_category :kubernetes_management
params do
requires :id, type: String, desc: 'The ID of the group'
end
......
......@@ -8,6 +8,8 @@ module API
before { authorize_read_group_container_images! }
feature_category :package_registry
REPOSITORY_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(
tag_name: API::NO_SLASH_URL_PART_REGEX)
......
......@@ -10,6 +10,8 @@ module API
authorize! :admin_group, user_group
end
feature_category :importers
params do
requires :id, type: String, desc: 'The ID of a group'
end
......
......@@ -2,6 +2,8 @@
module API
class GroupImport < ::API::Base
feature_category :importers
helpers Helpers::FileUploadHelpers
helpers do
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :issue_tracking
params do
requires :id, type: String, desc: 'The ID of a group'
end
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
feature_category :issue_tracking
params do
requires :id, type: String, desc: 'The ID of a group'
end
......
......@@ -7,6 +7,8 @@ module API
before { authenticate! }
before { authorize! :admin_build, user_group }
feature_category :continuous_integration
params do
requires :id, type: String, desc: 'The ID of a group'
end
......
......@@ -7,6 +7,8 @@ module API
before { authenticate_non_get! }
feature_category :subgroups
helpers Helpers::GroupsHelpers
helpers do
......
......@@ -22,7 +22,17 @@ RSpec.describe 'Every API endpoint' do
completed_classes = [
::API::Users, ::API::Issues, ::API::AccessRequests, ::API::Admin::Ci::Variables,
::API::Admin::InstanceClusters, ::API::Admin::Sidekiq, ::API::Appearance,
::API::Applications, ::API::Avatar, ::API::AwardEmoji
::API::Applications, ::API::Avatar, ::API::AwardEmoji, API::Badges,
::API::Boards, ::API::Branches, ::API::BroadcastMessages, ::API::Ci::Pipelines,
::API::Ci::PipelineSchedules, ::API::Ci::Runners, ::API::Ci::Runner,
::API::Commits, ::API::CommitStatuses, ::API::ContainerRegistryEvent,
::API::DeployKeys, ::API::DeployTokens, ::API::Deployments, ::API::Environments,
::API::ErrorTracking, ::API::Events, ::API::FeatureFlags, ::API::FeatureFlagScopes,
::API::FeatureFlagsUserLists, ::API::Features, ::API::Files, ::API::FreezePeriods,
::API::GroupBoards, ::API::GroupClusters, ::API::GroupExport, ::API::GroupImport,
::API::GroupLabels, ::API::GroupMilestones, ::API::Groups,
::API::GroupContainerRepositories, ::API::GroupVariables
]
next unless completed_classes.include?(klass)
......
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