/**
 * @kosService core.fetch
 * @kosApiLevel 1
 */
export declare enum KosFetchMethods {
    GET = "GET",
    PUT = "PUT",
    POST = "POST",
    DELETE = "DELETE"
}
type FetchMethodStrings = keyof typeof KosFetchMethods;
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface Headers {
    append(name: string, value: string): void;
    delete(name: string): void;
    get(name: string): string | null;
    has(name: string): boolean;
    set(name: string, value: string): void;
    forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
}
interface Body {
    readonly body: ReadableStream<Uint8Array> | null;
    readonly bodyUsed: boolean;
    arrayBuffer(): Promise<ArrayBuffer>;
    blob(): Promise<Blob>;
    formData(): Promise<FormData>;
    json<T = any>(): Promise<T | null>;
    text(): Promise<string>;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface Response extends Body {
    readonly headers: Headers;
    readonly ok: boolean;
    readonly redirected: boolean;
    readonly status: number;
    readonly statusText: string;
    readonly type: ResponseType;
    readonly url: string;
    clone(): Response;
}
/**
 * Configuration for automatic retry with exponential backoff.
 *
 * @kosService core.fetch
 *
 * When `retry` is set to `true` on {@link KosFetchOptions}, these defaults apply.
 * When set to a partial `RetryConfig`, unspecified fields use these defaults:
 * - `maxAttempts`: 3
 * - `baseDelayMs`: 350
 * - `backoffFactor`: 2
 * - `retryMutations`: false (POST, PUT, DELETE, PATCH are NOT retried)
 * - `retryOn`: retries on any error (return `true` to retry, `false` to stop)
 *
 * @example
 * ```typescript
 * // Use all defaults
 * retry: true
 *
 * // Custom config
 * retry: {
 *   maxAttempts: 5,
 *   retryOn: (response) => response.status === 503 || response.status === 429,
 * }
 * ```
 *
 * @category Service Request
 * @kosApiLevel 22
 */
export interface RetryConfig {
    /** Maximum number of attempts (including the initial request). @default 3 */
    maxAttempts?: number;
    /** Base delay in milliseconds before the first retry. @default 350 */
    baseDelayMs?: number;
    /** Multiplier applied to the delay after each attempt. @default 2 */
    backoffFactor?: number;
    /**
     * Whether to retry mutating methods (POST, PUT, DELETE, PATCH).
     * Set to `true` only if the endpoint is idempotent.
     * @default false
     */
    retryMutations?: boolean;
    /**
     * Predicate called with the {@link Response} to decide if a failed request
     * should be retried. Return `true` to retry, `false` to stop immediately.
     *
     * If not provided, all errors are retried (up to `maxAttempts`).
     *
     * @example
     * ```typescript
     * retryOn: (response) => response.status >= 500
     * ```
     */
    retryOn?: (response: Response) => boolean;
}
/**
 * Represents the configuration options for performing a Kos WebSocket fetch operation.
 *
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosFetchOptions {
    /**
     * The HTTP method for the request (e.g., 'GET', 'POST', 'PUT', 'DELETE', etc.).
     */
    method: FetchMethodStrings;
    /**
     * The request body - can be string, ArrayBuffer, Blob, or FormData.
     */
    body?: string | ArrayBuffer | Blob | FormData | Uint8Array;
    /**
     * Indicates whether the request should be ordered.
     */
    ordered?: boolean;
    /**
     * The destination address for the WebSocket request.
     */
    destinationAddress?: string;
    /**
     * @internal
     */
    signal?: AbortSignal;
    /**
     * The tracker associated with the request.
     */
    tracker?: string;
    /**
     * @internal
     */
    studio?: boolean;
    /**
     * @internal
     */
    fos?: boolean;
    /**
     * @internal
     */
    bridge?: boolean;
    timeout?: number;
    /**
     * @kosApiLevel 5
     */
    headers?: Record<string, string>;
    /**
     * Enable streaming mode for large responses
     * @kosApiLevel 11
     */
    stream?: boolean;
    /**
     * Response type hint for binary data handling
     * @kosApiLevel 11
     */
    responseType?: "text" | "json" | "arraybuffer" | "blob";
    /**
     * Retry configuration for transient failures.
     *
     * - `true`: enable retry with all defaults
     * - `RetryConfig`: partial overrides (unspecified fields use defaults)
     * - `undefined` / omitted: no retry (current behavior)
     *
     * Mutating methods (POST, PUT, DELETE, PATCH) are NOT retried by default.
     * Set `retryMutations: true` to opt in.
     * @kosApiLevel 22
     */
    retry?: boolean | RetryConfig;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosFetchResponse {
    headers: Headers;
    status: string | number | boolean;
    ok: boolean;
    json: <T = Record<string | number | symbol, string | number | symbol>>() => Promise<T>;
    body: ReadableStream<Uint8Array> | null;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosFetchReqeust {
    path: string;
    requestId: string;
    method: FetchMethodStrings;
    destinationAddress?: string;
    ordered?: boolean;
    tracker?: string;
    bridge?: boolean;
    /**
     * @kosApiLevel 5
     */
    headers?: Record<string, string | number | boolean>;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosMessageRequest extends Omit<KosFetchReqeust, "method" | "path" | "requestId"> {
    requestType: string;
    requestId?: string;
    headers?: Record<string, string>;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosBroadcastRequest {
    topic: string;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosMessageOptions extends KosBroadcastRequest {
    destinationAddress?: string;
    responseId?: string;
    type?: string;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosHttpMessageOptions {
    destinationAddress: string;
    sourceAddress: string;
    responseId: string;
    status: number;
    type: string;
    contentType?: string;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosFetchResponseParams {
    path: string;
    responseId?: string;
    destinationAddress: string;
    status: string | number | boolean;
}
/**
 * @kosService core.fetch
 * @kosApiLevel 2
 */
export interface KosFetchPostReqeust extends KosFetchReqeust {
    body?: string;
}
export {};
//# sourceMappingURL=kos-fetch.d.ts.map