untappd

package module
v0.0.0-...-80806bf Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 10 Imported by: 0

README

untappd Build Status GoDoc Go Report Card

Package untappd provides an Untappd APIv4 client, written in Go. MIT Licensed.

You must register an Untappd APIv4 key to use this package: https://untappd.com/api/register.

This client was built using documentation and example output from the Untappd APIv4 documentation: https://untappd.com/api/docs. This project is in no way affiliated with or endorsed by Untappd.

Documentation

Overview

Package untappd provides an Untappd APIv4 client, written in Go. MIT Licensed.

To use this client with the Untappd APIv4, you must register for an API key here: https://untappd.com/api/register.

This package is inspired by Google's go-github library, as well as Antoine Grondin's canlii library. Both can be found on GitHub:

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoAccessToken is returned when an empty AccessToken is passed to
	// NewAuthenticatedClient.
	ErrNoAccessToken = errors.New("no client ID")

	// ErrNoClientID is returned when an empty Client ID is passed to NewClient.
	ErrNoClientID = errors.New("no client ID")

	// ErrNoClientSecret is returned when an empty Client Secret is passed
	// to NewClient.
	ErrNoClientSecret = errors.New("no client secret")
)

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

AuthHandler implements http.Handler, and provides a simple process for authenticating users using OAuth with Untappd APIv4.

func NewAuthHandler

func NewAuthHandler(clientID string, clientSecret string, redirectURL string, fn TokenHandlerFunc, client *http.Client) (*AuthHandler, *url.URL, error)

NewAuthHandler creates a http.Handler which can be used to easily authenticate a user using the Server Side Authentication process, documented here: https://untappd.com/api/docs#authentication.

The first return parameter is the http.Handler described above. The second is a URL which should be provided to a user, so that they can begin the authentication flow. The third contains any errors which may have occurred during setup.

The client ID, client secret, and redirectURL parameters are mandatory.

The TokenHandlerFunc parameter can be used to provide a custom handler which contains an access token, and HTTP request and response writers, for further processing. The TokenHandlerFunc is only called upon successful authentication. Otherwise, an HTTP error is returned to the client. If no TokenHandlerFunc is provided, a default one which writes the token to the HTTP response body will be used.

The http.Client parameter can be used to provide a custom http.Client which obeys timeouts, etc. This client is used to communicate with an upstream OAuth authentication server. If no http.Client is provided, http.DefaultClient will be used.

func (*AuthHandler) ServeHTTP

