import { Server } from 'http'; export interface IDictionary { [key: string]: T; } export interface RodoServer extends Server { get: RodoBuilderFactory; post: RodoBuilderFactory; put: RodoBuilderFactory; delete: RodoBuilderFactory; patch: RodoBuilderFactory; request: () => RodoBuilder; clean: (options?: { validatePending: boolean }) => RodoBuilder; waitForPending: (params?: { timeout: number }) => Promise; } export type RodoBuilderFactory = (path: string) => RodoBuilder; export interface RodoBuilder { path: string; method: string; returns: (response: RodoResponse) => RodoResponse; times: (timesCount: number) => RodoBuilder; then: (callback?: any) => Promise; reply: (body?: any) => RodoResponse; havingMethod: (method: string) => RodoBuilder; havingPath: (method: string) => RodoBuilder; havingHeader: (name: string, value: string) => RodoBuilder; havingBody: (body: any) => RodoBuilder; havingFields: (fields: IDictionary) => RodoBuilder; havingFiles: (files: any) => RodoBuilder; havingQuery: ( query: IDictionary | ((params: IDictionary) => boolean) ) => RodoBuilder; resolve: (req: any, res: any) => void; match: (req: any) => boolean; } export interface RodoResponse { then: (callback?: any) => Promise; withHeader: (name: string, value: string) => RodoResponse; withBody: (body: any) => RodoResponse; withFile: (filePath: string) => RodoResponse; withStatus: (status: number) => RodoResponse; withDelay: (delay: number) => RodoResponse; send: (req: any, res: any) => Promise; } export interface RodoOptions { defaultResponseDelay?: number; removeAfterUse?: boolean; cors?: boolean; } declare function RodoFactory( port?: number, hostname?: string, options?: RodoOptions ): RodoServer; export default RodoFactory;