Documentation
¶
Overview ¶
Package five00px provides ...
Package five00px provides ...
Package five00px provides ...
Package five00px provides main 500px API implementation ¶
Package five00px provides ...
Package five00px provides ...
Package five00px provides ...
Package five00px provides ...
Package five00px provides ...
Package five00px provides ...
Index ¶
- Constants
- Variables
- type AccessToken
- type Auth
- type Avatars
- type Categories
- type Category
- type Comment
- type Comments
- type Contacts
- type Equipment
- type Feature
- type Filters
- type Five00px
- func (f00 *Five00px) AddComment(id int, comment string) error
- func (f00 *Five00px) AddFriend(id int) (*User, error)
- func (f00 *Five00px) AddPhoto(info UploadInfo) (*Photo, error)
- func (f00 *Five00px) AddVote(id int, like bool) error
- func (f00 *Five00px) Auth() (*AccessToken, error)
- func (f00 *Five00px) DelFriend(id int) (*User, error)
- func (f00 *Five00px) DelPhoto(id int) error
- func (f00 *Five00px) GetPhotoByID(id int, info *PhotoInfo) (*Photo, error)
- func (f00 *Five00px) GetUserByEmail(email string) (*User, error)
- func (f00 *Five00px) GetUserByID(id int) (*User, error)
- func (f00 *Five00px) GetUserByName(name string) (*User, error)
- func (f00 *Five00px) ListComments(id int, p *Page) (*Comments, error)
- func (f00 *Five00px) ListFollowers(id int, p *Page) (*Followers, error)
- func (f00 *Five00px) ListFriends(id int, p *Page) (*Friends, error)
- func (f00 *Five00px) ListPhotos(c StreamCriterias, p *Page) (*Photos, error)
- func (f00 *Five00px) ListVotes(id int, p *Page) (*Votes, error)
- func (f00 *Five00px) Restore(t *AccessToken) error
- func (f00 *Five00px) SearchPhoto(c SearchCriterias, p *Page) (*Photos, error)
- func (f00 *Five00px) SearchUser(term string, p *Page) (*Search, error)
- type Followers
- type Friends
- type Geo
- type License
- type Page
- type Photo
- type PhotoInfo
- type Photos
- type Search
- type SearchCriterias
- type Size
- type SortBy
- type SortOrder
- type StreamCriterias
- type URLInfo
- type Units
- type UploadInfo
- type User
- type Validator
- type ValsConverter
- type Votes
Constants ¶
const ( FeaturePopular = Feature("popular") FeatureHRated = Feature("highest_rated") FeatureUpcoming = Feature("upcoming") FeatureEditors = Feature("editors") FeatureFreshToday = Feature("fresh_today") FeatureFreshYesterday = Feature("fresh_yesterday") FeatureFreshWeek = Feature("fresh_week") Size70x70 = Size(1) Size140x140 = Size(2) Size280x280 = Size(3) Size900l = Size(4) CategoryAll = Category(-1) CategoryUncategorized = Category(0) CategoryAbstract = Category(10) CategoryAnimals = Category(11) CategoryBW = Category(5) CategoryCelebrities = Category(1) CategoryArch = Category(9) CategoryCommercial = Category(15) CategoryConcert = Category(16) CategoryFamily = Category(20) CategoryFashion = Category(14) CategoryFilm = Category(2) CategoryFineArt = Category(24) CategoryFood = Category(23) CategoryJournalism = Category(3) CategoryLandscapes = Category(8) CategoryMacro = Category(12) CategoryNature = Category(18) CategoryNude = Category(4) CategoryPeople = Category(7) CategoryPerformingArts = Category(19) CategorySport = Category(17) CategoryStillLife = Category(6) CategoryStreet = Category(21) CategoryTransportation = Category(26) CategoryTravel = Category(13) CategoryUnderwater = Category(22) CategoryUrbanExploration = Category(27) CategoryWedding = Category(25) SortByCreatedAt = SortBy("created_at") SortByRating = SortBy("rating") SortByHighestRating = SortBy("highest_rating") SortByTimesViewed = SortBy("times_viewed") SortByVotesCount = SortBy("votes_count") SortByCommentsCount = SortBy("comments_count") SortByTakenAt = SortBy("taken_at") SortOrderAsk = SortOrder("ask") SortOrderDesk = SortOrder("desk") UnitsKm = Units("km") UnitsMi = Units("mi") LicAll = License(-1) Lic500px = License(0) LicCrCommonNonComAttr = License(1) LicCrCommonNonComNoDeriv = License(2) LicCrCommonAttr = License(4) LicCrCommonNoDeriv = License(5) )
Constants
Variables ¶
var ErrAuth = errors.New("Authentication error")
var ErrBadComment = errors.New("The body of the comment was not specified")
ErrBadComment ...
var ErrInternal = errors.New("Internal error")
ErrInternal ...
var ErrInvalidInput = errors.New("Invalid user input")
ErrInvalidInput ...
var ErrPhotoNotAvailable = errors.New("The photo was either deleted, belongs to a deactivated user")
ErrPhotoNotAvailable ...
var ErrPhotoNotFound = errors.New("Photo with the specified ID does not exist")
ErrPhotoNotFound ...
var ErrUnprocessableEntity = errors.New("The system had trouble saving the record. You may retry again.")
ErrUnprocessableEntity ...
var ErrUserAlreadyFriend = errors.New("The user requested has been disabled or already in followers list")
ErrUserAlreadyFriend ...
var ErrUserNotFound = errors.New("User does not exist in our database")
ErrUserNotFound ...
var ErrUserNotFriend = errors.New("The user requested has been disabled or not in followers list")
ErrUserNotFriend ...
var ErrVoteRejected = errors.New("The vote has been rejected; common reasons are:" +
" current user is inactive, has not completed their profile, is trying to vote" +
" on their own photo, or has already voted for the photo")
ErrVoteRejected ...
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken oauth.AccessToken
AccessToken is an alias for oauth.AccessToken structure
type Auth ¶
type Auth struct { Facebook int `json:"facebook"` GoogleOauth2 int `json:"google_oauth2"` Twitter int `json:"twitter"` }
Auth structure contains dictionary of a user's social network authentications.
type Avatars ¶
type Avatars struct { Default URLInfo `json:"default"` Large URLInfo `json:"large"` Small URLInfo `json:"small"` Tiny URLInfo `json:"tiny"` }
Avatars is a dictionary of different avatar sizes
type Categories ¶
type Categories []Category
Categories helper type
func (Categories) Valid ¶
func (c Categories) Valid() bool
Valid if Categories contains valid values
type Comment ¶
type Comment struct { Body string `json:"body"` CreatedAt string `json:"created_at"` Flagged bool `json:"flagged"` ID int `json:"id"` ParentID int `json:"parent_id"` Rating int `json:"rating"` ToWhomUserID int `json:"to_whom_user_id"` User User `json:"user"` UserID int `json:"user_id"` Voted bool `json:"voted"` }
Comment representation
type Comments ¶
type Comments struct { MediaType string `json:"media_type"` CurrentPage int `json:"current_page"` TotalItems int `json:"total_items"` TotalPages int `json:"total_pages"` Comments []Comment `json:"comments"` }
Comments contains list of comments
type Contacts ¶
type Contacts struct { Facebook string `json:"facebook"` Facebookpage string `json:"facebookpage"` Googleplus string `json:"googleplus"` Skype string `json:"skype"` Twitter string `json:"twitter"` Website string `json:"website"` }
Contacts structure contacts dictionary of user’s contacts, object
type Equipment ¶
type Equipment struct { Camera []string `json:"camera"` Lens []string `json:"lens"` Misc []string `json:"misc"` }
Equipment structure contains dictionary of a user's equipment
type Filters ¶
type Filters struct { Category interface{} `json:"category"` Exclude interface{} `json:"exclude"` }
Filters NOTE: Category and Exclude are interfaces as they could be false or int values
type Five00px ¶
type Five00px struct {
// contains filtered or unexported fields
}
Five00px client
func New ¶
New call creates and initiate Five00px object. ConsumerKey and ConsumerSecret have to be provided by user
func (*Five00px) AddComment ¶
AddComment call adds new comment to selected photo
func (*Five00px) AddFriend ¶
AddFriend call adds new friend by user ID. Returns errors: ErrUserNotFound and ErrUserAlreadyFriend
func (*Five00px) AddPhoto ¶
func (f00 *Five00px) AddPhoto(info UploadInfo) (*Photo, error)
AddPhoto call uploads new photo. Information about uploaded photo or upload error will be returned
func (*Five00px) Auth ¶
func (f00 *Five00px) Auth() (*AccessToken, error)
Auth initiate OAuth authentication call. Default Web broser will be popped up during authentication. Store AccessToken for futher usage with Restore API call. Returns error on authorization failure.
func (*Five00px) DelFriend ¶
DelFriend call deletes friend by user ID. Returns errors: ErrUserNotFound and ErrUserNotFriend
func (*Five00px) GetPhotoByID ¶
GetPhotoByID returns photo by its ID. info may contains additional photo criterias
func (*Five00px) GetUserByEmail ¶
GetUserByEmail returns User struct for a user specified by email.
func (*Five00px) GetUserByID ¶
GetUserByID call returns User struct for a user specified by id. If id == 0 returns the profile information for the current user.
func (*Five00px) GetUserByName ¶
GetUserByName returns User struct for a user specified by name.
func (*Five00px) ListComments ¶
ListComments call returns cammonts for selected photo.
func (*Five00px) ListFollowers ¶
ListFollowers call returns list of followers for a user specified by ID.
func (*Five00px) ListFriends ¶
ListFriends call returns list of friends for a user specified by ID.
func (*Five00px) ListPhotos ¶
func (f00 *Five00px) ListPhotos(c StreamCriterias, p *Page) (*Photos, error)
ListPhotos call returns a list of photos for specified phot stream
func (*Five00px) Restore ¶
func (f00 *Five00px) Restore(t *AccessToken) error
Restore call restores OAuth session without additional authentication call. Does not require to show any additional requests.
func (*Five00px) SearchPhoto ¶
func (f00 *Five00px) SearchPhoto(c SearchCriterias, p *Page) (*Photos, error)
SearchPhoto searches for specific photos
type Followers ¶
type Followers struct { Users []User `json:"followers"` FollowersCount int `json:"followers_count"` FollowersPages int `json:"followers_pages"` Page int `json:"page"` }
Followers structure is a list of followers for the specified user
type Friends ¶
type Friends struct { Users []User `json:"friends"` FriendsCount int `json:"friends_count"` FriendsPages int `json:"friends_pages"` Page int `json:"page"` }
Friends structure is a list of friends for the specified user
type Page ¶
Page structure stores RPP(Results Per Page) and Page(Return the specified page of the resource) values.
type Photo ¶
type Photo struct { Aperture string `json:"aperture"` Camera string `json:"camera"` Category Category `json:"category"` CollectionsCount int `json:"collections_count"` Comments []Comment `json:"comments"` CommentsCount int `json:"comments_count"` Converted interface{} `json:"converted"` ConvertedBits int `json:"converted_bits"` CreatedAt string `json:"created_at"` CropVersion int `json:"crop_version"` Description string `json:"description"` Disliked bool `json:"disliked"` Favorited bool `json:"favorited"` FavoritesCount int `json:"favorites_count"` FocalLength string `json:"focal_length"` ForSale bool `json:"for_sale"` ForSaleDate string `json:"for_sale_date"` Height int `json:"height"` HiResUploaded int `json:"hi_res_uploaded"` HighestRating float32 `json:"highest_rating"` HighestRatingDate string `json:"highest_rating_date"` ID int `json:"id"` ImageFormat string `json:"image_format"` ImageURL string `json:"image_url"` Iso string `json:"iso"` Latitude float32 `json:"latitude"` Lens string `json:"lens"` LicenseRequestsEnabled bool `json:"license_requests_enabled"` LicenseType int `json:"license_type"` LicensingRequested bool `json:"licensing_requested"` Liked bool `json:"liked"` Location string `json:"location"` Longitude float32 `json:"longitude"` Name string `json:"name"` Nsfw bool `json:"nsfw"` PositiveVotesCount int `json:"positive_votes_count"` Privacy bool `json:"privacy"` Profile bool `json:"profile"` Purchased bool `json:"purchased"` Rating float32 `json:"rating"` RequestToBuyEnabled bool `json:"request_to_buy_enabled"` SalesCount int `json:"sales_count"` ShutterSpeed string `json:"shutter_speed"` Status int `json:"status"` StoreDownload bool `json:"store_download"` StoreLicense bool `json:"store_license"` StorePrint bool `json:"store_print"` Tags []string `json:"tags"` TakenAt string `json:"taken_at"` TimesViewed int `json:"times_viewed"` URL string `json:"url"` User User `json:"user"` UserID int `json:"user_id"` Voted bool `json:"voted"` VotesCount int `json:"votes_count"` Watermark bool `json:"watermark"` Width int `json:"width"` }
Photo is an array of photos for selected criterias
type Photos ¶
type Photos struct { CurrentPage int `json:"current_page"` Feature Feature `json:"feature"` Filters Filters `json:"filters"` Photos []Photo `json:"photos"` TotalItems int `json:"total_items"` TotalPages int `json:"total_pages"` }
Photos structure contains a listing of (up to one hundred) photos for a specified photo stream.
type Search ¶
type Search struct { Users []User `json:"users"` CurrentPage int `json:"current_page"` TotalPages int `json:"total_pages"` TotalItems int `json:"total_items"` }
Search structure (up to one hundred) users from search results for a specified search term.
type SearchCriterias ¶
type SearchCriterias struct { Term string Tag string Geo Geo Only Categories Exclude Categories ImageSize Size LicenseType License Sort SortBy }
SearchCriterias intro information for photo search request
func NewSearchCriterias ¶
func NewSearchCriterias() *SearchCriterias
NewSearchCriterias is helper function for predefining vlaues for SearchCriterias
func (*SearchCriterias) Valid ¶
func (s *SearchCriterias) Valid() bool
Valid if SearchCriterias contains acceptable values
func (*SearchCriterias) Vals ¶
func (s *SearchCriterias) Vals() url.Values
Vals converts SearchCriterias to url.Values
type StreamCriterias ¶
type StreamCriterias struct { Feature Feature Only Categories Exclude Categories Sort SortBy SortDirection SortOrder ImageSize Size }
StreamCriterias structure is used for photo stream selection
func NewStreamCriterias ¶
func NewStreamCriterias() *StreamCriterias
NewStreamCriterias is helper function for predefining StreamCriterias values
func (*StreamCriterias) Valid ¶
func (p *StreamCriterias) Valid() bool
Valid returns true if PhotoCriterias a valid for futher usage
func (*StreamCriterias) Vals ¶
func (p *StreamCriterias) Vals() url.Values
Vals converts PhotoCriterias to url.Values
type UploadInfo ¶
type UploadInfo struct { FileName string PhotoStream io.Reader Aperture string Camera string Category Category Description string FocalLength string Iso string Latitude float32 Lens string Longitude float32 Name string Privacy bool ShutterSpeed string Tags []string }
UploadInfo contains values for new photo uploading
func (*UploadInfo) Valid ¶
func (i *UploadInfo) Valid() bool
Valid uf UploadInfo contains acceptable values
type User ¶
type User struct { About string `json:"about"` Affection int `json:"affection"` AllowSaleRequests int `json:"allow_sale_requests"` AnalyticsCode string `json:"analytics_code"` Auth Auth `json:"auth"` Avatars Avatars `json:"avatars"` Birthday string `json:"birthday"` City string `json:"city"` Contacts Contacts `json:"contacts"` Country string `json:"country"` CoverURL string `json:"cover_url"` Domain string `json:"domain"` Email string `json:"email"` Equipment Equipment `json:"equipment"` Firstname string `json:"firstname"` FollowersCount int `json:"followers_count"` Following bool `json:"following"` FotomotoOn bool `json:"fotomoto_on"` FriendsCount int `json:"friends_count"` Fullname string `json:"fullname"` GalleriesCount int `json:"galleries_count"` ID int `json:"id"` InFavoritesCount int `json:"in_favorites_count"` InviteAccepted bool `json:"invite_accepted"` InvitePending bool `json:"invite_pending"` Lastname string `json:"lastname"` Locale string `json:"locale"` PhotosCount int `json:"photos_count"` RegistrationDate string `json:"registration_date"` Sex int `json:"sex"` ShowNude bool `json:"show_nude"` State string `json:"state"` StoreOn bool `json:"store_on"` UpgradeStatus int `json:"upgrade_status"` UpgradeStatusExpiry string `json:"upgrade_status_expiry"` UpgradeType int `json:"upgrade_type"` UploadLimit int `json:"upload_limit"` UploadLimitExpiry string `json:"upload_limit_expiry"` Username string `json:"username"` UserpicHTTPSURL string `json:"userpic_https_url"` UserpicURL string `json:"userpic_url"` Usertype int `json:"usertype"` }
User 500px structure. See https://github.com/500px/api-documentation/blob/master/basics/formats_and_terms.md#full-format for additional information.
type Validator ¶
type Validator interface {
Valid() bool
}
Validator interface provides ability to test argument validity
type ValsConverter ¶
ValsConverter converts type to url.Values