forked from nodirt/AngularTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular.ng.http.d.ts
63 lines (54 loc) · 1.91 KB
/
angular.ng.http.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/// <reference path="angular.d.ts" />
declare module angular.ng {
interface HttpConfig {
method?: string;
url?: string;
params?: Object;
data?: any;
headers?: Object;
// transformRequest and transformResponse are either a function or an array of functions, so the best common type is any;
transformRequest?: any;
transformResponse?: any;
cache?: any; // bool or Cache
timeout?: number;
withCredentials?: bool;
}
interface HeadersFunction {
(key: string): string;
}
interface HttpResponse {
data: any;
status: number;
headers: HeadersFunction;
config: HttpConfig;
}
interface HttpPromise extends ng.Promise, HttpResponse {
then(successCallback: (response: HttpResponse) => any, errorCallback?: (response: HttpResponse) => any): Promise;
success(fn: (data: any, status?: number, headers?: HeadersFunction, config?: HttpConfig) => any): HttpPromise;
error(fn: (data: any, status?: number, headers?: HeadersFunction, config?: HttpConfig) => any): HttpPromise;
}
interface HttpHeaders {
common: Object;
get: Object;
post: Object;
put: Object;
delete: Object;
}
interface HttpDefaults {
headers: HttpHeaders;
}
interface HttpService {
(config: HttpConfig): HttpPromise;
delete(url: string, config?: HttpConfig): HttpPromise;
get(url: string, config?: HttpConfig): HttpPromise;
post(url: string, config?: HttpConfig): HttpPromise;
put(url: string, config?: HttpConfig): HttpPromise;
head(url: string, config?: HttpConfig): HttpPromise;
jsonp(url: string, config?: HttpConfig): HttpPromise;
defaults: HttpDefaults;
pendingRequests: HttpConfig[];
}
interface HttpProvider {
defaults: HttpDefaults;
}
}