Commit 9716bd34 authored by Sean McGivern's avatar Sean McGivern Committed by Stan Hu

Use API::Base as base class for all API resources

This is the result of auto-correcting API/Base.
parent 50295e65
......@@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0'
gem 'pg', '~> 1.1'
gem 'rugged', '~> 0.28'
gem 'grape-path-helpers', '~> 1.3'
gem 'grape-path-helpers', '~> 1.4'
gem 'faraday', '~> 1.0'
gem 'marginalia', '~> 1.9.0'
......
......@@ -495,7 +495,7 @@ GEM
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-path-helpers (1.3.0)
grape-path-helpers (1.4.0)
activesupport
grape (~> 1.3)
rake (~> 12)
......@@ -1348,7 +1348,7 @@ DEPENDENCIES
gpgme (~> 2.0.19)
grape (= 1.4.0)
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.3)
grape-path-helpers (~> 1.4)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.11.4)
......
......@@ -2,7 +2,7 @@
module API
module Analytics
class CodeReviewAnalytics < Grape::API::Instance
class CodeReviewAnalytics < ::API::Base
include PaginationParams
helpers do
......
......@@ -2,7 +2,7 @@
module API
module Analytics
class GroupActivityAnalytics < Grape::API::Instance
class GroupActivityAnalytics < ::API::Base
DESCRIPTION_DETAIL =
'This feature is gated by the `:group_activity_analytics`'\
' feature flag, introduced in GitLab 12.9.'
......
# frozen_string_literal: true
module API
class AuditEvents < ::Grape::API::Instance
class AuditEvents < ::API::Base
include ::API::PaginationParams
before do
......
# frozen_string_literal: true
module API
class Dependencies < Grape::API::Instance
class Dependencies < ::API::Base
helpers do
def dependencies_by(params)
pipeline = ::Security::ReportFetchService.new(user_project, ::Ci::JobArtifact.dependency_list_reports).pipeline
......
# frozen_string_literal: true
module API
class DependencyProxy < Grape::API::Instance
class DependencyProxy < ::API::Base
helpers ::API::Helpers::PackagesHelpers
helpers do
......
# frozen_string_literal: true
module API
class ElasticsearchIndexedNamespaces < Grape::API::Instance
class ElasticsearchIndexedNamespaces < ::API::Base
before { authenticated_as_admin! }
resource :elasticsearch_indexed_namespaces do
......
# frozen_string_literal: true
module API
class EpicIssues < Grape::API::Instance
class EpicIssues < ::API::Base
before do
authenticate!
authorize_epics_feature!
......
# frozen_string_literal: true
module API
class EpicLinks < Grape::API::Instance
class EpicLinks < ::API::Base
include ::Gitlab::Utils::StrongMemoize
before do
......
# frozen_string_literal: true
module API
class Epics < Grape::API::Instance
class Epics < ::API::Base
include PaginationParams
before do
......
......@@ -3,7 +3,7 @@
require 'base64'
module API
class Geo < Grape::API::Instance
class Geo < ::API::Base
resource :geo do
helpers do
def sanitized_node_status_params
......
# frozen_string_literal: true
module API
class GeoNodes < Grape::API::Instance
class GeoNodes < ::API::Base
include PaginationParams
include APIGuard
include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module API
class GeoReplication < Grape::API::Instance
class GeoReplication < ::API::Base
include PaginationParams
include APIGuard
include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module API
class GroupHooks < Grape::API::Instance
class GroupHooks < ::API::Base
include ::API::PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class GroupPushRule < Grape::API::Instance
class GroupPushRule < ::API::Base
before { authenticate! }
before { check_group_push_rule_access! }
before { authorize_change_param(user_group, :commit_committer_check, :reject_unsigned_commits) }
......
# frozen_string_literal: true
module API
class Ldap < Grape::API::Instance
class Ldap < ::API::Base
# Admin users by default should be able to access these API endpoints.
# However, non-admin users can access these endpoints if the "Allow group
# owners to manage LDAP-related group settings" is enabled, and they own a
......
# frozen_string_literal: true
module API
class LdapGroupLinks < Grape::API::Instance
class LdapGroupLinks < ::API::Base
before { authenticate! }
params do
......
# frozen_string_literal: true
module API
class License < Grape::API::Instance
class License < ::API::Base
before { authenticated_as_admin! }
resource :license do
......
# frozen_string_literal: true
module API
class ManagedLicenses < Grape::API::Instance
class ManagedLicenses < ::API::Base
include PaginationParams
before { authenticate! unless route.settings[:skip_authentication] }
......
# frozen_string_literal: true
module API
class MergeRequestApprovalRules < ::Grape::API
class MergeRequestApprovalRules < ::API::Base
before { authenticate_non_get! }
helpers do
......
# frozen_string_literal: true
module API
class MergeTrains < ::Grape::API::Instance
class MergeTrains < ::API::Base
include PaginationParams
before do
......
# frozen_string_literal: true
module API
class PersonalAccessTokens < Grape::API::Instance
class PersonalAccessTokens < ::API::Base
include ::API::PaginationParams
desc 'Get all Personal Access Tokens' do
......
# frozen_string_literal: true
module API
class ProjectAliases < Grape::API::Instance
class ProjectAliases < ::API::Base
include PaginationParams
before { check_feature_availability }
......
# frozen_string_literal: true
module API
class ProjectApprovalRules < ::Grape::API::Instance
class ProjectApprovalRules < ::API::Base
before { authenticate! }
helpers ::API::Helpers::ProjectApprovalRulesHelpers
......
# frozen_string_literal: true
module API
class ProjectApprovalSettings < ::Grape::API::Instance
class ProjectApprovalSettings < ::API::Base
before { authenticate! }
helpers ::API::Helpers::ProjectApprovalRulesHelpers
......
# frozen_string_literal: true
module API
class ProjectApprovals < ::Grape::API::Instance
class ProjectApprovals < ::API::Base
before { authenticate! }
before { authorize! :update_approvers, user_project }
......
......@@ -3,7 +3,7 @@
require_dependency 'declarative_policy'
module API
class ProjectMirror < Grape::API::Instance
class ProjectMirror < ::API::Base
helpers do
def github_webhook_signature
@github_webhook_signature ||= headers['X-Hub-Signature']
......
# frozen_string_literal: true
module API
class ProjectPushRule < Grape::API::Instance
class ProjectPushRule < ::API::Base
before { authenticate! }
before { authorize_admin_project }
before { check_project_feature_available!(:push_rules) }
......
# frozen_string_literal: true
module API
class ProtectedEnvironments < Grape::API::Instance
class ProtectedEnvironments < ::API::Base
include PaginationParams
ENVIRONMENT_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class ResourceIterationEvents < Grape::API::Instance
class ResourceIterationEvents < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true
module API
class ResourceWeightEvents < Grape::API::Instance
class ResourceWeightEvents < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true
module API
class Scim < Grape::API::Instance
class Scim < ::API::Base
include ::Gitlab::Utils::StrongMemoize
prefix 'api/scim'
......
# frozen_string_literal: true
module API
class VisualReviewDiscussions < Grape::API::Instance
class VisualReviewDiscussions < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
helpers ::RendersNotes
......
# frozen_string_literal: true
module API
class Vulnerabilities < Grape::API::Instance
class Vulnerabilities < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks
include PaginationParams
......
# frozen_string_literal: true
module API
class VulnerabilityExports < Grape::API::Instance
class VulnerabilityExports < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks
include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module API
class VulnerabilityFindings < Grape::API::Instance
class VulnerabilityFindings < ::API::Base
include PaginationParams
include ::Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
module API
class VulnerabilityIssueLinks < Grape::API::Instance
class VulnerabilityIssueLinks < ::API::Base
include ::API::Helpers::VulnerabilitiesHooks
helpers ::API::Helpers::VulnerabilitiesHelpers
......
......@@ -2,7 +2,7 @@
module EE
module API
class Boards < ::Grape::API::Instance
class Boards < ::API::Base
include ::API::PaginationParams
include ::API::BoardsResponses
......
......@@ -2,7 +2,7 @@
module EE
module API
class GroupBoards < ::Grape::API::Instance
class GroupBoards < ::API::Base
include ::API::PaginationParams
include ::API::BoardsResponses
......
# frozen_string_literal: true
module API
class AccessRequests < Grape::API::Instance
class AccessRequests < ::API::Base
include PaginationParams
before { authenticate! }
......
......@@ -3,7 +3,7 @@
module API
module Admin
module Ci
class Variables < Grape::API::Instance
class Variables < ::API::Base
include PaginationParams
before { authenticated_as_admin! }
......
......@@ -2,7 +2,7 @@
module API
module Admin
class InstanceClusters < Grape::API::Instance
class InstanceClusters < ::API::Base
include PaginationParams
before do
......
......@@ -2,7 +2,7 @@
module API
module Admin
class Sidekiq < Grape::API::Instance
class Sidekiq < ::API::Base
before { authenticated_as_admin! }
namespace 'admin' do
......
# frozen_string_literal: true
module API
class API < Grape::API::Instance
class API < ::API::Base
include APIGuard
LOG_FILENAME = Rails.root.join("log", "api_json.log")
......
# frozen_string_literal: true
module API
class Appearance < Grape::API::Instance
class Appearance < ::API::Base
before { authenticated_as_admin! }
helpers do
......
......@@ -2,7 +2,7 @@
module API
# External applications API
class Applications < Grape::API::Instance
class Applications < ::API::Base
before { authenticated_as_admin! }
resource :applications do
......
# frozen_string_literal: true
module API
class Avatar < Grape::API::Instance
class Avatar < ::API::Base
resource :avatar do
desc 'Return avatar url for a user' do
success Entities::Avatar
......
# frozen_string_literal: true
module API
class AwardEmoji < Grape::API::Instance
class AwardEmoji < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Badges < Grape::API::Instance
class Badges < ::API::Base
include PaginationParams
before { authenticate_non_get! }
......
# frozen_string_literal: true
module API
class Boards < Grape::API::Instance
class Boards < ::API::Base
include BoardsResponses
include PaginationParams
......
......@@ -3,7 +3,7 @@
require 'mime/types'
module API
class Branches < Grape::API::Instance
class Branches < ::API::Base
include PaginationParams
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class BroadcastMessages < Grape::API::Instance
class BroadcastMessages < ::API::Base
include PaginationParams
resource :broadcast_messages do
......
......@@ -2,7 +2,7 @@
module API
module Ci
class PipelineSchedules < Grape::API::Instance
class PipelineSchedules < ::API::Base
include PaginationParams
before { authenticate! }
......
......@@ -2,7 +2,7 @@
module API
module Ci
class Pipelines < Grape::API::Instance
class Pipelines < ::API::Base
include PaginationParams
before { authenticate_non_get! }
......
......@@ -2,7 +2,7 @@
module API
module Ci
class Runner < Grape::API::Instance
class Runner < ::API::Base
helpers ::API::Helpers::Runner
resource :runners do
......
......@@ -2,7 +2,7 @@
module API
module Ci
class Runners < Grape::API::Instance
class Runners < ::API::Base
include PaginationParams
before { authenticate! }
......
......@@ -3,7 +3,7 @@
require 'mime/types'
module API
class CommitStatuses < Grape::API::Instance
class CommitStatuses < ::API::Base
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
......@@ -3,7 +3,7 @@
require 'mime/types'
module API
class Commits < Grape::API::Instance
class Commits < ::API::Base
include PaginationParams
before do
......
......@@ -2,7 +2,7 @@
# PHP composer support (https://getcomposer.org/)
module API
class ComposerPackages < Grape::API::Instance
class ComposerPackages < ::API::Base
helpers ::API::Helpers::PackagesManagerClientsHelpers
helpers ::API::Helpers::RelatedResourcesHelpers
helpers ::API::Helpers::Packages::BasicAuthHelpers
......
......@@ -2,7 +2,7 @@
# Conan Instance-Level Package Manager Client API
module API
class ConanInstancePackages < Grape::API::Instance
class ConanInstancePackages < ::API::Base
namespace 'packages/conan/v1' do
include ConanPackageEndpoints
end
......
......@@ -2,7 +2,7 @@
# Conan Project-Level Package Manager Client API
module API
class ConanProjectPackages < Grape::API::Instance
class ConanProjectPackages < ::API::Base
params do
requires :id, type: Integer, desc: 'The ID of a project', regexp: %r{\A[1-9]\d*\z}
end
......
# frozen_string_literal: true
module API
class ContainerRegistryEvent < Grape::API::Instance
class ContainerRegistryEvent < ::API::Base
DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json'
before { authenticate_registry_notification! }
......
# frozen_string_literal: true
module API
class DebianGroupPackages < Grape::API::Instance
class DebianGroupPackages < ::API::Base
params do
requires :id, type: String, desc: 'The ID of a group'
end
......
# frozen_string_literal: true
module API
class DebianProjectPackages < Grape::API::Instance
class DebianProjectPackages < ::API::Base
params do
requires :id, type: String, desc: 'The ID of a project'
end
......
# frozen_string_literal: true
module API
class DeployKeys < Grape::API::Instance
class DeployKeys < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class DeployTokens < Grape::API::Instance
class DeployTokens < ::API::Base
include PaginationParams
helpers do
......
......@@ -2,7 +2,7 @@
module API
# Deployments RESTful API endpoints
class Deployments < Grape::API::Instance
class Deployments < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Discussions < Grape::API::Instance
class Discussions < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
helpers ::RendersNotes
......
......@@ -2,7 +2,7 @@
module API
# Environments RESTfull API endpoints
class Environments < Grape::API::Instance
class Environments < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class ErrorTracking < Grape::API::Instance
class ErrorTracking < ::API::Base
before { authenticate! }
params do
......
# frozen_string_literal: true
module API
class Events < Grape::API::Instance
class Events < ::API::Base
include PaginationParams
include APIGuard
helpers ::API::Helpers::EventsHelpers
......
# frozen_string_literal: true
module API
class FeatureFlagScopes < Grape::API::Instance
class FeatureFlagScopes < ::API::Base
include PaginationParams
ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS
......
# frozen_string_literal: true
module API
class FeatureFlags < Grape::API::Instance
class FeatureFlags < ::API::Base
include PaginationParams
FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
......
# frozen_string_literal: true
module API
class FeatureFlagsUserLists < Grape::API::Instance
class FeatureFlagsUserLists < ::API::Base
include PaginationParams
error_formatter :json, -> (message, _backtrace, _options, _env, _original_exception) {
......
# frozen_string_literal: true
module API
class Features < Grape::API::Instance
class Features < ::API::Base
before { authenticated_as_admin! }
helpers do
......
# frozen_string_literal: true
module API
class Files < Grape::API::Instance
class Files < ::API::Base
include APIGuard
FILE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(file_path: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class FreezePeriods < Grape::API::Instance
class FreezePeriods < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class GenericPackages < Grape::API::Instance
class GenericPackages < ::API::Base
GENERIC_PACKAGES_REQUIREMENTS = {
package_name: API::NO_SLASH_URL_PART_REGEX,
file_name: API::NO_SLASH_URL_PART_REGEX
......
# frozen_string_literal: true
module API
class GoProxy < Grape::API::Instance
class GoProxy < ::API::Base
helpers Gitlab::Golang
helpers ::API::Helpers::PackagesHelpers
......
# frozen_string_literal: true
module API
class GroupBoards < Grape::API::Instance
class GroupBoards < ::API::Base
include BoardsResponses
include PaginationParams
......
# frozen_string_literal: true
module API
class GroupClusters < Grape::API::Instance
class GroupClusters < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class GroupContainerRepositories < Grape::API::Instance
class GroupContainerRepositories < ::API::Base
include PaginationParams
helpers ::API::Helpers::PackagesHelpers
......
# frozen_string_literal: true
module API
class GroupExport < Grape::API::Instance
class GroupExport < ::API::Base
helpers Helpers::RateLimiter
before do
......
# frozen_string_literal: true
module API
class GroupImport < Grape::API::Instance
class GroupImport < ::API::Base
helpers Helpers::FileUploadHelpers
helpers do
......
# frozen_string_literal: true
module API
class GroupLabels < Grape::API::Instance
class GroupLabels < ::API::Base
include PaginationParams
helpers ::API::Helpers::LabelHelpers
......
# frozen_string_literal: true
module API
class GroupMilestones < Grape::API::Instance
class GroupMilestones < ::API::Base
include MilestoneResponses
include PaginationParams
......
# frozen_string_literal: true
module API
class GroupPackages < Grape::API::Instance
class GroupPackages < ::API::Base
include PaginationParams
before do
......
# frozen_string_literal: true
module API
class GroupVariables < Grape::API::Instance
class GroupVariables < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Groups < Grape::API::Instance
class Groups < ::API::Base
include PaginationParams
include Helpers::CustomAttributes
......
# frozen_string_literal: true
module API
class ImportBitbucketServer < Grape::API::Instance
class ImportBitbucketServer < ::API::Base
helpers do
def client
@client ||= BitbucketServer::Client.new(credentials)
......
# frozen_string_literal: true
module API
class ImportGithub < Grape::API::Instance
class ImportGithub < ::API::Base
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
before do
......
......@@ -3,7 +3,7 @@
module API
# Internal access API
module Internal
class Base < Grape::API::Instance
class Base < ::API::Base
before { authenticate_by_gitlab_shell_token! }
before do
......
......@@ -3,7 +3,7 @@
module API
# Kubernetes Internal API
module Internal
class Kubernetes < Grape::API::Instance
class Kubernetes < ::API::Base
before do
check_feature_enabled
authenticate_gitlab_kas_request!
......
......@@ -2,7 +2,7 @@
module API
module Internal
class Lfs < Grape::API::Instance
class Lfs < ::API::Base
use Rack::Sendfile
before { authenticate_by_gitlab_shell_token! }
......
......@@ -3,7 +3,7 @@
module API
# Pages Internal API
module Internal
class Pages < Grape::API::Instance
class Pages < ::API::Base
before do
authenticate_gitlab_pages_request!
end
......
# frozen_string_literal: true
module API
class IssueLinks < Grape::API::Instance
class IssueLinks < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Issues < Grape::API::Instance
class Issues < ::API::Base
include PaginationParams
helpers Helpers::IssuesHelpers
helpers Helpers::RateLimiter
......
# frozen_string_literal: true
module API
class JobArtifacts < Grape::API::Instance
class JobArtifacts < ::API::Base
before { authenticate_non_get! }
# EE::API::JobArtifacts would override the following helpers
......
# frozen_string_literal: true
module API
class Jobs < Grape::API::Instance
class Jobs < ::API::Base
include PaginationParams
before { authenticate! }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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