/** * Files a reviewer has read, pinned to the blob they read * @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 { platformProposalFileViewKeys } from '../query-keys'; import type { PlatformProposalFileViewSelect, PlatformProposalFileViewWithRelations, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformProposalFileViewSelect, PlatformProposalFileViewWithRelations, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformProposalFileViewsQueryKey = platformProposalFileViewKeys.list; /** * Files a reviewer has read, pinned to the blob they read * * @example * ```tsx * const { data, isLoading } = usePlatformProposalFileViewsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformProposalFileViewsQuery< S extends PlatformProposalFileViewSelect, TData = { platformProposalFileViews: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformProposalFileViewSelect>; } & Omit< UseQueryOptions< { platformProposalFileViews: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformProposalFileViewsQuery( params: { selection: ListSelectionConfig< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformProposalFileViewKeys.list(args), queryFn: () => getClient().platformProposalFileView.findMany(args).unwrap(), ...queryOptions, }); } /** * Files a reviewer has read, pinned to the blob they read * * @example * ```ts * const data = await fetchPlatformProposalFileViewsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformProposalFileViewsQuery< S extends PlatformProposalFileViewSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformProposalFileViewSelect>; }): Promise<{ platformProposalFileViews: ConnectionResult< InferSelectResult >; }>; export async function fetchPlatformProposalFileViewsQuery(params: { selection: ListSelectionConfig< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >; }) { const args = buildListSelectionArgs< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >(params.selection); return getClient().platformProposalFileView.findMany(args).unwrap(); } /** * Files a reviewer has read, pinned to the blob they read * * @example * ```ts * await prefetchPlatformProposalFileViewsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformProposalFileViewsQuery< S extends PlatformProposalFileViewSelect, >( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformProposalFileViewSelect>; } ): Promise; export async function prefetchPlatformProposalFileViewsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformProposalFileViewSelect, PlatformProposalFileViewFilter, PlatformProposalFileViewOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformProposalFileViewKeys.list(args), queryFn: () => getClient().platformProposalFileView.findMany(args).unwrap(), }); }