1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import {HttpContext} from "./context";
|
10 | import {HtmlWriter} from "@themost/common/html";
|
11 | import {HttpViewEngineConfiguration} from "./config";
|
12 |
|
13 |
|
14 | export declare class HttpResult {
|
15 | |
16 |
|
17 |
|
18 | constructor();
|
19 | contentType?: string;
|
20 | contentEncoding?: string;
|
21 |
|
22 | status(status?: number): HttpResult;
|
23 |
|
24 | public execute(context: HttpContext, callback: (err?: Error) => void);
|
25 | }
|
26 |
|
27 | export declare class HttpContentResult extends HttpResult {
|
28 |
|
29 | constructor(content: string|Buffer);
|
30 |
|
31 | data: any;
|
32 | }
|
33 |
|
34 | export declare class HttpJsonResult extends HttpResult {
|
35 |
|
36 | constructor(data: any);
|
37 |
|
38 | data: any;
|
39 | }
|
40 |
|
41 | export declare class HttpXmlResult extends HttpResult {
|
42 |
|
43 | constructor(data: any);
|
44 |
|
45 | data: any;
|
46 | }
|
47 |
|
48 | export declare class HttpJavascriptResult extends HttpResult {
|
49 |
|
50 | constructor(data: any);
|
51 |
|
52 | data: any;
|
53 | }
|
54 |
|
55 | export declare class HttpViewResult extends HttpResult {
|
56 | constructor(name?: string, data?: any);
|
57 | setName(name: string): HttpViewResult;
|
58 | static resolveViewPath(context: HttpContext, controller: string, view: string, engine: HttpViewEngineConfiguration, callback: (err?: Error, res?: string) => void);
|
59 | }
|
60 |
|
61 |
|
62 | export declare class HttpFileResult extends HttpResult {
|
63 | constructor(physicalPath: string, fileName: string);
|
64 | physicalPath: string;
|
65 | fileName: string;
|
66 |
|
67 | }
|
68 |
|
69 |
|
70 | export declare class HttpRedirectResult extends HttpResult {
|
71 | constructor(url: string);
|
72 | url: string;
|
73 |
|
74 | }
|
75 |
|
76 |
|
77 | export declare class HttpEmptyResult extends HttpResult {
|
78 | constructor();
|
79 |
|
80 | }
|
81 |
|
82 |
|
83 | export declare class HttpController {
|
84 |
|
85 | context: HttpContext;
|
86 | view(data?: any): HttpViewResult;
|
87 | html(data?: any): HttpViewResult;
|
88 | htm(data?: any): HttpViewResult;
|
89 | js(script?: string): HttpJavascriptResult;
|
90 | jsvar(name: string, obj: any): HttpJavascriptResult;
|
91 | result(data?: any): HttpResult;
|
92 | content(data?: any): HttpContentResult;
|
93 | json(data?: any): HttpJsonResult;
|
94 | xml(data?: any): HttpXmlResult;
|
95 | file(physicalPath: string, fileName: string): HttpFileResult;
|
96 | redirect(url: string): HttpRedirectResult;
|
97 | empty(): HttpEmptyResult;
|
98 | toPromise(resolver: (resolve: void, reject?: void) => Promise<any>): Promise<any>;
|
99 | next(): HttpNextResult;
|
100 |
|
101 | }
|
102 |
|
103 | export declare class HttpViewContext {
|
104 | constructor(context: HttpContext);
|
105 | body?: string;
|
106 | title?: string;
|
107 | layout?: string;
|
108 | data?: any;
|
109 | context: HttpContext;
|
110 | readonly writer: HtmlWriter;
|
111 | readonly model: any;
|
112 | init(): void;
|
113 | render(url: string, callback: (err?: Error, res?: any) => void);
|
114 | translate(key: string): string;
|
115 | }
|
116 |
|
117 | export declare class HttpNextResult extends HttpResult {
|
118 | constructor();
|
119 |
|
120 | } |
\ | No newline at end of file |