/**
 * Generated by orval v8.0.0-rc.0 🍺
 * Do not edit manually.
 * Backend Template
 * Coded by Meu TEAM
 * 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 {
  GetVideoId200,
  GetVideoParams,
  PatchVideoId200,
  PostVideo200,
  ResponseGetAllData,
  VideoMutate
} from '../models';

import { useCustomClient } from '../mutator/custom-client';
import type { ErrorType , BodyType } from '../mutator/custom-client';



type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];



/**
 * Retrieve a specific video by its ID
 * @summary Get a video by ID
 */
export type getVideoIdResponse200 = {
  data: GetVideoId200
  status: 200
}
    
export type getVideoIdResponseSuccess = (getVideoIdResponse200) & {
  headers: Headers;
};
;

export type getVideoIdResponse = (getVideoIdResponseSuccess)

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


  

  return `/video/${id}`
}

export const getVideoId = async (id: string, options?: RequestInit): Promise<getVideoIdResponse> => {
  
  return useCustomClient<getVideoIdResponse>(getGetVideoIdUrl(id),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetVideoIdInfiniteQueryKey = (id?: string,) => {
    return [
    'infinite', `/video/${id}`
    ] as const;
    }

export const getGetVideoIdQueryKey = (id?: string,) => {
    return [
    `/video/${id}`
    ] as const;
    }

    
export const getGetVideoIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getVideoId>>>, TError = ErrorType<unknown>>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

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

export type GetVideoIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getVideoId>>>
export type GetVideoIdInfiniteQueryError = ErrorType<unknown>


export function useGetVideoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideoId>>>, TError = ErrorType<unknown>>(
 id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideoId>>,
          TError,
          Awaited<ReturnType<typeof getVideoId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideoId>>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideoId>>,
          TError,
          Awaited<ReturnType<typeof getVideoId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideoId>>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get a video by ID
 */

export function useGetVideoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideoId>>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetVideoIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get a video by ID
 */
export const prefetchGetVideoIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetVideoIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetVideoIdQueryOptions = <TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

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

export type GetVideoIdQueryResult = NonNullable<Awaited<ReturnType<typeof getVideoId>>>
export type GetVideoIdQueryError = ErrorType<unknown>


export function useGetVideoId<TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideoId>>,
          TError,
          Awaited<ReturnType<typeof getVideoId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoId<TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideoId>>,
          TError,
          Awaited<ReturnType<typeof getVideoId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoId<TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get a video by ID
 */

export function useGetVideoId<TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetVideoIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get a video by ID
 */
export const prefetchGetVideoIdQuery = async <TData = Awaited<ReturnType<typeof getVideoId>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetVideoIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Update an existing video record
 * @summary Update a video
 */
export type patchVideoIdResponse200 = {
  data: PatchVideoId200
  status: 200
}
    
export type patchVideoIdResponseSuccess = (patchVideoIdResponse200) & {
  headers: Headers;
};
;

export type patchVideoIdResponse = (patchVideoIdResponseSuccess)

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


  

  return `/video/${id}`
}

export const patchVideoId = async (id: string,
    videoMutate: VideoMutate, options?: RequestInit): Promise<patchVideoIdResponse> => {
  
  return useCustomClient<patchVideoIdResponse>(getPatchVideoIdUrl(id),
  {      
    ...options,
    method: 'PATCH',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      videoMutate,)
  }
);}




export const getPatchVideoIdMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof patchVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext> => {

const mutationKey = ['patchVideoId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


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

          return  patchVideoId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PatchVideoIdMutationResult = NonNullable<Awaited<ReturnType<typeof patchVideoId>>>
    export type PatchVideoIdMutationBody = BodyType<VideoMutate>
    export type PatchVideoIdMutationError = ErrorType<unknown>

    /**
 * @summary Update a video
 */
export const usePatchVideoId = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof patchVideoId>>,
        TError,
        {id: string;data: BodyType<VideoMutate>},
        TContext
      > => {

      const mutationOptions = getPatchVideoIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Replace an existing video record
 * @summary Replace a video
 */
export type putVideoIdResponse200 = {
  data: void
  status: 200
}
    
export type putVideoIdResponseSuccess = (putVideoIdResponse200) & {
  headers: Headers;
};
;

export type putVideoIdResponse = (putVideoIdResponseSuccess)

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


  

  return `/video/${id}`
}

export const putVideoId = async (id: string,
    videoMutate: VideoMutate, options?: RequestInit): Promise<putVideoIdResponse> => {
  
  return useCustomClient<putVideoIdResponse>(getPutVideoIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      videoMutate,)
  }
);}




export const getPutVideoIdMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext> => {

const mutationKey = ['putVideoId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


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

          return  putVideoId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutVideoIdMutationResult = NonNullable<Awaited<ReturnType<typeof putVideoId>>>
    export type PutVideoIdMutationBody = BodyType<VideoMutate>
    export type PutVideoIdMutationError = ErrorType<unknown>

    /**
 * @summary Replace a video
 */
export const usePutVideoId = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putVideoId>>, TError,{id: string;data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putVideoId>>,
        TError,
        {id: string;data: BodyType<VideoMutate>},
        TContext
      > => {

      const mutationOptions = getPutVideoIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Delete a video record
 * @summary Delete a video
 */
export type deleteVideoIdResponse200 = {
  data: void
  status: 200
}
    
export type deleteVideoIdResponseSuccess = (deleteVideoIdResponse200) & {
  headers: Headers;
};
;

export type deleteVideoIdResponse = (deleteVideoIdResponseSuccess)

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


  

  return `/video/${id}`
}

export const deleteVideoId = async (id: string, options?: RequestInit): Promise<deleteVideoIdResponse> => {
  
  return useCustomClient<deleteVideoIdResponse>(getDeleteVideoIdUrl(id),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
);}




export const getDeleteVideoIdMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteVideoId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteVideoId>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteVideoId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


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

          return  deleteVideoId(id,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteVideoIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteVideoId>>>
    
    export type DeleteVideoIdMutationError = ErrorType<unknown>

    /**
 * @summary Delete a video
 */
export const useDeleteVideoId = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteVideoId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteVideoId>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteVideoIdMutationOptions(options);

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

export type getVideoResponse = (getVideoResponseSuccess)

export const getGetVideoUrl = (params?: GetVideoParams,) => {
  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 ? `/video?${stringifiedParams}` : `/video`
}

export const getVideo = async (params?: GetVideoParams, options?: RequestInit): Promise<getVideoResponse> => {
  
  return useCustomClient<getVideoResponse>(getGetVideoUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetVideoInfiniteQueryKey = (params?: GetVideoParams,) => {
    return [
    'infinite', `/video`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetVideoQueryKey = (params?: GetVideoParams,) => {
    return [
    `/video`, ...(params ? [params]: [])
    ] as const;
    }

    
export const getGetVideoInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getVideo>>>, TError = ErrorType<unknown>>(params?: GetVideoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

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

export type GetVideoInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getVideo>>>
export type GetVideoInfiniteQueryError = ErrorType<unknown>


export function useGetVideoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideo>>>, TError = ErrorType<unknown>>(
 params: undefined |  GetVideoParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideo>>,
          TError,
          Awaited<ReturnType<typeof getVideo>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideo>>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideo>>,
          TError,
          Awaited<ReturnType<typeof getVideo>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideo>>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all videos
 */

export function useGetVideoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getVideo>>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetVideoInfiniteQueryOptions(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 videos
 */
export const prefetchGetVideoInfiniteQuery = async <TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetVideoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetVideoInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetVideoQueryOptions = <TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(params?: GetVideoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

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

export type GetVideoQueryResult = NonNullable<Awaited<ReturnType<typeof getVideo>>>
export type GetVideoQueryError = ErrorType<unknown>


export function useGetVideo<TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 params: undefined |  GetVideoParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideo>>,
          TError,
          Awaited<ReturnType<typeof getVideo>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideo<TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getVideo>>,
          TError,
          Awaited<ReturnType<typeof getVideo>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetVideo<TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all videos
 */

export function useGetVideo<TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 params?: GetVideoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetVideoQueryOptions(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 videos
 */
export const prefetchGetVideoQuery = async <TData = Awaited<ReturnType<typeof getVideo>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetVideoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getVideo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetVideoQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Create a new video record
 * @summary Create a video
 */
export type postVideoResponse200 = {
  data: PostVideo200
  status: 200
}
    
export type postVideoResponseSuccess = (postVideoResponse200) & {
  headers: Headers;
};
;

export type postVideoResponse = (postVideoResponseSuccess)

export const getPostVideoUrl = () => {


  

  return `/video`
}

export const postVideo = async (videoMutate: VideoMutate, options?: RequestInit): Promise<postVideoResponse> => {
  
  return useCustomClient<postVideoResponse>(getPostVideoUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      videoMutate,)
  }
);}




export const getPostVideoMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postVideo>>, TError,{data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof postVideo>>, TError,{data: BodyType<VideoMutate>}, TContext> => {

const mutationKey = ['postVideo'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof postVideo>>, {data: BodyType<VideoMutate>}> = (props) => {
          const {data} = props ?? {};

          return  postVideo(data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostVideoMutationResult = NonNullable<Awaited<ReturnType<typeof postVideo>>>
    export type PostVideoMutationBody = BodyType<VideoMutate>
    export type PostVideoMutationError = ErrorType<unknown>

    /**
 * @summary Create a video
 */
export const usePostVideo = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postVideo>>, TError,{data: BodyType<VideoMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof postVideo>>,
        TError,
        {data: BodyType<VideoMutate>},
        TContext
      > => {

      const mutationOptions = getPostVideoMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    