import {IOGateway} from '../../../gateway';

export type Fetch = (endpoint: string | URL , request: Omit<RequestInit, 'signal'>, timeout: number) => Promise<Response>

export type RestPublisherConfig = {
    endpoint: string | URL
    timeout?: number
    authentication?: { user: string, password: string } | {path?: string} | false
    headers?: HeadersInit
    fetch?: Fetch
}

export const fetchWithTimeout: () => Fetch;

export const name = 'rest';

export function create(config: RestPublisherConfig, logger: IOGateway.Logging.Logger): (msg: 'start' | 'stop' | IOGateway.Metrics.Update) => Promise<unknown>;
