core

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2020 License: MIT Imports: 14 Imported by: 0

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
	// 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 NewForm

func NewForm() 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 LoggerEx

type LoggerEx interface {
	plugin.Logger
	Printf(format string, v ...interface{})
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL