/// <reference types="jquery" />
import { DoEntity, UiCallbacksEventMap, Widget } from '../../../index';
/**
 * Processes UI callback requests from the client backend.
 */
export declare class UiCallbacks extends Widget {
    eventMap: UiCallbacksEventMap;
    self: UiCallbacks;
    onUiCallbackRequest(handlerObjectType: string, callbackId: string, owner: Widget, request: DoEntity): void;
    protected _handleCallbackError(callbackId: string, error: any): JQuery.Promise<void>;
    protected _triggerUiResponse(callbackId: string, data: DoEntity, error: UiCallbackErrorDo): void;
}
export interface UiCallbackErrorDo extends DoEntity {
    message: string;
    code: string;
}
/**
 * Browser side UI callback. Called as soon as a corresponding UiCallback is sent from the client backend. A new instance is created for each callback call.
 */
export interface UiCallbackHandler {
    /**
     * Called when a UiCallback is sent from the client backend.
     * @param callbackId The ID of the callback (as sent from the client backend).
     * @param owner The owner {@link Widget} the call belongs to.
     * @param request The optional callback request data as sent from the client backend. May be null.
     * @returns {JQuery.Promise} holding the resulting {@link DoEntity} in case it is resolved or the {@link UiCallbackErrorDo} in case it is rejected.
     */
    handle(callbackId: string, owner: Widget, request: DoEntity): JQuery.Promise<DoEntity, UiCallbackErrorDo>;
}
export interface UiCallbackResponse<TObject extends DoEntity = DoEntity> {
    id: string;
    error?: UiCallbackErrorDo;
    data?: TObject | TObject[];
}
//# sourceMappingURL=UiCallbacks.d.ts.map