<commit_before>﻿using System.Linq;
using System.Collections.Generic;

namespace PlainElastic.Net
{
    public abstract class CommandBuilder<T> where T: CommandBuilder<T>
    {

        public readonly Dictionary<string, string> Parameters = new Dictionary<string, string>();


        public T WithParameter(string name, string value)
        {
            Parameters[name] = value;
            return (T)this;
        }


        public string BuildCommand()
        {
            string path = BuildUrlPath().ToLower();
            string queryParams = Parameters.Select(param => param.Key + "=" + param.Value).JoinWithSeparator("&");
            
            if (!queryParams.IsNullOrEmpty())
                return path + "?" + queryParams;

            return path;
        }


        protected abstract string BuildUrlPath();


        public static implicit operator string (CommandBuilder<T> command)
        {
            return command.BuildCommand();
        }
    }
}
<commit_msg>Added Pretty command parameter support<commit_after>﻿using System.Linq;
using System.Collections.Generic;

namespace PlainElastic.Net
{
    public abstract class CommandBuilder<T> where T: CommandBuilder<T>
    {

        public readonly Dictionary<string, string> Parameters = new Dictionary<string, string>();


        public T WithParameter(string name, string value)
        {
            Parameters[name] = value;
            return (T)this;
        }

        public T Pretty()
        {
            Parameters.Add("pretty", "true");
            return (T)this;
        }


        public string BuildCommand()
        {
            string path = BuildUrlPath().ToLower();
            string queryParams = Parameters.Select(param => param.Key + "=" + param.Value).JoinWithSeparator("&");
            
            if (!queryParams.IsNullOrEmpty())
                return path + "?" + queryParams;

            return path;
        }


        protected abstract string BuildUrlPath();


        public static implicit operator string (CommandBuilder<T> command)
        {
            return command.BuildCommand();
        }
    }
}

{'fraction_non_alphanumeric': 0.09943714821763602, 'fraction_numerical': 0.0, 'mean_word_length': 2.047142857142857, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '6979276', 'n_tokens_mistral': 532, 'n_tokens_neox': 511, 'n_words': 135}