func (b *Bot) request(method string, params map[string]interface{}) (resp []byte, err error) {
	apiURL := fmt.Sprintf("%s%s/%s", apiBaseURL, b.token, method)

	b.verbose("sending request to api url: %s, params: %#v", apiURL, params)

	if checkIfFileParamExists(params) {
		// multipart form data
		resp, err = b.requestMultipartFormData(apiURL, params)
	} else {
		// www-form urlencoded
		resp, err = b.requestURLEncodedFormData(apiURL, params)
	}

	if err == nil {
		return resp, nil
	}

	return []byte{}, fmt.Errorf(b.redact(err.Error()))
}
// Send request to API server and return the response as bytes(synchronously).
//
// NOTE: If *os.File is included in the params, it will be closed automatically by this function.
Send request to API server and return the response as bytes(synchronously).

If *os.File is included in the params, it will be closed automatically by this function.
// Send request to API server and return the response as bytes ( synchronously ) . // // NOTE : If * os . File is included in the params it will be closed automatically by this function .
func (b *Bot) request(method string, params map[string]interface{}) (resp []byte, err error) {
	apiURL := fmt.Sprintf("%s%s/%s", apiBaseURL, b.token, method)
	b.verbose("sending request to api url: %s, params: %#v", apiURL, params)
	if checkIfFileParamExists(params) {
		resp, err = b.requestMultipartFormData(apiURL, params)
	} else {
		resp, err = b.requestURLEncodedFormData(apiURL, params)
	}
	if err == nil {
		return resp, nil
	}
	return []byte{}, fmt.Errorf(b.redact(err.Error()))
}
func ( b * Bot ) request ( method string , params map [ string ] interface { } ) ( resp [ ] byte , err error ) { apiURL := fmt . Sprintf ( " " , apiBaseURL , b . token , method ) b . verbose ( " " , apiURL , params ) if checkIfFileParamExists ( params ) { resp , err = b . requestMultipartFormData ( apiURL , params ) } else { resp , err = b . requestURLEncodedFormData ( apiURL , params ) } if err == nil { return resp , nil } return [ ] byte { } , fmt . Errorf ( b . redact ( err . Error ( ) ) ) }
Send request to API server and return the response as bytes(synchronously).
Send request to API server and return the response as bytes ( synchronously ) .
// multipart form data // www-form urlencoded