Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Form ¶
type Form interface {
// Add a string value
WithString(name, value string) Form
// Add an int value
WithInt(name string, value int) Form
// Add an int64 value
WithInt64(name string, value int64) Form
// Add a string slice value
WithStrings(name string, value []string) Form
// Add a string map value
WithStringMap(name string, value map[string]string) Form
// Add a file
WithFile(name, filename string, stream io.Reader) Form
// Return content-type of the form
ContentType() string
// Archive the form and return the data stream
// You can not add values after call this method.
Archive() io.Reader
}
func NewMultipartForm ¶
func NewMultipartForm() Form
type HttpClient ¶
type HttpClient interface {
// Get content from a URL
Get(url string, qs QueryString) ([]byte, error)
// Call a JSON API with parameters
JsonApi(url string, qs QueryString, form Form, result interface{}) (err error)
// Call a JSON-P API with parameters
JsonpApi(url string, qs QueryString, result interface{}) (err error)
// Get cookies for URL.
Cookies(url string) (cookies map[string]string)
// Set cookies for URL.
SetCookies(url, domain string, cookies map[string]string)
}
HTTP client
func NewHttpClient ¶
func NewHttpClient(headers http.Header, logger plugin.Logger) HttpClient
type QueryString ¶
type QueryString interface {
// Add a string value
WithString(name, value string) QueryString
// Add an int value
WithInt(name string, value int) QueryString
// Add an int64 value
WithInt64(name string, value int64) QueryString
// Encode to querystring
Encode() string
}
A querystring holder
func NewQueryString ¶
func NewQueryString() QueryString
Click to show internal directories.
Click to hide internal directories.