@rr0/cms
Version:
RR0 Content Management System (CMS)
39 lines (38 loc) • 1.34 kB
TypeScript
import { ITimeouts, WebDriver } from "selenium-webdriver";
export declare class MimeType {
static readonly csv: string;
static readonly json: string;
static readonly txt: string;
static readonly xls: string;
static readonly pdf: string;
}
export interface HttpSourceSeleniumOptions {
browser: string;
timeout: ITimeouts;
selector: string;
}
export interface HttpFetcher {
fetch<T>(url: URL, init?: RequestInit, resOut?: Partial<Response>, error?: HttpSourceError): Promise<T>;
}
export interface HttpSourceOptions {
selenium?: HttpSourceSeleniumOptions;
fetchers: HttpFetcher[];
}
export declare class HttpSourceError extends Error {
readonly status: number;
readonly statusText?: string;
constructor(url: string, status: number, statusText?: string);
}
/**
* A source for cases that can be fetched online.
*/
export declare class HttpSource {
protected options: HttpSourceOptions;
protected driver: WebDriver;
constructor(options?: HttpSourceOptions);
getDriver(): Promise<WebDriver>;
get(queryUrl: URL, init?: RequestInit, resOut?: Partial<Response>): Promise<HTMLElement>;
fetch<T>(url: URL, init?: RequestInit, resOut?: Partial<Response>): Promise<T>;
submitForm<T>(url: URL, obj: object, headers?: {}): Promise<T>;
close(): Promise<void>;
}