import { DataTag, QueryClient } from '@tanstack/react-query'; import { APIError } from 'better-auth'; import { ApiKeyAuthServer } from '../../../lib/auth-server'; export type ListApiKeysData = Awaited>; export type ListedApiKey = NonNullable>["apiKeys"][number]; export type ListApiKeysParams = Parameters[0]; /** * Query options factory for the current user's API keys on the server. * * Uses the same query key as the client-side `listApiKeysOptions` so that data * fetched during SSR hydrates seamlessly into the client's React Query cache. * * @param auth - The Better Auth server instance with the API key plugin. * @param userId - The signed-in user's ID. Used for cache partitioning. * @param params - Parameters forwarded to `auth.api.listApiKeys`. */ export declare function listApiKeysOptions(auth: TAuth, userId: string, params: ListApiKeysParams): (import('@tanstack/query-core').OmitKeyof>, APIError, Awaited>, 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]: Awaited>; [dataTagErrorSymbol]: APIError; }; }) & { queryKey: DataTag>, APIError>; }; /** * Get the current user's API keys from the query cache, calling * `fetchListApiKeys` under the hood if no cached entry exists. * * @param queryClient - The React Query client used for SSR hydration. * @param auth - The Better Auth server instance with the API key plugin. * @param userId - The signed-in user's ID, used for cache partitioning. * @param params - Parameters forwarded to `auth.api.listApiKeys`. */ export declare const ensureListApiKeys: (queryClient: QueryClient, auth: TAuth, userId: string, params: ListApiKeysParams) => Promise>>; /** * Prefetch the current user's API keys into the query cache. * * @param queryClient - The React Query client used for SSR hydration. * @param auth - The Better Auth server instance with the API key plugin. * @param userId - The signed-in user's ID, used for cache partitioning. * @param params - Parameters forwarded to `auth.api.listApiKeys`. */ export declare const prefetchListApiKeys: (queryClient: QueryClient, auth: TAuth, userId: string, params: ListApiKeysParams) => Promise; /** * Fetch and cache the current user's API keys, resolving with the data or * throwing on error. * * @param queryClient - The React Query client used for SSR hydration. * @param auth - The Better Auth server instance with the API key plugin. * @param userId - The signed-in user's ID, used for cache partitioning. * @param params - Parameters forwarded to `auth.api.listApiKeys`. */ export declare const fetchListApiKeys: (queryClient: QueryClient, auth: TAuth, userId: string, params: ListApiKeysParams) => Promise>>;