Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyBody = errors.New("multipart body is empty") ErrInvalidFileType = errors.New("invalid file type") ErrInvalidBaseURL = errors.New("invalid base URL") ErrFailedToCreateReq = errors.New("failed to create request") ErrRequestFailed = errors.New("request execution failed") ErrUnexpectedStatus = errors.New("upload failed: unexpected status code") ErrInvalidBody = errors.New("invalid body") ErrNilForwardHeaders = errors.New("nil forward headers") ErrInvalidContentType = errors.New("invalid content type") ErrInvalidStatus = errors.New("invalid status") ErrMissingRequest = errors.New("missing request") )
Functions ¶
Types ¶
type Client ¶
type Client interface {
NewMultipartBody(ctx context.Context, file []byte, fileName string) (io.Reader, string, error)
Store(ctx context.Context, r *http.Request, opts StoreOptions) error
}
func NewClient ¶
func NewClient(d Dependencies) (Client, error)
type Dependencies ¶ added in v0.1.8
type StoreOption ¶
type StoreOption func(*StoreOptions)
func WithBaseURL ¶
func WithBaseURL(url string) StoreOption
func WithBody ¶
func WithBody(body io.Reader) StoreOption
func WithExpectedStatus ¶
func WithExpectedStatus(status int) StoreOption
func WithFormDataContentType ¶
func WithFormDataContentType(contentType string) StoreOption
func WithForwardHeaders ¶
func WithForwardHeaders(headers ...string) StoreOption
func WithQueryParams ¶
func WithQueryParams(q url.Values) StoreOption
type StoreOptions ¶
type StoreOptions struct {
BaseURL string
QueryParams url.Values
Body io.Reader
ForwardHeaders []string
FormDataContentType string
ExpectedStatus int
}
func ApplyStoreOptions ¶
func ApplyStoreOptions(opts *StoreOptions, modifiers ...StoreOption) StoreOptions
Click to show internal directories.
Click to hide internal directories.