import { Result } from '../../../util/common/result';
import { RequestId } from '../../networking/common/fetch';
import { IHeaders, Response } from '../../networking/common/fetcherService';
import { Completion } from './completionsAPI';
export declare class ResponseStream {
    private readonly fetcherResponse;
    readonly requestId: RequestId;
    readonly headers: IHeaders;
    /**
     * A promise that resolves to the array of completions that were emitted by the stream.
     *
     * (it's expected to not throw)
     */
    readonly aggregatedStream: Promise<Result<Completion[], Error>>;
    /**
     * A completion that aggregates completions stream.
     *
     * (it's expected to not throw)
     */
    readonly response: Promise<Result<Completion, Error>>;
    /**
     * The stream of completions that were emitted by the response.
     *
     * @remarks This stream is single-use — it can only be iterated once.
     *
     * @throws {Error} if the response stream throws an error.
     */
    readonly stream: AsyncIterable<Completion>;
    constructor(fetcherResponse: Response, stream: AsyncIterable<Completion>, requestId: RequestId, headers: IHeaders);
    /**
     * @throws client of the method should handle the error
     */
    destroy(): Promise<void>;
    private static aggregateCompletionsStream;
}
//# sourceMappingURL=responseStream.d.ts.map