pbapi

package
v0.0.0-...-2d56c29 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageTypeAll          = "all"
	ImageTypePhoto        = "photo"
	ImageTypeIllustration = "illustration"
	ImageTypeVector       = "vector"
)

Constants for ImageType attribute

View Source
const (
	ResponseGroupImageDetails   = "image_details"
	ResponseGroupHighResolution = "high_resolution"
)

Constants for ResponseGroup attribute

View Source
const (
	OrientationAll        = "all"
	OrientationHorizontal = "horizontal"
	OrientationVertical   = "vertical"
)

Constants for Orientation attribute

View Source
const (
	CategoryFashion        = "fashion"
	CategoryNature         = "nature"
	CategoryBackgrounds    = "backgrounds"
	CategoryScience        = "science"
	CategoryEducation      = "education"
	CategoryPeople         = "people"
	CategoryFeelings       = "feelings"
	CategoryReligion       = "religion"
	CategoryHealth         = "health"
	CategoryPlaces         = "places"
	CategoryAnimals        = "animals"
	CategoryIndustry       = "industry"
	CategoryFood           = "food"
	CategoryComputer       = "computer"
	CategorySports         = "sports"
	CategoryTransportation = "transportation"
	CategoryTravel         = "travel"
	CategoryBuildings      = "buildings"
	CategoryBusiness       = "business"
	CategoryMusic          = "music"
)

Constants for Category attribute

View Source
const (
	OrderPopular = "popular"
	OrderLatest  = "latest"
)

Constants for Order attibute

View Source
const APIURL = "https://pixabay.com/api/"

API constant

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Total     int `json:"total"`
	TotalHits int `json:"totalHits"`
}

type HighResolutionHitResponse

type HighResolutionHitResponse struct {
	ID            string `json:"id_hash"`
	LargeImageURL string `json:"largeImageURL"`
	ImageURL      string `json:"imageURL"`
	FullHDURL     string `json:"fullHDURL"`
	UserImageURL  string `json:"userImageURL"`
	// contains filtered or unexported fields
}

type HighResolutionResponse

type HighResolutionResponse struct {
	BaseResponse
	Hits []*HighResolutionHitResponse `json:"hits"`
}

func QueryHighResolution

func QueryHighResolution(req *Request) (*HighResolutionResponse, error)

type ImageDetailsHitResponse

type ImageDetailsHitResponse struct {
	ID        int    `json:"id"`
	Favorites int    `json:"favorites"`
	Likes     int    `json:"likes"`
	Comments  int    `json:"comments"`
	Views     int    `json:"views"`
	Tags      string `json:"tags"`
	Downloads int    `json:"downloads"`
	PageURL   string `json:"pageURL"`
	// contains filtered or unexported fields
}

type ImageDetailsResponse

type ImageDetailsResponse struct {
	BaseResponse
	Hits []*ImageDetailsHitResponse `json:"hits"`
}

func QueryImageDetails

func QueryImageDetails(req *Request) (*ImageDetailsResponse, error)

type Request

type Request struct {
	Key           string `url:"key"`
	ResponseGroup string `url:"response_group"`
	ID            string `url:"id"`
	Query         string `url:"q"`
	Lang          string `url:"lang"`
	ImageType     string `url:"image_type"`
	Orientation   string `url:"orientation"`
	Category      string `url:"category"`
	MinWidth      int    `url:"min_width"`
	MinHeight     int    `url:"min_height"`
	EditorsChoice bool   `url:"editors_choice"`
	SafeSearch    bool   `url:"safesearch"`
	Order         string `url:"order"`
	Page          int    `url:"page"`
	PerPage       int    `url:"per_page"`
	Callback      string `url:"callback"`
	Pretty        bool   `url:"pretty"`
}

Request payload

func NewRequest

func NewRequest(key string) *Request

NewRequest creates a new request

func (*Request) GetRequestURI

func (r *Request) GetRequestURI() (*url.URL, error)

Jump to

Keyboard shortcuts

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