|
| 1 | +declare type Promise<T> = any; |
| 2 | +declare type Set<T> = any; |
| 3 | +declare type Map<K, V> = any; |
| 4 | + |
| 5 | +declare class Request { |
| 6 | + constructor(input: string|Request, init?: RequestInit); |
| 7 | + method: string; |
| 8 | + url: string; |
| 9 | + headers: Headers; |
| 10 | + context: RequestContext; |
| 11 | + referrer: string; |
| 12 | + mode: RequestMode; |
| 13 | + credentials: RequestCredentials; |
| 14 | + cache: RequestCache; |
| 15 | +} |
| 16 | + |
| 17 | +interface RequestInit { |
| 18 | + method?: string; |
| 19 | + headers?: HeaderInit|{ [index: string]: string }; |
| 20 | + body?: BodyInit; |
| 21 | + mode?: RequestMode; |
| 22 | + credentials?: RequestCredentials; |
| 23 | + cache?: RequestCache; |
| 24 | +} |
| 25 | + |
| 26 | +declare class Headers { |
| 27 | + append(name: string, value: string): void; |
| 28 | + delete(name: string): void; |
| 29 | + get(name: string): string; |
| 30 | + getAll(name: string): Array<string>; |
| 31 | + has(name: string): boolean; |
| 32 | + set(name: string, value: string): void; |
| 33 | +} |
| 34 | + |
| 35 | +declare class Body { |
| 36 | + bodyUsed: boolean; |
| 37 | + /* |
| 38 | + arrayBuffer(): Promise<ArrayBuffer>; |
| 39 | + blob(): Promise<Blob>; |
| 40 | + */ |
| 41 | + formData(): Promise<FormData>; |
| 42 | + json(): Promise<any>; |
| 43 | + text(): Promise<string>; |
| 44 | +} |
| 45 | + |
| 46 | +declare class Response extends Body { |
| 47 | + constructor(body?: BodyInit, init?: ResponseInit); |
| 48 | + error(): Response; |
| 49 | + redirect(url: string, status: number): Response; |
| 50 | + type: ResponseType; |
| 51 | + url: string; |
| 52 | + status: number; |
| 53 | + ok: boolean; |
| 54 | + statusText: string; |
| 55 | + headers: Headers; |
| 56 | + clone(): Response; |
| 57 | +} |
| 58 | + |
| 59 | +declare enum ResponseType { "basic", "cors", "default", "error", "opaque" } |
| 60 | + |
| 61 | +declare class ResponseInit { |
| 62 | + status: number; |
| 63 | + statusText: string; |
| 64 | + headers: HeaderInit; |
| 65 | +} |
| 66 | + |
| 67 | +declare type BodyInit = Blob|FormData|string; |
| 68 | +declare type RequestInfo = Request|string; |
0 commit comments