/** * Custom error pages for a site surface, keyed by HTTP status code * @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 { platformSiteErrorPageKeys } from '../query-keys'; import type { PlatformSiteErrorPageSelect, PlatformSiteErrorPageWithRelations, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformSiteErrorPageSelect, PlatformSiteErrorPageWithRelations, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformSiteErrorPagesQueryKey = platformSiteErrorPageKeys.list; /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```tsx * const { data, isLoading } = usePlatformSiteErrorPagesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformSiteErrorPagesQuery< S extends PlatformSiteErrorPageSelect, TData = { platformSiteErrorPages: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformSiteErrorPageSelect>; } & Omit< UseQueryOptions< { platformSiteErrorPages: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformSiteErrorPagesQuery( params: { selection: ListSelectionConfig< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformSiteErrorPageKeys.list(args), queryFn: () => getClient().platformSiteErrorPage.findMany(args).unwrap(), ...queryOptions, }); } /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```ts * const data = await fetchPlatformSiteErrorPagesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformSiteErrorPagesQuery< S extends PlatformSiteErrorPageSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformSiteErrorPageSelect>; }): Promise<{ platformSiteErrorPages: ConnectionResult< InferSelectResult >; }>; export async function fetchPlatformSiteErrorPagesQuery(params: { selection: ListSelectionConfig< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >; }) { const args = buildListSelectionArgs< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >(params.selection); return getClient().platformSiteErrorPage.findMany(args).unwrap(); } /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```ts * await prefetchPlatformSiteErrorPagesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformSiteErrorPagesQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformSiteErrorPageSelect>; } ): Promise; export async function prefetchPlatformSiteErrorPagesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformSiteErrorPageSelect, PlatformSiteErrorPageFilter, PlatformSiteErrorPageOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformSiteErrorPageKeys.list(args), queryFn: () => getClient().platformSiteErrorPage.findMany(args).unwrap(), }); }