import { WritableComputedRef, ComputedRef, Ref, WatchSource } from 'vue-demi'; interface PaginationType { currentKey: string; pageSizeKey: string; totalKey: string; totalPageKey: string; } interface PaginationExtendsOption { pagination?: Partial; } interface PaginationOptions extends Options, PaginationExtendsOption { } interface PaginationQueryResult extends QueryResult { current: WritableComputedRef; pageSize: WritableComputedRef; total: ComputedRef; totalPage: ComputedRef; changeCurrent: (current: number) => void; changePageSize: (pageSize: number) => void; changePagination: (current: number, pageSize: number) => void; } declare function usePagination(service: Service, options?: PaginationOptions): PaginationQueryResult; type CacheData = { data: R; params: P; time: number; }; type CacheKey = string; declare const clearCache: (cacheKey?: CacheKey) => void; type MutateData = (newData: R) => void; type MutateFunction = (arg: (oldData: R) => R) => void; type Service = (...args: P) => Promise; interface Mutate extends MutateData, MutateFunction { } type State = { loading: Ref; data: Ref; error: Ref; params: Ref

; }; interface Query extends State { status: Ref<'pending' | 'settled'>; context: FunctionContext; plugins: Ref>[]>; } interface FunctionContext { runAsync: (...arg: P) => Promise; run: (...arg: P) => void; cancel: () => void; refresh: () => void; refreshAsync: () => Promise; mutate: Mutate; } interface QueryResult extends State, FunctionContext { } interface DebounceOptions { leading?: boolean; trailing?: boolean; maxWait?: number; } type ThrottleOptions = Omit; type GlobalOptions = BaseOptions & PaginationExtendsOption; type BaseOptions = { loadingDelay?: number | Ref; loadingKeep?: number | Ref; pollingInterval?: number | Ref; pollingWhenHidden?: boolean; pollingWhenOffline?: boolean; debounceInterval?: number | Ref; debounceOptions?: DebounceOptions; throttleOptions?: ThrottleOptions; throttleInterval?: number | Ref; refreshOnWindowFocus?: boolean | Ref; refocusTimespan?: number | Ref; cacheTime?: number; staleTime?: number; manual?: boolean; errorRetryCount?: number | Ref; errorRetryInterval?: number | Ref; getCache?: (cacheKey: string) => CacheData; setCache?: (cacheKey: string, cacheData: CacheData) => void; }; type Options = BaseOptions & { defaultParams?: P; ready?: Ref | (() => boolean); initialData?: R; refreshDeps?: WatchSource | WatchSource[]; cacheKey?: string | ((params?: P) => string); refreshDepsAction?: () => void; onSuccess?: (data: R, params: P) => void; onError?: (error: Error, params: P) => void; onBefore?: (params: P) => void; onAfter?: (params: P) => void; }; type PluginImplementType = { (queryInstance: Query, config: Options): Partial>; }; type PluginType = { onBefore: (params: P) => { isBreak?: Boolean; breakResult?: any; } | void; onQuery: (service: () => Promise) => () => Promise; onSuccess(data: R, params: P): void; onError(error: Error, params: P): void; onAfter(params: P, data: R, error: Error): void; onCancel(): void; onMutate(data: R): void; }; declare const setGlobalOptions: (config: GlobalOptions) => void; declare const definePlugin: (options: PluginImplementType) => PluginImplementType; type DataType = { list: any[]; [key: string]: any; }; type LoadMoreService = (data?: R) => Promise; type LoadMoreBaseOptions = Pick, 'ready' | 'manual' | 'refreshDeps' | 'refreshDepsAction' | 'debounceInterval' | 'debounceOptions' | 'throttleInterval' | 'throttleOptions' | 'errorRetryCount' | 'errorRetryInterval'> & { isNoMore?: (data?: R) => boolean; onBefore?: () => void; onAfter?: () => void; onSuccess?: (data: R) => void; onError?: (error: Error) => void; }; type LoadMoreQueryResult = Pick, 'data' | 'loading' | 'error' | 'refresh' | 'refreshAsync' | 'cancel' | 'mutate'> & { dataList: ComputedRef; noMore: ComputedRef; loadingMore: Ref; loadMore: () => void; loadMoreAsync: () => Promise; }; declare function useLoadMore(service: LoadMoreService, options?: LoadMoreBaseOptions): LoadMoreQueryResult; declare function useRequest(service: Service, options?: Options, plugins?: PluginImplementType[]): QueryResult; declare const _default: (config: GlobalOptions) => void; export { DataType, LoadMoreBaseOptions, LoadMoreQueryResult, LoadMoreService, Options, PaginationOptions, PaginationQueryResult, PluginImplementType, PluginType, QueryResult, Service, clearCache, definePlugin, setGlobalOptions, useLoadMore, usePagination, useRequest, _default as useRequestProvider };