import { IPagedData } from '@tsrt/utils'; export interface ICrudApiClient> { item: I; hasPendingRequest: boolean; /** * Creates new entity record. * * @param body - Entity data. * @param [query] - Additional query params. */ create(body: I, query?: IQueryParams): Promise; create(body: I[], query?: IQueryParams): Promise; create(body: I | I[], query?: IQueryParams): Promise; /** * Reads entity by id / list of entities. * * @param [query] - Additional query params. * @param [id] - Specific entity id. */ read(query?: IQueryParams, id?: null): Promise; read(query?: IQueryParams, id?: number | string): Promise; read(query?: IQueryParams, id?: number | string): Promise; /** * Updates entity by id or list of entities. * * @param body - Entity data / list of entities. * @param [id] - Entity id. * @param [query] - Additional query params. */ update(body: Array>, id?: null, query?: IQueryParams): Promise; update(body: Partial, id: number | string, query?: IQueryParams): Promise; update(body: Partial | Array>, id?: number | string, query?: IQueryParams): Promise; /** * Deletes entity by id. * * @param id - Entity id. * @param [query] - Additional query params. */ delete(id: number | string, query?: IQueryParams): Promise; /** * Creates or updates entities from provided list. * * @param body - List of entities * @param [query] - Additional query params. */ /** * Updates order for list of entities. * * @param body - List of entities to reorder / list of new orders where each item is { id: id, order: order }; * @param [query] - Additional query params */ updateItemsOrder(body: Array>, query?: IQueryParams): Promise; /** * Cancels current request. * * @param [message] - Message to show after request canceled */ cancel(message?: string): void; /** Resets value of current item */ reset(): void; }