/**
 * Generated by orval v8.0.0-rc.0 🍺
 * Do not edit manually.
 * VietProDev CMS Backend API
 * Generated API documentation
 * OpenAPI spec version: 1.0.0
 */
import {
  useInfiniteQuery,
  useMutation,
  useQuery
} from '@tanstack/react-query';
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseInfiniteQueryResult,
  DefinedUseQueryResult,
  InfiniteData,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseInfiniteQueryOptions,
  UseInfiniteQueryResult,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult
} from '@tanstack/react-query';

import type {
  CategoryMutate,
  DeleteApiV10CategoryId200,
  GetApiV10CategoryId200,
  GetApiV10CategoryParams,
  PostApiV10Category200,
  PutApiV10CategoryId200,
  ResponseGetAllData
} from '../models';






/**
 * Retrieve a single category record by its ID
 * @summary Get category by ID
 */
export type getApiV10CategoryIdResponse200 = {
  data: GetApiV10CategoryId200
  status: 200
}

export type getApiV10CategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type getApiV10CategoryIdResponseSuccess = (getApiV10CategoryIdResponse200) & {
  headers: Headers;
};
export type getApiV10CategoryIdResponseError = (getApiV10CategoryIdResponse404) & {
  headers: Headers;
};

export type getApiV10CategoryIdResponse = (getApiV10CategoryIdResponseSuccess | getApiV10CategoryIdResponseError)

export const getGetApiV10CategoryIdUrl = (id: string,) => {


  

  return `/api/v1.0/category/${id}`
}

