public HalLinkAttribute GetDocLink(IHalDocEndpointInfo docEndpointInfo)
        {
            String[] routeArgs;
            if (docEndpointInfo.Version == null)
            {
                routeArgs = new String[] {
                    $"{docEndpointInfo.GroupArg}={GroupName}",
                    $"{docEndpointInfo.MethodArg}={Method}",
                    $"{docEndpointInfo.RelativePathArg}={UriTemplate.TrimStart('\\', '/')}"
                };
            }
            else
            {
                routeArgs = new String[] {
                    $"{docEndpointInfo.GroupArg}={GroupName}",
                    $"{docEndpointInfo.MethodArg}={Method}",
                    $"{docEndpointInfo.RelativePathArg}={UriTemplate.TrimStart('\\', '/')}",
                    $"{docEndpointInfo.VersionArg}={docEndpointInfo.Version}",
                };
            }

            //Create a link to the endpoint info for this controller and action method.
            var docHalRefInfo = new HalRelInfo(docEndpointInfo.Rel, docEndpointInfo.ControllerType, routeArgs);

            return(new HalLinkAttribute($"{this.Rel}.Docs", docHalRefInfo.UrlTemplate, null, docHalRefInfo.HttpMethod, dataMode: DataModes.Query));
        }
 /// <summary>
 /// Declare a new shadowed link rel. Shadowed means that the link will be named rel, but use the documentation
 /// from the shadowedRel as the endpoint docs for the new link.
 /// </summary>
 /// <param name="rel">The rel to advertise this link as.</param>
 /// <param name="shadowedRel">The rel on the controller to grab docs from.</param>
 /// <param name="controllerType">The type of the controller to grab docs from.</param>
 /// <param name="routeArgs">The route args.</param>
 public DeclareHalLinkAttribute(string rel, string shadowedRel, Type controllerType, String[] routeArgs = null)
 {
     this.Rel              = rel;
     refInfo               = new HalRelInfo(shadowedRel, controllerType, routeArgs);
     this.GroupName        = HalcyonExtUtils.GetControllerName(refInfo.ControllerType);
     this.UriTemplate      = refInfo.UrlTemplate;
     this.Method           = refInfo.HttpMethod;
     LinkedToControllerRel = true;
 }
 /// <summary>
 /// Declare a new link bound to a controller function.
 /// </summary>
 /// <param name="controllerType">The type of the controller.</param>
 /// <param name="funcName">The name of the function on the controller</param>
 /// <param name="routeArgs">The route args.</param>
 public DeclareHalLinkAttribute(Type controllerType, string funcName, String[] routeArgs = null)
 {
     refInfo               = new HalRelInfo(controllerType, funcName, routeArgs);
     this.Rel              = refInfo.HalRelAttr.Rel;
     this.GroupName        = HalcyonExtUtils.GetControllerName(refInfo.ControllerType);
     this.UriTemplate      = refInfo.UrlTemplate;
     this.Method           = refInfo.HttpMethod;
     LinkedToControllerRel = true;
 }
 /// <summary>
 /// This constructor allows us to differentiate the real rel we pass to the base class from the one we lookup, useful for self links.
 /// </summary>
 private void ConstructFromRels(string realRel, string lookupRel, Type controllerType, String[] routeArgs = null, string title = null)
 {
     this.halRefInfo     = new HalRelInfo(lookupRel, controllerType, routeArgs);
     this.Rel            = realRel;
     this.Href           = this.halRefInfo.UrlTemplate;
     this.Title          = title;
     this.Method         = this.halRefInfo.HttpMethod;
     this.DataMode       = this.halRefInfo.DataMode;
     this.controllerType = controllerType;
 }
 /// <summary>
 /// Create a new link based on a controller and a function. This will lookup the rel from the linked function. Use nameof to send
 /// the funcName string to stay strongly typed. This is the preferred way to create links since the compiler can keep track of them,
 /// but it won't work with overloaded functions.
 /// </summary>
 /// <param name="controllerType">The controller type to lookup the rel on.</param>
 /// /// <param name="funcName">The function on the controller to lookup.</param>
 /// <param name="routeArgs">Any additional route args.</param>
 /// <param name="title">Title for the link.</param>
 public HalActionLinkAttribute(Type controllerType, String funcName, String[] routeArgs = null, string title = null)
 {
     this.halRefInfo     = new HalRelInfo(controllerType, funcName, routeArgs);
     this.Rel            = this.halRefInfo.HalRelAttr.Rel;
     this.Href           = this.halRefInfo.UrlTemplate;
     this.Title          = title;
     this.Method         = this.halRefInfo.HttpMethod;
     this.DataMode       = this.halRefInfo.DataMode;
     this.controllerType = controllerType;
 }