models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedImageFormat occurs when unsupported or invalid image format was provided.
	ErrUnsupportedImageFormat = errors.New("unsupported image format")
)

Functions

This section is empty.

Types

type ImageFormat

type ImageFormat string

ImageFormat represents an image format.

const (
	// PNGImageFormat represents PNG image format.
	PNGImageFormat ImageFormat = "png"
	// JPEGImageFormat represents JPEG image format.
	JPEGImageFormat ImageFormat = "jpeg"
	// WebPImageFormat represents WebP image format.
	WebPImageFormat ImageFormat = "webp"
)

func ParseImageFormat

func ParseImageFormat(text string) (ImageFormat, error)

ParseImageFormat parses the ImageFormat.

func (ImageFormat) ContentType

func (f ImageFormat) ContentType() string

ContentType returns image format as a Content-Type header value.

func (ImageFormat) Extension

func (f ImageFormat) Extension() string

Extension returns corresponding file extension for the underlying ImageFormat.

func (ImageFormat) IsValid

func (f ImageFormat) IsValid() bool

IsValid validates the ImageFormat.

func (*ImageFormat) UnmarshalText

func (f *ImageFormat) UnmarshalText(text []byte) (err error)

UnmarshalText implements encoding.TextUnmarshaler interface. It's mainly for use within gorilla/schema decoding.

type ScreenshotOptions

type ScreenshotOptions struct {
	// (required) URL of a page to take a screenshot of.
	URL string
	// (optional) Width of the browser viewport.
	Width int
	// (optional) Height of the browser viewport.
	Height int
	// (optional) Screenshot quality.
	Quality int
	// (optional) If true full page screenshot will be took.
	Fullpage bool
	// (optional) Viewport scale factor.
	Scale int
	// (optional) Delay before taking a screenshot.
	Delay int
	// (optional) Format of an image.
	Format ImageFormat
}

ScreenshotOptions is a various set of options that can be applied during the screenshotting process.

func (ScreenshotOptions) Hash

func (so ScreenshotOptions) Hash() (string, error)

Hash returns a hash of underlying ScreenshotOptions object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL