1 |
|
2 |
|
3 |
|
4 | import { Observable } from 'rxjs/internal/Observable';
|
5 | import 'reflect-metadata';
|
6 | import { AxiosError } from 'axios';
|
7 |
|
8 |
|
9 |
|
10 | export interface HttpInterceptor {
|
11 | intercep: (req: Request_) => Request_;
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 | export declare type Handler = <U extends HttpRequestException>(error: AxiosError) => U;
|
17 |
|
18 |
|
19 |
|
20 | export declare const interceptors: HttpInterceptor[];
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | export declare function addInterceptors<T extends {
|
26 | new (): HttpInterceptor;
|
27 | }>(...interceptor: T[]): void;
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | export declare function Client(config: string | Partial<ConfigHttp>): (target: any) => void;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | export declare function Get(url?: string, statusCodeOk?: number): Function;
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare function Post(url?: string, statusCodeOk?: number): Function;
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | export declare function Put(url?: string, statusCodeOk?: number): Function;
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | export declare function Patch(url?: string, statusCodeOk?: number): Function;
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | export declare function Delete(url?: string, statusCodeOk?: number): Function;
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 | export declare function PathParam(param?: string): Function;
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | export declare function Query(param_?: string): Function;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export declare function Body(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | export declare function PathParamProperty(enable?: boolean): Function;
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | export declare function Mapper(mapper: Function): Function;
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 | export declare function Headers<T extends any>(headers: {
|
111 | [key: string]: T;
|
112 | }): Function;
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | export declare function Before(before_: (request: Request_) => Request_): (target: Object, propertyKey: string) => void;
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 | export declare function HandlerError(handler: Handler): (target: Object, propertyKey: string) => void;
|
125 |
|
126 |
|
127 |
|
128 | export declare class HttpRequestException {
|
129 | error: string;
|
130 | statusCode: number;
|
131 | message: string;
|
132 | constructor(error: string, statusCode: number, message: string);
|
133 | }
|
134 | /**
|
135 | *
|
136 | */
|
137 | declare class HeadersHttp {
|
138 | |
139 |
|
140 |
|
141 |
|
142 | private headers;
|
143 | constructor();
|
144 | /**
|
145 | *
|
146 | * @param {string} key
|
147 | * @returns {boolean}
|
148 | */
|
149 | has(key: string): boolean;
|
150 | |
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | set(key: string, header: any): this;
|
157 | |
158 |
|
159 |
|
160 |
|
161 | getHeaders(): any;
|
162 | }
|
163 |
|
164 |
|
165 |
|
166 | export declare type HttpObservable<t> = Observable<t> & void;
|
167 |
|
168 |
|
169 |
|
170 | interface ConfigHttp {
|
171 | url: string;
|
172 | headers: {
|
173 | [key: string]: any;
|
174 | };
|
175 | }
|
176 |
|
177 |
|
178 |
|
179 | export interface Request_ {
|
180 | readonly method: string;
|
181 | body: any;
|
182 | readonly headers: HeadersHttp;
|
183 | readonly url: string;
|
184 | }
|
185 | export {};
|