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-

16 lines (15 loc) 1.09 kB
import { Schema, StringOrNumberKeys } from '../models/Schema'; import { RestModel } from '../models/restmodels'; import { Callback, HttpError } from '../..'; export default class BasicIdActions<S extends Schema<any>, IdKey extends StringOrNumberKeys<S['RealType']> & StringOrNumberKeys<S['PopulatedType']> & string> { private complexActions; constructor(model: RestModel<{}, S, IdKey, any, any>); invalidateById(id: S['RealType'][IdKey]): any; invalidateAll(): any; fetchByIdIfNeeded(id: S['RealType'][IdKey], callback?: Callback<S['RealType'] | null, HttpError>): any; fetchByIdPopulatedIfNeeded(id: S['RealType'][IdKey]): any; post(item: Omit<S['RealType'], IdKey> | FormData, callback: Callback<S['RealType'], HttpError>): any; put(id: S['RealType'][IdKey], item: S['RealType'] | FormData, callback: Callback<S['RealType'], HttpError>): any; patch(id: S['RealType'][IdKey], item: Partial<S['RealType']> | FormData, callback: Callback<S['RealType'], HttpError>): any; delete(item: S['RealType'], callback: Callback<undefined, HttpError>): any; }