import * as swr from 'swr'; import { SWRHook, SWRConfiguration } from 'swr'; import { AuthTokenHeader } from './fetcher.js'; import { MatsuriError } from './MatsuriError.js'; type SWRKey = Parameters[0]; interface FetchCreatorOptions { url: string; method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "OPTIONS" | "HEAD"; token?: string; body?: RequestInit["body"]; fetch?: (info: RequestInfo, init?: RequestInit) => Promise; authTokenHeader?: AuthTokenHeader; } declare const createFetcher: (options: FetchCreatorOptions) => (_: SWRKey) => Promise; declare const useRequest: >(key: SWRKey, fetchOptions: FetchCreatorOptions, config?: Partial) => { data: T | undefined; error: MatsuriError | undefined; refetch: swr.KeyedMutator; isLoading: boolean; isValidating: boolean; }; interface FetchCreatorOptionsForAuthRequest extends FetchCreatorOptions { token: string; } declare const useAuthRequest: >(key: SWRKey, fetchOptions: FetchCreatorOptionsForAuthRequest, config?: Partial) => { data: T | undefined; error: MatsuriError | undefined; refetch: swr.KeyedMutator; isLoading: boolean; isValidating: boolean; }; declare const useAuthBearerRequest: >(key: SWRKey, fetchOptions: FetchCreatorOptionsForAuthRequest, config?: Partial) => { data: T | undefined; error: MatsuriError | undefined; refetch: swr.KeyedMutator; isLoading: boolean; isValidating: boolean; }; export { createFetcher, useAuthBearerRequest, useAuthRequest, useRequest };