/** * 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 { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { platformSiteErrorPageKeys } from '../query-keys'; import type { PlatformSiteErrorPageSelect, PlatformSiteErrorPageWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { PlatformSiteErrorPageSelect, PlatformSiteErrorPageWithRelations, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformSiteErrorPageQueryKey = platformSiteErrorPageKeys.detail; /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```tsx * const { data, isLoading } = usePlatformSiteErrorPageQuery({ * id: 'some-id', * selection: { fields: { id: true, name: true } }, * }); * ``` */ export function usePlatformSiteErrorPageQuery< S extends PlatformSiteErrorPageSelect, TData = { platformSiteErrorPage: InferSelectResult | null; }, >( params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformSiteErrorPageSelect>; } & Omit< UseQueryOptions< { platformSiteErrorPage: InferSelectResult | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformSiteErrorPageQuery( params: { id: string; selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformSiteErrorPageKeys.detail(params.id), queryFn: () => getClient() .platformSiteErrorPage.findOne({ id: params.id, select: args.select, }) .unwrap(), ...queryOptions, }); } /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```ts * const data = await fetchPlatformSiteErrorPageQuery({ * id: 'some-id', * selection: { fields: { id: true } }, * }); * ``` */ export async function fetchPlatformSiteErrorPageQuery< S extends PlatformSiteErrorPageSelect, >(params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformSiteErrorPageSelect>; }): Promise<{ platformSiteErrorPage: InferSelectResult | null; }>; export async function fetchPlatformSiteErrorPageQuery(params: { id: string; selection: SelectionConfig; }): Promise { const args = buildSelectionArgs(params.selection); return getClient() .platformSiteErrorPage.findOne({ id: params.id, select: args.select, }) .unwrap(); } /** * Custom error pages for a site surface, keyed by HTTP status code * * @example * ```ts * await prefetchPlatformSiteErrorPageQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } }); * ``` */ export async function prefetchPlatformSiteErrorPageQuery( queryClient: QueryClient, params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformSiteErrorPageSelect>; } ): Promise; export async function prefetchPlatformSiteErrorPageQuery( queryClient: QueryClient, params: { id: string; selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: platformSiteErrorPageKeys.detail(params.id), queryFn: () => getClient() .platformSiteErrorPage.findOne({ id: params.id, select: args.select, }) .unwrap(), }); }