import { CommerceLayerClient } from '@commercelayer/sdk'; import { Fetcher, SWRConfiguration, SWRResponse } from 'swr'; import { ResourceEndpoint } from '../../helpers/resources'; type GenericMethod = (...args: any) => Promise; type ForceToBeMethod = Method extends GenericMethod ? Method : GenericMethod; type MethodKeys = { [K in keyof T]: T[K] extends GenericMethod ? K : never; }[keyof T]; /** * This hook performs api request base on [`@commercelayer/sdk`](https://github.com/commercelayer/commercelayer-sdk) and [`swr`](https://swr.vercel.app/). * * This is an example of getting the order with id `1234`. * * If you're used to use our sdk you can write: * ```ts * const order = await client.orders.retrieve('1234') * ``` * * With `useCoreApi` you'll write instead: * ```ts * const { * data: order, * isLoading * } = useCoreApi('orders', 'retrieve', ['1234']) * ``` * @param resource Resource type * @param action Related resource action * @param args Action arguments * @param config SWR options * @returns SWR response */ export declare function useCoreApi, Method extends ForceToBeMethod, Args extends Parameters, Output extends Awaited>, SWROptions extends SWRConfiguration>>(resource: Resource, action: Action, args: Args | null, config?: SWROptions): SWRResponse; export {};