import { ApiClients } from '@equinor/fusion'; /** * The useHangingGardenData hook fetched and stores your raw garden data. It also gives you cache invalidation capabilities and error handling. * * @param client Name of ApiClient to be used when fetching data. * @param endpoint Name of endpoint on given ApiClient to be used when fetching data. * @param applyToFetchedData Optional. A function that takes in and return the fetched data. Can be used if one wants "massage" the dat before returned * @param searchableValues Optional. A function that is used in a map to add a searchable field to each fetched item. * @returns data: fetched data, array of T. error: null if OK, else a GardenError object. isFetching: fetching state. retry: a function to initiate a new fetch. Will first remove current data. * invalidate: a function to initiate a new fetch. Will NOT first remove current data. cacheIsInvalid: state of the cache, is invalid if cache is 30 min or older. cacheAge: age of cache in minutes * @example * * export const setItemSearchableValues = (commpkg: HandoverPackage) => ({ ...commpkg, searchableValues: [ commpkg.commpkgNo, commpkg.description, commpkg.area, commpkg.responsible, ].join(), }); * * const applyToFetchedData = (data: HandoverPackage[]) => data.filter((item) => !item.isDemolition); * * const { data, error, isFetching, retry, invalidate, cacheAge, cacheIsInvalid, } = useHangingGardenData( 'dataProxy', 'getHandoverAsync', applyToFetchedData, setItemSearchableValues ); */ declare const useHangingGardenData: (client: C, endpoint: E, applyToFetchedData?: (data: T[]) => T[], searchableValues?: (data: T) => T) => { data: T[]; error: import("../models/GardenDataError").GardenDataError; isFetching: boolean; retry: () => void; invalidate: () => void; cacheIsInvalid: boolean; cacheAge: string; }; export default useHangingGardenData;