@rest-api/react-models
Version:
[](https://www.npmjs.com/package/@rest-api/react-models) [](https://codecov.io/gh/hector7/rest-
22 lines (21 loc) • 1.49 kB
TypeScript
import { Schema, StringOrNumberKeys } from '../models/Schema';
import { RestModel, UrlCallbackParam } from '../models/restmodels';
import ComplexIdReducer from './ComplexIdReducer';
import BasicIdReducer from './BasicIdReducer';
import { ReducerType } from '../models/ReducerStorage';
export default class ComplexSearchReducer<Opts, S extends Schema<any>, IdKey extends StringOrNumberKeys<S['RealType']> & StringOrNumberKeys<S['PopulatedType']> & string, MetaData> {
private url;
private restModel;
constructor(restModel: RestModel<Opts, S, IdKey, any, MetaData>, reducer: BasicIdReducer<S, IdKey> | ComplexIdReducer<Opts, S, IdKey>, url: UrlCallbackParam<Opts>);
getById: (state: ReducerType, i: S['RealType'][IdKey]) => S['RealType'] | null;
private getReducer;
private getUrl;
get(opts: Opts, state: ReducerType, queryString?: string): NonNullable<S["RealType"]>[];
getPopulated(opts: Opts, state: ReducerType, queryString?: string): any[];
isInitialized(opts: Opts, state: ReducerType, queryString?: string): boolean;
isPopulated(opts: Opts, state: ReducerType, queryString?: string): boolean;
getError(opts: Opts, state: ReducerType, queryString?: string): import("../..").HttpError | null;
isFetching(opts: Opts, state: ReducerType, queryString?: string): boolean;
isInvalidated(opts: Opts, state: ReducerType, queryString?: string): boolean;
getMetadata(opts: Opts, state: ReducerType, queryString?: string): MetaData | null;
}