// DecodeParameters converts the provided url.Values into an object of type From with the kind of into, and then
// converts that object to into (if necessary). Returns an error if the operation cannot be completed.
547156
func (c *parameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into Object) error {
	if len(parameters) == 0 {
		return nil
	}
	targetGVK, _, err := c.typer.ObjectKind(into)
	if err != nil {
		return err
	}
	if targetGVK.GroupVersion() == from {
		return c.convertor.Convert(&parameters, into)
	}
	input, err := c.creator.New(from.WithKind(targetGVK.Kind))
	if err != nil {
		return err
	}
	if err := c.convertor.Convert(&parameters, input); err != nil {
		return err
	}
	return c.convertor.Convert(input, into)
}
1073634
func decode(data []byte) (*api.Config, error) {
	// if no data, return empty config
	if len(data) == 0 {
		return api.NewConfig(), nil
	}

	config, _, err := latest.Codec.Decode(data, nil, nil)
	if err != nil {
		return nil, errors.Wrapf(err, "Error decoding config from data: %s", string(data))
	}

	return config.(*api.Config), nil
}
1143407
func DecodeSEOQueryParams(r *http.Request, v interface{}) (err error) {

	if rvi := r.Context().Value(defaultContextIdentifier); rvi != nil {

		rv := rvi.(*requestVars)

		values := make(url.Values, len(rv.params))

		for _, p := range rv.params {
			values.Add(p.key, p.value)
		}

		err = DefaultDecoder.Decode(v, values)
	}

	return
}
240598
func DecodeInts(s string) ([]int, error) {
	xs, err := DecodeUints(s)
	if err != nil {
		return nil, err
	}
	ys := make([]int, len(xs))
	for i, u := range xs {
		if u&1 == 0 {
			ys[i] = int(u >> 1)
		} else {
			ys[i] = -int((u + 1) >> 1)
		}
	}
	return ys, nil
}
273790
func DecodeJSON(res *http.Response, dest interface{}) error {
	defer CloseBody(res.Body)
	buf := getBuf()
	defer putBuf(buf)
	if err := json.NewDecoder(io.TeeReader(io.LimitReader(res.Body, 8<<20), buf)).Decode(dest); err != nil {
		return fmt.Errorf("httputil.DecodeJSON: %v, on input: %s", err, buf.Bytes())
	}
	return nil
}
269809
func (o *LocaleOptions) getParameters() (params map[string]string, err error) {
	params = make(map[string]string)
	if o.cc != "" {
		params["cc"] = o.cc
	}
	if o.lang != "" {
		params["lang"] = o.lang
	}
	return params, nil
}
638574
func decodeFindOptions(ctx context.Context, r *http.Request) (*platform.FindOptions, error) {
	opts := &platform.FindOptions{}
	qp := r.URL.Query()

	if offset := qp.Get("offset"); offset != "" {
		o, err := strconv.Atoi(offset)
		if err != nil {
			return nil, err
		}

		opts.Offset = o
	}

	if limit := qp.Get("limit"); limit != "" {
		l, err := strconv.Atoi(limit)
		if err != nil {
			return nil, err
		}

		if l < 1 || l > platform.MaxPageSize {
			return nil, errors.InvalidDataf("limit must be between 1 and %d", platform.MaxPageSize)
		}

		opts.Limit = l
	} else {
		opts.Limit = platform.DefaultPageSize
	}

	if sortBy := qp.Get("sortBy"); sortBy != "" {
		opts.SortBy = sortBy
	}

	if descending := qp.Get("descending"); descending != "" {
		desc, err := strconv.ParseBool(descending)
		if err != nil {
			return nil, err
		}

		opts.Descending = desc
	}

	return opts, nil
}
546072
func (r RouterJSR311) ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string {
	webServiceExpr := webService.pathExpr
	webServiceMatches := webServiceExpr.Matcher.FindStringSubmatch(urlPath)
	pathParameters := r.extractParams(webServiceExpr, webServiceMatches)
	routeExpr := route.pathExpr
	routeMatches := routeExpr.Matcher.FindStringSubmatch(webServiceMatches[len(webServiceMatches)-1])
	routeParams := r.extractParams(routeExpr, routeMatches)
	for key, value := range routeParams {
		pathParameters[key] = value
	}
	return pathParameters
}
107007
func QueryParams(r *http.Request, includeSEOQueryParams bool) (values url.Values) {

	values = r.URL.Query()

	if includeSEOQueryParams {
		if rvi := r.Context().Value(defaultContextIdentifier); rvi != nil {

			rv := rvi.(*requestVars)

			for _, p := range rv.params {
				values.Add(p.key, p.value)
			}
		}
	}

	return
}
274451
func EncodeURLParamMap(m *URLParamMap) string {

	parameters := url.Values{}

	for k, v := range *m {
		l := len(v)
		for x := 0; x < l; x++ {
			parameters.Add(k, v[x])
		}

	}

	qEncoded := parameters.Encode()
	return string(qEncoded)

}
1186350
func (c *Config) Decode(id string, v interface{}) (interface{}, error) {
	data, ok := c.Plugins[id]
	if !ok {
		return v, nil
	}
	if err := c.md.PrimitiveDecode(data, v); err != nil {
		return nil, err
	}
	return v, nil
}
671465
func encodeParameters(params map[string]string) map[string]string {
	encoded := map[string]string{}
	for key, value := range params {
		encoded[PercentEncode(key)] = PercentEncode(value)
	}
	return encoded
}
18001
func DecodeURI(uri string) (raw string, err error) {
	defer func() {
		if r := recover(); r != nil {
			err = r.(*js.Error)
		}
	}()
	raw = js.Global.Call("decodeURI", uri).String()
	return
}
556001
func filterParams(values map[string][]string) map[string][]string {
	for key := range values {
		if FilterFields.Match([]byte(key)) {
			values[key] = []string{FILTERED}
		}
	}

	return values
}
977207
func (r *request) GetQueryParams() url.Values {
	var result = make(url.Values)
	for key, value := range r.query {
		result[key] = append([]string{}, value...)
	}
	return result
}
304399
func (im imp) CallbackURLParameters(acctRef blob.Ref) url.Values {
	return url.Values{}
}
1055259
func getParams(genericParams map[string]interface{}) (map[string]string, error) {
	params := map[string]string{}
	for key, value := range genericParams {
		strVal, isString := value.(string)
		if !isString {
			return nil, fmt.Errorf("expected string, saw %v for '%s'", value, key)
		}
		params[key] = strVal
	}
	return params, nil
}