<commit_before>﻿using RestSharp.Contrib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Smartsheet.Api.Internal.Util
{
	public class QueryUtil
	{
		public QueryUtil() { }

		public static string GenerateCommaSeparatedList<T>(IEnumerable<T> include)
		{
			if (include == null)
			{
				return string.Empty;
			}

			List<string> includesList = new List<string>();
			foreach (T element in include)
			{
				includesList.Add(element.ToString().ToLower());
			}
			return string.Join(",", includesList);
		}

		public static string GenerateUrl(string baseUrl, IDictionary<string, string> parameters)
		{
			if (baseUrl == null)
			{
				baseUrl = string.Empty;
			}

			StringBuilder result = new StringBuilder();
			result.Append(baseUrl);
			result.Append(GenerateQueryString(parameters));

			return result.ToString();
		}

		/**
		 * Returns a query string.
		 *
		 * @param parameters the map of query string keys and values
		 * @return the query string
		 */
		protected static string GenerateQueryString(IDictionary<string, string> parameters)
		{
			StringBuilder result = new StringBuilder();

			if (parameters == null)<commit_msg>Converted enum parameters to camel case<commit_after>﻿using RestSharp.Contrib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Smartsheet.Api.Internal.Util
{
	public class QueryUtil
	{
		public QueryUtil() { }

		public static string GenerateCommaSeparatedList<T>(IEnumerable<T> include)
		{
			if (include == null)
			{
				return string.Empty;
			}

			Regex regex = new Regex(@"[^_]+");
			List<string> includesList = new List<string>();
			foreach (T element in include)
			{
				// Converts the enum members to camel case to be passed in the url as a parameter.
				// For example, 'COLUMN_TYPE' becomes 'columnType' and is appended to the path.
				// Different from JsonEnymTypeConverter because this does not involve serialization/deserialization.
				MatchCollection matches = regex.Matches(element.ToString());
				List<string> values = new List<string>();
				foreach (Match match in matches)
				{
					if (values.Count == 0)
					{
						values.Add(match.Value.ToLower());
					}
					else
					{
						values.Add(match.Value.Substring(0, 1).ToUpper() + match.Value.Substring(1).ToLower());
					}
				}
				includesList.Add(string.Join(string.Empty, values));
			}
			return string.Join(",", includesList);
		}

		public static string GenerateUrl(string baseUrl, IDictionary<string, string> parameters)
		{
			if (baseUrl == null)
			{
				baseUrl = string.Empty;
			}

			StringBuilder result = new StringBuilder();
			result.Append(baseUrl);
			result.Append(GenerateQueryString(parameters));

			return result.ToString();
		}

		/**
		 * Returns a query string.
		 *
		 * @param parameters the map of query string keys and values
		 * @return the query string
		 */
		protected static string GenerateQueryString(IDictionary<string, string> parameters)
		{
			StringBuilder result = new StringBuilder();

			if (parameters == null)
{'fraction_non_alphanumeric': 0.11043533930857874, 'fraction_numerical': 0.0012804097311139564, 'mean_word_length': 3.602356406480118, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '3740307', 'n_tokens_mistral': 1090, 'n_tokens_neox': 881, 'n_words': 251}