Exemple #1
0
        private string Method_ResponseCodesList(DocumentorContext context, params object[] parameters)
        {
            MethodInfo restMethod       = parameters[0] as MethodInfo;
            bool       hasResponseCodes = restMethod.GetRadishAttributes <ResponseCodeAttribute>().Count() > 0;

            return(hasResponseCodes ? context.RenderTemplate <BasicTemplateSet>(ts => ts.ResponseCodesList, restMethod) : "");
        }
Exemple #2
0
        private string Method_ResponseBodyExample(DocumentorContext context, params object[] parameters)
        {
            MethodInfo restMethod             = parameters[0] as MethodInfo;
            ResponseBodyExampleAttribute attr = restMethod.GetRadishAttribute <ResponseBodyExampleAttribute>();

            return(attr != null ? context.RenderTemplate <BasicTemplateSet>(ts => ts.ResponseBodyExample, restMethod) : "");
        }
Exemple #3
0
        private string Page_MethodsList(DocumentorContext context, params object[] parameters)
        {
            StringBuilder sbMethods      = new StringBuilder();
            string        latestGroupKey = null;

            foreach (MethodInfo method in context.RestMethods)
            {
                OrderAttribute attrOrder = method.GetRadishAttribute <OrderAttribute>();
                if (attrOrder != null)
                {
                    if (!String.IsNullOrEmpty(attrOrder.GroupKey) && latestGroupKey != attrOrder.GroupKey)
                    {
                        sbMethods.Append(context.RenderTemplate <BasicTemplateSet>(ts => ts.MethodsGroup, method));
                    }
                    latestGroupKey = attrOrder.GroupKey;
                }
                sbMethods.Append(context.RenderTemplate <BasicTemplateSet>(ts => ts.Method, method));
            }
            return(sbMethods.ToString());
        }
Exemple #4
0
        private string ResponseCodesList_ResponseCodesList(DocumentorContext context, params object[] parameters)
        {
            MethodInfo restMethod = parameters[0] as MethodInfo;
            IEnumerable <ResponseCodeAttribute> attrResponseCodes = restMethod.GetRadishAttributes <ResponseCodeAttribute>().OrderBy(rc => rc.Code);
            StringBuilder sbResponseCodesList = new StringBuilder();

            foreach (ResponseCodeAttribute attr in attrResponseCodes)
            {
                sbResponseCodesList.Append(context.RenderTemplate <BasicTemplateSet>(ts => ts.ResponseCode, attr));
            }
            return(sbResponseCodesList.ToString());
        }
Exemple #5
0
        private string RequestParametersList_RequestParametersList(DocumentorContext context, object[] parameters)
        {
            MethodInfo restMethod = parameters[0] as MethodInfo;
            IEnumerable <RequestParameterAttribute> attrRequestParametersList = restMethod.GetRadishAttributes <RequestParameterAttribute>().OrderBy(rp => rp.Order);
            StringBuilder sbRequestParametersList = new StringBuilder();

            foreach (RequestParameterAttribute attr in attrRequestParametersList)
            {
                sbRequestParametersList.Append(context.RenderTemplate <BasicTemplateSet>(ts => RequestParameter, attr));
            }
            return(sbRequestParametersList.ToString());
        }
Exemple #6
0
 private string Page_Title(DocumentorContext context, params object[] parameters)
 {
     return(context.RenderTemplate <BasicTemplateSet>(ts => ts.Title));
 }