<commit_before>/**
 * Class responsible for ajax call for project sample metadata fields.
 */
import axios from "axios";
import { setBaseUrl } from "../../utilities/url-utilities";

const OLD_URL = setBaseUrl(`linelist/fields`);

/**
 * @deprecated
 * Get all the MetadataTemplateFields belonging to the templates withing a
 * project.These will be the table headers.
 * @param {number} projectId
 * @returns {Promise}
 */
export function fetchMetadataFields(projectId) {
  return axios({
    method: "get",
    url: `${OLD_URL}?projectId=${projectId}`,
  });
}

const URL = setBaseUrl(`/ajax/metadata/fields`);

/**
 * Get all metadata fields associated with samples in a given project.
 * @param {number} projectId - identifier for a project
 * @returns {Promise<any>}
 */
export async function getMetadataFieldsForProject(projectId) {
  try {
    const { data } = await axios.get(`${URL}?projectId=${projectId}`);
    return data;<commit_msg>Updated JSDoc for deprecated function<commit_after>/**
 * Class responsible for ajax call for project sample metadata fields.
 */
import axios from "axios";
import { setBaseUrl } from "../../utilities/url-utilities";

const OLD_URL = setBaseUrl(`linelist/fields`);

/**
 * @deprecated - this is currently being used on the linelist page.
 * // TODO: remove once line list page refactor is complete.
 * Get all the MetadataTemplateFields belonging to the templates withing a
 * project.These will be the table headers.
 * @param {number} projectId
 * @returns {Promise}
 */
export function fetchMetadataFields(projectId) {
  return axios({
    method: "get",
    url: `${OLD_URL}?projectId=${projectId}`,
  });
}

const URL = setBaseUrl(`/ajax/metadata/fields`);

/**
 * Get all metadata fields associated with samples in a given project.
 * @param {number} projectId - identifier for a project
 * @returns {Promise<any>}
 */
export async function getMetadataFieldsForProject(projectId) {
  try {
    const { data } = await axios.get(`${URL}?projectId=${projectId}`);
    return data;
{'fraction_non_alphanumeric': 0.12771203155818542, 'fraction_numerical': 0.0, 'mean_word_length': 4.31151832460733, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3133474', 'n_tokens_mistral': 582, 'n_tokens_neox': 582, 'n_words': 195}