/** * Ownership verification challenges issued for a domain * @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 { platformDomainVerificationKeys } from '../query-keys'; import type { PlatformDomainVerificationSelect, PlatformDomainVerificationWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { PlatformDomainVerificationSelect, PlatformDomainVerificationWithRelations, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformDomainVerificationQueryKey = platformDomainVerificationKeys.detail; /** * Ownership verification challenges issued for a domain * * @example * ```tsx * const { data, isLoading } = usePlatformDomainVerificationQuery({ * id: 'some-id', * selection: { fields: { id: true, name: true } }, * }); * ``` */ export function usePlatformDomainVerificationQuery< S extends PlatformDomainVerificationSelect, TData = { platformDomainVerification: InferSelectResult< PlatformDomainVerificationWithRelations, S > | null; }, >( params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformDomainVerificationSelect>; } & Omit< UseQueryOptions< { platformDomainVerification: InferSelectResult< PlatformDomainVerificationWithRelations, S > | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformDomainVerificationQuery( params: { id: string; selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformDomainVerificationKeys.detail(params.id), queryFn: () => getClient() .platformDomainVerification.findOne({ id: params.id, select: args.select, }) .unwrap(), ...queryOptions, }); } /** * Ownership verification challenges issued for a domain * * @example * ```ts * const data = await fetchPlatformDomainVerificationQuery({ * id: 'some-id', * selection: { fields: { id: true } }, * }); * ``` */ export async function fetchPlatformDomainVerificationQuery< S extends PlatformDomainVerificationSelect, >(params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformDomainVerificationSelect>; }): Promise<{ platformDomainVerification: InferSelectResult | null; }>; export async function fetchPlatformDomainVerificationQuery(params: { id: string; selection: SelectionConfig; }): Promise { const args = buildSelectionArgs(params.selection); return getClient() .platformDomainVerification.findOne({ id: params.id, select: args.select, }) .unwrap(); } /** * Ownership verification challenges issued for a domain * * @example * ```ts * await prefetchPlatformDomainVerificationQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } }); * ``` */ export async function prefetchPlatformDomainVerificationQuery< S extends PlatformDomainVerificationSelect, >( queryClient: QueryClient, params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformDomainVerificationSelect>; } ): Promise; export async function prefetchPlatformDomainVerificationQuery( queryClient: QueryClient, params: { id: string; selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: platformDomainVerificationKeys.detail(params.id), queryFn: () => getClient() .platformDomainVerification.findOne({ id: params.id, select: args.select, }) .unwrap(), }); }