;
(api: xhr.API): xhr.Request
;
get
(url: string): xhr.Request
;
post
(url: string): xhr.Request
;
put
(url: string): xhr.Request
;
delete
(url: string): xhr.Request
;
patch
(url: string): xhr.Request
;
resolve(...urls: Array): string;
import(module: string, esModules?: ReadonlyArray): Promise;
}
declare namespace xhr {
export interface Request extends Yarla.Cancelable {
send(data?: P, opts?: Options): Promise>;
}
export interface Response {
readonly status: number;
readonly headers: Yarla.KVPair>;
readonly responseURL: string;
readonly response: T;
}
export interface ResponseError extends Yarla.HttpError {
readonly url: string;
readonly xhr: XMLHttpRequest;
readonly headers: Yarla.AnyObject>;
readonly responseType: Yarla.xhr.ResponseType;
readonly response: any;
readonly body: any;
}
export interface Options {
readonly body?: any;
readonly baseURI?: string;
readonly timeout?: number;
readonly headers?: Headers | Yarla.KVPair> | Yarla.AnyObject>;
readonly username?: string;
readonly password?: string;
readonly credentials?: boolean;
readonly responseType?: ResponseType;
readonly onStarting?: () => void;
readonly onProgress?: (progress: Progress) => void;
readonly onFinished?: () => void;
}
export interface Progress {
readonly lengthComputable: boolean;
readonly loaded: number;
readonly total: number;
}
export interface API {
readonly url: string;
readonly method: string;
}
export type ResponseType = Exclude;
}