UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

54 lines (53 loc) 3.63 kB
import type { RpcMethodParameters } from '@scayle/storefront-core'; import type { UseRpcOptions, UseRpcReturn, NormalizedRpcResponse, KeysOf, UseRpcCacheKey } from '../core/useRpc.js'; import type { MaybeRefOrGetter } from 'vue'; /** * Retrieves data of a single navigation tree using the `fetchNavigationTreeById` RPC method. * * This function acts as a wrapper around the `useRpc` composable, * simplifying the process of fetching data. It internally calls `useRpc` * with the provided parameters and options. * * @see https://scayle.dev/en/api-guides/storefront-api/resources/navigation/get-a-navigation * * @template DataT The type of the normalized RPC response data. Defaults to `NormalizedRpcResponse<'getBrands'>`. * @template PickKeys The keys to pick from the data. Defaults to all keys of `DataT`. * @template DefaultT The default value to use if data is not available. Defaults to `null`. * * @param params An object containing parameters and options for the `fetchNavigationTreeById` RPC call. * @param params.params The parameters for the `fetchNavigationTreeById` RPC method. * @param params.options The options for the underlying `useRpc` call, controlling data handling and loading state. * @param key A unique key for this RPC call. Used internally by `useRpc` for caching and state management. * * @returns The result of the `useRpc` call, which includes the fetched data, * loading state, and any error information. */ export declare function useNavigationTreeById<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{ params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeById'>>; options: UseRpcOptions<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>; }>, key?: UseRpcCacheKey): UseRpcReturn<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>; /** * Retrieves data of a single navigation tree using the `fetchNavigationTreeByName` RPC method. * * This function acts as a wrapper around the `useRpc` composable, * simplifying the process of fetching data. It internally calls `useRpc` * with the provided parameters and options. * * @see https://scayle.dev/en/api-guides/storefront-api/resources/navigation/get-a-navigation * * @template DataT The type of the normalized RPC response data. Defaults to `NormalizedRpcResponse<'getBrands'>`. * @template PickKeys The keys to pick from the data. Defaults to all keys of `DataT`. * @template DefaultT The default value to use if data is not available. Defaults to `null`. * * @param params An object containing parameters and options for the `fetchNavigationTreeByName` RPC call. * @param params.params The parameters for the `fetchNavigationTreeByName` RPC method. * @param params.options The options for the underlying `useRpc` call, controlling data handling and loading state. * @param key A unique key for this RPC call. Used internally by `useRpc` for caching and state management. * * @returns The result of the `useRpc` call, which includes the fetched data, * loading state, and any error information. */ export declare function useNavigationTreeByName<DataT = NormalizedRpcResponse<'fetchNavigationTreeById'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{ params: MaybeRefOrGetter<RpcMethodParameters<'fetchNavigationTreeByName'>>; options: UseRpcOptions<'fetchNavigationTreeById', DataT, PickKeys, DefaultT>; }>, key?: UseRpcCacheKey): UseRpcReturn<'fetchNavigationTreeByName', DataT, PickKeys, DefaultT>;