func (a *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler, and provides a simple http.Handler which can properly authenticate using the Server Side Authentication method outlined in Untappd documentation: https://untappd.com/api/docs#authentication.

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

AuthService is a "service" which allows access to API methods which require authentication.

func (*AuthService) Checkin

func (a *AuthService) Checkin(r CheckinRequest) (*Checkin, *http.Response, error)

Checkin checks-in a beer specified by the input CheckinRequest struct. A variety of struct members can be filled in to specify the rating, comment, etc. for a checkin.

func (*AuthService) Checkins

func (a *AuthService) Checkins() ([]*Checkin, *http.Response, error)

Checkins queries for information about checkins from friends of an authenticated user. This is akin to the "Recent Friend Activity" feed displayed on the homepage of Untappd for an authenticated user.

This method returns up to 25 of an authenticated user's friends' recent checkins. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimit instead.

func (*AuthService) CheckinsMinMaxIDLimit

func (a *AuthService) CheckinsMinMaxIDLimit(minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimit queries for information about checkins from friends of an authenticated user, but also accepts minimum checkin ID, maximum checkin ID, and a limit parameter to enable paging through checkins. This is akin to the "Recent Friend Activity" feed displayed on the homepage of Untappd for an authenticated user.

50 checkins is the maximum number of checkins which may be returned by one call.

type Badge

type Badge struct {
	// Metadata from Untappd.
	ID          int
	CheckinID   int
	Name        string
	Description string
	Hint        string
	Active      bool

	// Links to images of the badge.
	Media BadgeMedia

	// If applicable, time when the specified user earned this badge.
	Earned time.Time

	// If applicable, badge levels which the specified user has obtained.
	// If the slice has zero length, no levels exist for this badge.
	Levels []*Badge
}

Badge represents an Untappd badge, and contains information regarding its name, description, when it was earned, and various media associated with the badge.

type BadgeMedia

type BadgeMedia struct {
	SmallImage  url.URL
	MediumImage url.URL
	LargeImage  url.URL
}

BadgeMedia contains links to media regarding a Badge. Included are links to a small, medium, and large image for a given Badge.

type Beer

type Beer struct {
	// Metadata from Untappd.
	ID          int
	Name        string
	Label       url.URL
	ABV         float64
	IBU         int
	Slug        string
	Style       string
	Description string

	// Time when this beer was added to Untappd.
	Created time.Time

	// Is this beer present in the specified user's wish list?
	WishList bool

	// Global Untappd rating for this beer.
	OverallRating float64

	// For beer search requests this is the global checkin count, for beer info
	// requests this is the rating count.
	OverallCount int

	// If applicable, the specified user's rating for this beer.
	UserRating float64

	// If applicable, time when the specified user first, or most recently
	// checked in this beer.
	FirstHad  time.Time
	RecentHad time.Time

	// If applicable, time when the specified user added this beer to
	// their wish list.
	WishListed time.Time

	// If applicable, number of times the specified user has checked
	// in this beer.
	Count int

	// If available, information regarding the brewery which created
	// this beer.
	Brewery *Brewery
}

Beer represents an Untappd beer, and contains information regarding its name, style, description, ratings, and other various metadata.

If available, a beer's brewery information can be accessed via the Brewery member.

type BeerService

type BeerService struct {
	// contains filtered or unexported fields
}

BeerService is a "service" which allows access to API methods involving beers.

func (*BeerService) Checkins

func (b *BeerService) Checkins(id int) ([]*Checkin, *http.Response, error)

Checkins queries for information about a Beer's checkins. The ID parameter specifies the Beer ID, which will return a list of recent checkins for a given Beer.

This method returns up to 25 of the Beer's most recent checkins. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimit instead.

func (*BeerService) CheckinsMinMaxIDLimit

func (b *BeerService) CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimit queries for information about a Beer's checkins, but also accepts minimum checkin ID, maximum checkin ID, and a limit parameter to enable paging through checkins. The ID parameter specifies the Beer ID, which will return a list of recent checkins for a given Beer.

25 checkins is the maximum number of checkins which may be returned by one call.

func (*BeerService) Info

func (b *BeerService) Info(id int, compact bool) (*Beer, *http.Response, error)

Info queries for information about a Beer with the specified ID. If the compact parameter is set to 'true', only basic beer information will be populated.

func (*BeerService) Search

func (b *BeerService) Search(query string) ([]*Beer, *http.Response, error)

Search searches for information about beers, using the specified search query.

This method returns up to 25 search results. For more granular control, and to page through and sort the results list, use SearchOffsetLimitSort instead.

It is recommended to search using a "Brewery Name + Beer Name" query, such as "Dogfish 60 Minute".

func (*BeerService) SearchOffsetLimitSort

func (b *BeerService) SearchOffsetLimitSort(query string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)

SearchOffsetLimitSort searches for information about beers, using the specified search query. In addition, it accepts offset, limit, and sort parameters to enable paging and sorting through more than 25 beers. Beers may be sorted using any of the provided Sort constants with this package.

50 beers is the maximum number of results which may be returned by one call.

It is recommended to search using a "Brewery Name + Beer Name" query, such as "Dogfish 60 Minute".

type Brewery

type Brewery struct {
	ID       int
	Name     string
	Slug     string
	Country  string
	Active   bool
	Location BreweryLocation
	Contact  BreweryContact
	Type     string
	TypeID   int
}

Brewery represents an Untappd brewery, and contains information about a brewery's name, location, logo, and various other metadata.

type BreweryContact

type BreweryContact struct {
	Twitter   string `json:"twitter"`
	Facebook  string `json:"facebook"`
	Instagram string `json:"instagram"`
	URL       string `json:"url"`
}

BreweryContact represents an Untappd brewery's contact social media and website contact information.

type BreweryLocation

type BreweryLocation struct {
	City      string  `json:"brewery_city"`
	State     string  `json:"brewery_state"`
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lng"`
}

BreweryLocation represent's an Untappd brewery's location, and contains information such as the brewery's city, state, and latitude/longitude.

type BreweryService

type BreweryService struct {
	// contains filtered or unexported fields
}

BreweryService is a "service" which allows access to API methods involving breweries.

func (*BreweryService) Checkins

func (b *BreweryService) Checkins(id int) ([]*Checkin, *http.Response, error)

Checkins queries for information about recent checkins for beers from the specified Brewery. The ID parameter specifies the Brewery ID, which will return a list of recent checkins for beers made by a given Brewery.

This method returns up to 25 of the Brewery's most recent checkins. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimit instead.

func (*BreweryService) CheckinsMinMaxIDLimit

func (b *BreweryService) CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimit queries for information about recent checkins for beers from the specified Brewery, but also accepts minimum checkin ID, maximum checkin ID, and a limit parameter to enable paging through checkins. The ID parameter specifies the Brewery ID, which will return a list of recent checkins for beers made by a given Brewery.

25 checkins is the maximum number of checkins which may be returned by one call.

func (*BreweryService) Info

func (b *BreweryService) Info(id int, compact bool) (*Brewery, *http.Response, error)

Info queries for information about a Brewery with the specified ID. If the compact parameter is set to 'true', only basic brewery information will be populated.

func (*BreweryService) Search

func (b *BreweryService) Search(query string) ([]*Brewery, *http.Response, error)

Search searches for information about breweries, using the specified search query.

This method returns up to 25 search results. For more granular control, and to page through the results list, use SearchOffsetLimit instead.

func (*BreweryService) SearchOffsetLimit

func (b *BreweryService) SearchOffsetLimit(query string, offset int, limit int) ([]*Brewery, *http.Response, error)

SearchOffsetLimit searches for information about breweries, using the specified search query. In addition, it accepts offset and limit parameters to enable paging through more than 25 breweries.

50 breweries is the maximum number of results which may be returned by one call.

type Checkin

type Checkin struct {
	// Metadata from Untappd.
	ID int

	// Time when this checkin was added to Untappd.
	Created time.Time

	// User comment for this checkin.  May be blank.
	Comment string

	// If applicable, the specified user's rating for this beer.
	UserRating float64

	// The user checking in.
	User *User

	// The checkin beer.
	Beer *Beer

	// If available, information regarding the brewery which created
	// this beer.
	Brewery *Brewery

	// If available, information regarding the venue where this checkin
	// occurred.  If a venue was not added to the checkin, this member
	// will be nil.
	Venue *Venue

	// Badges earned when this checkin was submitted.
	Badges []*Badge

	// Toasts by Untappd users for this checkin.
	Toasts []*Toast

	// Comments by Untappd users about this checkin.
	Comments []*Comment
}

Checkin represents an Untappd checkin, and contains metadata regarding the checkin, including the checkin ID, comment, when the checkin occurred, and information about the user, beer, and brewery for a given checkin.

type CheckinRequest

type CheckinRequest struct {
	// Mandatory parameters
	BeerID    int
	GMTOffset int
	TimeZone  string

	// Checkin location
	FoursquareID string
	Latitude     float64
	Longitude    float64

	// User comment and rating
	Comment string
	Rating  float64

	// Send to social media?
	Facebook bool
	Twitter  bool
	// FoursquareID is required if this is true
	Foursquare bool
}

CheckinRequest represents a request to check-in a beer to Untappd. To perform a successful checkin, the BeerID, GMTOffset, and TimeZone members must be filled in. The easiest way to obtain the GMTOffset and TimeZone for your current system is to use the time package from the standard library:

beerID := 1
timezone, offset := time.Now().Zone()
offset = offset / 60 / 60

request := untappd.CheckinRequest{
    BeerID:    beerID,
    GMTOffset: offset,
    TimeZone:  timezone,
}

type Client

type Client struct {
	UserAgent string

	// Methods which require authentication
	Auth interface {
		// https://untappd.com/api/docs#checkin
		Checkin(r CheckinRequest) (*Checkin, *http.Response, error)

		// https://untappd.com/api/docs#activityfeed
		Checkins() ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimit(minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)
	}

	// Methods involving a Beer
	Beer interface {
		// https://untappd.com/api/docs#beeractivityfeed
		Checkins(id int) ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

		// https://untappd.com/api/docs#beerinfo
		Info(id int, compact bool) (*Beer, *http.Response, error)

		// https://untappd.com/api/docs#beersearch
		Search(query string) ([]*Beer, *http.Response, error)
		SearchOffsetLimitSort(query string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)
	}

	// Methods involving a Brewery
	Brewery interface {
		// https://untappd.com/api/docs#breweryactivityfeed
		Checkins(id int) ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

		// https://untappd.com/api/docs#breweryinfo
		Info(id int, compact bool) (*Brewery, *http.Response, error)

		// https://untappd.com/api/docs#brewerysearch
		Search(query string) ([]*Brewery, *http.Response, error)
		SearchOffsetLimit(query string, offset int, limit int) ([]*Brewery, *http.Response, error)
	}

	// Methods involving a Local area
	Local interface {
		// https://untappd.com/api/docs#theppublocal
		Checkins(latitude float64, longitude float64) ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimitRadius(r LocalCheckinsRequest) ([]*Checkin, *http.Response, error)
	}

	// Methods involving a User
	User interface {
		// https://untappd.com/api/docs#userbadges
		Badges(username string) ([]*Badge, *http.Response, error)
		BadgesOffsetLimit(username string, offset int, limit int) ([]*Badge, *http.Response, error)

		// https://untappd.com/api/docs#userbeers
		Beers(username string) ([]*Beer, *http.Response, error)
		BeersOffsetLimitSort(username string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)

		// https://untappd.com/api/docs#useractivityfeed
		Checkins(username string) ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimit(username string, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

		// https://untappd.com/api/docs#userfriends
		Friends(username string) ([]*User, *http.Response, error)
		FriendsOffsetLimit(username string, offset int, limit int) ([]*User, *http.Response, error)

		// https://untappd.com/api/docs#userinfo
		Info(username string, compact bool) (*User, *http.Response, error)

		// https://untappd.com/api/docs#userwishlist
		WishList(username string) ([]*Beer, *http.Response, error)
		WishListOffsetLimitSort(username string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)
	}

	// Methods involving a Venue
	Venue interface {
		// https://untappd.com/api/docs#venueactivityfeed
		Checkins(id int) ([]*Checkin, *http.Response, error)
		CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

		// https://untappd.com/api/docs#venueinfo
		Info(id int, compact bool) (*Venue, *http.Response, error)
	}
	// contains filtered or unexported fields
}

Client is a HTTP client for the Untappd APIv4. It enables access to various methods of the Untappd APIv4.

func NewAuthenticatedClient

func NewAuthenticatedClient(accessToken string, client *http.Client) (*Client, error)

NewAuthenticatedClient creates a properly initialized and authenticated instance of Client, using the input access token and http.Client.

NewAuthenticatedClient must be called in order to create a Client which can access authenticated API actions, such as checking in beers, toasting other users' checkins, adding comments, etc.

To use an authenticated Client with the Untappd APIv4, you must register for an API key here: https://untappd.com/api/register. Next, you must follow the OAuth Authentication procedure documented here: https://untappd.com/api/docs#authentication. Upon successful OAuth Authentication, you will receive an access token which can be used with NewAuthenticatedClient.

func NewClient

func NewClient(clientID string, clientSecret string, client *http.Client) (*Client, error)

NewClient creates a properly initialized instance of Client, using the input client ID, client secret, and http.Client.

To use a Client with the Untappd APIv4, you must register for an API key here: https://untappd.com/api/register.

type Comment

type Comment struct {
	// Metadata from Untappd.
	ID        int
	CheckinID int

	// The actual comment about a Checkin.
	Comment string

	// Time when this comment was submitted to Untappd.
	Created time.Time

	// The user who submitted the Comment.
	User *User
}

Comment represents an Untappd comment from a User to a Checkin, and contains metadata regarding the comment, and the User who submitted the comment.

type Distance

type Distance string

Distance is a distance unit accepted by the Untappd APIv4. A set of Distance constants are provided for ease of use.

const (
	// DistanceMiles requests a radius in miles for local checkins.
	DistanceMiles Distance = "m"

	// DistanceKilometers requests a radius in kilometers for local checkins.
	DistanceKilometers Distance = "km"
)

type Error

type Error struct {
	Code              int
	Detail            string
	Type              string
	DeveloperFriendly string
	Duration          time.Duration
}

Error represents an error returned from the Untappd APIv4.

func (Error) Error

func (e Error) Error() string

Error returns the string representation of an Error.

type LocalCheckinsRequest

type LocalCheckinsRequest struct {
	// Mandatory parameters
	Latitude  float64
	Longitude float64

	// Minimum and maximum checkin IDs to query
	MinID int
	MaxID int

	// Maximum number of results to return
	Limit int

	// Distance radius from latitude/longitude pair, and units
	// for the radius
	Radius int
	Units  Distance
}

LocalCheckinsRequest represents a request to view checkins in a local area, specified by latitude and longitude. All other parameters are optional, but may be used to filter checkins which meet a set of criteria.

type LocalService

type LocalService struct {
	// contains filtered or unexported fields
}

LocalService is a "service" which allows access to API methods involving checkins in a localized area.

func (*LocalService) Checkins

func (l *LocalService) Checkins(latitude float64, longitude float64) ([]*Checkin, *http.Response, error)

Checkins queries for information about checkins in a local area, specified by latitude and longitude.

This method returns up to 25 of a local area's most recent checkins within a distance of 25 miles. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimitRadius instead.

func (*LocalService) CheckinsMinMaxIDLimitRadius

func (l *LocalService) CheckinsMinMaxIDLimitRadius(r LocalCheckinsRequest) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimitRadius queries for information about a local area's checkins, but also accepts a variety of parameters to query and page through checkins. The latitude and longitude parameters specify the local area where recent checkins will be queried.

25 checkins is the maximum number of checkins which may be returned by one call.

type Sort

type Sort string

Sort is a sorting method accepted by the Untappd APIv4. A set of Sort constants are provided for ease of use.

const (
	// SortDate sorts a list of beers by most recent date checked in.
	SortDate Sort = "date"

	// SortCheckin sorts a list of beers by highest number of checkins.
	SortCheckin Sort = "checkin"

	// SortHighestRated sorts a list of beers by highest rated overall on Untappd.
	SortHighestRated Sort = "highest_rated"

	// SortLowestRated sorts a list of beers by lowest rated overall on Untappd.
	SortLowestRated Sort = "lowest_rated"

	// SortUserHighestRated sorts a list of beers by highest rated by this user
	// on Untappd.
	SortUserHighestRated Sort = "highest_rated_you"

	// SortUserLowestRated sorts a list of beers by lowest rated by this user
	// on Untappd.
	SortUserLowestRated Sort = "lowest_rated_you"

	// SortHighestABV sorts a list of beers by highest alcohol by volume on Untappd.
	SortHighestABV Sort = "highest_abv"

	// SortLowestABV sorts a list of beers by lowest alcohol by volume on Untappd.
	SortLowestABV Sort = "lowest_abv"
)

Constants that define various methods that the Untappd APIv4 can use to sort Beer results.

func Sorts

func Sorts() []Sort

Sorts returns a slice of all available Sort constants.

type Toast

type Toast struct {
	// Metadata from Untappd.
	ID     int
	UserID int

	// Time when this toast was submitted to Untappd.
	Created time.Time

	// The user who performed the Toast.
	User *User
}

Toast represents an Untappd toast to a Checkin, and contains metadata regarding the toast, and the User who performed the toast.

type TokenHandlerFunc

type TokenHandlerFunc func(token string, w http.ResponseWriter, r *http.Request)

TokenHandlerFunc is a function which is invoked at the end of a successful AuthHandler authentication process. The token generated during the process is provided via the token parameter, and the HTTP request and response writers are available for further HTTP processing.

type User

type User struct {
	// Metadata from Untappd.
	UID       int
	ID        int
	UserName  string
	FirstName string
	LastName  string
	Location  string
	Bio       string
	Supporter bool

	// Links to the user's avatar, cover photo, custom URL, and Untappd profile.
	Avatar     url.URL
	CoverPhoto url.URL
	URL        url.URL
	UntappdURL url.URL

	// Struct containing this user's total badges, friends, checkins,
	// and other various totals.
	Stats UserStats
}

User represents an Untappd user, and contains information regarding a user's username, first and last name, avatar, cover photo, and various other attributes.

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService is a "service" which allows access to API methods involving users.

func (*UserService) Badges

func (u *UserService) Badges(username string) ([]*Badge, *http.Response, error)

Badges queries for information about a User's badges. The username parameter specifies the User whose badges will be returned.

This method returns up to 50 of the User's most recently earned badges. For more granular control, and to page through the badges list, use BadgesOffsetLimit instead.

func (*UserService) BadgesOffsetLimit

func (u *UserService) BadgesOffsetLimit(username string, offset int, limit int) ([]*Badge, *http.Response, error)

BadgesOffsetLimit queries for information about a User's badges, but also accepts offset and limit parameters to enable paging through more than 50 badges. The username parameter specifies the User whose badges will be returned.

50 badges is the maximum number of badges which may be returned by one call.

func (*UserService) Beers

func (u *UserService) Beers(username string) ([]*Beer, *http.Response, error)

Beers queries for information about a User's checked-in beers. The username parameter specifies the User whose beers will be returned.

This method returns up to 25 of the User's most recently checked-in beerss. For more granular control, and to page through and sort the beers list, use BeersOffsetLimitSort instead.

func (*UserService) BeersOffsetLimitSort

func (u *UserService) BeersOffsetLimitSort(username string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)

BeersOffsetLimitSort queries for information about a User's checked-in beers, but also accepts offset, limit, and sort parameters to enable paging and sorting through more than 25 beers. The username parameter specifies the User whose checked-in beers will be returned. Beers may be sorted using any of the provided Sort constants with this package.

50 beers is the maximum number of beers which may be returned by one call.

func (*UserService) Checkins

func (u *UserService) Checkins(username string) ([]*Checkin, *http.Response, error)

Checkins queries for information about a User's checkins. The username parameter specifies the User whose checkins will be returned.

This method returns up to 25 of the User's most recent checkins. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimit instead.

func (*UserService) CheckinsMinMaxIDLimit

func (u *UserService) CheckinsMinMaxIDLimit(username string, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimit queries for information about a User's checkins, but also accepts minimum checkin ID, maximum checkin ID, and a limit parameter to enable paging through checkins. The username parameter specifies the User whose checkins will be returned.

50 checkins is the maximum number of checkins which may be returned by one call.

func (*UserService) Friends

func (u *UserService) Friends(username string) ([]*User, *http.Response, error)

Friends queries for information about a User's friends. The username parameter specifies the User whose friends will be returned.

This method returns up to a maximum of 25 friends. For more granular control, and to page through the friends list, use FriendsOffsetLimit instead.

The resulting slice of User structs contains a more limited set of user information than a call to Info would. However, basic information such as user ID, username, first name, last name, bio, etc. is available.

func (*UserService) FriendsOffsetLimit

func (u *UserService) FriendsOffsetLimit(username string, offset int, limit int) ([]*User, *http.Response, error)

FriendsOffsetLimit queries for information about a User's friends, but also accepts offset and limit parameters to enable paging through more than 25 friends. The username parameter specifies the User whose friends will be returned.

25 friends is the maximum number of friends which may be returned by one call.

func (*UserService) Info

func (u *UserService) Info(username string, compact bool) (*User, *http.Response, error)

Info queries for information about a User with the specified username. If the compact parameter is set to 'true', only basic user information will be populated.

func (*UserService) WishList

func (u *UserService) WishList(username string) ([]*Beer, *http.Response, error)

WishList queries for information about a User's wish list beers. The username parameter specifies the User whose beers will be returned.

This method returns up to 25 of the User's wish list beers. For more granular control, and to page through and sort the beers list, use WishListOffsetLimitSort instead.

func (*UserService) WishListOffsetLimitSort

func (u *UserService) WishListOffsetLimitSort(username string, offset int, limit int, sort Sort) ([]*Beer, *http.Response, error)

WishListOffsetLimitSort queries for information about a User's wish list beers, but also accepts offset, limit, and sort parameters to enable paging and sorting through more than 25 beers. The username parameter specifies the User whose wish list beers will be returned. Beers may be sorted using any of the provided Sort constants with this package.

50 beers is the maximum number of beers which may be returned by one call.

type UserStats

type UserStats struct {
	TotalBadges       int `json:"total_badges"`
	TotalFriends      int `json:"total_friends"`
	TotalCheckins     int `json:"total_checkins"`
	TotalBeers        int `json:"total_beers"`
	TotalCreatedBeers int `json:"total_created_beers"`
	TotalFollowings   int `json:"total_followings"`
	TotalPhotos       int `json:"total_photos"`
}

UserStats is a struct which contains various statistics regarding an Untappd user.

type Venue

type Venue struct {
	// Metadata from Untappd.
	ID      int
	Name    string
	Updated time.Time

	// Category of thie venue.
	Category string

	// Is this a public venue?
	Public bool

	// Location of this venue.
	Location VenueLocation

	// Foursquare data.
	Foursquare VenueFoursquare

	// Popular beers at this venue.
	TopBeers []*Beer

	// Checkins at this venue.
	Checkins []*Checkin

	// A logo or icon of the venue
	Icon VenueIcon
}

Venue represents an Untappd venue, and contains information about a venue's name, location, categories, and various other metadata.

type VenueFoursquare

type VenueFoursquare struct {
	ID  string `json:"foursquare_id"`
	URL string `json:"foursquare_url"`
}

VenueFoursquare represents an Untappd venue's Foursquare data, and contains the venue's Foursquare ID and URL.

type VenueIcon

type VenueIcon struct {
	SmallIcon  url.URL
	MediumIcon url.URL
	LargeIcon  url.URL
}

VenueIcon contains links to media regarding Venues. Included are links to a small, medium, and large photo for a given Venue.

type VenueLocation

type VenueLocation struct {
	Address   string  `json:"venue_address"`
	City      string  `json:"venue_city"`
	State     string  `json:"venue_state"`
	Country   string  `json:"venue_country"`
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lng"`
}

VenueLocation represent's an Untappd venue's location, and contains information such as the venue's address, city, state, country, and latitude/longitude.

type VenueService

type VenueService struct {
	// contains filtered or unexported fields
}

VenueService is a "service" which allows access to API methods involving venues.

func (*VenueService) Checkins

func (v *VenueService) Checkins(id int) ([]*Checkin, *http.Response, error)

Checkins queries for information about a Venue's checkins. The ID parameter specifies the Venue ID, which will return a list of recent checkins for a given Venue.

This method returns up to 25 of the Venue's most recent checkins. For more granular control, and to page through the checkins list using ID parameters, use CheckinsMinMaxIDLimit instead.

func (*VenueService) CheckinsMinMaxIDLimit

func (v *VenueService) CheckinsMinMaxIDLimit(id int, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error)

CheckinsMinMaxIDLimit queries for information about a Venue's checkins, but also accepts minimum checkin ID, maximum checkin ID, and a limit parameter to enable paging through checkins. The ID parameter specifies the Venue ID, which will return a list of recent checkins for a given Venue.

25 checkins is the maximum number of checkins which may be returned by one call.

func (*VenueService) Info

func (b *VenueService) Info(id int, compact bool) (*Venue, *http.Response, error)

Info queries for information about a Venue with the specified ID. If the compact parameter is set to 'true', only basic venue information will be populated.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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