import { schema } from '@rest-hooks/endpoint'; import { Schema, EndpointExtraOptions } from '@rest-hooks/endpoint'; import { AbstractInstanceType } from '@rest-hooks/endpoint'; import EntityRecord from './EntityRecord.js'; import { RestEndpoint, SchemaDetail, SchemaList } from './types.js'; /** * Represents an entity to be retrieved from a server. * Typically 1:1 with a url endpoint. * * This can be a useful organization for many REST-like API patterns. * * @deprecated Use Resource directly in the future */ export default abstract class SimpleResource extends EntityRecord { /** Used as base of url construction */ static readonly urlRoot: string; static toString(): string; /*Returns the globally unique identifier for this SimpleResource */ static readonly key: string; /** URL to find this SimpleResource */ readonly url: string; /** Get the url for a SimpleResource * * Default implementation conforms to common REST patterns */ static url(urlParams: Readonly>): string; /** Get the url for many SimpleResources * * Default implementation conforms to common REST patterns */ static listUrl(searchParams?: Readonly>): string; /** Perform network request and resolve with json body */ static fetch(input: RequestInfo, init: RequestInit): Promise; /** Perform network request and resolve with HTTP Response */ static fetchResponse(input: RequestInfo, init: RequestInit): Promise; /** Init options for fetch - run at fetch */ static getFetchInit(init: Readonly): RequestInit; /** Init options for fetch - run at render */ static useFetchInit(init: Readonly): RequestInit; /** Get the request options for this SimpleResource */ static getEndpointExtra(): EndpointExtraOptions | undefined; /** Field where endpoint cache is stored */ protected static readonly cacheSymbol: unique symbol; /** Used to memoize endpoint methods * * Relies on existance of runInit() member. */ protected static memo(name: string, construct: () => T): T; /** Base endpoint that uses all the hooks provided by Resource */ protected static endpoint(): RestEndpoint<(this: RestEndpoint, params: any) => Promise, Schema | undefined, undefined>; /** Base endpoint but for sideEffects */ protected static endpointMutate(): RestEndpoint<(this: RestEndpoint, params: any, body?: any) => Promise, Schema | undefined, true>; /** Endpoint to get a single entity */ static detail(this: T): RestEndpoint<(this: RestEndpoint, params: any) => Promise, SchemaDetail>, undefined>; /** Endpoint to get a list of entities */ static list(this: T): RestEndpoint<(this: RestEndpoint, params: any) => Promise, SchemaList>, undefined>; /** Endpoint to create a new entity (post) */ static create(this: T): RestEndpoint<(this: RestEndpoint, params: any, body: any) => Promise, SchemaDetail>, true>; /** Endpoint to update an existing entity (put) */ static update(this: T): RestEndpoint<(this: RestEndpoint, params: any, body: any) => Promise, SchemaDetail>, true>; /** Endpoint to update a subset of fields of an existing entity (patch) */ static partialUpdate(this: T): RestEndpoint<(this: RestEndpoint, params: any, body: any) => Promise, SchemaDetail>, true>; /** Endpoint to delete an entity (delete) */ static delete(this: T): RestEndpoint<(this: RestEndpoint, params: any) => Promise, schema.Delete, true>; /** @deprecated */ static fetchOptionsPlugin(options: RequestInit): RequestInit; /** @deprecated */ static getFetchOptions(): EndpointExtraOptions> | undefined; } //# sourceMappingURL=SimpleResource.d.ts.map