UNPKG

@rest-api/react-models

Version:

[![npm version](https://img.shields.io/npm/v/@rest-api/react-models)](https://www.npmjs.com/package/@rest-api/react-models) [![codecov](https://codecov.io/gh/hector7/rest-api-react-models/branch/master/graph/badge.svg)](https://codecov.io/gh/hector7/rest-

22 lines (21 loc) 1.31 kB
import { Schema, StringOrNumberKeys } from "../models/Schema"; import { Callback, HttpError } from "../.."; import { RestModel } from "../models/restmodels"; export default class ComplexIdActions<Opts, S extends Schema<any>, IdKey extends StringOrNumberKeys<S['RealType']> & StringOrNumberKeys<S['PopulatedType']> & string> { private actions; private restModel; private idQueue; constructor(restModel: RestModel<Opts, S, IdKey, any, any>); private getIdRequest; private getUri; private getIdUri; private getById; invalidateById(opts: Opts, id: S['RealType'][IdKey]): any; fetchByIdIfNeeded(opts: Opts, id: S['RealType'][IdKey], callback?: Callback<S['RealType'] | null, HttpError>): any; fetchByIdPopulatedIfNeeded(opts: Opts, id: S['RealType'][IdKey]): any; post(opts: Opts, item: Omit<S['RealType'], IdKey> | FormData, callback: Callback<S['RealType'], HttpError>): any; put(opts: Opts, id: S['RealType'][IdKey], item: S['RealType'] | FormData, callback: Callback<S['RealType'], HttpError>): any; invalidateAll(): any; patch(opts: Opts, id: S['RealType'][IdKey], item: Partial<S['RealType']> | FormData, callback: Callback<S['RealType'], HttpError>): any; delete(opts: Opts, item: S['RealType'], callback: Callback<undefined, HttpError>): any; }