unsplash

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseApiUrl = "https://api.unsplash.com"

	ApiImageSearch = "/search/photos"
	ApiPhotoRandom = "/photos/random"
)
View Source
const (
	Size256  = "256x256"
	Size512  = "512x512"
	Size1024 = "1024x1024"
)

256x256, 512x512, or 1024x1024

Variables

This section is empty.

Functions

This section is empty.

Types

type Unsplash

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

func NewUnsplash

func NewUnsplash(settings *commons.SettingsExternal) (instance *Unsplash, err error)

func (*Unsplash) EnsureRandomFromKeywords

func (instance *Unsplash) EnsureRandomFromKeywords(keywords []string, color string) (response map[string]interface{}, err error)

func (*Unsplash) Get

func (instance *Unsplash) Get(url string) (response map[string]interface{}, err error)

func (*Unsplash) Post

func (instance *Unsplash) Post(url string, body interface{}) (response map[string]interface{}, err error)

func (*Unsplash) Produce

func (instance *Unsplash) Produce(keywords []string, params map[string]interface{}) (response []*model.ProducerItem, err error)

func (*Unsplash) Random

func (instance *Unsplash) Random(query string) (response map[string]interface{}, err error)

Random https://unsplash.com/documentation#get-a-random-photo

func (*Unsplash) RandomByColor

func (instance *Unsplash) RandomByColor(query, color string) (response map[string]interface{}, err error)

func (*Unsplash) RandomByColorFromKeywords

func (instance *Unsplash) RandomByColorFromKeywords(keywords []string, color string) (response map[string]interface{}, err error)

func (*Unsplash) RandomFromKeywords

func (instance *Unsplash) RandomFromKeywords(keywords []string) (response map[string]interface{}, err error)

func (*Unsplash) Search

func (instance *Unsplash) Search(query string) (response []map[string]interface{}, err error)

Search https://unsplash.com/documentation#search-photos

func (*Unsplash) SearchBlackAndWhite

func (instance *Unsplash) SearchBlackAndWhite(query string) (response []map[string]interface{}, err error)

func (*Unsplash) SearchByColor

func (instance *Unsplash) SearchByColor(query, color string) (response []map[string]interface{}, err error)

SearchByColor Filter results by color. Valid values are: black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, and blue.

func (*Unsplash) SearchOne

func (instance *Unsplash) SearchOne(query string) (response map[string]interface{}, err error)

func (*Unsplash) SearchWith

func (instance *Unsplash) SearchWith(params map[string]interface{}) (response []map[string]interface{}, err error)

func (*Unsplash) String

func (instance *Unsplash) String() string

type UnsplashSettings

type UnsplashSettings struct {
	AccessKey string                 `json:"access-key"`
	SecretKey string                 `json:"secret-key"`
	Payload   map[string]interface{} `json:"payload"`
}

Jump to

Keyboard shortcuts

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