Documentation ¶
Index ¶
- func File(method, url, file string) (string, error)
- func PostForm(url string, values url.Values) (string, error)
- func Reader(method, url string, r io.Reader, size int64) (string, error)
- func ReaderMultipart(url, fileref, filename string, limitRate int, rdr io.Reader, size int64, ...) (string, error)
- type AsMultipart
- type AsPostFormHTTP
- type AsRequestHTTP
- type Config
- type Poster
- type UpBase
- type UpBaser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReaderMultipart ¶
func ReaderMultipart(url, fileref, filename string, limitRate int, rdr io.Reader, size int64, params map[string]string) (string, error)
ReaderMultipart creates a new http multipart POST upload request with optional extra params.
Thanks to https://gist.github.com/mattetti/5914158/f4d1393d83ebedc682a3c8e7bdc6b49670083b84
Types ¶
type AsMultipart ¶
type AsMultipart struct { UpBase FileRef string // Field used by the site as file name source. Options map[string]string // Needed site options with other fields values. PrePost func(hm *AsMultipart, file string) error // Optional call before the Post. }
AsMultipart implements a Poster with multipart POST.
func NewMultiparter ¶
func NewMultiparter(uri, fileRef string, args ...string) *AsMultipart
NewMultiparter creates a http multipart Poster with the given fields. Args must be provided by pairs of key, value.
type AsPostFormHTTP ¶
type AsPostFormHTTP struct { UpBase ContentRef string // Field used by the site as file name source. Options map[string]string // One shot options with fields values. PrePost func(hp *AsPostFormHTTP, content *string) error // Optional call before the Post. }
AsPostFormHTTP implements a Poster with http POST form fields.
func NewPostForm ¶
func NewPostForm(uri, fileRef string, args ...string) *AsPostFormHTTP
NewPostForm creates a form Poster with the given fields. Args must be provided by pairs of key, value.
type AsRequestHTTP ¶
AsRequestHTTP implements a Poster with simple http request (POST / PUT).
func NewRequester ¶
func NewRequester(method, uri string) *AsRequestHTTP
NewRequester creates a http request Poster with the given method (POST / GET).
type UpBase ¶
type UpBase struct { *Config // User config. CallGetURL func(string) string // Default set to return a simple url. // contains filtered or unexported fields }
UpBase provides the core for an upload service.
func NewBaseURL ¶
NewBaseURL creates an upload service base with the URI.