import { Schema, EndpointExtraOptions as FetchOptions, } from '@rest-hooks/react'; /** Defines the shape of a network request */ export interface FetchShape< S extends Schema | undefined, Params extends Readonly = Readonly, Body extends Readonly | void | unknown = | Readonly | undefined, Response = any, > { readonly type: 'read' | 'mutate' | 'delete'; fetch(params: Params, body?: Body): Promise; getFetchKey(params: Params): string; readonly schema: S; readonly options?: FetchOptions; } /** To change values on the server */ export interface MutateShape< S extends Schema | undefined, Params extends Readonly = Readonly, Body extends Readonly | void | unknown = | Readonly | undefined, Response extends object | string | number | boolean | null = any, > extends FetchShape { readonly type: 'mutate'; fetch(params: Params, body: Body): Promise; } /** Removes entities */ export interface DeleteShape< S extends Schema | undefined, Params extends Readonly = Readonly, Response extends object | string | number | boolean | null = any, > extends FetchShape { readonly type: 'mutate'; fetch(params: Params, ...args: any): Promise; } /** For retrieval requests */ export interface ReadShape< S extends Schema | undefined, Params extends Readonly = Readonly, Response extends object | string | number | boolean | null = any, > extends FetchShape { readonly type: 'read'; fetch(params: Params): Promise; }