unsplash

package
v0.0.0-...-08b44c8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RawSize     = "raw"
	FullSize    = "full"
	RegularSize = "regular"
	SmallSize   = "small"
	ThumbSize   = "thumb"
)

Variables

View Source
var ErrInvalidSize = errors.New("invalid size request")
View Source
var ErrRequestFailed = errors.New("request failed")

ErrRequestFailed indicates a general error in service request.

Functions

This section is empty.

Types

type Image

type Image struct {
	ID   string `json:"id"`
	URLs struct {
		Raw     string `json:"raw"`
		Full    string `json:"full"`
		Regular string `json:"regular"`
		Small   string `json:"small"`
		Thumb   string `json:"thumb"`
	} `json:"urls"`
	Location struct {
		City    string `json:"city"`
		Country string `json:"country"`
	} `json:"location"`
	Description string `json:"description"`
}

Image represents unsplash image information.

type Unsplash

type Unsplash struct {
	N           int
	Query       string
	Orientation string
	Path        string
	Prefix      string
	Size        string
	Client      *resty.Client
}

Unsplash image provider.

func New

func New(count int, query string, orientation string, token string, path string, size string) *Unsplash

func (*Unsplash) Fetch

func (u *Unsplash) Fetch() error

Fetch images from unsplash based on given critarias. nolint: cyclop

func (*Unsplash) Store

func (u *Unsplash) Store(name string, content io.ReadCloser)

Jump to

Keyboard shortcuts

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