/** * Branch heads — mutable pointers into the commit chain * @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 { platformInfraRefKeys } from '../query-keys'; import type { PlatformInfraRefSelect, PlatformInfraRefWithRelations, PlatformInfraRefFilter, PlatformInfraRefOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformInfraRefSelect, PlatformInfraRefWithRelations, PlatformInfraRefFilter, PlatformInfraRefOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformInfraRefsQueryKey = platformInfraRefKeys.list; /** * Branch heads — mutable pointers into the commit chain * * @example * ```tsx * const { data, isLoading } = usePlatformInfraRefsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformInfraRefsQuery< S extends PlatformInfraRefSelect, TData = { platformInfraRefs: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformInfraRefSelect>; } & Omit< UseQueryOptions< { platformInfraRefs: ConnectionResult>; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformInfraRefsQuery( params: { selection: ListSelectionConfig< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformInfraRefKeys.list(args), queryFn: () => getClient().platformInfraRef.findMany(args).unwrap(), ...queryOptions, }); } /** * Branch heads — mutable pointers into the commit chain * * @example * ```ts * const data = await fetchPlatformInfraRefsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformInfraRefsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformInfraRefSelect>; }): Promise<{ platformInfraRefs: ConnectionResult>; }>; export async function fetchPlatformInfraRefsQuery(params: { selection: ListSelectionConfig< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >; }) { const args = buildListSelectionArgs< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >(params.selection); return getClient().platformInfraRef.findMany(args).unwrap(); } /** * Branch heads — mutable pointers into the commit chain * * @example * ```ts * await prefetchPlatformInfraRefsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformInfraRefsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformInfraRefSelect>; } ): Promise; export async function prefetchPlatformInfraRefsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformInfraRefSelect, PlatformInfraRefFilter, PlatformInfraRefOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformInfraRefKeys.list(args), queryFn: () => getClient().platformInfraRef.findMany(args).unwrap(), }); }