Documentation ¶
Index ¶
- Variables
- type CallContext
- type Header
- type Headers
- type MultipartFormDataObject
- func (multipart *MultipartFormDataObject) AddFile(parameterName string, file UploadableFile) error
- func (multipart *MultipartFormDataObject) AddValue(parameterName string, value string) error
- func (multipart *MultipartFormDataObject) GetBoundary() string
- func (multipart *MultipartFormDataObject) GetContentType() string
- func (multipart *MultipartFormDataObject) GetFiles() map[string]UploadableFile
- func (multipart *MultipartFormDataObject) GetValues() map[string]string
- type ResponseHandler
- type ResponseHandlerFunc
- type UploadableFile
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoName occurs when the given name is empty ErrNoName = errors.New("name is required") )
Functions ¶
This section is empty.
Types ¶
type CallContext ¶
type CallContext interface { GetIdempotenceKey() string GetIdempotenceRequestTimestamp() *int64 SetIdempotenceRequestTimestamp(*int64) }
CallContext can be used to send extra information with a request, and to receive extra information from a response. Please note that this type is not thread-safe. Each request should get its own call context instance.
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header represents a single response header. Immutable.
type Headers ¶
type Headers []Header
Headers represents a slice of Header
func (Headers) GetDispositionFilename ¶
GetDispositionFilename returns the content of the filename found in the Content-Disposition header, or the empty string if it couldn't have been found.
func (Headers) GetHeaderValue ¶
GetHeaderValue searches for the header name and returns the value as string, or the empty string if it doesn't exist. This doesn't break HTTP support since headers can't have empty values
type MultipartFormDataObject ¶
type MultipartFormDataObject struct {
// contains filtered or unexported fields
}
MultipartFormDataObject is a representation of a multipart/form-data object.
func NewMultipartFormDataObject ¶
func NewMultipartFormDataObject() (*MultipartFormDataObject, error)
NewMultipartFormDataObject constructs a new MultipartFormDataObject
func (*MultipartFormDataObject) AddFile ¶
func (multipart *MultipartFormDataObject) AddFile(parameterName string, file UploadableFile) error
AddFile adds a file parameter.
func (*MultipartFormDataObject) AddValue ¶
func (multipart *MultipartFormDataObject) AddValue(parameterName string, value string) error
AddValue adds a value parameter.
func (*MultipartFormDataObject) GetBoundary ¶
func (multipart *MultipartFormDataObject) GetBoundary() string
GetBoundary returns the boundary.
func (*MultipartFormDataObject) GetContentType ¶
func (multipart *MultipartFormDataObject) GetContentType() string
GetContentType returns the content type.
func (*MultipartFormDataObject) GetFiles ¶
func (multipart *MultipartFormDataObject) GetFiles() map[string]UploadableFile
GetFiles returns the files.
func (*MultipartFormDataObject) GetValues ¶
func (multipart *MultipartFormDataObject) GetValues() map[string]string
GetValues returns the values.
type ResponseHandler ¶
type ResponseHandler interface {
Handle(statusCode int, headers []Header, reader io.Reader) (interface{}, error)
}
ResponseHandler is a handler for an incoming response
type ResponseHandlerFunc ¶
type ResponseHandlerFunc func(statusCode int, headers []Header, reader io.Reader) (interface{}, error)
ResponseHandlerFunc is a handler function for an incoming response
type UploadableFile ¶
type UploadableFile struct {
// contains filtered or unexported fields
}
UploadableFile represents a file that can be uploaded.
func NewUploadableFile ¶
func NewUploadableFile(fileName string, content io.Reader, contentType string) (*UploadableFile, error)
NewUploadableFile creates an uploadable file with the given file name, content and content type, and an unspecified content length.
func NewUploadableFileWithLength ¶
func NewUploadableFileWithLength(fileName string, content io.Reader, contentType string, contentLength int64) (*UploadableFile, error)
NewUploadableFileWithLength creates an uploadable file with the given file name, content, content type and content length.
func (*UploadableFile) GetContent ¶
func (f *UploadableFile) GetContent() io.Reader
GetContent returns a reader with the file's content.
func (*UploadableFile) GetContentLength ¶
func (f *UploadableFile) GetContentLength() int64
GetContentLength returns the file's content length, or -1 if not known.
func (*UploadableFile) GetContentType ¶
func (f *UploadableFile) GetContentType() string
GetContentType returns the file's content type.
func (*UploadableFile) GetFileName ¶
func (f *UploadableFile) GetFileName() string
GetFileName returns the name of the file.