import { BaseResourceWithId } from "./base-resource-with-id";
import { Config, Json, PaginatedResponse } from "./interfaces";
import { QueryParams, Response } from "./server";
/**
 * Base class for all API resources.
 * In case of error in:
 *  - list
 *  - get
 *  - save
 *  - delete
 *
 * methods, throws an APIResponseError with the result of
 * calling handleError on the response received from server.
 */
export declare abstract class Resource extends BaseResourceWithId {
    /**
     * Provide an implementation for serializing the resource for the API server.
     */
    abstract serializeAPI(): any;
    /**
     * Provide an implementation for deserializing data from the API server.
     *
     * @param data The data from the API server
     */
    abstract deserializeAPI(data: any): void;
    /**
     * Provide an implementation for serializing the resource for the Redux store.
     *
     * @returns data for the redux store.
     */
    abstract serializeRedux(): any;
    /**
     * Provide an implementation for creating the resource from API server data.
     *
     * @param data The data from the server
     *
     * @returns A new resource created from the given data.
     */
    static apiFactory(data: any): Resource;
    /**
     * Provide an implementation for creating the resource from the Redux store.
     *
     * @param data The data from the Redux store
     *
     * @returns A new resource created from the given data.
     */
    static reduxFactory(data: any): Resource;
    /**
     * Fetch the resource from the server.
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     *
     * @param id The id of the resource.
     * @param queryParams Params to send with the request.
     *
     * @returns The resource.
     */
    static get<R extends Resource>(id?: string, queryParams?: QueryParams): Promise<R>;
    /**
     * List the resource.
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     * @param queryParams Params to send with the request.
     * @param cancelToken Token that allows to cancel pending request.
     * @param timeout Timeout value for the request.
     * @returns The list of resources from the server.
     */
    static list<R extends Resource>(queryParams?: QueryParams, { cancelToken, timeout }?: Config): Promise<Array<R>>;
    /**
     * Create or update this resource on the server
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     */
    save(timeout?: number): Promise<void>;
    /**
     * Delete the resource on the server.
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     */
    delete(): Promise<void>;
    /**
     * Parse a response from the list endpoint from the API server.
     *
     * @param data Data from the server
     *
     * @returns The list of data from the api server.
     */
    protected static parseList(data: Response["data"]): Array<Json>;
    /**
     * List paginated resource.
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     * @param queryParams Params to send with the request.
     * @param cancelToken Token that allows to cancel pending request.
     * @param timeout Timeout value for the request.
     * @returns {PaginatedResponse}
     */
    static paginatedList<R extends Resource>(queryParams?: QueryParams, { cancelToken, timeout }?: Config): Promise<PaginatedResponse<R>>;
    /**
     * Batch list resource.
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     * @param queryParams Params to send with the request.
     * @param cancelToken Token that allows to cancel pending request.
     * @param timeout Timeout value for the request.
     * @returns List of data from server
     */
    static batchList<R extends Resource>(batchParamKey: string, queryParams: QueryParams, batchSize?: number, { cancelToken, timeout }?: Config): Promise<R[]>;
    /**
     * Bulk create resources on the server
     * In case of error, it throws an APIResponseError which
     * contains the result of calling handleError(errorResponse)
     */
    static bulkCreate<R extends Resource>(instances: R[], { timeout }?: Config): Promise<Array<R>>;
}
