Documentation ¶
Index ¶
- Variables
- type Client
- type OptidashError
- type P
- type Request
- func (r *Request) Adjust(data P) *Request
- func (r *Request) Auto(data P) *Request
- func (r *Request) Border(data P) *Request
- func (r *Request) CDN(data P) *Request
- func (r *Request) Context(ctx context.Context) *Request
- func (r *Request) CopyTo(input io.Writer) (*fastjson.Value, error)
- func (r *Request) Crop(data P) *Request
- func (r *Request) Flip(data P) *Request
- func (r *Request) HTTPClient(client *http.Client) *Request
- func (r *Request) Mask(data P) *Request
- func (r *Request) Optimize(data P) *Request
- func (r *Request) Output(data P) *Request
- func (r *Request) Padding(data P) *Request
- func (r *Request) Resize(data P) *Request
- func (r *Request) Scale(data P) *Request
- func (r *Request) Store(data P) *Request
- func (r *Request) Stylize(data P) *Request
- func (r *Request) ToFile(input string, perm os.FileMode) (*fastjson.Value, error)
- func (r *Request) ToJSON() (*fastjson.Value, error)
- func (r *Request) ToReader() (*fastjson.Value, io.ReadCloser, error)
- func (r *Request) Watermark(data P) *Request
- func (r *Request) Webhook(data P) *Request
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSourceType = errors.New("optidash: Invalid request source type") ErrBinaryWebhook = errors.New("optidash: Webhooks are not supported when using binary responses") ErrBinaryStorage = errors.New("optidash: External storage is not supported when using binary responses") ErrNoSuccess = errors.New("optidash: Success is missing in the response") )
In-code validation and other frequent error cases.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the Optidash HTTP API client
func NewClient ¶
NewClient returns a new client using the given config. The *Config has to be generated using the NewConfig() function.
type OptidashError ¶
OptidashError is an error returned by the Optidash API.
func (*OptidashError) Error ¶
func (c *OptidashError) Error() string
Error implements the error interface.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is a generator that allows creation of Optidash API requests.
func (*Request) Adjust ¶
Adjust adds an visual parameters adjustment to the transformation flow. Check out Optidash docs for more details.
func (*Request) Auto ¶
Auto adds an automatic image enhancement step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Border ¶
Border adds adding a border to the image to the transformation flow. Check out Optidash docs for more details.
func (*Request) CDN ¶
CDN configures CDN settings of the platform. Check out Optidash docs for more details.
func (*Request) CopyTo ¶
CopyTo executes a request, waits for the results and copies it into the passed io.Writer. It returns 2 variables:
- meta map containing the result information
- error that should be nil if everything succeeded
Due to the fact that CopyTo performs a binary request, using Webhook and Store is forbidden.
func (*Request) Crop ¶
Crop adds an image cropping step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Flip ¶
Flip adds an image flipping step to the transformation flow. Check out Optidash docs for more details.
func (*Request) HTTPClient ¶
HTTPClient replaces the client used to execute the request.
func (*Request) Mask ¶
Mask adds application of an elliptical mask to the transformation flow. Check out Optidash docs for more details.
func (*Request) Optimize ¶
Optimize adds an image optimization step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Output ¶
Output sets the output format and encoding. Check out Optidash docs for more details.
func (*Request) Padding ¶
Padding adds an image padding step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Resize ¶
Resize adds an image resizing step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Scale ¶
Scale adds an image scaling step to the transformation flow. Check out Optidash docs for more details.
func (*Request) Store ¶
Store specifies where the image should be stored after transformations. Check out Optidash docs for more details.
func (*Request) Stylize ¶
Stylize adds filter application to the transformation flow. Check out Optidash docs for more details.
func (*Request) ToFile ¶
ToFile executes a request, waits for the results and saves them into a file created on given path. If a file does not exist, it creates one with the passed `perm` file permissions. It returns 2 variables:
- meta map containing the result information
- error that should be nil if everything succeeded
Due to the fact that ToFile performs a binary request, using Webhook and Store is forbidden.
func (*Request) ToJSON ¶
ToJSON runs the request and returns a fastjson.Value with a result from the API.
func (*Request) ToReader ¶
ToReader executes the request, waits for the result and returns a set of 3 variables:
- meta map containing the result you would normally get in the body
- io.ReadCloser containing the resulting file
- error that should be nil if everything succeeded
Due to the fact that ToReader performs a binary request, using Webhook and Store is forbidden.