1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Net . Http . Headers ;
4+ using System . Web ;
5+ using System . Web . Http ;
6+
7+ namespace SampleWebAPI . Areas . HelpPage
8+ {
9+ /// <summary>
10+ /// Use this class to customize the Help Page.
11+ /// For example you can set a custom <see cref="System.Web.Http.Description.IDocumentationProvider"/> to supply the documentation
12+ /// or you can provide the samples for the requests/responses.
13+ /// </summary>
14+ public static class HelpPageConfig
15+ {
16+ public static void Register ( HttpConfiguration config )
17+ {
18+ //// Uncomment the following to use the documentation from XML documentation file.
19+ //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
20+
21+ //// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type.
22+ //// Also, the string arrays will be used for IEnumerable<string>. The sample objects will be serialized into different media type
23+ //// formats by the available formatters.
24+ //config.SetSampleObjects(new Dictionary<Type, object>
25+ //{
26+ // {typeof(string), "sample string"},
27+ // {typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}}
28+ //});
29+
30+ //// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format
31+ //// and have IEnumerable<string> as the body parameter or return type.
32+ //config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable<string>));
33+
34+ //// Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values"
35+ //// and action named "Put".
36+ //config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put");
37+
38+ //// Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png"
39+ //// on the controller named "Values" and action named "Get" with parameter "id".
40+ //config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id");
41+
42+ //// Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent<string>.
43+ //// The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter.
44+ //config.SetActualRequestType(typeof(string), "Values", "Get");
45+
46+ //// Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent<string>.
47+ //// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string.
48+ //config.SetActualResponseType(typeof(string), "Values", "Post");
49+ }
50+ }
51+ }
0 commit comments