@gpa-gemstone/react-interactive
Version:
Interactive UI Components for GPA products
30 lines (29 loc) • 1.32 kB
TypeScript
import { Search } from './SearchBar';
interface IPagedResult<T> {
Data: T[];
NumberOfPages: number;
TotalRecords: number;
RecordsPerPage: number;
}
export default class GenericController<T> {
APIPath: string;
DefaultSort: keyof T;
Ascending: boolean;
Fetch: (parentID: (void | number | string | null), sortField?: keyof T, ascending?: boolean) => JQuery.jqXHR<T[]>;
DBAction: (verb: 'POST' | 'DELETE' | 'PATCH', record: T) => JQuery.jqXHR;
DBSearch: (filter: Search.IFilter<T>[], sortField?: keyof T, ascending?: boolean, parentID?: (number | string)) => JQuery.jqXHR<T[]>;
PagedSearch: (filter: Search.IFilter<T>[], sortField?: keyof T, ascending?: boolean, page?: number, parentID?: (number | string)) => JQuery.jqXHR<IPagedResult<T>>;
/**
* Creates a new Controler of type T, which can be used to perform basic CRUD operations against
* a specified web api. without the Reduxstore associated with GenericSlice
* @typeParam T - Model of Generic Slice
* @param {string} apiPath - string containing relative path to web api
* @returns a new GenericController<T>
*/
constructor(apiPath: string, defaultSort: keyof T, ascending?: boolean);
private GetRecords;
private Action;
private Search;
private FetchPage;
}
export {};