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! }
......
......@@ -2,7 +2,7 @@
module API
# Keys API
class Keys < Grape::API::Instance
class Keys < ::API::Base
before { authenticate! }
resource :keys do
......
# frozen_string_literal: true
module API
class Labels < Grape::API::Instance
class Labels < ::API::Base
include PaginationParams
helpers ::API::Helpers::LabelHelpers
......
# frozen_string_literal: true
module API
class Lint < Grape::API::Instance
class Lint < ::API::Base
namespace :ci do
desc 'Validation of .gitlab-ci.yml content'
params do
......
# frozen_string_literal: true
module API
class Markdown < Grape::API::Instance
class Markdown < ::API::Base
params do
requires :text, type: String, desc: "The markdown text to render"
optional :gfm, type: Boolean, desc: "Render text using GitLab Flavored Markdown"
......
# frozen_string_literal: true
module API
class MavenPackages < Grape::API::Instance
class MavenPackages < ::API::Base
MAVEN_ENDPOINT_REQUIREMENTS = {
file_name: API::NO_SLASH_URL_PART_REGEX
}.freeze
......
# frozen_string_literal: true
module API
class Members < Grape::API::Instance
class Members < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class MergeRequestApprovals < ::Grape::API::Instance
class MergeRequestApprovals < ::API::Base
before { authenticate_non_get! }
helpers do
......
......@@ -2,7 +2,7 @@
module API
# MergeRequestDiff API
class MergeRequestDiffs < Grape::API::Instance
class MergeRequestDiffs < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class MergeRequests < Grape::API::Instance
class MergeRequests < ::API::Base
include PaginationParams
CONTEXT_COMMITS_POST_LIMIT = 20
......
......@@ -3,7 +3,7 @@
module API
module Metrics
module Dashboard
class Annotations < Grape::API::Instance
class Annotations < ::API::Base
desc 'Create a new monitoring dashboard annotation' do
success Entities::Metrics::Dashboard::Annotation
end
......
......@@ -2,7 +2,7 @@
module API
module Metrics
class UserStarredDashboards < Grape::API::Instance
class UserStarredDashboards < ::API::Base
resource :projects do
desc 'Marks selected metrics dashboard as starred' do
success Entities::Metrics::UserStarredDashboard
......
# frozen_string_literal: true
module API
class Namespaces < Grape::API::Instance
class Namespaces < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Notes < Grape::API::Instance
class Notes < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
......@@ -2,7 +2,7 @@
module API
# notification_settings API
class NotificationSettings < Grape::API::Instance
class NotificationSettings < ::API::Base
before { authenticate! }
helpers ::API::Helpers::MembersHelpers
......
# frozen_string_literal: true
module API
class NpmPackages < Grape::API::Instance
class NpmPackages < ::API::Base
helpers ::API::Helpers::PackagesHelpers
helpers ::API::Helpers::Packages::DependencyProxyHelpers
......
......@@ -6,7 +6,7 @@
# called by the NuGet package manager client when users run commands
# like `nuget install` or `nuget push`.
module API
class NugetPackages < Grape::API::Instance
class NugetPackages < ::API::Base
helpers ::API::Helpers::PackagesManagerClientsHelpers
helpers ::API::Helpers::Packages::BasicAuthHelpers
......
# frozen_string_literal: true
module API
class PackageFiles < Grape::API::Instance
class PackageFiles < ::API::Base
include PaginationParams
before do
......
# frozen_string_literal: true
module API
class Pages < Grape::API::Instance
class Pages < ::API::Base
before do
require_pages_config_enabled!
authenticated_with_can_read_all_resources!
......
# frozen_string_literal: true
module API
class PagesDomains < Grape::API::Instance
class PagesDomains < ::API::Base
include PaginationParams
PAGES_DOMAINS_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(domain: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class ProjectClusters < Grape::API::Instance
class ProjectClusters < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class ProjectContainerRepositories < Grape::API::Instance
class ProjectContainerRepositories < ::API::Base
include PaginationParams
helpers ::API::Helpers::PackagesHelpers
......
# frozen_string_literal: true
module API
class ProjectEvents < Grape::API::Instance
class ProjectEvents < ::API::Base
include PaginationParams
include APIGuard
helpers ::API::Helpers::EventsHelpers
......
# frozen_string_literal: true
module API
class ProjectExport < Grape::API::Instance
class ProjectExport < ::API::Base
helpers Helpers::RateLimiter
before do
......
# frozen_string_literal: true
module API
class ProjectHooks < Grape::API::Instance
class ProjectHooks < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class ProjectImport < Grape::API::Instance
class ProjectImport < ::API::Base
include PaginationParams
helpers Helpers::ProjectsHelpers
......
# frozen_string_literal: true
module API
class ProjectMilestones < Grape::API::Instance
class ProjectMilestones < ::API::Base
include PaginationParams
include MilestoneResponses
......
# frozen_string_literal: true
module API
class ProjectPackages < Grape::API::Instance
class ProjectPackages < ::API::Base
include PaginationParams
before do
......
# frozen_string_literal: true
module API
class ProjectRepositoryStorageMoves < Grape::API::Instance
class ProjectRepositoryStorageMoves < ::API::Base
include PaginationParams
before { authenticated_as_admin! }
......
# frozen_string_literal: true
module API
class ProjectSnapshots < Grape::API::Instance
class ProjectSnapshots < ::API::Base
helpers ::API::Helpers::ProjectSnapshotsHelpers
before { authorize_read_git_snapshot! }
......
# frozen_string_literal: true
module API
class ProjectSnippets < Grape::API::Instance
class ProjectSnippets < ::API::Base
include PaginationParams
before { check_snippets_enabled }
......
# frozen_string_literal: true
module API
class ProjectStatistics < Grape::API::Instance
class ProjectStatistics < ::API::Base
before do
authenticate!
authorize! :daily_statistics, user_project
......
# frozen_string_literal: true
module API
class ProjectTemplates < Grape::API::Instance
class ProjectTemplates < ::API::Base
include PaginationParams
TEMPLATE_TYPES = %w[dockerfiles gitignores gitlab_ci_ymls licenses metrics_dashboard_ymls issues merge_requests].freeze
......
......@@ -3,7 +3,7 @@
require_dependency 'declarative_policy'
module API
class Projects < Grape::API::Instance
class Projects < ::API::Base
include PaginationParams
include Helpers::CustomAttributes
......
# frozen_string_literal: true
module API
class ProtectedBranches < Grape::API::Instance
class ProtectedBranches < ::API::Base
include PaginationParams
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class ProtectedTags < Grape::API::Instance
class ProtectedTags < ::API::Base
include PaginationParams
TAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX)
......
......@@ -6,7 +6,7 @@
# called by the PyPI package manager client when users run commands
# like `pip install` or `twine upload`.
module API
class PypiPackages < Grape::API::Instance
class PypiPackages < ::API::Base
helpers ::API::Helpers::PackagesManagerClientsHelpers
helpers ::API::Helpers::RelatedResourcesHelpers
helpers ::API::Helpers::Packages::BasicAuthHelpers
......
......@@ -2,7 +2,7 @@
module API
module Release
class Links < Grape::API::Instance
class Links < ::API::Base
include PaginationParams
RELEASE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
......
# frozen_string_literal: true
module API
class Releases < Grape::API::Instance
class Releases < ::API::Base
include PaginationParams
RELEASE_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
......
# frozen_string_literal: true
module API
class RemoteMirrors < Grape::API::Instance
class RemoteMirrors < ::API::Base
include PaginationParams
before do
......
......@@ -3,7 +3,7 @@
require 'mime/types'
module API
class Repositories < Grape::API::Instance
class Repositories < ::API::Base
include PaginationParams
helpers ::API::Helpers::HeadersHelpers
......
# frozen_string_literal: true
module API
class ResourceLabelEvents < Grape::API::Instance
class ResourceLabelEvents < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true
module API
class ResourceMilestoneEvents < Grape::API::Instance
class ResourceMilestoneEvents < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true
module API
class ResourceStateEvents < Grape::API::Instance
class ResourceStateEvents < ::API::Base
include PaginationParams
helpers ::API::Helpers::NotesHelpers
......
# frozen_string_literal: true
module API
class Search < Grape::API::Instance
class Search < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Services < Grape::API::Instance
class Services < ::API::Base
services = Helpers::ServicesHelpers.services
service_classes = Helpers::ServicesHelpers.service_classes
......
# frozen_string_literal: true
module API
class Settings < Grape::API::Instance
class Settings < ::API::Base
before { authenticated_as_admin! }
helpers Helpers::SettingsHelpers
......
......@@ -3,7 +3,7 @@
require 'sidekiq/api'
module API
class SidekiqMetrics < Grape::API::Instance
class SidekiqMetrics < ::API::Base
before { authenticated_as_admin! }
helpers do
......
......@@ -2,7 +2,7 @@
module API
# Snippets API
class Snippets < Grape::API::Instance
class Snippets < ::API::Base
include PaginationParams
resource :snippets do
......
# frozen_string_literal: true
module API
class Statistics < Grape::API::Instance
class Statistics < ::API::Base
before { authenticated_as_admin! }
COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue,
......
# frozen_string_literal: true
module API
class Submodules < Grape::API::Instance
class Submodules < ::API::Base
before { authenticate! }
helpers do
......
# frozen_string_literal: true
module API
class Subscriptions < Grape::API::Instance
class Subscriptions < ::API::Base
helpers ::API::Helpers::LabelHelpers
before { authenticate! }
......
# frozen_string_literal: true
module API
class Suggestions < Grape::API::Instance
class Suggestions < ::API::Base
before { authenticate! }
resource :suggestions do
......
# frozen_string_literal: true
module API
class SystemHooks < Grape::API::Instance
class SystemHooks < ::API::Base
include PaginationParams
before do
......
# frozen_string_literal: true
module API
class Tags < Grape::API::Instance
class Tags < ::API::Base
include PaginationParams
TAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(tag_name: API::NO_SLASH_URL_PART_REGEX)
......
# frozen_string_literal: true
module API
class Templates < Grape::API::Instance
class Templates < ::API::Base
include PaginationParams
GLOBAL_TEMPLATE_TYPES = {
......
......@@ -4,7 +4,7 @@ require_dependency 'api/validations/validators/limit'
module API
module Terraform
class State < Grape::API::Instance
class State < ::API::Base
include ::Gitlab::Utils::StrongMemoize
default_format :json
......
......@@ -2,7 +2,7 @@
module API
module Terraform
class StateVersion < Grape::API::Instance
class StateVersion < ::API::Base
default_format :json
before do
......
# frozen_string_literal: true
module API
class Todos < Grape::API::Instance
class Todos < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Triggers < Grape::API::Instance
class Triggers < ::API::Base
include PaginationParams
HTTP_GITLAB_EVENT_HEADER = "HTTP_#{WebHookService::GITLAB_EVENT_HEADER}".underscore.upcase
......
# frozen_string_literal: true
module API
class Unleash < Grape::API::Instance
class Unleash < ::API::Base
include PaginationParams
namespace :feature_flags do
......
# frozen_string_literal: true
module API
class UsageData < Grape::API::Instance
class UsageData < ::API::Base
before { authenticate! }
namespace 'usage_data' do
......
# frozen_string_literal: true
module API
class UserCounts < Grape::API::Instance
class UserCounts < ::API::Base
resource :user_counts do
desc 'Return the user specific counts' do
detail 'Open MR Count'
......
# frozen_string_literal: true
module API
class Users < Grape::API::Instance
class Users < ::API::Base
include PaginationParams
include APIGuard
include Helpers::CustomAttributes
......
......@@ -7,7 +7,7 @@
#
module API
module V3
class Github < Grape::API::Instance
class Github < ::API::Base
NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze
ENDPOINT_REQUIREMENTS = {
namespace: NO_SLASH_URL_PART_REGEX,
......
# frozen_string_literal: true
module API
class Variables < Grape::API::Instance
class Variables < ::API::Base
include PaginationParams
before { authenticate! }
......
# frozen_string_literal: true
module API
class Version < Grape::API::Instance
class Version < ::API::Base
helpers ::API::Helpers::GraphqlHelpers
include APIGuard
......
# frozen_string_literal: true
module API
class Wikis < Grape::API::Instance
class Wikis < ::API::Base
helpers ::API::Helpers::WikisHelpers
helpers do
......
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