api

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIDAndTag    = fmt.Errorf("cannot generate url with id and tag")
	ErrSaysNoText  = fmt.Errorf("cannot generate a Says URL with no text")
	ErrInvalidTag  = fmt.Errorf("invalid tag")
	ErrHTMLAndJSON = fmt.Errorf("cannot generate as both HTML and JSON")
)
View Source
var AvailableTags = CAASTags{}
View Source
var CAASFonts = map[CAASFont]string{
	CAASFontImpact:        "Impact",
	CAASFontAndale:        "Andale",
	CAASFontMono:          "Mono",
	CAASFontArial:         "Arial",
	CAASFontArialBlack:    url.QueryEscape("Arial Black"),
	CAASFontComicSansMS:   url.QueryEscape("Comic Sans MS"),
	CAASFontCourierNew:    url.QueryEscape("Courier New"),
	CAASFontGeorgia:       "Georgia",
	CAASFontTimesNewRoman: url.QueryEscape("Times New Roman"),
	CAASFontVerdana:       "Verdana",
	CAASFontWebdings:      "Webdings",
}
View Source
var CAASImageFilters = map[CAASImageFilter]string{
	CAASImageFilterMono:   "mono",
	CAASImageFilterNegate: "negate",
	CAASImageFilterCustom: "custom",
}
View Source
var CAASImageFits = map[CAASImageFit]string{
	CAASImageFitCover:   "cover",
	CAASImageFitContain: "contain",
	CAASImageFitFill:    "fill",
	CAASImageFitInside:  "inside",
	CAASImageFitOutside: "outside",
}
View Source
var CAASImageTypes = map[CAASImageType]string{
	CAASImageTypeSquare: "square",
	CAASImageTypeMedium: "medium",
	CAASImageTypeSmall:  "small",
	CAASImageTypeXSmall: "xsmall",
}

Functions

func FetchCAASTags added in v0.4.0

func FetchCAASTags(timeout time.Duration)

Types

type CAASFont added in v0.4.0

type CAASFont int
const (
	CAASFontImpact CAASFont = iota
	CAASFontAndale
	CAASFontMono
	CAASFontArial
	CAASFontArialBlack
	CAASFontComicSansMS
	CAASFontCourierNew
	CAASFontGeorgia
	CAASFontTimesNewRoman
	CAASFontVerdana
	CAASFontWebdings
)

type CAASImageFilter added in v0.4.0

type CAASImageFilter int
const (
	CAASImageFilterMono CAASImageFilter = iota
	CAASImageFilterNegate
	CAASImageFilterCustom
)

type CAASImageFit added in v0.4.0

type CAASImageFit int
const (
	CAASImageFitCover CAASImageFit = iota
	CAASImageFitContain
	CAASImageFitFill
	CAASImageFitInside
	CAASImageFitOutside
)

type CAASImagePosition added in v0.4.0

type CAASImagePosition int
const (
	CAASImagePositionCenter CAASImagePosition = iota
	CAASImagePositionTop
	CAASImagePositionRightTop
	CAASImagePositionRight
	CAASImagePositionRightBottom
	CAASImagePositionBottom
	CAASImagePositionLeftBottom
	CAASImagePositionLeft
	CAASImagePositionLeftTop
)

type CAASImageType added in v0.4.0

type CAASImageType int
const (
	CAASImageTypeSquare CAASImageType = iota
	CAASImageTypeMedium
	CAASImageTypeSmall
	CAASImageTypeXSmall
)

type CAASTags added in v0.4.0

type CAASTags []string

type CatMetadata

type CatMetadata struct {
	ID        string    `json:"id"`
	Tags      []string  `json:"tags"`
	CreatedAt time.Time `json:"created_at"`
	URL       string    `json:"url"`
	MIMEType  string    `json:"mimetype"`
}

func RequestRandomCat

func RequestRandomCat(timeout time.Duration) (image.Image, *CatMetadata, error)

