|
1 |
| -using System; |
2 |
| - |
3 |
| -namespace GenHTTP.Api.Protocol |
4 |
| -{ |
5 |
| - |
6 |
| - /// <summary> |
7 |
| - /// The protocol allowing to manipulate the response sent by |
8 |
| - /// the server. |
9 |
| - /// </summary> |
10 |
| - /// <typeparam name="T">The type of builder used as a return value</typeparam> |
11 |
| - public interface IResponseModification<out T> |
12 |
| - { |
13 |
| - |
14 |
| - /// <summary> |
15 |
| - /// Specifies the HTTP status code of the response. |
16 |
| - /// </summary> |
17 |
| - /// <param name="status">The HTTP status code of the response</param> |
18 |
| - T Status(ResponseStatus status); |
19 |
| - |
20 |
| - /// <summary> |
21 |
| - /// Specifies the HTTP status code of the response. |
22 |
| - /// </summary> |
23 |
| - /// <param name="status">The status code of the response</param> |
24 |
| - /// <param name="reason">The reason phrase of the response (such as "Not Found" for 404)</param> |
25 |
| - T Status(int status, string reason); |
26 |
| - |
27 |
| - /// <summary> |
28 |
| - /// Sets the given header field on the response. Changing HTTP |
29 |
| - /// protocol headers may cause incorrect behavior. |
30 |
| - /// </summary> |
31 |
| - /// <param name="key">The name of the header to be set</param> |
32 |
| - /// <param name="value">The value of the header field</param> |
33 |
| - T Header(string key, string value); |
34 |
| - |
35 |
| - /// <summary> |
36 |
| - /// Sets the expiration date of the response. |
37 |
| - /// </summary> |
38 |
| - /// <param name="expiryDate">The expiration date of the response</param> |
39 |
| - T Expires(DateTime expiryDate); |
40 |
| - |
41 |
| - /// <summary> |
42 |
| - /// Sets the point in time when the requested resource has been |
43 |
| - /// modified last. |
44 |
| - /// </summary> |
45 |
| - /// <param name="modificationDate">The point in time when the requested resource has been modified last</param> |
46 |
| - T Modified(DateTime modificationDate); |
47 |
| - |
48 |
| - /// <summary> |
49 |
| - /// Adds the given cookie to the response. |
50 |
| - /// </summary> |
51 |
| - /// <param name="cookie">The cookie to be added</param> |
52 |
| - T Cookie(Cookie cookie); |
53 |
| - |
54 |
| - /// <summary> |
55 |
| - /// Specifies the content type of this response. |
56 |
| - /// </summary> |
57 |
| - /// <param name="contentType">The content type of this response</param> |
58 |
| - T Type(FlexibleContentType contentType); |
59 |
| - |
60 |
| - /// <summary> |
61 |
| - /// Sets the encoding of the content. |
62 |
| - /// </summary> |
63 |
| - /// <param name="encoding">The encoding of the content</param> |
64 |
| - T Encoding(string encoding); |
65 |
| - |
66 |
| - } |
67 |
| - |
68 |
| -} |
| 1 | +using System; |
| 2 | + |
| 3 | +namespace GenHTTP.Api.Protocol |
| 4 | +{ |
| 5 | + |
| 6 | + /// <summary> |
| 7 | + /// Allows the response generated by a builder or handler to be |
| 8 | + /// adjusted. |
| 9 | + /// </summary> |
| 10 | + /// <remarks> |
| 11 | + /// This can be useful if you would like to add behavior that the |
| 12 | + /// original handler (such as a page renderer) does not provide. |
| 13 | + /// |
| 14 | + /// For example, as the page handlers implement this interface, |
| 15 | + /// you can add an additional header to the response being generated |
| 16 | + /// for a page. |
| 17 | + /// </remarks> |
| 18 | + /// <typeparam name="TBuilder">The type of builder used as a return value</typeparam> |
| 19 | + public interface IResponseModification<out TBuilder> |
| 20 | + { |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// Specifies the HTTP status code of the response. |
| 24 | + /// </summary> |
| 25 | + /// <param name="status">The HTTP status code of the response</param> |
| 26 | + TBuilder Status(ResponseStatus status); |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Specifies the HTTP status code of the response. |
| 30 | + /// </summary> |
| 31 | + /// <param name="status">The status code of the response</param> |
| 32 | + /// <param name="reason">The reason phrase of the response (such as "Not Found" for 404)</param> |
| 33 | + TBuilder Status(int status, string reason); |
| 34 | + |
| 35 | + /// <summary> |
| 36 | + /// Sets the given header field on the response. Changing HTTP |
| 37 | + /// protocol headers may cause incorrect behavior. |
| 38 | + /// </summary> |
| 39 | + /// <param name="key">The name of the header to be set</param> |
| 40 | + /// <param name="value">The value of the header field</param> |
| 41 | + TBuilder Header(string key, string value); |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Sets the expiration date of the response. |
| 45 | + /// </summary> |
| 46 | + /// <param name="expiryDate">The expiration date of the response</param> |
| 47 | + TBuilder Expires(DateTime expiryDate); |
| 48 | + |
| 49 | + /// <summary> |
| 50 | + /// Sets the point in time when the requested resource has been |
| 51 | + /// modified last. |
| 52 | + /// </summary> |
| 53 | + /// <param name="modificationDate">The point in time when the requested resource has been modified last</param> |
| 54 | + TBuilder Modified(DateTime modificationDate); |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Adds the given cookie to the response. |
| 58 | + /// </summary> |
| 59 | + /// <param name="cookie">The cookie to be added</param> |
| 60 | + TBuilder Cookie(Cookie cookie); |
| 61 | + |
| 62 | + /// <summary> |
| 63 | + /// Specifies the content type of this response. |
| 64 | + /// </summary> |
| 65 | + /// <param name="contentType">The content type of this response</param> |
| 66 | + TBuilder Type(FlexibleContentType contentType); |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// Sets the encoding of the content. |
| 70 | + /// </summary> |
| 71 | + /// <param name="encoding">The encoding of the content</param> |
| 72 | + TBuilder Encoding(string encoding); |
| 73 | + |
| 74 | + } |
| 75 | + |
| 76 | +} |
0 commit comments