import { EndpointInstance, FetchFunction, Schema, SchemaClass, } from '@rest-hooks/endpoint'; import { EntityInterface } from '@rest-hooks/normalizr'; export type RestFetch< P = any, B = RequestInit['body'] | Record, R = any, > = (this: RestEndpoint, params?: P, body?: B, ...rest: any) => Promise; export type FetchMutate< P = any, B = RequestInit['body'] | Record, R = any, > = (this: RestEndpoint, params: P, body: B) => Promise; export type FetchGet

= ( this: RestEndpoint, params: P, ) => Promise; /** Endpoint from a Resource * * Includes additional properties provided by Resource.endpoint() */ export interface RestEndpoint< F extends FetchFunction = RestFetch, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined, U extends any[] = any, > extends EndpointInstance { url: (...args: U) => string; fetchInit: RequestInit; useFetchInit: (this: any) => any; getFetchInit: ( this: any, body?: RequestInit['body'] | Record, ) => any; method: string; signal: AbortSignal | undefined; } export type SchemaDetail = | EntityInterface | { [K: string]: any } | SchemaClass; /** @deprecated */ export type SchemaList = | EntityInterface[] | { [K: string]: any } | Schema[] | SchemaClass;