Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 DefaultTool ¶ added in v0.1.11
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) NewMultipartBody ¶ added in v0.1.245
func (d *DefaultTool) NewMultipartBody(ctx context.Context, file []byte, fileName string) (io.Reader, string, error)
NewMultipartBody generates a multipart request body and returns the body and content type.
func (*DefaultTool) Store ¶ added in v0.1.11
func (d *DefaultTool) Store(ctx context.Context, r *http.Request, opts StoreOptions) error
Store sends a file to a storage service using a multipart request.
type Dependencies ¶ added in v0.1.8
type StoreOption ¶
type StoreOption func(*StoreOptions)
func WithBaseURL ¶
func WithBaseURL(x *url.URL) StoreOption
func WithBody ¶
func WithBody(x io.Reader) StoreOption
func WithExpectedStatus ¶
func WithExpectedStatus(x int) StoreOption
func WithFormDataContentType ¶
func WithFormDataContentType(x string) StoreOption
func WithForwardHeaders ¶
func WithForwardHeaders(x ...string) StoreOption
func WithQueryParams ¶
func WithQueryParams(x url.Values) StoreOption
type StoreOptions ¶
type StoreOptions struct {
BaseURL *url.URL
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.