Documentation ¶
Index ¶
- Constants
- Variables
- func NewUnsplashOauthConfig(clientID, clientSecret, redirectURI string, scopes *AuthScopes) *oauth2.Config
- type AuthScopes
- type Client
- func (c *Client) AddPhotoToCollection(ctx context.Context, collectionID string, data map[string]string) (*CollectionActionResponse, error)
- func (c *Client) CreateCollection(ctx context.Context, data map[string]string) (*Collection, error)
- func (c *Client) DeleteCollection(ctx context.Context, collectionID string) error
- func (c *Client) GetCollection(ctx context.Context, id string) (*Collection, error)
- func (c *Client) GetCollectionPhotos(ctx context.Context, id string, queryParams QueryParams) ([]Photo, error)
- func (c *Client) GetCollectionsList(ctx context.Context, queryParams QueryParams) ([]Collection, error)
- func (c *Client) GetPhoto(ctx context.Context, ID string) (*Photo, error)
- func (c *Client) GetPhotoList(ctx context.Context, queryParams QueryParams) ([]Photo, error)
- func (c *Client) GetPhotoStats(ctx context.Context, ID string, queryParams QueryParams) (*PhotoStats, error)
- func (c *Client) GetRandomPhoto(ctx context.Context, queryParams QueryParams) (interface{}, error)
- func (c *Client) GetRelatedCollections(ctx context.Context, id string) ([]Collection, error)
- func (c *Client) GetStatsMonth(ctx context.Context) (*StatsMonth, error)
- func (c *Client) GetStatsTotal(ctx context.Context) (*StatsTotal, error)
- func (c *Client) GetTopic(ctx context.Context, IDOrSlug string) (*Topic, error)
- func (c *Client) GetTopicPhotos(ctx context.Context, IDOrSlug string, queryParams QueryParams) ([]Photo, error)
- func (c *Client) GetTopicsList(ctx context.Context, queryParams QueryParams) ([]Topic, error)
- func (c *Client) GetUserCollections(ctx context.Context, username string, queryParams QueryParams) ([]Collection, error)
- func (c *Client) GetUserLikedPhotos(ctx context.Context, username string, queryParams QueryParams) ([]Photo, error)
- func (c *Client) GetUserPhotos(ctx context.Context, username string, queryParams QueryParams) ([]Photo, error)
- func (c *Client) GetUserPortfolioLink(ctx context.Context, username string) (*url.URL, error)
- func (c *Client) GetUserPrivateProfile(ctx context.Context) (*User, error)
- func (c *Client) GetUserPublicProfile(ctx context.Context, username string) (*User, error)
- func (c *Client) GetUserStats(ctx context.Context, username string, queryParams QueryParams) (*UserStats, error)
- func (c *Client) LikePhoto(ctx context.Context, photoID string) (*LikeResponse, error)
- func (c *Client) RemovePhotoFromCollection(ctx context.Context, collectionID string, data map[string]string) (*CollectionActionResponse, error)
- func (c *Client) SearchCollections(ctx context.Context, queryParams QueryParams) (*CollectionSearchResult, error)
- func (c *Client) SearchPhotos(ctx context.Context, queryParams QueryParams) (*PhotoSearchResult, error)
- func (c *Client) SearchUsers(ctx context.Context, queryParams QueryParams) (*UserSearchResult, error)
- func (c *Client) UnlikePhoto(ctx context.Context, photoID string) error
- func (c *Client) UpdateCollection(ctx context.Context, collectionID string, data map[string]string) (*Collection, error)
- func (c *Client) UpdatePhoto(ctx context.Context, photoID string, updatedData map[string]string) (*Photo, error)
- func (c *Client) UpdateUserProfile(ctx context.Context, updatedData map[string]string) (*User, error)
- type Collection
- type CollectionActionResponse
- type CollectionSearchResult
- type Config
- type ErrQueryNotInURL
- type ErrRequiredScopeAbsent
- type ErrStatusCode
- type Errors
- type LikeResponse
- type Photo
- type PhotoSearchResult
- type PhotoStats
- type QueryParams
- type Stats
- type StatsMonth
- type StatsTotal
- type Tag
- type Topic
- type User
- type UserSearchResult
- type UserStats
Constants ¶
const ( // Default. Read public data. PublicScope = "public" // Access user’s private data. ReadUserScope = "read_user" // Update the user’s profile. WriteUserScope = "write_user" // Read private data from the user’s photos. ReadPhotosScope = "read_photos" // Update photos on the user’s behalf. WritePhotosScope = "write_photos" // Like or unlike a photo on the user’s behalf. WriteLikesScope = "write_likes" // Follow or unfollow a user on the user’s behalf. WriteFollowersScope = "write_followers" // View a user’s private collections. ReadCollectionsScope = "read_collections" // Create and update a user’s collections. WriteCollectionsScope = "write_collections" )
Permissions scopes To write data on behalf of a user or to access their private data, you must request additional permission scopes from them.
const ( // BaseEndpoint defines the base api address BaseEndpoint = "https://api.unsplash.com/" // BaseUserEndpoint defines the base api address for user resources BaseUserEndpoint = BaseEndpoint + "users/" // PrivateUserProfileEndpoint defines the api address for accessing a user's private profile PrivateUserProfileEndpoint = BaseEndpoint + "me" // RandomPhotoEndpoint defines the api address for getting a random photo RandomPhotoEndpoint = BaseEndpoint + "photos/random/" // AllPhotosEndpoint defines the api address for photos resources AllPhotosEndpoint = BaseEndpoint + "photos/" // SearchPhotosEndpoint defines the api address for searching photo resources SearchPhotosEndpoint = BaseEndpoint + "search/photos" // SearchCollectionsEndpoint defines the api address for searching collection resources SearchCollectionsEndpoint = BaseEndpoint + "search/collections" // SearchUsersEndpoint defines the api address for searching users resources SearchUsersEndpoint = BaseEndpoint + "search/users" // TopicsListEndpoint defines the api address for topic resources TopicsListEndpoint = BaseEndpoint + "topics/" // CollectionsListEndpoint defines the api address for collections resources CollectionsListEndpoint = BaseEndpoint + "collections/" // StatsTotalEndpoint defines the api address for total Unsplash stats StatsTotalEndpoint = BaseEndpoint + "stats/total" // StatsMonthEndpoint defines the api address for monthly Unsplash stats StatsMonthEndpoint = BaseEndpoint + "stats/month" )
const ( AuthCodeEndpoint = "https://unsplash.com/oauth/authorize" AuthTokenEndpoint = "https://unsplash.com/oauth/token" )
Private authorization endpoints
Variables ¶
var ( // ErrCodeQueryParamNotFound is raised when code query parameter is not in the url used for // oauth token access. ErrCodeQueryParamNotFound = errors.New("`code` query parameter not found in the request URL") // ErrClientNotPrivate is raised when the client usedd with the Unsplash object is not authentocated // for private functions. ErrClientNotPrivate = errors.New("client not private but used for functions that require private authentication") // ErrAuthCodeEmpty is raised when the authorization code is empty. ErrAuthCodeEmpty = errors.New("auth code provided is empty") )
Functions ¶
func NewUnsplashOauthConfig ¶
func NewUnsplashOauthConfig(clientID, clientSecret, redirectURI string, scopes *AuthScopes) *oauth2.Config
NewUnsplashOauthConfig constructs an *oauth.Config object with all necessary credentials
Types ¶
type AuthScopes ¶
type AuthScopes []string
AuthScopes lists all scopes used in a particular request
func NewAuthScopes ¶
func NewAuthScopes(scopes ...string) *AuthScopes
NewAuthScopes constructs a new AuthScopes object, with an initial `public` element
func (AuthScopes) Contains ¶
func (a AuthScopes) Contains(elem string) bool
Contains returns true if string is found in the the underlying slice structure
type Client ¶
type Client struct { ClientID string HTTPClient *http.Client Config *Config Private bool // true if private authentication is required to make requests, default should be false AuthScopes *AuthScopes }
Client defines methods to interact with the Unsplash API
func New ¶
New initializes a new Client. if a client is not provided, a default http client is used.
func NewPrivateAuthClient ¶
func NewPrivateAuthClient(clientID, clientSecret, redirectURI string, as *AuthScopes, config *Config) (*Client, error)
NewPrivateAuthClient initializes a new client that has been authorised for private actions.
func (*Client) AddPhotoToCollection ¶
func (c *Client) AddPhotoToCollection(ctx context.Context, collectionID string, data map[string]string) (*CollectionActionResponse, error)
AddPhotoToCollection takes in a context, collection id, and data with photo details. `data` must have `photo_id`. Returns abbreviated versions of the added picture and user. Adds a photo to one of the logged-in user’s collections. Requires the `write_collections` scope. https://unsplash.com/documentation#add-a-photo-to-a-collection
func (*Client) CreateCollection ¶
CreateCollection takes in a context and the new collection's data. Returns a pointer to the created collection. Creates a new collection. This requires the `write_collections` scope. https://unsplash.com/documentation#create-a-new-collection
func (*Client) DeleteCollection ¶
DeleteCollection takes in a context and collection's id. Returns an error if delete has failed, nil otherwise. Deletes a collection belonging to the logged-in user. This requires the `write_collections` scope. https://unsplash.com/documentation#delete-a-collection
func (*Client) GetCollection ¶
GetCollection takes in a contect and a collection id to return a single *Collection if a collection of the given id is found. Get a collection using id https://unsplash.com/documentation#get-a-collection
func (*Client) GetCollectionPhotos ¶
func (c *Client) GetCollectionPhotos(ctx context.Context, id string, queryParams QueryParams) ([]Photo, error)
GetCollectionPhotos takes in a context, collection id, and query parameters. If a collection of the given id is found, a slice of Photo objects in the collection is returned. Retrieve a collection's photos https://unsplash.com/documentation#get-a-collections-photos
func (*Client) GetCollectionsList ¶
func (c *Client) GetCollectionsList(ctx context.Context, queryParams QueryParams) ([]Collection, error)
GetCollectionsList takes in a context and query parameters to build the required response and return a slice of Collection objects. Gets a single page of a list of collections https://unsplash.com/documentation#list-collections
func (*Client) GetPhoto ¶
GetPhoto takes in a context and photo id. If a photo with the given id exists, the Photo is returned. Get a Photo using photo ID https://unsplash.com/documentation#get-a-photo
func (*Client) GetPhotoList ¶
GetPhotoList takes in a context and query parameters to return a list(given page, default first) of all Unsplash photos. Get a single page with a list of all photos https://unsplash.com/documentation#list-photos
func (*Client) GetPhotoStats ¶
func (c *Client) GetPhotoStats(ctx context.Context, ID string, queryParams QueryParams) (*PhotoStats, error)
GetPhotoStats takes in a context, photo id and query parameters. If photo with given id is found, the photo stats are returned in a pointer to a PhotoStats object. Retrieve total number of downloads, views and likes of a single photo, as well as the historical breakdown of these stats in a specific timeframe (default is 30 days). https://unsplash.com/documentation#get-a-photos-statistics
func (*Client) GetRandomPhoto ¶
func (c *Client) GetRandomPhoto(ctx context.Context, queryParams QueryParams) (interface{}, error)
GetRandomPhoto takes in a context and query parameters. If a `count` query parameter is provided, a list of photos is returned, otherwise, a single photo is returned. Get a random Photo return a list of photos if a count query parameter is provided https://unsplash.com/documentation#get-a-random-photo
func (*Client) GetRelatedCollections ¶
GetRelatedCollections takes in a context and a collection id to return a slice of Collection objects if the collection of the given id is found. Retrieve a list of collections related to this one. https://unsplash.com/documentation#list-a-collections-related-collections
func (*Client) GetStatsMonth ¶
func (c *Client) GetStatsMonth(ctx context.Context) (*StatsMonth, error)
GetStatsMonth takes a context, returns monthly stats in a pointer to a StatsMonth object. Get the overall Unsplash stats for the past 30 days. https://unsplash.com/documentation#month
func (*Client) GetStatsTotal ¶
func (c *Client) GetStatsTotal(ctx context.Context) (*StatsTotal, error)
GetStatsTotal takes a context, returns total stats in a pointer to a StatsTotal object. Get a list of counts for all of Unsplash. https://unsplash.com/documentation#totals
func (*Client) GetTopic ¶
GetTopic takes a context and a topic's id or slug. Returns a pointer to a Topic, if a topic with the given id or slug is found. Retrieve a single topic. https://unsplash.com/documentation#get-a-topic
func (*Client) GetTopicPhotos ¶
func (c *Client) GetTopicPhotos(ctx context.Context, IDOrSlug string, queryParams QueryParams) ([]Photo, error)
GetTopicPhotos takes a context, a topic's id or slug, and query parameters. Returns slice of Photos in the topic if topic with the given id or slug is found. Retrieve a topic’s photos. https://unsplash.com/documentation#get-a-topics-photos
func (*Client) GetTopicsList ¶
GetTopicsList takes a context and query parameters, returns a slice of Topic objects. Get a single page from the list of all topics. https://unsplash.com/documentation#list-topics
func (*Client) GetUserCollections ¶
func (c *Client) GetUserCollections(ctx context.Context, username string, queryParams QueryParams) ([]Collection, error)
GetUserCollections takes a context, user's username, and query parameters. Returns a slice of Collection objects if user with provided username is found. Gets a list of collections created by the user. https://unsplash.com/documentation#list-a-users-collections
func (*Client) GetUserLikedPhotos ¶
func (c *Client) GetUserLikedPhotos(ctx context.Context, username string, queryParams QueryParams) ([]Photo, error)
GetUserLikedPhotos takes a context, user's username, and query parameters. Returns a slice of Photo objects liked by the user, if user with provided username is found. Gets a list of photos liked by a user. https://unsplash.com/documentation#list-a-users-liked-photos
func (*Client) GetUserPhotos ¶
func (c *Client) GetUserPhotos(ctx context.Context, username string, queryParams QueryParams) ([]Photo, error)
GetUserPhotos takes a context, user's username, and query parameters. Returns a slice of Photo objects uploaded by the user, if user with provided username is found. Gets a list of photos uploaded by a user. https://unsplash.com/documentation#list-a-users-photos
func (*Client) GetUserPortfolioLink ¶
GetUserPortfolioLink takes in a context and username, returns the user's portfolio link. Retrieves a single user’s portfolio link. https://unsplash.com/documentation#get-a-users-portfolio-link
func (*Client) GetUserPrivateProfile ¶
GetUserPrivateProfile takes a context and returns the private profile of the authenticated user Note: To access a user’s private data, the user is required to authorize the read_user scope.
func (*Client) GetUserPublicProfile ¶
GetUserPublicProfile takes in a context and username. Returns a pointer to a User, if user with provided username is found. Retrieves public details on a given user. https://unsplash.com/documentation#get-a-users-public-profile
func (*Client) GetUserStats ¶
func (c *Client) GetUserStats(ctx context.Context, username string, queryParams QueryParams) (*UserStats, error)
GetUserStats takes a context, user's username, and query parameters. Returns user's stats if user with provided username is found. Retrieves the consolidated number of downloads, views and likes of all user’s photos, as well as the historical breakdown and average of these stats in a specific timeframe (default is 30 days). https://unsplash.com/documentation#get-a-users-statistics
func (*Client) LikePhoto ¶
LikePhoto takes in a context and photo id, returns abbreviated versions of the picture and user. Likes a photo on behalf of the logged-in user. This requires the `write_likes` scope. https://unsplash.com/documentation#like-a-photo
func (*Client) RemovePhotoFromCollection ¶
func (c *Client) RemovePhotoFromCollection(ctx context.Context, collectionID string, data map[string]string) (*CollectionActionResponse, error)
RemovePhotoFromCollection takes in a context, collection id, and data with photo details. `data` must have `photo_id`. Returns abbreviated versions of the deleted picture and user. Removes a photo from one of the logged-in user’s collections. Requires the `write_collections` scope. https://unsplash.com/documentation#remove-a-photo-from-a-collection
func (*Client) SearchCollections ¶
func (c *Client) SearchCollections(ctx context.Context, queryParams QueryParams) (*CollectionSearchResult, error)
SearchCollections takes in a context and query parameters, returns the search results, in a pointer to a CollectionSearchResult object. Get a single page with collection search results https://unsplash.com/documentation#search-collections
func (*Client) SearchPhotos ¶
func (c *Client) SearchPhotos(ctx context.Context, queryParams QueryParams) (*PhotoSearchResult, error)
SearchPhotos takes in a context and query parameters, returns the search results, in a pointer to a PhotoSearchResult object. Get a single page with photo search results https://unsplash.com/documentation#search-photos
func (*Client) SearchUsers ¶
func (c *Client) SearchUsers(ctx context.Context, queryParams QueryParams) (*UserSearchResult, error)
SearchUsers takes in a context and query parameters, returns the search results, in a pointer to a UserSearchResult object. Get a single page with users search results https://unsplash.com/documentation#search-users
func (*Client) UnlikePhoto ¶
UnlikePhoto takes in a context and photo id. Returns an error if failed deleting like from Photo, nil otherwise. Removes the logged-in user’s like of a photo. https://unsplash.com/documentation#unlike-a-photo
func (*Client) UpdateCollection ¶
func (c *Client) UpdateCollection(ctx context.Context, collectionID string, data map[string]string) (*Collection, error)
UpdateCollection takes in a context, collection's id and data with which to update the collection. Returns a pointer to the updated collection if collection with the provided collection is found. Updates an existing collection belonging to the logged-in user. This requires the `write_collections` scope. https://unsplash.com/documentation#update-an-existing-collection check if client is private to do private requests
func (*Client) UpdatePhoto ¶
func (c *Client) UpdatePhoto(ctx context.Context, photoID string, updatedData map[string]string) (*Photo, error)
UpdatePhoto takes in a context, photo id and data with which to update photo. Returns the updated Photo. Updates a photo on behalf of the logged-in user. This requires the `write_photos` scope. https://unsplash.com/documentation#update-a-photo
func (*Client) UpdateUserProfile ¶
func (c *Client) UpdateUserProfile(ctx context.Context, updatedData map[string]string) (*User, error)
UpdateUserProfile takes a context and a map with the data to update a user. Returns the updated profile. Updates the current user’s profile. https://unsplash.com/documentation#update-the-current-users-profile Note: This action requires the write_user scope. Without it, it will return a 403 Forbidden response.
type Collection ¶
type Collection struct { ID string `json:"id"` Title string `json:"title"` Description string `json:"description"` PublishedAt string `json:"published_at"` LastCollectedAt string `json:"last_collected_at"` UpdatedAt string `json:"updated_at"` Featured bool `json:"featured"` TotalPhotos int `json:"total_photos"` Private bool `json:"private"` CoverPhoto Photo `json:"cover_photo"` User User `json:"user"` Links struct { Self string `json:"self"` HTML string `json:"html"` Photos string `json:"photos"` } `json:"links"` }
Collection defines fields in a collection resource
type CollectionActionResponse ¶
type CollectionActionResponse struct { Photo Photo `json:"photo"` Collection Collection `json:"collection"` User User `json:"user"` CreatedAt string `json:"created_at"` }
CollectionActionResponse defines the fields returned on adding a photo to a collection or deleting a photo from a collection.
type CollectionSearchResult ¶
type CollectionSearchResult struct { Total int `json:"total"` TotalPages int `json:"total_pages"` Results []Collection `json:"results"` }
CollectionSearchResult defines the structure of the response gotten after searching for a collection
type Config ¶
Config sets up configuration details to be used in making requests. It contains headers that will be used in all client requests.
type ErrQueryNotInURL ¶
type ErrQueryNotInURL string
ErrQueryNotInURL is raised when a search query parameter is not part of the url.
func (ErrQueryNotInURL) Error ¶
func (e ErrQueryNotInURL) Error() string
type ErrRequiredScopeAbsent ¶
type ErrRequiredScopeAbsent string
ErrRequiredScopeAbsent is raised on trying to access a private action when the required scope is not provided or allowed from the authenticated user's endd.
func (ErrRequiredScopeAbsent) Error ¶
func (e ErrRequiredScopeAbsent) Error() string
type ErrStatusCode ¶
type ErrStatusCode struct {
// contains filtered or unexported fields
}
ErrStatusCode defines a http status code error with the status code and tthe reasons for the error
func (ErrStatusCode) Error ¶
func (e ErrStatusCode) Error() string
type Errors ¶
Errors defines the structure Unsplash responds with when an error is encountered while using their API.
type LikeResponse ¶
LikeResponse defines the struct returned on liking and unliking photos returns abbreviated versions of the picture and User
type Photo ¶
type Photo struct { ID string `json:"id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` PromotedAt string `json:"promoted_at"` Width int `json:"width"` Height int `json:"height"` Color string `json:"color"` Downloads int `json:"downloads"` BlurHash string `json:"blur_hash"` Likes int `json:"likes"` LikedByUser bool `json:"liked_by_user"` Description string `json:"description"` AltDescription string `json:"alt_description"` Exif struct { Make string `json:"make"` Model string `json:"model"` ExposureTime string `json:"exposure_time"` Aperture string `json:"aperture"` FocalLength string `json:"focal_length"` ISO int `json:"iso"` } `json:"exif"` Location struct { City string `json:"city"` Country string `json:"country"` Position struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` } `json:"position"` } `json:"location"` Tags []Tag `json:"tags"` CurrentUserCollections []Collection `json:"current_user_collections"` URLs struct { Raw string `json:"raw"` Full string `json:"full"` Regular string `json:"regular"` Small string `json:"small"` Thumb string `json:"thumb"` } `json:"urls"` Links struct { Self string `json:"self"` HTML string `json:"html"` Download string `json:"download"` DownloadLocation string `json:"download_location"` } `json:"links"` User User `json:"user"` Statistics struct { Downloads Stats `json:"downloads"` Views Stats `json:"views"` Likes Stats `json:"likes"` } `json:"statistics"` }
Photo defines fields in a photo resource
type PhotoSearchResult ¶
type PhotoSearchResult struct { Total int `json:"total"` TotalPages int `json:"total_pages"` Results []Photo `json:"results"` }
PhotoSearchResult defines the structure of the response gotten after searching for a picture
type PhotoStats ¶
type PhotoStats struct { ID string `json:"id"` Downloads Stats `json:"downloads"` Views Stats `json:"views"` Likes Stats `json:"likes"` }
PhotoStats defines specific photo statistics fields
type Stats ¶
type Stats struct { Total int `json:"total"` Historical struct { Change int `json:"change"` Resolution string `json:"resolution"` Quantity int `json:"quantity"` Values []struct { Date string `json:"date"` Value int `json:"value"` } `json:"values"` } `json:"historical"` }
Stats defines a blueprint for statistics
type StatsMonth ¶
type StatsMonth struct { Downloads int `json:"downloads"` Views int `json:"views"` Likes int `json:"likes"` NewPhotos int `json:"new_photos"` NewPhotographers int `json:"new_photographers"` NewPixels int `json:"new_pixels"` NewDevelopers int `json:"new_developers"` NewApplications int `json:"new_applications"` NewRequests int `json:"new_requests"` }
StatsMonth defines fields for an Unsplash 30-day stats
type StatsTotal ¶
type StatsTotal struct { Photos int `json:"photos"` Downloads int `json:"downloads"` Views int `json:"views"` Likes int `json:"likes"` Photographers int `json:"photographers"` Pixels int `json:"pixels"` DownloadsPerSecond int `json:"downloads_per_second"` ViewPerSecond int `json:"views_per_second"` Developers int `json:"developers"` Applications int `json:"applications"` Requests int `json:"requests"` }
StatsTotal defines fields for an Unsplash Total Stats Resource
type Topic ¶
type Topic struct { ID string `json:"id"` Slug string `json:"slug"` Title string `json:"title"` Description string `json:"description"` PublishedAt string `json:"published_at"` UpdatedAt string `json:"updated_at"` StartsAt string `json:"starts_at"` EndsAt string `json:"ends_at"` Featured bool `json:"featured"` TotalPhotos int `json:"total_photos"` Links struct { Self string `json:"self"` HTML string `json:"html"` Photos string `json:"photos"` } `json:"links"` Status string `json:"status"` Owners []User `json:"owners"` TopContributors []User `json:"top_contributors"` CurrentUserContributions []Photo `json:"current_user_contributions"` TotalCurrentUserSubmissions int `json:"total_current_user_submissions"` CoverPhoto Photo `json:"cover_photo"` PreviewPhotos []Photo `json:"preview_photos"` }
Topic defines fields in an Unsplash topic
type User ¶
type User struct { ID string `json:"id"` UpdatedAt string `json:"updated_at"` Username string `json:"username"` Name string `json:"name"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` InstagramUsername string `json:"instagram_username"` TwitterUsername string `json:"twitter_username"` PortfolioURL string `json:"portfolio_url"` Bio string `json:"bio"` Location string `json:"location"` TotalLikes int `json:"total_likes"` TotalPhotos int `json:"total_photos"` TotalCollections int `json:"total_collections"` FollowedByUser bool `json:"followed_by_user"` FollowersCount int `json:"followers_count"` FollowingCount int `json:"following_count"` Downloads int `json:"downloads"` UploadsRemaining int `json:"uploads_remaining"` AcceptedTos bool `json:"accepted_tos"` ProfileImage struct { Small string `json:"small"` Medium string `json:"medium"` Large string `json:"large"` } `json:"profile_image"` Badge struct { Title string `json:"title"` Primary bool `json:"primary"` Slug string `json:"slug"` Link string `json:"link"` } `json:"badge"` Links struct { Self string `json:"self"` HTML string `json:"html"` Photos string `json:"photos"` Likes string `json:"likes"` Portfolio string `json:"portfolio"` Following string `json:"following"` Followers string `json:"followers"` } `json:"links"` }
User defines public & private fields Unsplash provides on a user
type UserSearchResult ¶
type UserSearchResult struct { Total int `json:"total"` TotalPages int `json:"total_pages"` Results []User `json:"results"` }
UserSearchResult defines the structure of the response gotten after searching for a user