export const getApiV10CategoryId = async (id: string, options?: RequestInit): Promise<getApiV10CategoryIdResponse> => {
  
  const res = await fetch(getGetApiV10CategoryIdUrl(id),
  {      
    ...options,
    method: 'GET'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: getApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as getApiV10CategoryIdResponse
}





export const getGetApiV10CategoryIdInfiniteQueryKey = (id?: string,) => {
    return [
    'infinite', `/api/v1.0/category/${id}`
    ] as const;
    }

export const getGetApiV10CategoryIdQueryKey = (id?: string,) => {
    return [
    `/api/v1.0/category/${id}`
    ] as const;
    }

    
export const getGetApiV10CategoryIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetApiV10CategoryIdInfiniteQueryKey(id);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10CategoryId>>> = ({ signal }) => getApiV10CategoryId(id, { signal, ...fetchOptions });

      

      

   return  { queryKey, queryFn, enabled: !!(id),  retry: 3, retryDelay: 1000,  ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetApiV10CategoryIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10CategoryId>>>
export type GetApiV10CategoryIdInfiniteQueryError = void


export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
 id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10CategoryId>>,
          TError,
          Awaited<ReturnType<typeof getApiV10CategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10CategoryId>>,
          TError,
          Awaited<ReturnType<typeof getApiV10CategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get category by ID
 */

export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetApiV10CategoryIdInfiniteQueryOptions(id,options)

  const query = useInfiniteQuery(queryOptions, queryClient) as  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get category by ID
 */
export const prefetchGetApiV10CategoryIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetApiV10CategoryIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetApiV10CategoryIdQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetApiV10CategoryIdQueryKey(id);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10CategoryId>>> = ({ signal }) => getApiV10CategoryId(id, { signal, ...fetchOptions });

      

      

   return  { queryKey, queryFn, enabled: !!(id),  retry: 3, retryDelay: 1000,  ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetApiV10CategoryIdQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10CategoryId>>>
export type GetApiV10CategoryIdQueryError = void


export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10CategoryId>>,
          TError,
          Awaited<ReturnType<typeof getApiV10CategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10CategoryId>>,
          TError,
          Awaited<ReturnType<typeof getApiV10CategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get category by ID
 */

export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetApiV10CategoryIdQueryOptions(id,options)

  const query = useQuery(queryOptions, queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get category by ID
 */
export const prefetchGetApiV10CategoryIdQuery = async <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetApiV10CategoryIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Update a single category record by its ID
 * @summary Update category by ID
 */
export type putApiV10CategoryIdResponse200 = {
  data: PutApiV10CategoryId200
  status: 200
}

export type putApiV10CategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type putApiV10CategoryIdResponseSuccess = (putApiV10CategoryIdResponse200) & {
  headers: Headers;
};
export type putApiV10CategoryIdResponseError = (putApiV10CategoryIdResponse404) & {
  headers: Headers;
};

export type putApiV10CategoryIdResponse = (putApiV10CategoryIdResponseSuccess | putApiV10CategoryIdResponseError)

export const getPutApiV10CategoryIdUrl = (id: string,) => {


  

  return `/api/v1.0/category/${id}`
}

export const putApiV10CategoryId = async (id: string,
    categoryMutate: CategoryMutate, options?: RequestInit): Promise<putApiV10CategoryIdResponse> => {
  
  const res = await fetch(getPutApiV10CategoryIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      categoryMutate,)
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: putApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as putApiV10CategoryIdResponse
}




export const getPutApiV10CategoryIdMutationOptions = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext> => {

const mutationKey = ['putApiV10CategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof putApiV10CategoryId>>, {id: string;data: CategoryMutate}> = (props) => {
          const {id,data} = props ?? {};

          return  putApiV10CategoryId(id,data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutApiV10CategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof putApiV10CategoryId>>>
    export type PutApiV10CategoryIdMutationBody = CategoryMutate
    export type PutApiV10CategoryIdMutationError = void

    /**
 * @summary Update category by ID
 */
export const usePutApiV10CategoryId = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putApiV10CategoryId>>,
        TError,
        {id: string;data: CategoryMutate},
        TContext
      > => {

      const mutationOptions = getPutApiV10CategoryIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Delete a single category record by its ID
 * @summary Delete category by ID
 */
export type deleteApiV10CategoryIdResponse200 = {
  data: DeleteApiV10CategoryId200
  status: 200
}

export type deleteApiV10CategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type deleteApiV10CategoryIdResponseSuccess = (deleteApiV10CategoryIdResponse200) & {
  headers: Headers;
};
export type deleteApiV10CategoryIdResponseError = (deleteApiV10CategoryIdResponse404) & {
  headers: Headers;
};

export type deleteApiV10CategoryIdResponse = (deleteApiV10CategoryIdResponseSuccess | deleteApiV10CategoryIdResponseError)

export const getDeleteApiV10CategoryIdUrl = (id: string,) => {


  

  return `/api/v1.0/category/${id}`
}

export const deleteApiV10CategoryId = async (id: string, options?: RequestInit): Promise<deleteApiV10CategoryIdResponse> => {
  
  const res = await fetch(getDeleteApiV10CategoryIdUrl(id),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: deleteApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as deleteApiV10CategoryIdResponse
}




export const getDeleteApiV10CategoryIdMutationOptions = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteApiV10CategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deleteApiV10CategoryId(id,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteApiV10CategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteApiV10CategoryId>>>
    
    export type DeleteApiV10CategoryIdMutationError = void

    /**
 * @summary Delete category by ID
 */
export const useDeleteApiV10CategoryId = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteApiV10CategoryId>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteApiV10CategoryIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Retrieve a list of category with pagination, filtering and sorting
 * @summary Get all category
 */
export type getApiV10CategoryResponse200 = {
  data: ResponseGetAllData
  status: 200
}
    
export type getApiV10CategoryResponseSuccess = (getApiV10CategoryResponse200) & {
  headers: Headers;
};
;

export type getApiV10CategoryResponse = (getApiV10CategoryResponseSuccess)

export const getGetApiV10CategoryUrl = (params?: GetApiV10CategoryParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {
    
    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : value.toString())
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/api/v1.0/category?${stringifiedParams}` : `/api/v1.0/category`
}

export const getApiV10Category = async (params?: GetApiV10CategoryParams, options?: RequestInit): Promise<getApiV10CategoryResponse> => {
  
  const res = await fetch(getGetApiV10CategoryUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: getApiV10CategoryResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as getApiV10CategoryResponse
}





export const getGetApiV10CategoryInfiniteQueryKey = (params?: GetApiV10CategoryParams,) => {
    return [
    'infinite', `/api/v1.0/category`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetApiV10CategoryQueryKey = (params?: GetApiV10CategoryParams,) => {
    return [
    `/api/v1.0/category`, ...(params ? [params]: [])
    ] as const;
    }

    
export const getGetApiV10CategoryInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetApiV10CategoryInfiniteQueryKey(params);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Category>>> = ({ signal }) => getApiV10Category(params, { signal, ...fetchOptions });

      

      

   return  { queryKey, queryFn,   retry: 3, retryDelay: 1000,  ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetApiV10CategoryInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Category>>>
export type GetApiV10CategoryInfiniteQueryError = unknown


export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
 params: undefined |  GetApiV10CategoryParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10Category>>,
          TError,
          Awaited<ReturnType<typeof getApiV10Category>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10Category>>,
          TError,
          Awaited<ReturnType<typeof getApiV10Category>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all category
 */

export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetApiV10CategoryInfiniteQueryOptions(params,options)

  const query = useInfiniteQuery(queryOptions, queryClient) as  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get all category
 */
export const prefetchGetApiV10CategoryInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 queryClient: QueryClient, params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetApiV10CategoryInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetApiV10CategoryQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetApiV10CategoryQueryKey(params);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Category>>> = ({ signal }) => getApiV10Category(params, { signal, ...fetchOptions });

      

      

   return  { queryKey, queryFn,   retry: 3, retryDelay: 1000,  ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetApiV10CategoryQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Category>>>
export type GetApiV10CategoryQueryError = unknown


export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 params: undefined |  GetApiV10CategoryParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10Category>>,
          TError,
          Awaited<ReturnType<typeof getApiV10Category>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getApiV10Category>>,
          TError,
          Awaited<ReturnType<typeof getApiV10Category>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all category
 */

export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetApiV10CategoryQueryOptions(params,options)

  const query = useQuery(queryOptions, queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get all category
 */
export const prefetchGetApiV10CategoryQuery = async <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
 queryClient: QueryClient, params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetApiV10CategoryQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Create a new category record
 * @summary Create a category
 */
export type postApiV10CategoryResponse200 = {
  data: PostApiV10Category200
  status: 200
}
    
export type postApiV10CategoryResponseSuccess = (postApiV10CategoryResponse200) & {
  headers: Headers;
};
;

export type postApiV10CategoryResponse = (postApiV10CategoryResponseSuccess)

export const getPostApiV10CategoryUrl = () => {


  

  return `/api/v1.0/category`
}

export const postApiV10Category = async (categoryMutate: CategoryMutate, options?: RequestInit): Promise<postApiV10CategoryResponse> => {
  
  const res = await fetch(getPostApiV10CategoryUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      categoryMutate,)
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: postApiV10CategoryResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as postApiV10CategoryResponse
}




export const getPostApiV10CategoryMutationOptions = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext> => {

const mutationKey = ['postApiV10Category'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof postApiV10Category>>, {data: CategoryMutate}> = (props) => {
          const {data} = props ?? {};

          return  postApiV10Category(data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostApiV10CategoryMutationResult = NonNullable<Awaited<ReturnType<typeof postApiV10Category>>>
    export type PostApiV10CategoryMutationBody = CategoryMutate
    export type PostApiV10CategoryMutationError = unknown

    /**
 * @summary Create a category
 */
export const usePostApiV10Category = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof postApiV10Category>>,
        TError,
        {data: CategoryMutate},
        TContext
      > => {

      const mutationOptions = getPostApiV10CategoryMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    