2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class BaseRequestOptions extends RequestOptions {
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class BaseResponseOptions extends ResponseOptions {
|
|
|
|
constructor();
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class BrowserXhr {
|
|
|
|
constructor();
|
|
|
|
build(): any;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class Connection {
|
|
|
|
readyState: ReadyState;
|
|
|
|
request: Request;
|
|
|
|
response: any;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class ConnectionBackend {
|
|
|
|
abstract createConnection(request: any): Connection;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class CookieXSRFStrategy implements XSRFStrategy {
|
|
|
|
constructor(_cookieName?: string, _headerName?: string);
|
|
|
|
configureRequest(req: Request): void;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class Headers {
|
|
|
|
constructor(headers?: Headers | {
|
2016-10-03 18:27:56 -04:00
|
|
|
[name: string]: any;
|
2016-06-22 17:56:10 -04:00
|
|
|
});
|
|
|
|
append(name: string, value: string): void;
|
|
|
|
delete(name: string): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
entries(): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void;
|
2016-10-03 18:27:56 -04:00
|
|
|
get(name: string): string;
|
|
|
|
getAll(name: string): string[];
|
|
|
|
has(name: string): boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
keys(): string[];
|
2016-10-03 18:27:56 -04:00
|
|
|
set(name: string, value: string | string[]): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
toJSON(): {
|
2016-10-03 18:27:56 -04:00
|
|
|
[name: string]: any;
|
2016-06-22 17:56:10 -04:00
|
|
|
};
|
2016-06-23 21:19:32 -04:00
|
|
|
values(): string[][];
|
|
|
|
static fromResponseHeaderString(headersString: string): Headers;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class Http {
|
|
|
|
protected _backend: ConnectionBackend;
|
|
|
|
protected _defaultOptions: RequestOptions;
|
|
|
|
constructor(_backend: ConnectionBackend, _defaultOptions: RequestOptions);
|
2016-06-23 21:19:32 -04:00
|
|
|
delete(url: string, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-22 17:56:10 -04:00
|
|
|
get(url: string, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-23 21:19:32 -04:00
|
|
|
head(url: string, options?: RequestOptionsArgs): Observable<Response>;
|
2016-08-08 12:15:13 -04:00
|
|
|
options(url: string, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-23 21:19:32 -04:00
|
|
|
patch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-22 17:56:10 -04:00
|
|
|
post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
|
|
|
|
put(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-23 21:19:32 -04:00
|
|
|
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-07-27 16:09:05 -04:00
|
|
|
/** @experimental */
|
|
|
|
export declare class HttpModule {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class Jsonp extends Http {
|
|
|
|
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions);
|
|
|
|
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class JSONPBackend extends ConnectionBackend {
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class JSONPConnection implements Connection {
|
|
|
|
readyState: ReadyState;
|
|
|
|
request: Request;
|
|
|
|
response: Observable<Response>;
|
|
|
|
abstract finished(data?: any): void;
|
|
|
|
}
|
|
|
|
|
2016-07-27 16:09:05 -04:00
|
|
|
/** @experimental */
|
|
|
|
export declare class JsonpModule {
|
|
|
|
}
|
|
|
|
|
2016-06-28 14:31:35 -04:00
|
|
|
/** @experimental */
|
|
|
|
export declare class QueryEncoder {
|
|
|
|
encodeKey(k: string): string;
|
|
|
|
encodeValue(v: string): string;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare enum ReadyState {
|
|
|
|
Unsent = 0,
|
|
|
|
Open = 1,
|
|
|
|
HeadersReceived = 2,
|
|
|
|
Loading = 3,
|
|
|
|
Done = 4,
|
|
|
|
Cancelled = 5,
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-05-26 18:47:20 -04:00
|
|
|
export declare class Request extends Body {
|
2016-06-22 17:56:10 -04:00
|
|
|
headers: Headers;
|
2016-06-23 21:19:32 -04:00
|
|
|
method: RequestMethod;
|
2016-05-26 18:47:20 -04:00
|
|
|
responseType: ResponseContentType;
|
2016-06-22 17:56:10 -04:00
|
|
|
url: string;
|
|
|
|
withCredentials: boolean;
|
|
|
|
constructor(requestOptions: RequestArgs);
|
|
|
|
detectContentType(): ContentType;
|
2016-07-22 11:37:32 -04:00
|
|
|
detectContentTypeFromBody(): ContentType;
|
2016-06-22 17:56:10 -04:00
|
|
|
getBody(): any;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare enum RequestMethod {
|
|
|
|
Get = 0,
|
|
|
|
Post = 1,
|
|
|
|
Put = 2,
|
|
|
|
Delete = 3,
|
|
|
|
Options = 4,
|
|
|
|
Head = 5,
|
|
|
|
Patch = 6,
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class RequestOptions {
|
|
|
|
body: any;
|
2016-06-23 21:19:32 -04:00
|
|
|
headers: Headers;
|
|
|
|
method: RequestMethod | string;
|
2016-12-09 18:38:29 -05:00
|
|
|
params: URLSearchParams;
|
2016-05-26 18:47:20 -04:00
|
|
|
responseType: ResponseContentType;
|
2016-12-09 18:38:29 -05:00
|
|
|
/** @deprecated */ search: URLSearchParams;
|
2016-06-23 21:19:32 -04:00
|
|
|
url: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
withCredentials: boolean;
|
2016-12-09 18:38:29 -05:00
|
|
|
constructor({method, headers, body, url, search, params, withCredentials, responseType}?: RequestOptionsArgs);
|
2016-06-22 17:56:10 -04:00
|
|
|
merge(options?: RequestOptionsArgs): RequestOptions;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface RequestOptionsArgs {
|
2016-06-23 21:19:32 -04:00
|
|
|
body?: any;
|
|
|
|
headers?: Headers;
|
2016-06-22 17:56:10 -04:00
|
|
|
method?: string | RequestMethod;
|
2016-12-09 18:38:29 -05:00
|
|
|
params?: string | URLSearchParams | {
|
|
|
|
[key: string]: any | any[];
|
|
|
|
};
|
2016-05-26 18:47:20 -04:00
|
|
|
responseType?: ResponseContentType;
|
2016-12-09 18:38:29 -05:00
|
|
|
/** @deprecated */ search?: string | URLSearchParams | {
|
|
|
|
[key: string]: any | any[];
|
|
|
|
};
|
2016-06-23 21:19:32 -04:00
|
|
|
url?: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
withCredentials?: boolean;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-05-26 18:47:20 -04:00
|
|
|
export declare class Response extends Body {
|
2016-06-23 21:19:32 -04:00
|
|
|
bytesLoaded: number;
|
|
|
|
headers: Headers;
|
2016-06-22 17:56:10 -04:00
|
|
|
ok: boolean;
|
|
|
|
status: number;
|
|
|
|
statusText: string;
|
|
|
|
totalBytes: number;
|
2016-06-23 21:19:32 -04:00
|
|
|
type: ResponseType;
|
|
|
|
url: string;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor(responseOptions: ResponseOptions);
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
|
2016-05-26 18:47:20 -04:00
|
|
|
/** @experimental */
|
|
|
|
export declare enum ResponseContentType {
|
2016-07-21 16:44:38 -04:00
|
|
|
Text = 0,
|
2016-05-26 18:47:20 -04:00
|
|
|
Json = 1,
|
2016-07-21 16:44:38 -04:00
|
|
|
ArrayBuffer = 2,
|
|
|
|
Blob = 3,
|
2016-05-26 18:47:20 -04:00
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class ResponseOptions {
|
2016-07-21 16:44:38 -04:00
|
|
|
body: string | Object | ArrayBuffer | Blob;
|
2016-06-22 17:56:10 -04:00
|
|
|
headers: Headers;
|
2016-06-23 21:19:32 -04:00
|
|
|
status: number;
|
2016-06-22 17:56:10 -04:00
|
|
|
url: string;
|
|
|
|
constructor({body, status, headers, statusText, type, url}?: ResponseOptionsArgs);
|
|
|
|
merge(options?: ResponseOptionsArgs): ResponseOptions;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare type ResponseOptionsArgs = {
|
2016-07-21 16:44:38 -04:00
|
|
|
body?: string | Object | FormData | ArrayBuffer | Blob;
|
2016-06-22 17:56:10 -04:00
|
|
|
status?: number;
|
|
|
|
statusText?: string;
|
|
|
|
headers?: Headers;
|
|
|
|
type?: ResponseType;
|
|
|
|
url?: string;
|
|
|
|
};
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare enum ResponseType {
|
|
|
|
Basic = 0,
|
|
|
|
Cors = 1,
|
|
|
|
Default = 2,
|
|
|
|
Error = 3,
|
|
|
|
Opaque = 4,
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class URLSearchParams {
|
|
|
|
paramsMap: Map<string, string[]>;
|
2016-06-23 21:19:32 -04:00
|
|
|
rawParams: string;
|
2016-06-28 14:31:35 -04:00
|
|
|
constructor(rawParams?: string, queryEncoder?: QueryEncoder);
|
2016-06-23 21:19:32 -04:00
|
|
|
append(param: string, val: string): void;
|
|
|
|
appendAll(searchParams: URLSearchParams): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
clone(): URLSearchParams;
|
2016-06-23 21:19:32 -04:00
|
|
|
delete(param: string): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
get(param: string): string;
|
|
|
|
getAll(param: string): string[];
|
2016-06-23 21:19:32 -04:00
|
|
|
has(param: string): boolean;
|
|
|
|
replaceAll(searchParams: URLSearchParams): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
set(param: string, val: string): void;
|
|
|
|
setAll(searchParams: URLSearchParams): void;
|
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
|
2016-11-30 16:52:08 -05:00
|
|
|
/** @stable */
|
|
|
|
export declare const VERSION: Version;
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class XHRBackend implements ConnectionBackend {
|
|
|
|
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy);
|
|
|
|
createConnection(request: Request): XHRConnection;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class XHRConnection implements Connection {
|
2016-06-23 21:19:32 -04:00
|
|
|
readyState: ReadyState;
|
2016-06-22 17:56:10 -04:00
|
|
|
request: Request;
|
|
|
|
response: Observable<Response>;
|
|
|
|
constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions);
|
|
|
|
setDetectedContentType(req: any, _xhr: any): void;
|
|
|
|
}
|
|
|
|
|
2016-06-27 15:27:23 -04:00
|
|
|
/** @experimental */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class XSRFStrategy {
|
|
|
|
abstract configureRequest(req: Request): void;
|
|
|
|
}
|