import { DataTag, QueryClient } from '@tanstack/react-query'; import { BetterFetchError } from 'better-auth/react'; import { ApiKeyAuthClient, InferData } from '../../lib/auth-client'; export type ListApiKeysData = InferData; export type ListApiKeysParams = Parameters[0]; export type ListedApiKey = NonNullable>["apiKeys"][number]; export type ListApiKeysOptions = Omit>, "queryKey" | "queryFn">; /** * Query options factory for the current user's API keys. * * Shares a query key with the server-side `listApiKeysOptions` from * `@better-auth-ui/react/server`, so SSR-hydrated data is reused from the * cache without an immediate refetch. * * @param authClient - The Better Auth client with the API key plugin. * @param userId - The current signed-in user's ID. Used for cache partitioning. * @param params - Parameters forwarded to `authClient.apiKey.list`. */ export declare function listApiKeysOptions(authClient: TAuthClient, userId: string | undefined, params?: ListApiKeysParams): (import('@tanstack/query-core').OmitKeyof, BetterFetchError, InferData, readonly ["auth", "user", string | undefined, "apiKey", "list", { configId?: string | undefined; organizationId?: string | undefined; limit?: unknown; offset?: unknown; sortBy?: string | undefined; sortDirection?: "asc" | "desc" | undefined; } | null]>, "queryFn"> & { queryFn?: import('@tanstack/query-core').QueryFunction, readonly ["auth", "user", string | undefined, "apiKey", "list", { configId?: string | undefined; organizationId?: string | undefined; limit?: unknown; offset?: unknown; sortBy?: string | undefined; sortDirection?: "asc" | "desc" | undefined; } | null], never> | undefined; } & { queryKey: readonly ["auth", "user", string | undefined, "apiKey", "list", { configId?: string | undefined; organizationId?: string | undefined; limit?: unknown; offset?: unknown; sortBy?: string | undefined; sortDirection?: "asc" | "desc" | undefined; } | null] & { [dataTagSymbol]: InferData; [dataTagErrorSymbol]: BetterFetchError; }; }) & { queryKey: DataTag, BetterFetchError>; }; export declare const ensureListApiKeys: (queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListApiKeysParams) => Promise>; export declare const prefetchListApiKeys: (queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListApiKeysParams) => Promise; export declare const fetchListApiKeys: (queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListApiKeysParams) => Promise>; export type UseListApiKeysOptions = ListApiKeysOptions & ListApiKeysParams; /** * Subscribe to the current user's API keys via TanStack Query. * * Shares a query key with the server-side `listApiKeysOptions`, so * SSR-hydrated data is reused from the cache without an immediate refetch. * The query is gated on a signed-in user; while the session is loading or * absent, the underlying `queryFn` is replaced with `skipToken`. * * @param authClient - The Better Auth client with the API key plugin. * @param options - `apiKey.list` params merged with `useQuery` options. * @param queryClient - Optional custom `QueryClient`. */ export declare function useListApiKeys(authClient: TAuthClient, options?: UseListApiKeysOptions, queryClient?: QueryClient): import('@tanstack/react-query').UseQueryResult>, BetterFetchError>;