Skip to content

Commit

Permalink
add Alt Text, Tags and other fields
Browse files Browse the repository at this point in the history
From #46
  • Loading branch information
martinroberts committed Mar 12, 2020
1 parent c12a247 commit 7a236cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
33 changes: 22 additions & 11 deletions unsplash/photo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,29 @@ type ExifData struct {
Iso *int `json:"iso"`
}

// Tag lists can be applied to any photo
type Tag struct {
Type *string `json:"type"`
Title *string `json:"title"`
}

// Photo represents a photo on unsplash.com
type Photo struct {
ID *string `json:"id"`
CreatedAt *time.Time `json:"created_at"`
Width *int `json:"width"`
Height *int `json:"height"`
Color *string `json:"color"`
Downloads *int `json:"downloads"`
Likes *int `json:"likes"`
LikedByUser *bool `json:"liked_by_user"`
Exif *ExifData `json:"exif"`
Photographer *User `json:"user"`
Location *struct {
ID *string `json:"id"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Width *int `json:"width"`
Height *int `json:"height"`
Color *string `json:"color"`
Description *string `json:"description"`
AltDescription *string `json:"alt_description"`
Views *int `json:"views"`
Downloads *int `json:"downloads"`
Likes *int `json:"likes"`
LikedByUser *bool `json:"liked_by_user"`
Exif *ExifData `json:"exif"`
Photographer *User `json:"user"`
Location *struct {
Title *string `json:"title"`
Name *string `json:"name"`
City *string `json:"city"`
Expand All @@ -60,6 +70,7 @@ type Photo struct {
Longitude *float64 `json:"longitude"`
} `json:"position"`
} `json:"location"`
Tags *[]Tag `json:"tags"`
CurrentUserCollections *[]Collection `json:"current_user_collections"`
Urls *struct {
Raw *URL `json:"raw"`
Expand Down
3 changes: 3 additions & 0 deletions unsplash/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ type User struct {
Badge *UserBadge `json:"badge"`
Links *UserLinks `json:"links,omitempty"`
Photos *[]Photo `json:"photos"`
UpdatedAt *string `json:"updated_at"`
InstagramUsername *string `json:"instagram_username"`
TwitterUsername *string `json:"twitter_username"`
}

func (u *User) String() string {
Expand Down

0 comments on commit 7a236cd

Please sign in to comment.