/** * Grants that make a catalog image usable by one scope * @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 { platformImageGrantKeys } from '../query-keys'; import type { PlatformImageGrantSelect, PlatformImageGrantWithRelations, PlatformImageGrantFilter, PlatformImageGrantOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformImageGrantSelect, PlatformImageGrantWithRelations, PlatformImageGrantFilter, PlatformImageGrantOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformImageGrantsQueryKey = platformImageGrantKeys.list; /** * Grants that make a catalog image usable by one scope * * @example * ```tsx * const { data, isLoading } = usePlatformImageGrantsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformImageGrantsQuery< S extends PlatformImageGrantSelect, TData = { platformImageGrants: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformImageGrantSelect>; } & Omit< UseQueryOptions< { platformImageGrants: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformImageGrantsQuery( params: { selection: ListSelectionConfig< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformImageGrantKeys.list(args), queryFn: () => getClient().platformImageGrant.findMany(args).unwrap(), ...queryOptions, }); } /** * Grants that make a catalog image usable by one scope * * @example * ```ts * const data = await fetchPlatformImageGrantsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformImageGrantsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformImageGrantSelect>; }): Promise<{ platformImageGrants: ConnectionResult>; }>; export async function fetchPlatformImageGrantsQuery(params: { selection: ListSelectionConfig< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >; }) { const args = buildListSelectionArgs< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >(params.selection); return getClient().platformImageGrant.findMany(args).unwrap(); } /** * Grants that make a catalog image usable by one scope * * @example * ```ts * await prefetchPlatformImageGrantsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformImageGrantsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformImageGrantSelect>; } ): Promise; export async function prefetchPlatformImageGrantsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformImageGrantSelect, PlatformImageGrantFilter, PlatformImageGrantOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformImageGrantKeys.list(args), queryFn: () => getClient().platformImageGrant.findMany(args).unwrap(), }); }