UNPKG

@scayle/storefront-nuxt

Version:

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

29 lines (28 loc) 1.81 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 multiple brands data using the 'getBrands' RPC method. * * This function acts as a wrapper around the `useRpc` composable, * simplifying the process of fetching brands data. It internally calls `useRpc` * with the provided parameters and options. * * @see https://scayle.dev/en/api-guides/storefront-api/resources/brands/list-brands * * @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 `getBrands` RPC call. * @param params.params The parameters for the `getBrands` 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. This key is used internally by `useRpc` for caching and managing state. * * @returns The result of the `useRpc` call, which includes the fetched data, * loading state, and any error information. */ export declare function useBrands<DataT = NormalizedRpcResponse<'getBrands'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{ params: MaybeRefOrGetter<RpcMethodParameters<'getBrands'>>; options: UseRpcOptions<'getBrands', DataT, PickKeys, DefaultT>; }>, key?: UseRpcCacheKey): UseRpcReturn<'getBrands', DataT, PickKeys, DefaultT>;