export interface Config { endpoint: string; authCode?: string; type?: "json" | "xml" | string; } export interface GenericObject { [key: string]: T; } export interface CallProps { body?: GenericObject; method?: "POST" | "GET"; headers?: GenericObject; } export interface CrudListCallProps { order?: GenericObject; filter?: GenericObject; select?: string[]; } export interface CrudUpdateCallProps { id: number; fields: GenericObject; params?: GenericObject; } export interface APIType { call(path: string, params?: CallProps): Promise; } export interface MethodsDefBuilder { [key: "add" | "delete" | "fields" | "get" | "list" | "update" | "noParams" | "withFieldsParam" | string]: (api: APIType, path: string) => (...params: any) => Promise; } export interface MethodsBuilder { [key: string]: { key: string; callBuilder: (api: APIType, path: string) => (...params: any) => Promise; }; } export interface CrudDefaultMethodsType { add(fields: GenericObject): Promise; fields(): Promise; delete(id: string): Promise; get(id: string): Promise; list(options: CrudListCallProps): Promise; update(options: CrudUpdateCallProps): Promise; }