import { type URLSearchParamsInit } from '@opra/common';
import { Observable, ReplaySubject } from 'rxjs';
import { kBackend, kContext } from './constants.js';
import { HttpObserveType } from './enums/http-observable-type.enum.js';
import { HttpBackend } from './http-backend.js';
import { HttpResponse } from './http-response.js';
import { type HttpEvent } from './interfaces/http-event.js';
/**
 *
 * @class HttpRequestObservable
 */
export declare class HttpRequestObservable<T, TBody = T, TRequestOptions = {}, TResponseExt = {}> extends Observable<T> {
    [kBackend]: HttpBackend;
    [kContext]: {
        requestId: string;
        observe: HttpObserveType;
        method: string;
        url: URL;
        headers: Headers;
        /**
         * Present once this request has been included in a bundle. Subscriptions
         * attach to this subject instead of issuing their own network call, so
         * they resolve whenever {@link _finalize} pushes the bundled response —
         * whether that happens before or after the subscription is made.
         */
        _bundleEvents?: ReplaySubject<HttpEvent>;
        [key: string]: any;
    };
    constructor(backend: HttpBackend, init?: HttpBackend.RequestInit);
    get requestId(): string;
    /**
     * Marks this request as part of a bundle: it will no longer issue its own
     * network call when subscribed — instead, subscriptions wait on the internal
     * subject that {@link _finalize} pushes into. Idempotent.
     * @internal
     */
    _bindBundle(): void;
    /**
     * Resolves this request with a response parsed out-of-band, e.g. a matching
     * part of a bundled multipart response — pushed to any subscriber that's
     * already waiting as well as replayed to any future one, exactly as if the
     * response had come back over the network.
     * @internal
     */
    _finalize(response: HttpResponse<any>): void;
    /**
     * Rejects this request, e.g. when the bundle it belongs to failed before
     * (or without) producing a matching response part.
     * @internal
     */
    _finalizeError(error: unknown): void;
    options(options: TRequestOptions): HttpRequestObservable<T, TBody, TRequestOptions, TResponseExt>;
    header(headers: HeadersInit): this;
    header(name: string, value?: string | number | boolean | null): this;
    param(params: URLSearchParamsInit | Record<string, string | number | boolean | Date>): this;
    param(name: string, value: any): this;
    observe(observe: HttpObserveType.Body): HttpRequestObservable<TBody, TBody, TRequestOptions, TResponseExt>;
    observe(observe: HttpObserveType.ResponseHeader): HttpRequestObservable<HttpResponse<void> & TResponseExt, TBody, TRequestOptions, TResponseExt>;
    observe(observe: HttpObserveType.Response): HttpRequestObservable<HttpResponse<TBody> & TResponseExt, TBody, TRequestOptions, TResponseExt>;
    observe(observe: HttpObserveType.Events): HttpRequestObservable<HttpEvent<TBody, TResponseExt>, TBody, TRequestOptions, TResponseExt>;
    getBody(): Promise<TBody>;
    getResponse(): Promise<HttpResponse<TBody> & TResponseExt>;
}
