/** * List query hook for RefusalLogModule * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useQuery } from '@tanstack/react-query'; import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildListSelectionArgs } from '../selection'; import type { ListSelectionConfig } from '../selection'; import { refusalLogModuleKeys } from '../query-keys'; import type { RefusalLogModuleSelect, RefusalLogModuleWithRelations, RefusalLogModuleFilter, RefusalLogModuleOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { RefusalLogModuleSelect, RefusalLogModuleWithRelations, RefusalLogModuleFilter, RefusalLogModuleOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const refusalLogModulesQueryKey = refusalLogModuleKeys.list; /** * Query hook for fetching RefusalLogModule list * * @example * ```tsx * const { data, isLoading } = useRefusalLogModulesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useRefusalLogModulesQuery< S extends RefusalLogModuleSelect, TData = { refusalLogModules: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, RefusalLogModuleSelect>; } & Omit< UseQueryOptions< { refusalLogModules: ConnectionResult>; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useRefusalLogModulesQuery( params: { selection: ListSelectionConfig< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: refusalLogModuleKeys.list(args), queryFn: () => getClient().refusalLogModule.findMany(args).unwrap(), ...queryOptions, }); } /** * Fetch RefusalLogModule list without React hooks * * @example * ```ts * const data = await fetchRefusalLogModulesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchRefusalLogModulesQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, RefusalLogModuleSelect>; }): Promise<{ refusalLogModules: ConnectionResult>; }>; export async function fetchRefusalLogModulesQuery(params: { selection: ListSelectionConfig< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >; }) { const args = buildListSelectionArgs< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >(params.selection); return getClient().refusalLogModule.findMany(args).unwrap(); } /** * Prefetch RefusalLogModule list for SSR or cache warming * * @example * ```ts * await prefetchRefusalLogModulesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchRefusalLogModulesQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, RefusalLogModuleSelect>; } ): Promise; export async function prefetchRefusalLogModulesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >; } ): Promise { const args = buildListSelectionArgs< RefusalLogModuleSelect, RefusalLogModuleFilter, RefusalLogModuleOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: refusalLogModuleKeys.list(args), queryFn: () => getClient().refusalLogModule.findMany(args).unwrap(), }); }