func (*CatMetadata) GetCreatedAt

func (cm *CatMetadata) GetCreatedAt() time.Time

func (*CatMetadata) GetID

func (cm *CatMetadata) GetID() string

func (*CatMetadata) GetMIMEType

func (cm *CatMetadata) GetMIMEType() string

func (*CatMetadata) GetTags

func (cm *CatMetadata) GetTags() []string

func (*CatMetadata) GetURL

func (cm *CatMetadata) GetURL() string

type CatURL added in v0.4.0

type CatURL struct {
	// contains filtered or unexported fields
}

func NewCatURL added in v0.4.0

func NewCatURL() *CatURL

func (*CatURL) AsHTML added in v0.5.0

func (c *CatURL) AsHTML() *CatURL

func (*CatURL) AsJSON added in v0.5.0

func (c *CatURL) AsJSON() *CatURL

func (*CatURL) Generate added in v0.4.0

func (c *CatURL) Generate() (string, error)

func (*CatURL) WithBlur added in v0.4.0

func (c *CatURL) WithBlur(blur int) *CatURL

func (*CatURL) WithBrightness added in v0.4.0

func (c *CatURL) WithBrightness(brightness int) *CatURL

func (*CatURL) WithCAASImageFilter added in v0.4.0

func (c *CatURL) WithCAASImageFilter(filter CAASImageFilter) *CatURL

func (*CatURL) WithCAASImageFit added in v0.4.0

func (c *CatURL) WithCAASImageFit(fit CAASImageFit) *CatURL

func (*CatURL) WithCAASImagePosition added in v0.4.0

func (c *CatURL) WithCAASImagePosition(position CAASImagePosition) *CatURL

func (*CatURL) WithCAASImageType added in v0.4.0

func (c *CatURL) WithCAASImageType(imgType CAASImageType) *CatURL

func (*CatURL) WithFilterB added in v0.4.0

func (c *CatURL) WithFilterB(b int) *CatURL

func (*CatURL) WithFilterG added in v0.4.0

func (c *CatURL) WithFilterG(g int) *CatURL

func (*CatURL) WithFilterR added in v0.4.0

func (c *CatURL) WithFilterR(r int) *CatURL

func (*CatURL) WithFilterRGB added in v0.4.0

func (c *CatURL) WithFilterRGB(r, g, b int) *CatURL

WithFilterRGB is a convenience function combining all 3 values

func (*CatURL) WithFont added in v0.4.0

func (c *CatURL) WithFont(font CAASFont) *CatURL

func (*CatURL) WithFontBackground added in v0.4.0

func (c *CatURL) WithFontBackground(hexColor string) *CatURL

func (*CatURL) WithFontColor added in v0.4.0

func (c *CatURL) WithFontColor(hexColor string) *CatURL

func (*CatURL) WithFontSize added in v0.4.0

func (c *CatURL) WithFontSize(size int) *CatURL

func (*CatURL) WithHeight added in v0.4.0

func (c *CatURL) WithHeight(height int) *CatURL

func (*CatURL) WithHue added in v0.4.0

func (c *CatURL) WithHue(hue int) *CatURL

func (*CatURL) WithID added in v0.4.0

func (c *CatURL) WithID(id string) *CatURL

func (*CatURL) WithLightness added in v0.4.0

func (c *CatURL) WithLightness(lightness int) *CatURL

func (*CatURL) WithSaturation added in v0.4.0

func (c *CatURL) WithSaturation(saturation int) *CatURL

func (*CatURL) WithSays added in v0.4.0

func (c *CatURL) WithSays(txt string) *CatURL

func (*CatURL) WithTag added in v0.4.0

func (c *CatURL) WithTag(tag string) *CatURL

func (*CatURL) WithWidth added in v0.4.0

func (c *CatURL) WithWidth(width int) *CatURL

Jump to

Keyboard shortcuts

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