import { EnumOrLiteral, StreamEventName } from "../models"; import { RawResponse } from "../models/http/RawResponse"; import { StreamEventCallback } from "../models/endpoints/stream/StreamEventCallback"; /** * Wrapper class around {@link RawResponse} that provides * an interface for working with Chat's streaming data in * both browser and Node environments. * * @public */ export declare class StreamResponse { /** * {@inheritdoc RawResponse} * * @public */ readonly rawResponse: RawResponse; private streamDataParser; private isConsumed; private eventListeners; constructor(rawResponse: RawResponse); /** * Registers a function that will be called whenever the specified stream event occurs. * * @public * * @param eventName - name of the event to listen * @param cb - callback function to invoke when event occurs */ addEventListener>(eventName: E, cb: StreamEventCallback): void; /** * Reads data from a stream response and invokes callbacks from event * listeners for each chunk of data that is read. * * @remarks * Once the data has been consumed from the stream, this method will * simply return immediately on subsequent calls. * * @public */ consume(): Promise; private consumeWebStream; private consumeNodeStream; private handleEvent; }