/** * Top-level AI/LLM conversation thread * @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 { platformAgentThreadKeys } from '../query-keys'; import type { PlatformAgentThreadSelect, PlatformAgentThreadWithRelations, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformAgentThreadSelect, PlatformAgentThreadWithRelations, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformAgentThreadsQueryKey = platformAgentThreadKeys.list; /** * Top-level AI/LLM conversation thread * * @example * ```tsx * const { data, isLoading } = usePlatformAgentThreadsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformAgentThreadsQuery< S extends PlatformAgentThreadSelect, TData = { platformAgentThreads: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentThreadSelect>; } & Omit< UseQueryOptions< { platformAgentThreads: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformAgentThreadsQuery( params: { selection: ListSelectionConfig< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformAgentThreadKeys.list(args), queryFn: () => getClient().platformAgentThread.findMany(args).unwrap(), ...queryOptions, }); } /** * Top-level AI/LLM conversation thread * * @example * ```ts * const data = await fetchPlatformAgentThreadsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformAgentThreadsQuery(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentThreadSelect>; }): Promise<{ platformAgentThreads: ConnectionResult>; }>; export async function fetchPlatformAgentThreadsQuery(params: { selection: ListSelectionConfig< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >; }) { const args = buildListSelectionArgs< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >(params.selection); return getClient().platformAgentThread.findMany(args).unwrap(); } /** * Top-level AI/LLM conversation thread * * @example * ```ts * await prefetchPlatformAgentThreadsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformAgentThreadsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentThreadSelect>; } ): Promise; export async function prefetchPlatformAgentThreadsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformAgentThreadSelect, PlatformAgentThreadFilter, PlatformAgentThreadOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformAgentThreadKeys.list(args), queryFn: () => getClient().platformAgentThread.findMany(args).unwrap(), }); }