@openapi-qraft/react
Version:
OpenAPI client for React, providing type-safe requests and dynamic TanStack Query React Hooks via a modular, Proxy-based architecture.
21 lines • 1.39 kB
TypeScript
import type { QueryClient } from '@tanstack/react-query';
import type { CreateAPIQueryClientOptions } from '../qraftAPIClient.js';
import type { OperationSchema, RequestFn } from './requestFn.js';
/**
* Calls a query client fetch method with parameters and options,
* and automatically composes the `QueryKey` based on the schema and parameters.
*/
export declare function callQueryClientMethodWithQueryKey<QFMethod extends QueryKeyMethods>(qraftOptions: CreateAPIQueryClientOptions, queryFilterMethod: QFMethod, schema: OperationSchema, infinite: boolean, args: QueryClientMethodArgs<QFMethod>): ReturnType<(typeof QueryClient.prototype)[QFMethod]>;
type QueryClientMethodArgs<QMethod extends keyof QueryClientPrototype> = [
options: Parameters<QueryClientPrototype[QMethod]>[0] & {
parameters?: unknown;
baseUrl?: string;
requestFn?: RequestFn<unknown, unknown>;
},
queryClient: QueryClient
];
type QueryKeyMethods = QueryKeyMethod<'fetchQuery'> | QueryKeyMethod<'prefetchQuery'> | QueryKeyMethod<'ensureQueryData'> | QueryKeyMethod<'fetchInfiniteQuery'> | QueryKeyMethod<'prefetchInfiniteQuery'> | QueryKeyMethod<'ensureInfiniteQueryData'>;
type QueryClientPrototype = typeof QueryClient.prototype;
type QueryKeyMethod<QFMethod extends keyof typeof QueryClient.prototype> = QFMethod;
export {};
//# sourceMappingURL=callQueryClientFetchMethod.d.ts.map