// post comunicates to Cryptomarket via the http post method, also set
// the needed headers of the request for an authenticated communication.
post comunicates to Cryptomarket via the http post method, also set
the needed headers of the request for an authenticated communication.
// post comunicates to Cryptomarket via the http post method also set // the needed headers of the request for an authenticated communication .
func (client *Client) post(endpoint string, request *requests.Request) ([]byte, error) {
	args := request.GetArguments()
	u, err := url.Parse(baseApiUri)
	if err != nil {
		return nil, fmt.Errorf("Error parsing url %s: %v", baseApiUri, err)
	}
	u.Path = path.Join(u.Path, apiVersion, endpoint)
	form := url.Values{}
	for k, v := range args {
		form.Add(k, v)
	}
	httpReq, err := http.NewRequest("POST", u.String(), strings.NewReader(form.Encode()))
	if err != nil {
		return nil, fmt.Errorf("Error building NewRequest struct: %v", err)
	}
	keys := make([]string, 0, len(args))
	for k := range args {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	var bb bytes.Buffer
	for _, k := range keys {
		bb.WriteString(args[k])
	}
	requestPath := "/" + apiVersion + "/" + endpoint
	client.auth.setHeaders(httpReq, requestPath, bb.String())
	httpReq.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
	return client.runRequest(httpReq)
}
func ( client * Client ) post ( endpoint string , request * requests . Request ) ( [ ] byte , error ) { args := request . GetArguments ( ) u , err := url . Parse ( baseApiUri ) if err != nil { return nil , fmt . Errorf ( " " , baseApiUri , err ) } u . Path = path . Join ( u . Path , apiVersion , endpoint ) form := url . Values { } for k , v := range args { form . Add ( k , v ) } httpReq , err := http . NewRequest ( " " , u . String ( ) , strings . NewReader ( form . Encode ( ) ) ) if err != nil { return nil , fmt . Errorf ( " " , err ) } keys := make ( [ ] string , 0 , len ( args ) ) for k := range args { keys = append ( keys , k ) } sort . Strings ( keys ) var bb bytes . Buffer for _ , k := range keys { bb . WriteString ( args [ k ] ) } requestPath := " " + apiVersion + " " + endpoint client . auth . setHeaders ( httpReq , requestPath , bb . String ( ) ) httpReq . Header . Set ( " " , " " ) return client . runRequest ( httpReq ) }
post comunicates to Cryptomarket via the http post method, also set
the needed headers of the request for an authenticated communication.
post comunicates to Cryptomarket via the http post method also set the needed headers of the request for an authenticated communication .
// builds a form from the Arguments //sets the body for the header, arguments must be sorted //required header for the reciever to interpret the request as a http form post