UNPKG

bnk-components

Version:

Reusable React components for Issaglam UI - Modern, responsive UI components with TypeScript support

57 lines (56 loc) 2.43 kB
export interface IEntityDto<TKey> { id: TKey; } export interface PagedAndSortedResultRequestDto { maxResultCount?: number; skipCount?: number; sorting?: string; } export interface PagedResultDto<T> { totalCount: number; items: T[]; } export interface LookupRequest { searchText?: string; skipCount?: number; maxResultCount?: number; getPropsForDisplay?: string[]; displayFormat?: 'string' | 'table'; } export interface LookupResponse<TKey = number> { id: TKey; display: string | Record<string, any>; properties: Record<string, any>; } export interface ICrudApiService<TEntityDto extends IEntityDto<TKey>, TKey, TGetListInput extends PagedAndSortedResultRequestDto> { getAsync(id: TKey): Promise<TEntityDto>; getListAsync(input: TGetListInput): Promise<PagedResultDto<TEntityDto>>; createAsync(input: TEntityDto): Promise<TEntityDto>; updateAsync(id: TKey, input: TEntityDto): Promise<TEntityDto>; deleteAsync(id: TKey): Promise<void>; getCountAsync(): Promise<number>; createRangeAsync(input: TEntityDto[]): Promise<void>; updateRangeAsync(input: TEntityDto[]): Promise<void>; deleteRangeAsync(ids: TKey[]): Promise<void>; } export declare class BaseApiService { protected baseUrl: string; constructor(baseUrl?: string); protected get<T>(url: string, config?: object): Promise<T>; protected post<T>(url: string, data: any, config?: object): Promise<T>; protected put<T>(url: string, data: any, config?: object): Promise<T>; protected delete<T>(url: string, config?: object): Promise<T>; } export declare class BaseCrudApiService<TEntityDto extends IEntityDto<TKey>, TKey, TGetListInput extends PagedAndSortedResultRequestDto> extends BaseApiService implements ICrudApiService<TEntityDto, TKey, TGetListInput> { constructor(baseUrl: string); getAsync(id: TKey): Promise<TEntityDto>; getListAsync(input: TGetListInput): Promise<PagedResultDto<TEntityDto>>; getLookupAsync(request: LookupRequest): Promise<LookupResponse<TKey>[]>; createAsync(input: TEntityDto): Promise<TEntityDto>; updateAsync(id: TKey, input: TEntityDto): Promise<TEntityDto>; deleteAsync(id: TKey): Promise<void>; getCountAsync(): Promise<number>; createRangeAsync(input: TEntityDto[]): Promise<void>; updateRangeAsync(input: TEntityDto[]): Promise<void>; deleteRangeAsync(ids: TKey[]): Promise<void>; }