import Dictionary from '../types/Dictionary'; import { ServiceModel } from './ServiceModel'; import { ServiceStoreOptions } from '../types/store/ServiceStore'; import { ResponseData, RetrieveInterfaceParams, PrimaryKey, DeleteInterfaceParams, CreateInterfaceParams, UpdateInterfaceParams } from '../types/models/ModelManager'; /** * ModelManager * Provides interface for model to retrieve data from backend api */ export declare class ModelManager { model: typeof ServiceModel; constructor(model: typeof ServiceModel); /** * Fill ServiceStoreOptions default options from params */ protected getServiceStoreOptions(options: ServiceStoreOptions, params: RetrieveInterfaceParams | undefined): ServiceStoreOptions; /** * Retrieve specific model instance from service */ detail(pk: PrimaryKey, params?: RetrieveInterfaceParams): Promise; /** * Retrieve list of model instances from service */ list(params?: RetrieveInterfaceParams): Promise>; /** * Create single instance */ create(data: any, params?: CreateInterfaceParams): Promise; /** * Update single instance */ update(pk: PrimaryKey, data: any, params?: UpdateInterfaceParams): Promise; /** * Delete single instance */ delete(pk: PrimaryKey, params?: DeleteInterfaceParams): Promise; /** * Build config for axios retrieve request */ buildRetrieveRequestConfig(params?: RetrieveInterfaceParams): Promise; /** * Retrieve detail data from ServiceStore */ retrieveDetailData(pk: PrimaryKey, params?: RetrieveInterfaceParams): Promise>; /** * Send actual detail service request and map data before caching */ sendDetailRequest(options: ServiceStoreOptions, url: string, pk: PrimaryKey, params?: RetrieveInterfaceParams): Promise; /** * Map raw response data from detail service request before cache */ mapDetailResponseBeforeCache(options: ServiceStoreOptions, data: Array, url: string, pk: PrimaryKey, params?: RetrieveInterfaceParams): Promise; /** * Send actual list service request and map data before caching */ sendListRequest(options: ServiceStoreOptions, url: string, params?: RetrieveInterfaceParams): Promise>; /** * Map raw response data from list service request before cache */ mapListResponseBeforeCache(options: ServiceStoreOptions, data: Array, url: string, params?: RetrieveInterfaceParams): Promise>; /** * Send actual create (POST) service request */ sendCreateRequest(url: string, data: any, params?: CreateInterfaceParams): Promise; /** * Send actual update (PUT) service request */ sendUpdateRequest(url: string, pk: PrimaryKey, data: any, params?: UpdateInterfaceParams): Promise; /** * Send actual partial update (PATCH) service request */ sendPartialUpdateRequest(url: string, pk: PrimaryKey, data: any, params?: UpdateInterfaceParams): Promise; /** * Send actual delete (DELETE) service request */ sendDeleteRequest(url: string, pk: PrimaryKey, params?: DeleteInterfaceParams): Promise; /** * Receive error from service and map to api exceptions */ handleResponseError(error: any): Promise; }