func (a *Action) paramsByLocation(loc Location) []string {
	var res []string
	for _, p := range a.APIParams {
		if p.Location == loc {
			res = append(res, p.Name)
		}
	}
	sort.Strings(res)
	return res
}
paramsByLocation is a helper method that returns the names of the parameters at the given
location (path, query string or payload).
package metadata
import (
	"fmt"
	"regexp"
	"sort"
	"strings"
)
type Action struct {
	Name         string
	Description  string
	PathPatterns []*PathPattern  
	APIParams    []*ActionParam  
	CommandFlags []*ActionParam  
	Payload      string          
}
func (a *Action) PathParamNames() []string {
	return a.paramsByLocation(PathParam)
}
func (a *Action) QueryParamNames() []string {
	return a.paramsByLocation(QueryParam)
}
func (a *Action) PayloadParamNames() []string {
	return a.paramsByLocation(PayloadParam)
}
func (a *Action) MatchHref(href string) bool {
	hrefs := []string{href, href + "/"}
	for _, pattern := range a.PathPatterns {
		for _, href := range hrefs {
			indices := pattern.Regexp.FindStringIndex(href)
			if indices != nil && indices[0] == 0 && indices[1] == len(href) {
				return true
			}
		}
	}
	return false
}