Documentation
¶
Overview ¶
Package pexels is used for searching and retrieving photos and videos from Pexels https://www.pexels.com/api/documentation/
Index ¶
- func CollectionMedia(w http.ResponseWriter, req *http.Request)
- type CollectionMediaParams
- type CollectionParams
- type CollectionResourceResponse
- type CollectionsResponse
- type CuratedParams
- type PhotoQueryParams
- type PhotoResponse
- type PhotoSearchResponse
- type VideoPopularParams
- type VideoQueryParams
- type VideoResponse
- type VideoSearchResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectionMedia ¶
func CollectionMedia(w http.ResponseWriter, req *http.Request)
CollectionMedia returns all the media (photos and videos) within a single collection. You can filter to only receive photos or videos using the type parameter: /collection/gz8lwcj?page=2&per_page=10&type=photos https://www.pexels.com/api/documentation/#collections-media
Types ¶
type CollectionMediaParams ¶
type CollectionParams ¶
type CollectionsResponse ¶
type CollectionsResponse struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalResults int `json:"total_results"`
NextPage string `json:"next_page"`
PrevPage string `json:"prev_page"`
Collections []*CollectionResourceResponse `json:"collections"`
}
func FeaturedCollections ¶
func FeaturedCollections(ctx context.Context, queryParams *CollectionParams) (*CollectionsResponse, error)
FeaturedCollections retrieves all featured collections on Pexels. https://www.pexels.com/api/documentation/#collections-featured
func MyCollections ¶
func MyCollections(ctx context.Context, queryParams *CollectionParams) (*CollectionsResponse, error)
MyCollections returns all of your collections. https://www.pexels.com/api/documentation/#collections-all
type CuratedParams ¶
type PhotoQueryParams ¶
type PhotoQueryParams struct {
// Default: 1
Page int `query:"page,omitempty" url:"page,omitempty"`
// Default: 15, Max: 80
PerPage int `query:"per_page" url:"per_page,omitempty"`
Query string `query:"query" url:"query,omitempty"`
// "landscape", "portrait", "square"
Orientation string `query:"orientation" url:"per_page,omitempty"`
// "large" (24MP), "medium" (12MP) or "small" (4MP)
Size string `query:"size" url:"size,omitempty"`
// "red", "orange", "yellow", "green", "turquoise", "blue", "violet", "pink", "brown", "black", "gray", "white" or any hexidecimal color code (eg. "#ffffff").
Color string `query:"color" url:"color,omitempty"`
// "en-US", "pt-BR", "es-ES", "ca-ES", "de-DE", "it-IT", "fr-FR", "sv-SE", "id-ID", "pl-PL", "ja-JP", "zh-TW", "zh-CN", "ko-KR"
// "th-TH", "nl-NL", "hu-HU", "vi-VN", "cs-CZ", "da-DK", "fi-FI", "uk-UA", "el-GR", "ro-RO", "nb-NO", "sk-SK", "tr-TR", "ru-RU"
Locale string `query:"locale" url:"locale,omitempty"`
}
type PhotoResponse ¶
type PhotoResponse struct {
Id int `json:"id"`
Width int `json:"width"`
Height int `json:"height"`
Url string `json:"url"`
Photographer string `json:"photographer"`
PhotographerUrl string `json:"photographer_url"`
PhotographerId int `json:"photographer_id"`
AvgColor string `json:"avg_color"`
Src struct {
Original string `json:"original"`
Large2X string `json:"large2x"`
Large string `json:"large"`
Medium string `json:"medium"`
Small string `json:"small"`
Portrait string `json:"portrait"`
Landscape string `json:"landscape"`
Tiny string `json:"tiny"`
} `json:"src"`
Liked bool `json:"liked"`
Alt string `json:"alt"`
}
func GetPhoto ¶
func GetPhoto(ctx context.Context, id string) (*PhotoResponse, error)
GetPhoto retrieves a specific photo. https://www.pexels.com/api/documentation/#photos-show
type PhotoSearchResponse ¶
type PhotoSearchResponse struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalResults int `json:"total_results"`
NextPage string `json:"next_page"`
PrevPage string `json:"prev_page"`
Photos []*PhotoResponse `json:"photos"`
}
func CuratedPhotos ¶
func CuratedPhotos(ctx context.Context, queryParams *CuratedParams) (*PhotoSearchResponse, error)
CuratedPhotos receive real-time photos curated by the Pexels team. https://www.pexels.com/api/documentation/#photos-curated
func SearchPhotos ¶
func SearchPhotos(ctx context.Context, queryParams *PhotoQueryParams) (*PhotoSearchResponse, error)
SearchPhotos search Pexels for photos. Query could be something broad like "Nature", "Tigers", "People". Or it could be something specific like "Group of people working". https://www.pexels.com/api/documentation/#photos-search
type VideoPopularParams ¶
type VideoPopularParams struct {
// Default: 1
Page int `query:"page" url:"page,omitempty"`
// Default: 15, Max: 80
PerPage int `query:"per_page" url:"per_page,omitempty"`
MinWidth int `query:"min_width" url:"min_width,omitempty"`
MinHeight int `query:"min_height" url:"min_height,omitempty"`
MinDuration int `query:"min_duration" url:"min_duration,omitempty"`
MaxDuration int `query:"max_duration" url:"max_duration,omitempty"`
}
type VideoQueryParams ¶
type VideoQueryParams struct {
// Default: 1
Page int `query:"page" url:"page,omitempty"`
// Default: 15, Max: 80
PerPage int `query:"per_page" url:"per_page,omitempty"`
Query string `query:"query" url:"query,omitempty"`
// "landscape", "portrait", "square"
Orientation string `query:"orientation" url:"per_page,omitempty"`
// "large" (4K), "medium" (Full HD) or "small" (HD)
Size string `query:"size" url:"size,omitempty"`
// "en-US", "pt-BR", "es-ES", "ca-ES", "de-DE", "it-IT", "fr-FR", "sv-SE", "id-ID", "pl-PL", "ja-JP", "zh-TW", "zh-CN", "ko-KR"
// "th-TH", "nl-NL", "hu-HU", "vi-VN", "cs-CZ", "da-DK", "fi-FI", "uk-UA", "el-GR", "ro-RO", "nb-NO", "sk-SK", "tr-TR", "ru-RU"
Locale string `query:"locale" url:"locale,omitempty"`
}
type VideoResponse ¶
type VideoResponse struct {
Id int `json:"id"`
Width int `json:"width"`
Height int `json:"height"`
Url string `json:"url"`
Image string `json:"image"`
Tags []string `json:"tags"`
Duration int `json:"duration"`
User struct {
Id int `json:"id"`
Name string `json:"name"`
Url string `json:"url"`
} `json:"user"`
VideoFiles []struct {
Id int `json:"id"`
Quality string `json:"quality"`
FileType string `json:"file_type"`
Width int `json:"width"`
Height int `json:"height"`
Fps float64 `json:"fps"`
Link string `json:"link"`
} `json:"video_files"`
VideoPictures []struct {
Id int `json:"id"`
Picture string `json:"picture"`
Nr int `json:"nr"`
} `json:"video_pictures"`
}
func GetVideo ¶
func GetVideo(ctx context.Context, id string) (*VideoResponse, error)
GetVideo retrieves a specific video. https://www.pexels.com/api/documentation/#videos-show
type VideoSearchResponse ¶
type VideoSearchResponse struct {
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalResults int `json:"total_results"`
Url string `json:"url"`
NextPage string `json:"next_page"`
PrevPage string `json:"prev_page"`
Photos []*VideoResponse `json:"videos"`
}
func PopularVideos ¶
func PopularVideos(ctx context.Context, queryParams *VideoPopularParams) (*VideoSearchResponse, error)
PopularVideos receives the current popular Pexels videos. https://www.pexels.com/api/documentation/#videos-popular
func SearchVideos ¶
func SearchVideos(ctx context.Context, queryParams *VideoQueryParams) (*VideoSearchResponse, error)
SearchVideos search Pexels for videos. Query could be something broad like "Nature", "Tigers", "People". Or it could be something specific like "Group of people working". https://www.pexels.com/api/documentation/#videos-search