<commit_before>require 'doorkeeper/grape/helpers'

module API
  module V1
    class Categories < Grape::API
      helpers Doorkeeper::Grape::Helpers
      #
      # before do
      #   doorkeeper_authorize!
      # end

      before do
        authenticate!
        restrict_to_role %w(admin agent)
      end

      include API::V1::Defaults
      resource :categories do

        # LIST ALL CATEGORIES
        desc "List all public categories", {
          entity: Entity::Category,
          notes: "Lists all active categories defined for the knowledgebase"
        }
        get "", root: :categories do
          categories = Category.active.all
          present categories, with: Entity::Category
        end

        # SHOW CATEGORY
        desc "Return a single category with listing of docs", {
          entity: Entity::Category,
          notes: "Lists all active categories defined for the knowledgebase"
        }<commit_msg>Remove whitespace<commit_after>require 'doorkeeper/grape/helpers'

module API
  module V1
    class Categories < Grape::API
      helpers Doorkeeper::Grape::Helpers
      #
      # before do
      #   doorkeeper_authorize!
      # end
      before do
        authenticate!
        restrict_to_role %w(admin agent)
      end

      include API::V1::Defaults
      resource :categories do

        # LIST ALL CATEGORIES
        desc "List all public categories", {
          entity: Entity::Category,
          notes: "Lists all active categories defined for the knowledgebase"
        }
        get "", root: :categories do
          categories = Category.active.all
          present categories, with: Entity::Category
        end

        # SHOW CATEGORY
        desc "Return a single category with listing of docs", {
          entity: Entity::Category,
          notes: "Lists all active categories defined for the knowledgebase"
        }
{'fraction_non_alphanumeric': 0.07017543859649122, 'fraction_numerical': 0.002126528442317916, 'mean_word_length': 2.1107438016528928, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2215119', 'n_tokens_mistral': 498, 'n_tokens_neox': 481, 'n_words': 159}