/** * Custom query hook for sitesDeepLinkUrl * @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 { customQueryKeys } from '../query-keys'; import type { SitesDeepLinkUrlVariables } from '../../orm/query'; export type { SitesDeepLinkUrlVariables } from '../../orm/query'; /** Query key factory - re-exported from query-keys.ts */ export const sitesDeepLinkUrlQueryKey = customQueryKeys.sitesDeepLinkUrl; /** * Query hook for sitesDeepLinkUrl * * @example * ```tsx * const { data, isLoading } = useSitesDeepLinkUrlQuery({ variables: { linkSlug, targetSiteId } }); * * if (data?.sitesDeepLinkUrl) { * console.log(data.sitesDeepLinkUrl); * } * ``` */ export function useSitesDeepLinkUrlQuery< TData = { sitesDeepLinkUrl: string | null; }, >( params?: { variables?: SitesDeepLinkUrlVariables; } & Omit< UseQueryOptions< { sitesDeepLinkUrl: string | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useSitesDeepLinkUrlQuery< TData = { sitesDeepLinkUrl: string | null; }, >( params?: { variables?: SitesDeepLinkUrlVariables; } & Omit< UseQueryOptions< { sitesDeepLinkUrl: string | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult { const variables = params?.variables ?? {}; const { variables: _variables, ...queryOptions } = params ?? {}; void _variables; return useQuery({ queryKey: sitesDeepLinkUrlQueryKey(variables), queryFn: () => getClient().query.sitesDeepLinkUrl(variables).unwrap(), ...queryOptions, }); } /** * Fetch sitesDeepLinkUrl without React hooks * * @example * ```ts * const data = await fetchSitesDeepLinkUrlQuery({ variables: { linkSlug, targetSiteId } }); * ``` */ export async function fetchSitesDeepLinkUrlQuery(params?: { variables?: SitesDeepLinkUrlVariables; }) { const variables = params?.variables ?? {}; return getClient().query.sitesDeepLinkUrl(variables).unwrap(); } /** * Prefetch sitesDeepLinkUrl for SSR or cache warming * * @example * ```ts * await prefetchSitesDeepLinkUrlQuery(queryClient, { variables: { linkSlug, targetSiteId } }); * ``` */ export async function prefetchSitesDeepLinkUrlQuery( queryClient: QueryClient, params?: { variables?: SitesDeepLinkUrlVariables; } ): Promise { const variables = params?.variables ?? {}; await queryClient.prefetchQuery({ queryKey: sitesDeepLinkUrlQueryKey(variables), queryFn: () => getClient().query.sitesDeepLinkUrl(variables).unwrap(), }); }