<commit_before>import { getJson, makeQueryString, del, putJson, postJson, apiUrl } from './http-clients';
import { Page } from '../types/tokens/standard-tokens';
import { IVolume } from '../types/models/i-volume-entry';

const rootPath = `${apiUrl}/volumes`;

export type GetAllOptions = {
  search: string;
  index: number;
  limit: number;
}

export async function getAll( options: Partial<GetAllOptions> ) {
  const page = await getJson<Page<IVolume<'client'>>>( `${rootPath}` + makeQueryString( options ) );
  return page;
}

export async function getAllForUser( username: string, options: Partial<GetAllOptions> ) {
  const page = await getJson<Page<IVolume<'client'>>>( `${rootPath}/user/${username}` + makeQueryString( options ) );
  return page;
}

export async function getOne( id: string ) {
  const page = await getJson<IVolume<'client'>>( `${rootPath}/${id}` );
  return page;
}

export function remove( id: string ) {
  return del( `${rootPath}/${id}` );
}

export function update( id: string, token: Partial<IVolume<'client'>> ) {
  return putJson<IVolume<'client'>>( `${rootPath}/${id}`, token );
}

export function create( user: string, name: string ) {
  return postJson<IVolume<'client'>>( `${rootPath}/user/${user}/${name}`, {} );
}<commit_msg>Updated modepress frontend post call to match endpoint<commit_after>import { getJson, makeQueryString, del, putJson, postJson, apiUrl } from './http-clients';
import { Page } from '../types/tokens/standard-tokens';
import { IVolume } from '../types/models/i-volume-entry';

const rootPath = `${apiUrl}/volumes`;

export type GetAllOptions = {
  search: string;
  index: number;
  limit: number;
}

export async function getAll( options: Partial<GetAllOptions> ) {
  const page = await getJson<Page<IVolume<'client'>>>( `${rootPath}` + makeQueryString( options ) );
  return page;
}

export async function getAllForUser( username: string, options: Partial<GetAllOptions> ) {
  const page = await getJson<Page<IVolume<'client'>>>( `${rootPath}/user/${username}` + makeQueryString( options ) );
  return page;
}

export async function getOne( id: string ) {
  const page = await getJson<IVolume<'client'>>( `${rootPath}/${id}` );
  return page;
}

export function remove( id: string ) {
  return del( `${rootPath}/${id}` );
}

export function update( id: string, token: Partial<IVolume<'client'>> ) {
  return putJson<IVolume<'client'>>( `${rootPath}/${id}`, token );
}

export function create( volume: Partial<IVolume<'client'>> ) {
  return postJson<IVolume<'client'>>( `${rootPath}`, volume );
}
{'fraction_non_alphanumeric': 0.17396403440187647, 'fraction_numerical': 0.0, 'mean_word_length': 5.318518518518519, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '7121155', 'n_tokens_mistral': 799, 'n_tokens_neox': 842, 'n_words': 212}