import { Channel } from "./channel";
import { BagmanConfig, SubscribeOptions } from "./types";
export type GlobalEvent = "disconnect" | "disconnecting" | "connect" | "connect_error";
export declare class Bagman {
    /**
     * Configuration for this Bagman Client
     * @private
     */
    private config;
    /**
     * The socket connection.
     * @private
     */
    private socket;
    /**
     * The Holder for Authentication
     * @private
     */
    private securityCtx;
    /**
     * Creates a new `Bagman` instance.
     * @param {BagmanArgs} - The URL for the websocket server.
     */
    constructor(config: BagmanConfig);
    authorize(): Promise<void>;
    /**
     * Subscribes to a channel.
     * @async
     * @param {string} channel - The name of the channel to subscribe to.
     * @param {object} [options] - Optional parameters for the subscription.
     * @param {boolean} [options.withPresence=false] - Whether to subscribe to the channel with presence functionality.
     * @throws {Error} Throws an error if the client is not authorized.
     * @throws {Error} Throws an error if the subscription fails.
     * @returns {Promise<Channel>} A Promise that resolves with a Channel instance representing the subscribed channel.
     */
    subscribe(channel: string, { withPresence }?: SubscribeOptions): Promise<Channel>;
    /**
     * Listens to a specific global event.
     * @template T The type of the arguments to be passed to the callback.
     * @param {GlobalEvent} event - The global event to listen to.
     * @param {(...args: T) => Promise<void> | void} cb - The callback to be called when the event is emitted.
     * @throws {Error} When an invalid event is provided.
     */
    listen<T extends [...any[]]>(event: GlobalEvent, cb: (...args: T) => Promise<void> | void): void;
    close(): void;
}
