// Get signature from params in map
763683
func MapToSign(params map[string]interface{}, keySecret string, httpMethod string) string {
	key := []byte(keySecret + SEPARATOR)
	h := hmac.New(sha1.New, key)
	query := canonicalizedFromMap(params)
	toSign := httpMethod + SEPARATOR + PercentEncode("/") + SEPARATOR + query
	h.Write([]byte(toSign))
	sign := base64.StdEncoding.EncodeToString(h.Sum(nil))
	sign = PercentEncode(sign)
	return sign
}
235261
func getName(params map[string]string) (string, error) {
	name, found := params["name"]
	if !found || len(name) == 0 {
		name, found = params["default-name"]
		if !found || len(name) == 0 {
			return "", fmt.Errorf("'name' is a required parameter")
		}
	}
	return name, nil
}
46752
func getSignature(signingKey []byte, stringToSign string) string {
	return hex.EncodeToString(sumHMAC(signingKey, []byte(stringToSign)))
}
999289
func (js *JSONSignature) Signatures() ([][]byte, error) {
	sort.Sort(jsSignaturesSorted(js.signatures))

	var sb [][]byte
	for _, jsig := range js.signatures {
		p, err := json.Marshal(jsig)
		if err != nil {
			return nil, err
		}

		sb = append(sb, p)
	}

	return sb, nil
}
566777
func (a *Client) GetMap(params *GetMapParams) (*GetMapOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetMapParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetMap",
		Method:             "GET",
		PathPattern:        "/map",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetMapReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetMapOK), nil

}
591822
func (c *Client) Params(params map[string]string) *Client {
	c.Use(url.Params(params))
	return c
}
76271
func (params Params) Get(key string) (interface{}, error) {
	v, ok := params[key]
	if !ok {
		return nil, &ParamError{Param: key, Message: "not set"}
	}
	return v, nil
}
677563
func (s *Signer) concatQueryParameters(values url.Values) string {
	str := ""
	keys := s.sortedQueryKeys(values)
	for _, k := range keys {
		if k == s.signatureParam {
			continue
		}
		str = fmt.Sprintf("%s%s", str, values.Get(k))
	}
	return str
}
1150303
func (r *Request) Param(key, value string) *Request {
	r.params[key] = value
	return r
}
197421
func Params(params map[string]interface{}) RequestOption {
	return func(req *http.Request) (*http.Request, error) {
		u := req.URL.String()
		req.URL = URLWithParams(u, params)
		return req, nil
	}
}
552888
func (p *Params) Get(key string) string {
	if len(key) == 0 {
		return ""
	}
	if key[0] != ':' && key[0] != '*' {
		key = ":" + key
	}

	for _, v := range *p {
		if v.Name == key {
			return v.Value
		}
	}
	return ""
}
811705
func Params(r *http.Request) map[string]string {
	v := r.Context().Value(routeParamsID)
	if v == nil {
		return map[string]string{}
	}
	if v, ok := v.(map[string]string); ok {
		return v
	}
	return map[string]string{}
}
709741
func signatureV2(cred auth.Credentials, method string, encodedResource string, encodedQuery string, headers http.Header) string {
	stringToSign := getStringToSignV2(method, encodedResource, encodedQuery, headers, "")
	signature := calculateSignatureV2(stringToSign, cred.SecretKey)
	return signature
}
185051
func (d Data) GetMapFromJSON(key string) (map[string]interface{}, error) {
	if !d.KeyExists(key) || len(d.Values[key]) == 0 {
		return nil, nil
	}
	result := map[string]interface{}{}
	if err := json.Unmarshal([]byte(d.Get(key)), &result); err != nil {
		return nil, err
	} else {
		return result, nil
	}
}
717429
func (m Match) Parameter(param ParameterInterface) (string, error) {
	pos := m.Command.Position(param)
	if pos == -1 {
		return "", errors.New("Unknonw parameter \"" + param.Name() + "\"")
	}

	matches := m.Command.Expression().FindAllStringSubmatch(m.Request, -1)[0][1:]
	return matches[m.Command.Position(param)], nil
}
288435
func (p *gc_parser) parse_signature() *ast.FuncType {
	var params *ast.FieldList
	var results *ast.FieldList

	params = p.parse_parameters()
	switch p.tok {
	case scanner.Ident, '[', '*', '<', '@':
		fld := &ast.Field{Type: p.parse_type()}
		results = &ast.FieldList{List: []*ast.Field{fld}}
	case '(':
		results = p.parse_parameters()
	}
	return &ast.FuncType{Params: params, Results: results}
}
606081
func (p *ctx) Param(key string) string {
	val, _ := p.ParamOk(key)
	return val
}