import { AxiosError } from 'axios'; import { ServerEndPoint } from './context/DRFReactBySchemaContext'; import { Item, SchemaType, DataSchemaColumnsType, ItemSchemaColumnsType, PaginatedResult, Id, TargetApiParams, TargetApiPostParams, GetGenericModelListProps, GetGenericModelProps, UpdateDataBySchema, AutocompleteItem, Field, TField, PaginationModel } from './@types'; /** * Global event dispatched whenever the session is definitively expired (i.e. a * 401 happened AND refreshing the token failed). Host apps can listen to this * to immediately sign out and redirect to the login page. */ export declare const AUTH_EXPIRED_EVENT = "drf-react-by-schema:auth-expired"; export declare const dispatchAuthExpired: () => void; interface TargetApiParamsOptionalId { path: string; serverEndPoint: ServerEndPoint | null; data: Item; id?: Id; contentType?: 'application/json' | 'multipart/form-data'; } export declare function getRawData({ path, serverEndPoint, }: { path: string; serverEndPoint: ServerEndPoint | null; }): Promise | T>; export declare function getData({ path, serverEndPoint, route, }: { path: string; serverEndPoint: ServerEndPoint | null; route?: string; }): Promise | Item | PaginatedResult | Item[]>; /** * * @param options - params * @returns updatedData when succesfully updated, axiosError otherwise */ export declare function updateData({ path, serverEndPoint, data, id, contentType, }: TargetApiParams): Promise | Item>; export declare function partialUpdateData({ path, serverEndPoint, data, id, }: TargetApiParams): Promise | Item>; export declare function createData({ path, serverEndPoint, data, contentType, }: TargetApiPostParams): Promise | Item>; export declare function deleteData(path: string, serverEndPoint: ServerEndPoint | null, id: Id): Promise; export declare function createOrUpdateData({ path, serverEndPoint, data, id, contentType, }: TargetApiParamsOptionalId): Promise | Item>; export declare function prepareDataBySchema({ data, schema, }: { data: Item; schema: SchemaType; }): { data: Record | FormData; contentType: "application/json" | "multipart/form-data"; }; export declare function updateDataBySchema({ model, modelObjectId, serverEndPoint, data, schema, path, }: UpdateDataBySchema & { serverEndPoint: ServerEndPoint | null; }): Promise | Item>; export declare function addExistingRelatedModel({ model, serverEndPoint, id, data, }: { model: string; serverEndPoint: ServerEndPoint | null; id: Id; data: Item; }): Promise | AxiosError>; export declare function getAutoComplete({ model, queryParams, serverEndPoint, }: { model: string; queryParams?: string[]; serverEndPoint: ServerEndPoint | null; }): Promise | AutocompleteItem[]>; export declare const loginByPayload: (payload: Item, serverEndPoint: ServerEndPoint | null) => Promise>; export declare const clearJWT: () => boolean; export declare const hasJWT: () => boolean; export declare const setAuthToken: (token: string | null) => void; export declare const isLoggedIn: (serverEndPoint: ServerEndPoint | null) => Promise>; export declare const getSignUpOptions: (serverEndPoint: ServerEndPoint | null) => Promise | { [x: string]: Field; }>; export declare const signUp: (data: Item, serverEndPoint: ServerEndPoint | null) => Promise | AxiosError>; export declare const requestPasswordReset: (email: string, serverEndPoint: ServerEndPoint | null) => Promise; export declare const confirmPasswordReset: (data: Item, serverEndPoint: ServerEndPoint | null) => Promise; export declare const changePassword: (data: Item, serverEndPoint: ServerEndPoint | null) => Promise; export declare function getGenericModelList({ model, serverEndPoint, id, relatedModel, relatedModelId, columnFields, creatableFields, disabledFields, isInBatches, loadedSchema, loadedModelOptions, page, filter, queryParams, sort, sumRows, schemas, }: GetGenericModelListProps): Promise | DataSchemaColumnsType>; export declare function getGenericModel({ model, serverEndPoint, id, relatedModel, relatedModelId, schemas, }: GetGenericModelProps): Promise | AxiosError>; export declare const getAllModels: (serverEndPoint: ServerEndPoint | null) => Promise | Record[]>; export declare const exportExcelData: ({ model, modelParent, modelParentId, paginationModel, serverEndPoint, }: { model: string; modelParent?: string; modelParentId?: Id; paginationModel: PaginationModel; serverEndPoint: ServerEndPoint | null; }) => Promise; export {}; //# sourceMappingURL=api.d.ts.map