import { FrameworkError } from '../errors.js'; import { Serializable } from './serializable.js'; import { EventSourceMessage } from '@ai-zen/node-fetch-event-source'; import { FetchEventSourceInit } from '@ai-zen/node-fetch-event-source/lib/cjs/fetch.js'; import { E as Emitter, C as Callback } from '../emitter-kHxkUxco.js'; import './types.js'; import './helpers/guards.js'; /** * Copyright 2025 © BeeAI a Series of LF Projects, LLC * SPDX-License-Identifier: Apache-2.0 */ declare class RestfulClientError extends FrameworkError { } type URLParamType = string | number | boolean | null | undefined; declare function createURLParams(data: Record>): URLSearchParams; interface FetchInput { url: string; options: RequestInit; } interface StreamInput { url: string; options: FetchEventSourceInit; } interface RestfulClientEvents { fetchStart: Callback<{ input: FetchInput; }>; fetchError: Callback<{ error: Error; input: FetchInput; }>; fetchSuccess: Callback<{ response: Response; data: any; input: FetchInput; }>; fetchDone: Callback<{ input: FetchInput; }>; streamStart: Callback<{ input: StreamInput; }>; streamOpen: Callback<{ input: StreamInput; }>; streamSuccess: Callback<{ input: StreamInput; }>; streamMessage: Callback<{ data: EventSourceMessage; input: StreamInput; }>; streamError: Callback<{ error: Error; input: StreamInput; }>; streamDone: Callback<{ input: StreamInput; }>; } declare class RestfulClient> extends Serializable { protected input: { baseUrl: string; headers?: () => Promise; paths: K; }; readonly emitter: Emitter; constructor(input: { baseUrl: string; headers?: () => Promise; paths: K; }); stream(path: keyof K, init: FetchEventSourceInit): AsyncGenerator; fetch(path: keyof K, init?: RequestInit & { searchParams?: URLSearchParams; }): Promise; protected getHeaders(extra?: HeadersInit): Promise>; protected getUrl(path: keyof K): URL; createSnapshot(): { input: { baseUrl: string; headers?: () => Promise; paths: K; }; emitter: Emitter; }; loadSnapshot(snapshot: ReturnType): void; } export { RestfulClient, RestfulClientError, type RestfulClientEvents, type StreamInput, createURLParams };