import { Action, ActionTypes, Filter, IAction, INotificationClient, INotification, IFilter, IMuteFilter, INotificationHistoryOptions, ISubscription, OnNotificationCallback, Notification, Subscription } from "../services/notification/types";
import { _BaseClient as BaseClient } from "./baseClient";
import PublicEventManager from "../common/events/PublicEventManager";
import { StandardCallback } from "../types";
/**
 * User for creating custom actions
 */
export declare const ROUTER_NAMESPACE: {
    ACTION_PREFIX: string;
};
/**
 * @introduction
 *
 * <h2>Notification Client (Finsemble Workspaces)</h2>
 *
 * Used to send, receive and manipulate notifications
 *
 */
declare class NotificationClient extends BaseClient implements INotificationClient {
    private subscriptions;
    Notification: typeof Notification;
    ActionTypes: typeof ActionTypes;
    Subscription: typeof Subscription;
    Action: typeof Action;
    Filter: typeof Filter;
    actionTypes: typeof ActionTypes;
    publicEventManager: PublicEventManager;
    constructor(params: any);
    /**
     * @private
     */
    applyOverrides(): Promise<void>;
    /**
     * Overriding to remove from documentation
     *
     * @param event
     * @param handler
     * @private
     */
    addEventListener(event: string, handler: Function): void;
    /**
     * Overriding to remove from documentation
     *
     * @param event
     * @param handler
     * @private
     */
    removeEventListener(event: string, handler: Function): void;
    /**
     * @param {string} channel
     * @param {string} channelPrefix Will use the default prefix if null is passed
     * @param data
     * @param {Function} callback
     * @private
     */
    query(channel: string, data: any, channelPrefix?: string, callback?: StandardCallback): Promise<any>;
    /**
     * Fetches all the notifications sent to Finsemble after a specific date.
     *
     * @param {INotificationHistoryOptions|string} options An options object or an ISO8601 formatted date string.
     * @param {IFilter} filter to match to notifications.
     * @returns {Promise<INotification[]>} array of notifications.
     * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
     *
     * @example <caption>Get notifications sent between now and one month ago</caption>
     * let lastMonth = new Date();
     * lastMonth.setMonth(lastMonth.getMonth()-1);
     *
     * const notifications = await FSBL.Clients.NotificationClient.fetchHistory({sentAfter: lastMonth.toISOString()})
     *
     * @example <caption>Get notifications sent between now and one month ago that matches a filter.</caption>
     *
     * const lastMonth = new Date();
     * lastMonth.setMonth(lastMonth.getMonth()-1);
     *
     * const filter = new FSBL.Clients.NotificationClient.Filter();
     *
     * // include all notifications from the OMS
     * filter.include.push({"source":"order-management-system"})
     *
     * // But exclude informational notifications from the OMS
     * filter.exclude.push({"source":"order-management-system", type:"informational"})
     * const notifications = await FSBL.Clients.NotificationClient.fetchHistory({sentAfter: lastMonth.toISOString()}, filter)
     */
    fetchHistory(options?: INotificationHistoryOptions | string, filter?: IFilter): Promise<INotification[]>;
    /**
     * Return an ISO8601 date a notification matching the specified source was issued.
     * If no source is provided it will get the latest issue date for all notifications
     * (i.e the last time any notification was issue to the service)
     *
     * If you're sending notifications to Finsemble from an external source, you might want to know when the last
     * Notification of that type was received by Finsemble, so you're able to send any pending ones to the
     * user's desktop
     *
     * @param {string} source to identify which notification to save lastUpdated time for.
     * @returns {Promise<string>} last issued at date string in the ISO8601 date format.
     * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
     *
     * @example
     * // Get the last date Finsemble received a notification sent with the source field set to "product-update-service"
     * const lastIssuedDate = await FSBL.Clients.NotificationClient.getLastIssuedAt("product-update-service")
     */
    getLastIssuedAt(source?: string): Promise<string>;
    /**
     * Tells the service to perform the supplied action on the notification(s)
     *
     * @param {INotification[]} notifications Notifications to apply action to.
     * @param {IAction} action which has been triggered by user.
     * @throws Error Error If no error is thrown, the service has received the request to perform the action successfully. Note a successful resolution of the promise does not mean successful completion of the action.
     * @returns {Promise<void>}
     *
     * @example
     *  await FSBL.Clients.NotificationClient.performAction([notification], action).catch((e) => {
     *   console.log("Request to perform action failed");
     * });
     * // Request to perform action succeeded. The updated notification state will be broadcast to the subscribed clients
     */
    performAction(notifications: Partial<INotification>[], action: IAction): Promise<void>;
    /**
     * Sets the states of the isRead field to true.
     *
     * All clients subscribed to received the updated notifications will be sent the new state.
     *
     * @param {INotification[]} notifications
     * @returns {Promise<void>}
     *
     * @example
     * await FSBL.Clients.NotificationClient.markRead([previouslyReceivedNotification]);
     */
    markRead(notifications: INotification[]): Promise<void>;
    /**
     * Sets the states of the isRead field to false.
     *
     * All clients subscribed to received the updated notifications will be sent the new state.
     *
     * @param {INotification[]} notifications
     * @returns {Promise<void>}
     *
     * @example
     * await FSBL.Clients.NotificationClient.markUnread([previouslyReceivedNotification]);
     */
    markUnread(notifications: INotification[]): Promise<void>;
    /**
     * Deletes a notification
     *
     * All clients subscribed to receive the updated notifications will be sent the new state.
     *
     * @param {INotification[]} notifications The notifications to delete
     * @returns {Promise<void>}
     */
    deleteNotifications(notifications: INotification[]): Promise<void>;
    /**
     * Send a new notification to Finsemble or update existing notifications already in Finsemble.
     *
     * @param {INotification[]} notifications Array of INotification
     * @throws Error If no error is thrown the service has received the notifications successfully
     * @returns {Promise<void>}
     *
     * @example <caption>Send a new notification</caption>
     * const notification = new FSBL.Clients.NotificationClient.Notification();
     * // Set your notification fields accordingly
     * 	notification.title = "Regarding Order...";
     * 	notification.details = "Creates a new notification in UI";
     * 	notification.type = "email";
     *
     * await FSBL.Clients.NotificationClient.notify([notification]);
     */
    notify(notifications: Partial<INotification>[] | Partial<INotification>): Promise<void>;
    /**
     * Subscribe to a notification stream given filters. Returns subscriptionId
     *
     * @param {ISubscription} subscription with name value pair used to match on.
     * @param {OnNotificationCallback} onNotification callback for when a subscribing UI component receives a notification.
     * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
     * @returns {Promise<string>} A subscription Id that can be used to unsubscribe from the notification stream.
     *
     * @example
     * const { NotificationClient } = FSBL.Clients;
     * const subscription = new NotificationClient.Subscription();
     *
     * // Set the filter to match INotification fields
     * subscription.filter = new NotificationClient.Filter();
     * // subscription.filter.include.push({"type": "chat"});
     *
     * const onNotification = (notification: INotification) => {
     *  // This function will be called when a notification arrives
     *  addToList(notification);
     * };
     *
     * // Use the subscription Id to unsubscribe from a specific subscription
     * const subscriptionId = await NotificationClient.subscribe(subscription, onNotification);
     */
    subscribe(subscription: Partial<ISubscription>, onNotification: OnNotificationCallback): Promise<string>;
    /**
     * Used to unsubscribe from a notification stream.
     * @param {string} subscriptionId which was returned when subscription was created.
     * @throws Error throws an error on par with the Promise standard, containing detail why the request did not complete
     * @returns {Promise<void>}
     *
     * @example
     * // the subscriptionId is returned from the subscribe function
     * await FSBL.Clients.NotificationClient.unsubscribe(subscriptionId);
     */
    unsubscribe(subscriptionId: string): Promise<void>;
    /**
     *
     * @param channel
     * @param channelPrefix
     * @private
     */
    removeResponder(channel: string, channelPrefix?: string): void;
    /**
     * Unsubscribe from all notification streams registered with the window's client instance.
     *
     * @example
     * FSBL.Clients.NotificationClient.unsubscribeAll();
     */
    unsubscribeAll(): void;
    /**
     * Sets a user preference on which notifications to mute. All future notifications that match the filter will
     * have the mute flag set to true
     *
     * @param {IFilter[]} filter Notifications to apply action to.
     * @throws Error If no error is thrown the service has performed the mute successfully.
     * @returns {Promise<void>}
     *
     * @example
     * // Mute all notifications coming from the 'order-management-system' source with type 'informational'
     * await FSBL.Clients.NotificationClient.mute({
     *   source: "order-management-system",
     *   type: "informational"
     * });
     */
    mute(filter: IMuteFilter | IMuteFilter[]): Promise<void>;
    /**
     * Sets the filter preference on which notifications to mute. All future notifications that match the filter will
     * have the mute flag set to true
     *
     * @param {IFilter[]} filter Notifications to apply action to.
     * @throws Error If no error is thrown the service has performed the unmute successfully.
     * @returns {Promise<void>}
     *
     * @example
     * // Unmute all notifications coming from the 'order-management-system' source with type 'informational'
     * await FSBL.Clients.NotificationClient.unmute({
     *   source: "order-management-system",
     *   type: "informational"
     * });
     */
    unmute(filter: IMuteFilter | IMuteFilter[]): Promise<void>;
    /**
     * Gets the available notification sources in Finsemble.
     *
     * @returns {Promise<string>} A string array with all the configured sources in Finsemble.
     * @private
     */
    getSources(): Promise<string[]>;
    /**
     * Gets the current mute filters for Notification sources in Finsemble.
     *
     * @return {IMuteFilter[]} an array with all the mute filters.
     * @private
     */
    getMuteFilters(): Promise<IMuteFilter[]>;
    /**
     * Gets the current notifications preferences object. It tries to load the configs saved in
     * the user preferences and will fallback to config/schema defaults if none are present.
     *
     * @returns {Promise<Object>} The notification preferences object.
     * @private
     */
    getPreferences(): Promise<Object>;
    /**
     *
     * @param subscriptionId
     * @private
     */
    private cleanupSubscription;
    /**
     *
     * @param {string} channel
     * @param {Function} dataProcessor
     * @param {string|null} channelPrefix
     * @private
     */
    addResponder(channel: string, dataProcessor: (notification: any) => any, channelPrefix?: string): void;
    /**
     * Listens on a channel to execute the onNotification callback and sends receipt
     *
     * @param channel the channel to listen to.
     * @param onNotification the action to take when a notification comes though
     */
    private monitorChannel;
    onClose: (cb: any) => void;
}
declare const notificationClient: NotificationClient;
export default notificationClient;
export { ActionTypes, NotificationClient };
//# sourceMappingURL=notificationClient.d.ts.map