UNPKG

@bit-ui-libs/common

Version:
50 lines (43 loc) 1.38 kB
// This has to be a type, because.. // some requests that use this require Record<string, string> export type PaginationPayload = { page: string; limit: string; }; // Can be used by other code to use only these "filter" parameters export interface FilterParams { $ids?: string[]; // This value depends on the column names // of the entity that we're requesting $orderBy?: string; $order?: 'asc' | 'desc'; $resolveImages?: boolean; } // Can be used by other code to use only these "pagination" parameters export interface PaginationParams { $page?: number; $perPage?: number; } export type SerializableValue = | object | number | number[] | number[][] | string | string[] | boolean | number | undefined; // Can be used by other code to wrap Request interfaces with FiltersParams export type FilteredRequest<TRequest> = TRequest & FilterParams; // Can be used by other code to wrap Request interfaces with Pagination & Filters // Note: every Paginated request from bit-core-api looks like it already includes FilterParams export type PagedRequest<TRequest> = TRequest & FilterParams & PaginationParams; // Can be used by other code to wrap Response interfaces with these Pagination properties export type PagedResponse<TResponse> = { items: TResponse[]; page: number; perPage: number; totalPages: number; totalCount: number; };