brewerydb

package module
Version: v0.0.0-...-37520b5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2015 License: BSD-2-Clause Imports: 9 Imported by: 0

README

brewerydb

brewerydb is a Go library for accessing the BreweryDB API

GoDoc Build StatusCoverage Status

usage

import "github.com/naegelejd/brewerydb"

Construct a new Client using your BreweryDB API key:

client := brewerydb.NewClient("<your API key>")

Then use the available services to access the API. For example:

// Get any random beer
beer, _ := client.Beer.Random(&brewerydb.RandomBeerRequest{ABV: "8"})
fmt.Println(beer.Name, beer.Style.Name)

or

// Get all breweries established in 1983
bs, err := client.Brewery.List(&brewerydb.BreweryListRequest{Established: "1983"})
if err != nil {
    panic(err)
}
for _, b := range bs {
    fmt.Println(b.Name, b.Website)
}

or

// "What is in Dragon's Milk?"
bl, _ := client.Search.Beer("Dragon's Milk", nil)

var beerID string
for _, beer := range bl.Beers {
    if beer.Name == "Dragon's Milk" {
        beerID = beer.ID
    }
}
if beerID == "" {
    panic("Dragon's Milk not found")
}

ingredients, _ := client.Beer.ListIngredients(beerID)
adjuncts, _ := client.Beer.ListAdjuncts(beerID)
fermentables, _ := client.Beer.ListFermentables(beerID)
hops, _ := client.Beer.ListHops(beerID)
yeasts, _ := client.Beer.ListYeasts(beerID)

fmt.Println("Dragon's Milk:")
fmt.Println("  Ingredients:")
for _, ingredient := range ingredients {
    fmt.Println("    " + ingredient.Name)
}
fmt.Println("\n  Adjuncts:")
for _, adjunct := range adjuncts {
    fmt.Println("    " + adjunct.Name)
}
fmt.Println("  Fermentables:")
for _, fermentable := range fermentables {
    fmt.Println("    " + fermentable.Name)
}
fmt.Println("  Hops:")
for _, hop := range hops {
    fmt.Println("    " + hop.Name)
}
fmt.Println("  Yeasts:")
for _, yeast := range yeasts {
    fmt.Println("    " + yeast.Name)
}

status

This library is under development. Please feel free to suggest design changes or report issues.

license

This library is distributed under the BSD-style license found in the LICENSE file.

viewsviews 24h

Documentation

Overview

Package brewerydb provides bindings to the BreweryDB API (http://www.brewerydb.com)

Example (Doppelbock)

"What is Doppelbock?"

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

styles, err := c.Menu.Styles()
if err != nil {
	panic(err)
}
for _, style := range styles {
	if style.ShortName == "Doppelbock" {
		fmt.Println("Doppelbock: \n", style.Description)
	}
}
Output:

Example (Dragonsmilk)

"What is in Dragon's Milk?"

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

bl, err := c.Search.Beer("Dragon's Milk", nil)
if err != nil {
	panic(err)
}

var beerID string
for _, beer := range bl.Beers {
	if beer.Name == "Dragon's Milk" {
		beerID = beer.ID
	}
}
if beerID == "" {
	panic("Dragon's Milk not found")
}

ingredients, err := c.Beer.ListIngredients(beerID)
if err != nil {
	panic(err)
}

adjuncts, err := c.Beer.ListAdjuncts(beerID)
if err != nil {
	panic(err)
}

fermentables, err := c.Beer.ListFermentables(beerID)
if err != nil {
	panic(err)
}

hops, err := c.Beer.ListHops(beerID)
if err != nil {
	panic(err)
}

yeasts, err := c.Beer.ListYeasts(beerID)
if err != nil {
	panic(err)
}

fmt.Println("Dragon's Milk:")
fmt.Println("  Ingredients:")
for _, ingredient := range ingredients {
	fmt.Println("    " + ingredient.Name)
}
fmt.Println("\n  Adjuncts:")
for _, adjunct := range adjuncts {
	fmt.Println("    " + adjunct.Name)
}
fmt.Println("  Fermentables:")
for _, fermentable := range fermentables {
	fmt.Println("    " + fermentable.Name)
}
fmt.Println("  Hops:")
for _, hop := range hops {
	fmt.Println("    " + hop.Name)
}
fmt.Println("  Yeasts:")
for _, yeast := range yeasts {
	fmt.Println("    " + yeast.Name)
}
Output:

Index

Examples

Constants

View Source
const (
	BeerOrderName        BeerOrder = "name"
	BeerOrderDescription           = "description"
	BeerOrderAbv                   = "abv"
	BeerOrderIbu                   = "ibu"
	BeerOrderGlasswareID           = "glasswareId"
	BeerOrderSrmID                 = "smrID"
	BeerOrderAvailableID           = "availableId"
	BeerOrderStyleID               = "styleId"
	BeerOrderIsOrganic             = "isOrganic"
	BeerOrderStatus                = "status"
	BeerOrderCreateDate            = "createDate"
	BeerOrderUpdateDate            = "updateDate"
	BeerOrderRandom                = "random"
)

BeerList ordering options.

View Source
const (
	TemperatureCellar   BeerTemperature = "cellar"
	TemperatureVeryCold                 = "very_cold"
	TemperatureCool                     = "cool"
	TemperatureCold                     = "cold"
	TemperatureWarm                     = "warm"
	TemperatureHot                      = "hot"
)

Beer temperatures.

View Source
const (
	BreweryOrderName           BreweryOrder = "name"
	BreweryOrderDescription                 = "description"
	BreweryOrderWebsite                     = "website"
	BreweryOrderEstablished                 = "established"
	BreweryOrderMailingListURL              = "mailingListUrl"
	BreweryOrderIsOrganic                   = "isOrganic"
	BreweryOrderStatus                      = "status"
	BreweryOrderCreateDate                  = "createDate"
	BreweryOrderUpdateDate                  = "updateDate"
	BreweryOrderRandom                      = "random"
)

BreweryList ordering options.

View Source
const (
	ChangeBeer     ChangeType = "beer"
	ChangeBrewery             = "brewery"
	ChangeEvent               = "event"
	ChangeGuild               = "guild"
	ChangeLocation            = "location"
)

ChangeTypes available.

View Source
const (
	ChangeAdd    ChangeAction = "add"
	ChangeDelete              = "delete"
	ChangeEdit                = "edit"
)

ChangeActions available.

View Source
const (
	EventFestival            EventType = "festival"
	EventCompetition                   = "competition"
	EventFestivalCompetition           = "festival_competition"
	EventTasting                       = "tasting"
	EventBeerRelease                   = "beer_release"
	EventSeminar                       = "seminar"
	EventMeetup                        = "meetup"
	EventOther                         = "other"
)

Types of Events.

View Source
const (
	EventOrderWebsite        EventOrder = "website"
	EventOrderYear                      = "year"
	EventOrderStartDate                 = "startDate"
	EventOrderEndDate                   = "endDate"
	EventOrderLocality                  = "locality"
	EventOrderRegion                    = "region"
	EventOrderCountryIsoCode            = "countryIsoCode"
	EventOrderStatus                    = "status"
	EventOrderCreateDate                = "createDate"
	EventOrderUpdateDate                = "updateDate"
)

EventList ordering options.

View Source
const (
	VolumeBarrel Volume = "barrel"
	VolumePack          = "pack"
	VolumeOunce         = "oz"
	VolumeLiter         = "liter"
)

Pre-defined fluidsize Volumes.

View Source
const (
	GuildOrderName        GuildOrder = "name"
	GuildOrderDescription            = "description"
	GuildOrderEstablished            = "established"
	GuildOrderStatus                 = "status"
	GuildOrderCreateDate             = "createDate"
	GuildOrderUpdateDate             = "updateDate"
)

GuildList ordering options.

View Source
const (
	LocationMicro      LocationType = "micro"
	LocationMacro                   = "macro"
	LocationNano                    = "nano"
	LocationBrewpub                 = "brewpub"
	LocationProduction              = "production"
	LocationOffice                  = "office"
	LocationTasting                 = "tasting"
	LocationRestaurant              = "restaurant"
	LocationCidery                  = "cidery"
	LocationMeadery                 = "meadery"
)

Types of Locations.

View Source
const (
	LocationOrderName           LocationOrder = "name"
	LocationOrderBreweryname                  = "breweryName"
	Locality                                  = "locality"
	LocationOrderRegion                       = "region"
	LocationOrderPostalCode                   = "postalCode"
	LocationOrderIsPrimary                    = "isPrimary"
	LocationOrderInPlanning                   = "inPlanning"
	LocationOrderIsClosed                     = "isClosed"
	LocationOrderLocationType                 = "locationType"
	LocationOrderCountryIsoCode               = "countryIsoCode"
	LocationOrderStatus                       = "status"
	LocationOrderCreateDate                   = "createDate"
	LocationOrderUpdateDate                   = "updateDate"
)

LocationList ordering options.

View Source
const (
	YeastTypeAle       YeastType = "ale"
	YeastTypeWheat               = "wheat"
	YeastTypeLager               = "lager"
	YeastTypeWine                = "wine"
	YeastTypeChampagne           = "champagne"
)

Specific Yeast types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjunct

type Adjunct struct {
	ID              int
	Name            string
	Description     string
	Category        string // This will always be set to "misc"
	CategoryDisplay string // This will always be set to "Miscellaneous"
	CreateDate      string
}

Adjunct represents an additional ingredient used in making a Beer.

type AdjunctList

type AdjunctList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Adjuncts      []Adjunct `json:"data"`
}

AdjunctList represents a single "page" containing a slice of Adjuncts.

type AdjunctService

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

AdjunctService provides access to the BreweryDB Adjunct API. Use Client.Adjunct.

See: http://www.brewerydb.com/developers/docs-endpoint/adjunct_index

func (*AdjunctService) Get

func (as *AdjunctService) Get(id int) (a Adjunct, err error)

Get obtains the Adjunct with the given Adjunct ID.

See: http://www.brewerydb.com/developers/docs-endpoint/adjunct_index#2

func (*AdjunctService) List

func (as *AdjunctService) List(page int) (al AdjunctList, err error)

List returns all Adjuncts on the given page.

See: http://www.brewerydb.com/developers/docs-endpoint/adjunct_index#1

type AlternateName

type AlternateName struct {
	ID         int
	Name       string
	BreweryID  string
	CreateDate string
	UpdateDate string
}

AlternateName represents an alternate name for a Brewery. TODO: the actual response object contains the entire Brewery object as well.

see: http://www.brewerydb.com/developers/docs-endpoint/brewery_alternatename

type Attribute

type Attribute struct {
	ID   string
	Name string
}

Attribute is a generic object that contains the ID and Name of either a Beer, Brewery, Event, Guild, or Location.

type Availability

type Availability struct {
	ID          int
	Name        string
	Description string
}

Availability contains information on a Beer's availability.

type AwardCategory

type AwardCategory struct {
	ID          int    `url:"-"`
	Name        string `url:"name"` // required for adding/updating AwardCategories
	Description string `url:"description"`
	Image       string `url:"image"` // base64
	CreateDate  string `url:"-"`
	UpdateDate  string `url:"-"`
}

AwardCategory represents a category of award for an Event.

type AwardPlace

type AwardPlace struct {
	ID          int    `url:"-"`
	Name        string `url:"name"` // required for adding/updating AwardPlaces
	Description string `url:"description"`
	Image       string `url:"image"` // base64
	CreateDate  string `url:"-"`
	UpdateDate  string `url:"-"`
}

AwardPlace represents an award location.

type Beer

type Beer struct {
	ID                        string          `url:"-"`
	Name                      string          `url:"name"` // Required
	Description               string          `url:"description,omitempty"`
	FoodPairings              string          `url:"foodPairings,omitempty"`
	OriginalGravity           string          `url:"originalGravity,omitempty"`
	ABV                       string          `url:"abv,omitempty"`
	IBU                       string          `url:"ibu,omitempty"`
	GlasswareID               int             `url:"glasswareId,omitempty"`
	Glass                     Glass           `url:"-"`
	StyleID                   int             `url:"styleId"` // Required
	Style                     Style           `url:"-"`
	IsOrganic                 YesNo           `url:"isOrganic,omitempty"`
	Labels                    Images          `url:"-"`
	Label                     string          `url:"label,omitempty"`   // base64. Only used for adding/updating Beers.
	Brewery                   []string        `url:"brewery,omitempty"` // breweryID list. Only used for adding/updating Beers.
	ServingTemperature        BeerTemperature `url:"servingTemperature,omitempty"`
	ServingTemperatureDisplay string          `url:"-"`
	Status                    string          `url:"-"`
	StatusDisplay             string          `url:"-"`
	AvailableID               int             `url:"availableId,omitempty"`
	Available                 Availability    `url:"-"`
	BeerVariationID           string          `url:"beerVariationId,omitempty"`
	BeerVariation             struct {
	} `url:"-"`
	SrmID      int    `url:"srmId,omitempty"`
	SRM        SRM    `url:"-"`
	Year       int    `url:"year,omitempty"`
	CreateDate string `url:"-"`
	UpdateDate string `url:"-"`
}

Beer contains all relevant information for a single Beer.

type BeerBreweryRequest

type BeerBreweryRequest struct {
	LocationID string `url:"locationId,omitempty"`
}

BeerBreweryRequest allows for specifying locations for a given Brewery, e.g. if only adding/removing a specific Brewery location from a Beer.

type BeerList

type BeerList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Beers         []Beer `json:"data"`
}

BeerList represents a "page" containing a slice of Beers.

type BeerListRequest

type BeerListRequest struct {
	Page               int       `url:"p"`
	IDs                string    `url:"ids,omitempty"` // IDs of the beers to return, comma separated. Max 10.
	Name               string    `url:"name,omitempty"`
	ABV                string    `url:"abv,omitempty"`
	IBU                string    `url:"ibu,omitempty"`
	GlasswareID        int       `url:"glasswareId,omitempty"`
	SrmID              int       `url:"srmId,omitempty"`
	AvailableID        int       `url:"availableId,omitempty"`
	StyleID            int       `url:"styleId,omitempty"`
	IsOrganic          YesNo     `url:"isOrganic,omitempty"`
	HasLabels          YesNo     `url:"hasLabels,omitempty"`
	Year               int       `url:"year,omitempty"`  // YYYY
	Since              string    `url:"since,omitempty"` // UNIX timestamp format. Max 30 days
	Status             string    `url:"status,omitempty"`
	Order              BeerOrder `url:"order,omitempty"`
	Sort               ListSort  `url:"sort,omitempty"`
	RandomCount        string    `url:"randomCount,omitempty"` // how many random beers to return. Max 10
	WithBreweries      YesNo     `url:"withBreweries,omitempty"`
	WithSocialAccounts YesNo     `url:"withSocialAccounts,omitempty"` // Premium
	WithIngredients    YesNo     `url:"withIngredients,omitempty"`    // Premium
}

BeerListRequest contains all the required and optional fields used for querying for a list of Beers.

type BeerOrder

type BeerOrder string

BeerOrder represents the ordering of a list of Beers.

type BeerService

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

BeerService provides access to the BreweryDB Beer API. Use Client.Beer.

func (*BeerService) Add

func (bs *BeerService) Add(b *Beer) (id string, err error)

Add adds a new Beer to the BreweryDB and returns its new ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_index#3

func (*BeerService) AddAdjunct

func (bs *BeerService) AddAdjunct(beerID string, adjunctID int) error

AddAdjunct adds the Adjunct with the given ID to the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_adjunct#2

func (*BeerService) AddBrewery

func (bs *BeerService) AddBrewery(beerID, breweryID string, q *BeerBreweryRequest) error

AddBrewery adds the Brewery with the given Brewery ID to the Beer with the given Beer ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_brewery#2

func (*BeerService) AddFermentable

func (bs *BeerService) AddFermentable(beerID string, fermentableID int) error

AddFermentable adds the Fermentable with the given ID to the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_fermentable#2

func (*BeerService) AddHop

func (bs *BeerService) AddHop(beerID string, hopID int) error

AddHop adds the Hop with the given ID to the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_hop#2

func (*BeerService) AddSocialAccount

func (bs *BeerService) AddSocialAccount(beerID string, s *SocialAccount) error

AddSocialAccount adds a new SocialAccount to the given Beer.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_socialaccount#3

func (*BeerService) AddUPC

func (bs *BeerService) AddUPC(beerID string, code uint64, fluidsizeID *int) error

AddUPC assigns a Universal Product Code to the Beer with the given ID. fluidsizeID is optional. NOTE: fluidsizeID is encoded as "fluidSizeId" with a capital S.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_upc#1

func (*BeerService) AddYeast

func (bs *BeerService) AddYeast(beerID string, yeastID int) error

AddYeast adds the Yeast with the given ID to the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_yeast#2

func (*BeerService) Delete

func (bs *BeerService) Delete(id string) error

Delete removes the Beer with the given ID from the BreweryDB.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_index#5

func (*BeerService) DeleteAdjunct

func (bs *BeerService) DeleteAdjunct(beerID string, adjunctID int) error

DeleteAdjunct removes the Adjunct with the given ID from the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_adjunct#3

func (*BeerService) DeleteBrewery

func (bs *BeerService) DeleteBrewery(beerID, breweryID string, q *BeerBreweryRequest) error

DeleteBrewery removes the Brewery with the given Brewery ID from the Beer with the given Beer ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_brewery#3

func (*BeerService) DeleteFermentable

func (bs *BeerService) DeleteFermentable(beerID string, fermentableID int) error

DeleteFermentable removes the Fermentable with the given ID from the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_fermentable#3

func (*BeerService) DeleteHop

func (bs *BeerService) DeleteHop(beerID string, hopID int) error

DeleteHop removes the Hop with the given ID from the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_hop#3

func (*BeerService) DeleteSocialAccount

func (bs *BeerService) DeleteSocialAccount(beerID string, socialAccountID int) error

DeleteSocialAccount removes a SocialAccount from the given Beer.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_socialaccount#4

func (*BeerService) DeleteYeast

func (bs *BeerService) DeleteYeast(beerID string, yeastID int) error

DeleteYeast removes the Yeast with the given ID from the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_yeast#3

func (*BeerService) Get

func (bs *BeerService) Get(id string) (beer Beer, err error)

Get queries for a single Beer with the given Beer ID.

TODO: add withBreweries, withSocialAccounts, withIngredients request parameters

See: http://www.brewerydb.com/developers/docs-endpoint/beer_index#2

func (*BeerService) GetRandom

func (bs *BeerService) GetRandom(q *RandomBeerRequest) (b Beer, err error)

GetRandom returns a random Beer.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_random#1

func (*BeerService) GetSocialAccount

func (bs *BeerService) GetSocialAccount(beerID string, socialAccountID int) (s SocialAccount, err error)

GetSocialAccount retrieves the SocialAccount with the given ID for the given Beer.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_socialaccount#2

func (*BeerService) List

func (bs *BeerService) List(q *BeerListRequest) (bl BeerList, err error)

List returns all Beers on the page specified in the given BeerListRequest. For non-premium members, one of Name, ABV, IBU, SrmID, AvailabilityID, StyleID must be set.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_index#1

Example

Get first ~40 beers with an ABV between 8.0 and 9.0, descending, alphabetical

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

bl, err := c.Beer.List(&BeerListRequest{ABV: "8", Sort: SortDescending})
if err != nil {
	panic(err)
}
for _, b := range bl.Beers {
	fmt.Println(b.Name, b.ID)
}
Output:

func (*BeerService) ListAdjuncts

func (bs *BeerService) ListAdjuncts(beerID string) (al []Adjunct, err error)

ListAdjuncts returns a slice of all Adjuncts in the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_adjunct#1

func (*BeerService) ListBreweries

func (bs *BeerService) ListBreweries(id string) ([]Brewery, error)

ListBreweries queries for all Breweries associated with the Beer having the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_brewery#1

func (*BeerService) ListEvents

func (bs *BeerService) ListEvents(beerID string, onlyWinners bool) (el []Event, err error)

ListEvents returns a slice of Events where the given Beer is/was present or has won awards.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_event#1

func (*BeerService) ListFermentables

func (bs *BeerService) ListFermentables(beerID string) (fl []Fermentable, err error)

ListFermentables returns a slice of all Fermentables in the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_fermentable#1

func (*BeerService) ListHops

func (bs *BeerService) ListHops(beerID string) (al []Hop, err error)

ListHops returns a slice of all Hops in the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_hop#1

func (*BeerService) ListIngredients

func (bs *BeerService) ListIngredients(beerID string) (el []Ingredient, err error)

ListIngredients returns a slice of Ingredients found in the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_ingredient#1

func (*BeerService) ListSocialAccounts

func (bs *BeerService) ListSocialAccounts(beerID string) (sl []SocialAccount, err error)

ListSocialAccounts returns a slice of all social media accounts associated with the given Beer.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_socialaccount#1

func (*BeerService) ListVariations

func (bs *BeerService) ListVariations(beerID string) (bl []Beer, err error)

ListVariations returns a slice of all Beers that are variations of the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_variation#1

func (*BeerService) ListYeasts

func (bs *BeerService) ListYeasts(beerID string) (al []Yeast, err error)

ListYeasts returns a slice of all Yeasts in the Beer with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_yeast#1

func (*BeerService) Update

func (bs *BeerService) Update(id string, b *Beer) error

Update changes an existing Beer in the BreweryDB.

See: http://www.brewerydb.com/developers/docs-endpoint/beer_index#4

func (*BeerService) UpdateSocialAccount

func (bs *BeerService) UpdateSocialAccount(beerID string, s *SocialAccount) error

UpdateSocialAccount updates a SocialAccount for the given Beer.

See: TODO (API docs seem wrong)

type BeerTemperature

type BeerTemperature string

BeerTemperature represents the approximate temperature for a Beer.

type Brewery

type Brewery struct {
	ID             string `url:"-"`
	Name           string `url:"name"`
	Description    string `url:"description,omitempty"`
	MailingListURL string `url:"mailingListUrl,omitempty"`
	Images         Images `url:"-"`
	Image          string `url:"image,omitempty"` // only used for adding/update Breweries
	Established    string `url:"established,omitempty"`
	IsOrganic      YesNo  `url:"isOrganic,omitempty"`
	Website        string `url:"website,omitempty"`
	Status         string `url:"-"`
	StatusDisplay  string `url:"-"`
	CreateDate     string `url:"-"`
	UpdateDate     string `url:"-"`
}

Brewery contains all relevant information for a single Brewery.

type BreweryBeersRequest

type BreweryBeersRequest struct {
	WithBreweries      YesNo `url:"withBreweries,omitempty"`
	WithSocialAccounts YesNo `url:"withSocialAccounts,omitempty"`
	WithIngredients    YesNo `url:"withIngredients,omitempty"`
}

BreweryBeersRequest contains options for querying for all Beers from a Brewery.

type BreweryList

type BreweryList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Breweries     []Brewery `json:"data"`
}

BreweryList represents a "page" containing one slice of Breweries.

type BreweryListRequest

type BreweryListRequest struct {
	Page               int          `url:"p"`
	Name               string       `url:"name,omitempty"`
	IDs                string       `url:"ids,omitempty"`
	Established        string       `url:"established,omitempty"`
	IsOrganic          YesNo        `url:"isOrganic,omitempty"`
	HasImages          YesNo        `url:"hasImages,omitempty"`
	Since              string       `url:"since,omitempty"`
	Status             string       `url:"status,omitempty"`
	Order              BreweryOrder `url:"order,omitempty"` // TODO: enumerate
	Sort               string       `url:"sort,omitempty"`  // TODO: enumerate
	RandomCount        string       `url:"randomCount,omitempty"`
	WithSocialAccounts YesNo        `url:"withSocialAccounts,omitempty"`
	WithGuilds         YesNo        `url:"withGuilds,omitempty"`
	WithLocations      YesNo        `url:"withLocations,omitempty"`
	WithAlternateNames YesNo        `url:"withAlternateNames,omitempty"`
}

BreweryListRequest contains all the required and optional fields used for querying for a list of Breweries.

type BreweryOrder

type BreweryOrder string

BreweryOrder represents the ordering of a list of Breweries.

type BreweryService

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

BreweryService provides access to the BreweryDB Brewery API. Use Client.Brewery.

func (*BreweryService) Add

func (bs *BreweryService) Add(b *Brewery) (id string, err error)

Add adds a new Brewery to the BreweryDB and returns its new ID.

func (*BreweryService) AddAlternateName

func (bs *BreweryService) AddAlternateName(breweryID, name string) (id int, err error)

AddAlternateName adds an alternate name to the Brewery with the given ID and returns the alternate name's new ID.

func (*BreweryService) AddGuild

func (bs *BreweryService) AddGuild(breweryID string, guildID string, discount *string) error

AddGuild adds the Guild with the given ID to the Brewery with the given ID. discount is optional (value of discount offered to guild members).

func (*BreweryService) AddLocation

func (bs *BreweryService) AddLocation(breweryID string, loc *Location) (id string, err error)

AddLocation adds a new location for the Brewery with the given ID and returns the new location's ID. TODO: verify that the location ID in the response is, in fact, called "guid". see: http://www.brewerydb.com/developers/docs-endpoint/brewery_location#2

func (*BreweryService) AddSocialAccount

func (bs *BreweryService) AddSocialAccount(breweryID string, s *SocialAccount) error

AddSocialAccount adds a new SocialAccount to the given Brewery.

func (*BreweryService) Delete

func (bs *BreweryService) Delete(id string) error

Delete removes the Brewery with the given ID from the BreweryDB.

func (*BreweryService) DeleteAlternateName

func (bs *BreweryService) DeleteAlternateName(breweryID string, alternateNameID int) error

DeleteAlternateName removes the AlternateName with the given ID from the Brewery with the given ID.

func (*BreweryService) DeleteGuild

func (bs *BreweryService) DeleteGuild(breweryID string, guildID string) error

DeleteGuild removes the Guild with the given ID from the Brewery with the given ID.

func (*BreweryService) DeleteSocialAccount

func (bs *BreweryService) DeleteSocialAccount(breweryID string, socialAccountID int) error

DeleteSocialAccount removes a SocialAccount from the given Brewery.

func (*BreweryService) Get

func (bs *BreweryService) Get(id string) (brewery Brewery, err error)

Get queries for a single Brewery with the given Brewery ID.

Example

Get all information about brewery with given ID (Flying Dog)

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

b, err := c.Brewery.Get("jmGoBA")
if err != nil {
	panic(err)
}
fmt.Println(b.Name)
fmt.Println(b.Description)
Output:

func (*BreweryService) GetRandom

func (bs *BreweryService) GetRandom(q *RandomBreweryRequest) (b Brewery, err error)

GetRandom returns a random active Brewery.

func (*BreweryService) GetSocialAccount

func (bs *BreweryService) GetSocialAccount(breweryID string, socialAccountID int) (s SocialAccount, err error)

GetSocialAccount retrieves the SocialAccount with the given ID for the given Brewery.

func (*BreweryService) List

func (bs *BreweryService) List(q *BreweryListRequest) (bl BreweryList, err error)

List returns all Breweries on the page specified in the given BreweryListRequest. For non-premium members, one of Name or Established must be set.

Example

Get all breweries established in 1983

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

bl, err := c.Brewery.List(&BreweryListRequest{Established: "1983"})
if err != nil {
	panic(err)
}
for _, b := range bl.Breweries {
	fmt.Println(b.Name, b.ID)
}
Output:

func (*BreweryService) ListAlternateNames

func (bs *BreweryService) ListAlternateNames(breweryID string) (al []AlternateName, err error)

ListAlternateNames returns a slice of all the AlternateNames for the Brewery with the given ID.

func (*BreweryService) ListBeers

func (bs *BreweryService) ListBeers(breweryID string, q *BreweryBeersRequest) (bl []Beer, err error)

ListBeers returns a slice of all Beers offered by the Brewery with the given ID.

func (*BreweryService) ListEvents

func (bs *BreweryService) ListEvents(breweryID string, onlyWinners bool) (el []Event, err error)

ListEvents returns a slice of Events where the given Brewery is/was present or has won awards.

func (*BreweryService) ListGuilds

func (bs *BreweryService) ListGuilds(breweryID string) (al []Guild, err error)

ListGuilds returns a slice of all Guilds the Brewery with the given ID belongs to.

func (*BreweryService) ListLocations

func (bs *BreweryService) ListLocations(breweryID string) (ll []Location, err error)

ListLocations returns a slice of all locations for the Brewery with the given ID.

func (*BreweryService) ListSocialAccounts

func (bs *BreweryService) ListSocialAccounts(breweryID string) (sl []SocialAccount, err error)

ListSocialAccounts returns a slice of all social media accounts associated with the given Brewery.

func (*BreweryService) Update

func (bs *BreweryService) Update(breweryID string, b *Brewery) error

Update changes an existing Brewery in the BreweryDB.

func (*BreweryService) UpdateSocialAccount

func (bs *BreweryService) UpdateSocialAccount(breweryID string, s *SocialAccount) error

UpdateSocialAccount updates a SocialAccount for the given Brewery.

type Category

type Category struct {
	ID          int
	Name        string
	Description string
	CreateDate  string
	UpdateDate  string
}

Category represents a type of Beer as specified by the Brewers Association Style Guidelines.

type CategoryService

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

CategoryService provides access to the BreweryDB Category API. Use Client.Category.

See: http://www.brewerydb.com/developers/docs-endpoint/category_index

func (*CategoryService) Get

func (cs *CategoryService) Get(id int) (cat Category, err error)

Get obtains the Category with the given Category ID.

See: http://www.brewerydb.com/developers/docs-endpoint/category_index#2

func (*CategoryService) List

func (cs *CategoryService) List() ([]Category, error)

List returns all possible Beer Categories.

See: http://www.brewerydb.com/developers/docs-endpoint/category_index#1

type Change

type Change struct {
	AttributeName    ChangeType
	Action           ChangeAction
	Attribute        Attribute
	SubAttributeName ChangeType
	SubAction        ChangeAction
	SubAttribute     Attribute
}

Change contains all the relevant information for an individual change in BreweryDB.

type ChangeAction

type ChangeAction string

ChangeAction represents the type of change made to an attribute.

type ChangeList

type ChangeList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Changes       []Change `json:"data"`
}

ChangeList represents one "page" containing a slice of Changes.

type ChangeListRequest

type ChangeListRequest struct {
	Page          int        `url:"p,omitempty"`
	AttributeName ChangeType `url:"attributeName,omitempty"`
	AttributeID   string     `url:"attributeId,omitempty"`
	Since         string     `url:"since,omitempty"`
}

ChangeListRequest contains parameters for obtaining a list of BreweryDB changes.

type ChangeService

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

ChangeService provides access to the BreweryDB Change API. Use Client.Change.

See: http://www.brewerydb.com/developers/docs-endpoint/change_index

func (*ChangeService) List

func (cs *ChangeService) List(q *ChangeListRequest) (cl ChangeList, err error)

List retrieves (by default) a paginated list of all Changes to BreweryDB in the last 30 days.

See: http://www.brewerydb.com/developers/docs-endpoint/change_index#1

type ChangeType

type ChangeType string

ChangeType represents a type of attribute changed in BreweryDB.

type Characteristic

type Characteristic struct {
	ID          int
	Name        string
	Description string
	CreateDate  string
	UpdateDate  string
}

Characteristic represents a descriptive characteristic of a Fermentable.

type Client

type Client struct {
	NumRequests int
	JSONWriter  io.Writer
	Adjunct     *AdjunctService
	Beer        *BeerService
	Brewery     *BreweryService
	Category    *CategoryService
	Change      *ChangeService
	ConvertID   *ConvertIDService
	Event       *EventService
	Feature     *FeatureService
	Fermentable *FermentableService
	Fluidsize   *FluidsizeService
	Glass       *GlassService
	Guild       *GuildService
	Heartbeat   *HeartbeatService
	Hop         *HopService
	Ingredient  *IngredientService
	Location    *LocationService
	Menu        *MenuService
	Search      *SearchService
	SocialSite  *SocialSiteService
	Style       *StyleService
	Yeast       *YeastService
	// contains filtered or unexported fields
}

Client serves as the interface to the BreweryDB API.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new BreweryDB Client using the given API key.

func (*Client) Do

func (c *Client) Do(req *http.Request, data interface{}) error

Do performs the given http.Request and optionally decodes the JSON response into the given data struct.

func (*Client) NewRequest

func (c *Client) NewRequest(method string, endpoint string, data interface{}) (req *http.Request, err error)

NewRequest creates a new http.Request with the given method, BreweryDB endpoint, and optionally a struct to be URL-encoded in the request.

type ConvertIDService

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

ConvertIDService provides access to the BreweryDB ID Conversion API. Use Client.ConvertID.

See: http://www.brewerydb.com/developers/docs-endpoint/convertid_index

func (*ConvertIDService) ConvertIDs

func (cs *ConvertIDService) ConvertIDs(t ConvertType, oldIDs ...int) (map[int]string, error)

ConvertIDs converts a series of "old" Beer or Brewery IDs to the "new" format (BreweryDB v1 to v2)

See: http://www.brewerydb.com/developers/docs-endpoint/convertid_index#1

type ConvertType

type ConvertType string

ConvertType is the type of ID to convert.

const (
	ConvertBrewery ConvertType = "brewery" // ConvertBrewery converts Brewery IDs.
	ConvertBeer                = "beer"    // ConvertBeer converts Beer IDs.
)

Types of things that have IDs that can be converted.

type Country

type Country struct {
	ISOCode     string
	Name        string
	DisplayName string
	ISOThree    string
	NumberCode  int
	URLTitle    string
	CreateDate  string
}

Country represents a country found on Earth.

type Event

type Event struct {
	ID              string    `url:"-"`
	Name            string    `url:"name"`
	Type            EventType `url:"type"`
	StartDate       string    `url:"startDate"` // YYYY-MM-DD
	EndDate         string    `url:"endDate"`   // YYYY-MM-DD
	Description     string    `url:"description,omitempty"`
	Year            string    `url:"year,omitempty"`
	Time            string    `url:"time,omitempty"`
	Price           string    `url:"price,omitempty"`
	VenueName       string    `url:"venueName,omitempty"`
	StreetAddress   string    `url:"streetAddress,omitempty"`
	ExtendedAddress string    `url:"extendedAddress,omitempty"`
	Locality        string    `url:"locality,omitempty"`
	Region          string    `url:"region,omitempty"`
	PostalCode      string    `url:"postalCode,omitempty"`
	CountryISOCode  string    `url:"countryIsoCode"` // Required
	Phone           string    `url:"phone,omitempty"`
	Website         string    `url:"website,omitempty"`
	Longitude       float64   `url:"longitude,omitempty"`
	Latitude        float64   `url:"latitude,omitempty"`
	Image           string    `url:"image"` // base64. Only used for adding/updating Events.
	Images          Images    `url:"-"`
	Status          string    `url:"-"`
	StatusDisplay   string    `url:"-"`
	Country         Country   `url:"-"`
	CreateDate      string    `url:"-"`
	UpdateDate      string    `url:"-"`
}

Event represents a community event related to Beer/Breweries.

type EventBeersRequest

type EventBeersRequest struct {
	Page            int   `url:"p, omitempty"`
	OnlyWinners     YesNo `url:"onlyWinners,omitempty"`
	AwardCategoryID int   `url:"awardcategoryId,omitempty"`
	AwardPlaceID    int   `url:"awardplaceId,omitempty"`
}

EventBeersRequest contains parameters for specifying desired Beers for a given Event.

type EventBreweriesRequest

type EventBreweriesRequest struct {
	Page            int   `url:"p,omitempty"`
	OnlyWinners     YesNo `url:"onlyWinners,omitempty"`
	AwardCategoryID int   `url:"awardcategoryId,omitempty"`
	AwardPlaceID    int   `url:"awardplaceId,omitempty"`
}

EventBreweriesRequest contains parameters for specifying desired Breweries for a given Event.

type EventChangeBeerRequest

type EventChangeBeerRequest struct {
	IsPouring       YesNo `url:"isPouring,omitempty"`
	AwardCategoryID int   `url:"awardcategoryId,omitempty"`
	AwardPlaceID    int   `url:"awardplaceId,omitempty"`
}

EventChangeBeerRequest contains parameters for changing or adding a new Beer to an Event.

type EventChangeBreweryRequest

type EventChangeBreweryRequest struct {
	AwardCategoryID int `url:"awardcategoryId,omitempty"`
	AwardPlaceID    int `url:"awardplaceId,omitempty"`
}

EventChangeBreweryRequest contains parameters for changing or adding a new Brewery to an Event.

type EventList

type EventList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Events        []Event `json:"data"`
}

EventList represents a single "page" containing a slice of Events.

type EventListRequest

type EventListRequest struct {
	Page           int        `url:"p"`
	IDs            string     `url:"ids,omitempty"`
	Year           int        `url:"year,omitempty"`
	Name           string     `url:"name,omitempty"`
	Type           string     `url:"type,omitempty"`     // Key of the type of event, comma separated for multiple types
	Locality       string     `url:"locality,omitempty"` // e.g. US city
	Region         string     `url:"region,omitempty"`   // e.g. US state
	CountryISOCode string     `url:"countryIsoCode,omitempty"`
	Since          int        `url:"since,omitempty"` // Unix timestamp
	Status         string     `url:"status,omitempty"`
	HasImages      YesNo      `url:"hasImages,omitempty"`
	Order          EventOrder `url:"order,omitempty"`
	Sort           ListSort   `url:"sort,omitempty"`
}

EventListRequest contains options for specifying the kinds of Events desired. Non-Premium users must set one of the following: year, name, type, locality, region

type EventOrder

type EventOrder string

EventOrder specifies the ordering of an EventList.

type EventService

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

EventService provides access to the BreweryDB Event API. Use Client.Event.

func (*EventService) Add

func (es *EventService) Add(e *Event) (string, error)

Add adds an Event to the BreweryDB and returns its new ID. The following **must** be set in the Event:

- Name - Type - StartDate (YYYY-MM-DD) - EndDate (YYYY-MM-DD)

func (*EventService) AddAwardCategory

func (es *EventService) AddAwardCategory(eventID string, a *AwardCategory) error

AddAwardCategory adds a new AwardCategory to the given Event.

func (*EventService) AddAwardPlace

func (es *EventService) AddAwardPlace(eventID string, a *AwardPlace) error

AddAwardPlace adds a new AwardPlace to the given Event.

func (*EventService) AddBeer

func (es *EventService) AddBeer(eventID, beerID string, q *EventChangeBeerRequest) error

AddBeer adds the Beer with the given ID to the given Event.

func (*EventService) AddBrewery

func (es *EventService) AddBrewery(eventID, breweryID string, q *EventChangeBreweryRequest) error

AddBrewery adds the Brewery with the given ID to the given Event.

func (*EventService) AddSocialAccount

func (es *EventService) AddSocialAccount(eventID string, s *SocialAccount) error

AddSocialAccount adds a new SocialAccount to the given Event.

func (*EventService) Delete

func (es *EventService) Delete(eventID string) error

Delete removes the Event with the given eventID.

func (*EventService) DeleteAwardCategory

func (es *EventService) DeleteAwardCategory(eventID string, awardCategoryID int) error

DeleteAwardCategory removes an AwardCategory from the given Event.

func (*EventService) DeleteAwardPlace

func (es *EventService) DeleteAwardPlace(eventID string, awardPlaceID int) error

DeleteAwardPlace removes an AwardPlace from the given Event.

func (*EventService) DeleteBeer

func (es *EventService) DeleteBeer(eventID, beerID string) error

DeleteBeer removes the Beer with the given ID from the given Event.

func (*EventService) DeleteBrewery

func (es *EventService) DeleteBrewery(eventID, breweryID string) error

DeleteBrewery removes the Brewery with the given ID from the given Event.

func (*EventService) DeleteSocialAccount

func (es *EventService) DeleteSocialAccount(eventID string, socialAccountID int) error

DeleteSocialAccount removes a SocialAccount from the given Event.

func (*EventService) Get

func (es *EventService) Get(eventID string) (e Event, err error)

Get retrieves a single event with the given eventID.

func (*EventService) GetAwardCategory

func (es *EventService) GetAwardCategory(eventID string, awardCategoryID int) (a AwardCategory, err error)

GetAwardCategory retrieves the specified AwardCategory for the given Event.

func (*EventService) GetAwardPlace

func (es *EventService) GetAwardPlace(eventID string, awardPlaceID int) (a AwardPlace, err error)

GetAwardPlace retrieves the specified AwardPlace for the given Event.

func (*EventService) GetBeer

func (es *EventService) GetBeer(eventID, beerID string) (b Beer, err error)

GetBeer retrieves the Beer with the given ID for the given Event.

func (*EventService) GetBrewery

func (es *EventService) GetBrewery(eventID, breweryID string) (b Brewery, err error)

GetBrewery retrieves the Brewery with the given ID for the given Event.

func (*EventService) GetSocialAccount

func (es *EventService) GetSocialAccount(eventID string, socialAccountID int) (s SocialAccount, err error)

GetSocialAccount retrieves the SocialAccount with the given ID for the given Event.

func (*EventService) List

func (es *EventService) List(q *EventListRequest) (el EventList, err error)

List returns an EventList containing a "page" of Events. For non-premium members, one of Year, Name, Type, Locality or Region must be set.

func (*EventService) ListAwardCategories

func (es *EventService) ListAwardCategories(eventID string) (al []AwardCategory, err error)

ListAwardCategories returns a slice of all AwardCategories for the given Event.

func (*EventService) ListAwardPlaces

func (es *EventService) ListAwardPlaces(eventID string) (al []AwardPlace, err error)

ListAwardPlaces returns a slice of all AwardPlaces for the given Event.

func (*EventService) ListBeers

func (es *EventService) ListBeers(eventID string, q *EventBeersRequest) (bl BeerList, err error)

ListBeers returns a page of Beers for the given Event.

func (*EventService) ListBreweries

func (es *EventService) ListBreweries(eventID string, q *EventBreweriesRequest) (bl BreweryList, err error)

ListBreweries returns a page of Breweries for the given Event.

func (*EventService) ListSocialAccounts

func (es *EventService) ListSocialAccounts(eventID string) (sl []SocialAccount, err error)

ListSocialAccounts returns a slice of all social media accounts associated with the given Event.

func (*EventService) Update

func (es *EventService) Update(eventID string, e *Event) error

Update updates the Event with the given eventID to match the given Event.

func (*EventService) UpdateAwardCategory

func (es *EventService) UpdateAwardCategory(eventID string, a *AwardCategory) error

UpdateAwardCategory updates an AwardCategory for the given Event.

func (*EventService) UpdateAwardPlace

func (es *EventService) UpdateAwardPlace(eventID string, a *AwardPlace) error

UpdateAwardPlace updates an AwardPlace for the given Event.

func (*EventService) UpdateBeer

func (es *EventService) UpdateBeer(eventID, beerID string, q *EventChangeBeerRequest) error

UpdateBeer updates the Beer with the given ID for the given Event.

func (*EventService) UpdateBrewery

func (es *EventService) UpdateBrewery(eventID, breweryID string, q *EventChangeBreweryRequest) error

UpdateBrewery updates the Brewery with the given ID for the given Event.

func (*EventService) UpdateSocialAccount

func (es *EventService) UpdateSocialAccount(eventID string, s *SocialAccount) error

UpdateSocialAccount updates a SocialAccount for the given Event.

type EventType

type EventType string

EventType specifies the type of the Event.

type Feature

type Feature struct {
	ID        int
	Year      int
	Week      int
	BeerID    string
	Beer      Beer
	BreweryID string
	Brewery   Brewery
}

Feature represents a combined Featured Beer and Brewery. TODO: the Brewery in a Feature should ALSO contain its locations:

type FeatureList

type FeatureList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Features      []Feature `json:"data"`
}

FeatureList represents a single "page" containing a slice of Features.

type FeatureListRequest

type FeatureListRequest struct {
	Page         int    `url:"p"`
	Year         int    `url:"year,omitempty"`
	Week         int    `url:"week,omitempty"`
	IgnoreFuture string `url:"ignoreFuture,omitempty"` // Y or N
}

FeatureListRequest contains options for querying for a list of features.

type FeatureService

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

FeatureService provides access to the BreweryDB Feature API. Use Client.Feature.

See: http://www.brewerydb.com/developers/docs-endpoint/feature_index

func (*FeatureService) ByWeek

func (fs *FeatureService) ByWeek(year, week int) (f Feature, err error)

ByWeek returns the Featured Beer and Brewery for the given year and week number.

See: http://www.brewerydb.com/developers/docs-endpoint/feature_index#3

func (*FeatureService) Get

func (fs *FeatureService) Get() (f Feature, err error)

Get returns this week's Featured Beer and Brewery.

See: http://www.brewerydb.com/developers/docs-endpoint/feature_index#1

func (*FeatureService) List

func (fs *FeatureService) List(q *FeatureListRequest) (fl FeatureList, err error)

List returns all Featured Beers and Breweries.

See: http://www.brewerydb.com/developers/docs-endpoint/feature_index#2

type Fermentable

type Fermentable struct {
	ID                   int
	Name                 string
	Description          string
	CountryOfOrigin      string
	SrmID                int
	SrmPrecise           float64
	MoistureContent      float64
	CoarseFineDifference float64
	DiastaticPower       float64
	DryYield             float64
	Potential            float64
	Protein              float64
	SolubleNitrogenRatio float64
	MaxInBatch           float64
	RequiresMashing      YesNo
	Category             string // This will always be set to "malt"
	CategoryDisplay      string // This will always be set to "Malts, Grains, & Fermentables"
	CreateDate           string
	UpdateDate           string
	SRM                  SRM
	Country              struct {
		IsoCode     string
		Name        string
		DisplayName string
		IsoThree    string
		NumberCode  int
		CreateDate  string
	}
	Characteristics []Characteristic
}

Fermentable represents a Fermentable Beer ingredient.

type FermentableList

type FermentableList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Fermentables  []Fermentable `json:"data"`
}

FermentableList represents a "page" containing a slice of Fermentables.

type FermentableService

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

FermentableService provides access to the BreweryDB Fermentable API. Use Client.Fermentable.

See: http://www.brewerydb.com/developers/docs-endpoint/fermentable_index

func (*FermentableService) Get

func (fs *FermentableService) Get(id int) (f Fermentable, err error)

Get returns the Fermentable with the given Fermentable ID.

See: http://www.brewerydb.com/developers/docs-endpoint/fermentable_index#2

func (*FermentableService) List

func (fs *FermentableService) List(page int) (fl FermentableList, err error)

List returns a list of Fermentable Beer ingredients.

See: http://www.brewerydb.com/developers/docs-endpoint/fermentable_index#1

type Fluidsize

type Fluidsize struct {
	ID            int
	Volume        string
	VolumeDisplay string
	Quantity      string
	CreateDate    string
}

Fluidsize represents a Fluidsize assigned to a UPC code.

type FluidsizeService

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

FluidsizeService provides access to the BreweryDB Fluidsize API. Use Client.Fluidsize.

See: http://www.brewerydb.com/developers/docs-endpoint/fluidsize_index

func (*FluidsizeService) Get

func (fs *FluidsizeService) Get(id int) (f Fluidsize, err error)

Get returns the Fluidsize with the given Fluidsize ID.

See: http://www.brewerydb.com/developers/docs-endpoint/fluidsize_index#2

func (*FluidsizeService) List

func (fs *FluidsizeService) List() (fl []Fluidsize, err error)

List returns a list of Fluidsizes.

See: http://www.brewerydb.com/developers/docs-endpoint/fluidsize_index#1

type GeoPointRequest

type GeoPointRequest struct {
	Latitude           float64      `url:"lat"` // Required
	Longitude          float64      `url:"lng"` // Required
	Radius             float64      `url:"radius,omitempty"`
	Unit               GeoPointUnit `url:"unit,omitempty"` // Default: mi
	WithSocialAccounts YesNo        `url:"withSocialAccounts,omitempty"`
	WithGuilds         YesNo        `url:"withGuilds,omitempty"`
	WithAlternateNames YesNo        `url:"withAlternateNames,omitempty"`
}

GeoPointRequest contains options for specifying a geographic coordinate.

type GeoPointUnit

type GeoPointUnit string

GeoPointUnit differentiates between miles and kilometers.

const (
	Miles      GeoPointUnit = "mi"
	Kilometers GeoPointUnit = "km"
)

Units of measurement.

type Glass

type Glass struct {
	ID          int
	Name        string
	Description string
	CreateDate  string
	UpdateDate  string
}

Glass represents a Glass assigned to a UPC code.

type GlassService

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

GlassService provides access to the BreweryDB Glassware API. Use Client.Glass.

See: http://www.brewerydb.com/developers/docs-endpoint/glass_index

func (*GlassService) Get

func (gs *GlassService) Get(id int) (g Glass, err error)

Get returns the Glass with the given Glass ID.

See: http://www.brewerydb.com/developers/docs-endpoint/glass_index#2

func (*GlassService) List

func (gs *GlassService) List() (gl []Glass, err error)

List returns a list of Glasses.

See: http://www.brewerydb.com/developers/docs-endpoint/glass_index#1

type Guild

type Guild struct {
	ID          string `url:"-"`
	Name        string `url:"name"` // Required
	Description string `url:"description,omitempty"`
	Website     string `url:"website,omitempty"`
	Image       string `url:"image,omitempty"` // Base64. Only used for adding/updating Guilds.
	Images      Images `url:"-"`
	Established int    `url:"established,omitempty"`
	CreateDate  string `url:"-"`
	UpdateDate  string `url:"-"`
}

Guild represents a Beer or Brewing organization.

type GuildList

type GuildList struct {
	NumberOfPages int
	CurrentPage   int
	TotalResults  int
	Guilds        []Guild `json:"data"`
}

GuildList represents a single "page" containing a slice of Guilds.

type GuildListRequest

type GuildListRequest struct {
	Page        int        `url:"p,omitempty"`
	IDs         string     `url:"ids,omitempty"`
	Name        string     `url:"name,omitempty"`        // Required for non-premium users.
	Established int        `url:"established,omitempty"` // Year
	Since       int        `url:"since,omitempty"`
	Status      string     `url:"status,omitempty"`
	HasImages   YesNo      `url:"hasImages,omitempty"`
	Order       GuildOrder `url:"order,omitempty"`
	Sort        ListSort   `url:"sort,omitempty"`
}

GuildListRequest contains options for specifying kinds of Guilds desired.

type GuildOrder

type GuildOrder string

GuildOrder specifies ordering of a GuildList.

type GuildService

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

GuildService provides access to the BreweryDB Guild API. Use Client.Guild.

func (*GuildService) Add

func (gs *GuildService) Add(g *Guild) (string, error)

Add adds a Guild to the BreweryDB and returns its new ID. The Guild Name is required.

func (*GuildService) AddSocialAccount

func (gs *GuildService) AddSocialAccount(guildID string, s *SocialAccount) error

AddSocialAccount adds a new SocialAccount to the given Guild.

func (*GuildService) Delete

func (gs *GuildService) Delete(guildID string) error

Delete removes the Guild with the given guildID.

func (*GuildService) DeleteSocialAccount

func (gs *GuildService) DeleteSocialAccount(guildID string, socialAccountID int) error

DeleteSocialAccount removes a SocialAccount from the given Guild.

func (*GuildService) Get

func (gs *GuildService) Get(guildID string) (g Guild, err error)

Get retrieves a single Guild with the given guildID.

func (*GuildService) GetSocialAccount

func (gs *GuildService) GetSocialAccount(guildID string, socialAccountID int) (s SocialAccount, err error)

GetSocialAccount retrieves the SocialAccount with the given ID for the given Guild.

func (*GuildService) List

func (gs *GuildService) List(q *GuildListRequest) (gl GuildList, err error)

List returns an GuildList containing a "page" of Guilds. For non-premium members, Name must be set.

func (*GuildService) ListBreweries

func (gs *GuildService) ListBreweries(guildID string) (bl []Brewery, err error)

ListBreweries returns a slice of all Breweries that are members of the given Guild.

func (*GuildService) ListSocialAccounts

func (gs *GuildService) ListSocialAccounts(guildID string) (sl []SocialAccount, err error)

ListSocialAccounts returns a slice of all social media accounts associated with the given Guild.

func (*GuildService) Update

func (gs *GuildService) Update(guildID string, g *Guild) error

Update updates the Guild with the given guildID to match the given Guild.

func (*GuildService) UpdateSocialAccount

func (gs *GuildService) UpdateSocialAccount(guildID string, s *SocialAccount) error

UpdateSocialAccount updates a SocialAccount for the given Guild.

type HeartbeatResponse

type HeartbeatResponse struct {
	Status string
	Data   struct {
		Format        string
		RequestMethod string
		Key           string
		Timestamp     int
	}
	Message string
}

HeartbeatResponse represents a BreweryDB Heartbeat (essentially an "echo" of the Heartbeat request).

type HeartbeatService

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

HeartbeatService provides access to the BreweryDB Heartbeat API. Use Client.Heartbeat.

See: http://www.brewerydb.com/developers/docs-endpoint/heartbeat_index

func (*HeartbeatService) Heartbeat

func (hs *HeartbeatService) Heartbeat() error

Heartbeat checks whether the BreweryDB API is currently active. It returns nil if the API is available and an error otherwise.

See: http://www.brewerydb.com/developers/docs-endpoint/heartbeat_index#1

type Hop

type Hop struct {
	ID               int
	Name             string
	Description      string
	CountryOfOrigin  string
	AlphaAcidMin     float64
	AlphaAcidMax     float64
	BetaAcidMin      float64
	BetaAcidMax      float64
	HumuleneMin      float64
	HumuleneMax      float64
	CaryophylleneMin float64
	CaryophylleneMax float64
	CohumuloneMin    float64
	CohumuloneMax    float64
	MyrceneMin       float64
	MyrceneMax       float64
	FarneseneMin     float64
	FarneseneMax     float64
	IsNoble          YesNo
	ForBittering     YesNo
	ForFlavor        YesNo
	ForAroma         YesNo
	Category         string
	CategoryDisplay  string
	CreateDate       string
	UpdateDate       string
	Country          struct {
		IsoCode     string
		Name        string
		DisplayName string
		IsoThree    string
		NumberCode  int
		CreateDate  string
	}
}

Hop contains all relevant information for a single variety of Hop.

type HopList

type HopList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Hops          []Hop `json:"data"`
}

HopList represents a "page" containing a slice of Hops.

type HopService

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

HopService provides access to the BreweryDB Hop API. Use Client.Hop.

See: http://www.brewerydb.com/developers/docs-endpoint/hop_index

func (*HopService) Get

func (hs *HopService) Get(id int) (hop Hop, err error)

Get queries for a single Hop with the given Hop ID.

See: http://www.brewerydb.com/developers/docs-endpoint/hop_index#2

Example

Get a specific variety of hop with a given ID

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

h, err := c.Hop.Get(84)
if err != nil {
	panic(err)
}
fmt.Printf("%+v\n", h)
Output:

func (*HopService) List

func (hs *HopService) List(page int) (hl HopList, err error)

List returns all Hops on the given page.

See: http://www.brewerydb.com/developers/docs-endpoint/hop_index#1

Example

Get all types of hops

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

hl, err := c.Hop.List(1)
if err != nil {
	panic(err)
}
for _, h := range hl.Hops {
	fmt.Println(h.Name)
}
Output:

type Images

type Images struct {
	Icon   string `url:"-"`
	Medium string `url:"-"`
	Large  string `url:"-"`
}

Images is a collection of up to three differently-sized image URLs.

type Ingredient

type Ingredient struct {
	ID              int
	Name            string
	Category        string
	CategoryDisplay string
	CreateDate      string
	UpdateDate      string
}

Ingredient represents a single Beer Ingredient.

type IngredientList

type IngredientList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Ingredients   []Ingredient `json:"data"`
}

IngredientList represents a single "page" containing a slice of Ingredients.

type IngredientService

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

IngredientService provides access to the BreweryDB Ingredient API. Use Client.Ingredient.

See: http://www.brewerydb.com/developers/docs-endpoint/ingredient_index

func (*IngredientService) Get

func (is *IngredientService) Get(id int) (ing Ingredient, err error)

Get returns the Ingredient with the given Ingredient ID.

See: http://www.brewerydb.com/developers/docs-endpoint/ingredient_index#2

func (*IngredientService) List

func (is *IngredientService) List(page int) (il IngredientList, err error)

List returns all Ingredients on the given page.

See: http://www.brewerydb.com/developers/docs-endpoint/ingredient_index#1

type ListSort

type ListSort string

ListSort represents the sorting scheme for a list of values.

const (
	SortAscending  ListSort = "ASC"
	SortDescending          = "DESC"
)

List sorting options.

type Location

type Location struct {
	ID                       string       `url:"-"`
	Name                     string       `url:"name,omitempty"`
	StreetAddress            string       `url:"streetAddress,omitempty"`
	ExtendedAddress          string       `url:"extendedAddress,omitempty"`
	Locality                 string       `url:"locality,omitempty"`
	Region                   string       `url:"region,omitempty"`
	PostalCode               string       `url:"postalCode,omitempty"`
	Phone                    string       `url:"phone,omitempty"`
	Website                  string       `url:"website,omitempty"`
	HoursOfOperation         string       `url:"-"`
	HoursOfOperationExplicit []string     `url:"hoursOfOperationExplicit,omitempty"`
	HoursOfOperationNotes    string       `url:"hoursOfOperationNotes,omitempty"`
	TourInfo                 string       `url:"tourInfo,omitempty"`
	TimezoneID               string       `url:"timezoneId,omitempty"`
	Latitude                 float64      `url:"latitude,omitempty"`
	Longitude                float64      `url:"longitude,omitempty"`
	IsPrimary                YesNo        `url:"isPrimary,omitempty"`
	InPlanning               YesNo        `url:"inPlanning,omitempty"`
	IsClosed                 YesNo        `url:"isClosed,omitempty"`
	OpenToPublic             YesNo        `url:"openToPublic,omitempty"`
	LocationType             LocationType `url:"locationType,omitempty"`
	LocationTypeDisplay      string       `url:"-"`
	CountryISOCode           string       `url:"countryIsoCode"` // Required for UpdateLocation
	Country                  Country      `url:"-"`
	CreateDate               string       `url:"-"`
	UpdateDate               string       `url:"-"`
	YearOpened               string       `url:"-"`
	YearClosed               string       `url:"-"`
	BreweryID                string       `url:"-"`
	Brewery                  Brewery      `url:"-"`
}

Location represents a the location of a Brewery or similar institution.

type LocationList

type LocationList struct {
	NumberOfPages int
	CurrentPage   int
	TotalResults  int
	Locations     []Location `json:"data"`
}

LocationList represents a "page" containing a slice of Locations.

type LocationListRequest

type LocationListRequest struct {
	Page           int           `url:"p,omitempty"`
	IDs            string        `url:"ids,omitempty"`
	Locality       string        `url:"locality,omitempty"`
	Region         string        `url:"region,omitempty"`
	PostalCode     string        `url:"postalCode,omitempty"`
	IsPrimary      YesNo         `url:"isPrimary,omitempty"`
	InPlanning     YesNo         `url:"inPlanning,omitempty"`
	IsClosed       YesNo         `url:"isClosed,omitempty"`
	LocationType   LocationType  `url:"locationType,omitempty"`
	CountryISOCode string        `url:"countryIsoCode,omitempty"`
	Since          int           `url:"since,omitempty"`
	Status         string        `url:"status,omitempty"`
	Order          LocationOrder `url:"order,omitempty"`
	Sort           ListSort      `url:"sort,omitempty"`
}

LocationListRequest contains options for specifying Locations.

type LocationOrder

type LocationOrder string

LocationOrder specifies the ordering of a LocationList.

type LocationService

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

LocationService provides access to the BreweryDB Location API. Use Client.Location.

See: http://www.brewerydb.com/developers/docs-endpoint/location_index

func (*LocationService) Delete

func (ls *LocationService) Delete(locID string) error

Delete removes the Location with the given ID from the BreweryDB.

See: http://www.brewerydb.com/developers/docs-endpoint/location_index#4

func (*LocationService) Get

func (ls *LocationService) Get(locID string) (l Location, err error)

Get retrieves the Location with the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/location_index#2

func (*LocationService) List

func (ls *LocationService) List(q *LocationListRequest) (ll LocationList, err error)

List retrieves a list of Locations matching the given request. For non-premium users, one of Locality, PostalCode, Region must be set.

See: http://www.brewerydb.com/developers/docs-endpoint/location_index#1

Example

List all brewpubs in Boston

c := NewClient(os.Getenv("BREWERYDB_API_KEY"))

req := &LocationListRequest{
	Locality:     "Boston",
	Region:       "Massachusetts",
	LocationType: LocationBrewpub,
}

for l, err := c.Location.List(req); l.CurrentPage < l.NumberOfPages; req.Page++ {
	if err != nil {
		panic(err)
	}
	for _, loc := range l.Locations {
		fmt.Println(loc.Name)
	}
}
Output:

func (*LocationService) Update

func (ls *LocationService) Update(locID string, l *Location) error

Update updates the Location having the given ID to match the given Location. The CountryISOCode of the given Location *must* be set.

See: http://www.brewerydb.com/developers/docs-endpoint/location_index#3

type LocationType

type LocationType string

LocationType represents the specific type of the Location.

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

MenuService provides access to the BreweryDB Menu API. Use Client.Menu.

func (ms *MenuService) BeerAvailability() ([]Availability, error)

BeerAvailability provides a listing of all possible Availability states.

func (ms *MenuService) BeerTemperature() (map[BeerTemperature]string, error)

BeerTemperature provides a mapping of BeerTemperatures to their respective descriptions.

func (ms *MenuService) Categories() ([]Category, error)

Categories provides a listing of all Beer Categories.

func (ms *MenuService) Countries() ([]Country, error)

Countries provides a listing of all Countries on Earth.

func (ms *MenuService) EventTypes() (map[EventType]string, error)

EventTypes provides a mapping of EventTypes to their respective descriptions.

func (ms *MenuService) Fluidsize() ([]Fluidsize, error)

Fluidsize provides a listing of all fluidsizes.

func (ms *MenuService) FluidsizeVolume() (map[Volume]string, error)

FluidsizeVolume provides a mapping of Volumes to their respective descriptions.

func (ms *MenuService) Glassware() ([]Glass, error)

Glassware provides a listing of all Beer Glasses.

func (ms *MenuService) Ingredients() ([]Ingredient, error)

Ingredients provides a listing of all Ingredients.

func (ms *MenuService) LocationTypes() (map[LocationType]string, error)

LocationTypes provides a mapping of LocationTypes to their respective descriptions.

func (ms *MenuService) SRM() ([]SRM, error)

SRM provides a listing of all SRMs.

func (ms *MenuService) Styles() ([]Style, error)

Styles provides a listing of all Beer Styles.

type Page

type Page struct {
	P int `url:"p"`
}

Page is a convenience type for encoding only a page number when paginating lists.

type RandomBeerRequest

type RandomBeerRequest struct {
	ABV                string `url:"abv,omitempty"`
	IBU                string `url:"ibu,omitempty"`
	GlasswareID        int    `url:"glasswareId,omitempty"`
	SrmID              int    `url:"srmID,omitempty"`
	AvailableID        int    `url:"availableId,omitempty"`
	StyleID            int    `url:"styleId,omitempty"`
	IsOrganic          YesNo  `url:"isOrganic,omitempty"`
	Labels             YesNo  `url:"labels,omitempty"`
	Year               int    `url:"year,omitempty"`
	WithBreweries      YesNo  `url:"withBreweries,omitempty"`
	WithSocialAccounts YesNo  `url:"withSocialAccounts,omitempty"`
	WithIngredients    YesNo  `url:"withIngredients,omitempty"`
}

RandomBeerRequest contains options for retrieving a random Beer.

type RandomBreweryRequest

type RandomBreweryRequest struct {
	Established        string `url:"established"` // YYYY
	IsOrganic          YesNo  `url:"isOrganic"`
	WithSocialAccounts YesNo  `url:"withSocialAccounts"`
	WithGuilds         YesNo  `url:"withGuilds"`
	WithLocations      YesNo  `url:"withLocations"`
	WithAlternateNames YesNo  `url:"withAlternateNames"`
}

RandomBreweryRequest contains options for retrieving a random Brewery.

type SRM

type SRM struct {
	ID   int
	Hex  string
	Name string
}

SRM represents a Standard Reference Method.

type SearchRequest

type SearchRequest struct {
	Page               int
	WithBreweries      bool
	WithSocialAccounts bool
	WithGuilds         bool
	WithLocations      bool
	WithAlternateNames bool
	WithIngredients    bool
}

SearchRequest contains options for narrowing a Search.

type SearchService

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

SearchService provides access to the BreweryDB Search API. Use Client.Search.

func (*SearchService) Beer

func (ss *SearchService) Beer(query string, q *SearchRequest) (bl BeerList, err error)

Beer searches for Beers matching the given query.

func (*SearchService) Brewery

func (ss *SearchService) Brewery(query string, q *SearchRequest) (bl BreweryList, err error)

Brewery searches for Breweries matching the given query.

func (*SearchService) Event

func (ss *SearchService) Event(query string, q *SearchRequest) (el EventList, err error)

Event searches for Events matching the given query.

func (*SearchService) GeoPoint

func (ss *SearchService) GeoPoint(q *GeoPointRequest) ([]Location, error)

GeoPoint searches for Locations near the geographic coordinate specified in the GeoPointRequest. TODO: pagination??

func (*SearchService) Guild

func (ss *SearchService) Guild(query string, q *SearchRequest) (gl GuildList, err error)

Guild searches for Guilds matching the given query.

func (*SearchService) Style

func (ss *SearchService) Style(query string, withDescriptions bool) ([]Style, error)

Style retrieves one or more Styles matching the given query string. TODO: pagination??

func (*SearchService) UPC

func (ss *SearchService) UPC(code uint64) ([]Beer, error)

UPC retrieves one or more Beers matching the given Universal Product Code. TODO: pagination?? TODO: the API doc example shows "data" as being an array of arrays, see: http://www.brewerydb.com/developers/docs-endpoint/search_upc

type SocialAccount

type SocialAccount struct {
	ID            int        `url:"-"`
	SocialMediaID int        `url:"socialmediaId"`
	SocialSite    SocialSite `url:"-",json:"socialMedia"` // see TODO above
	Handle        string     `url:"handle"`
}

SocialAccount represents a social media account/handle. TODO: it appears some SocialAccount responses include the SocialSite ("socialMedia") object as well. TODO: SocialAccount responses also return an object corresponding to the query (e.g. Beer, Event, Guild, etc.)

type SocialSite

type SocialSite struct {
	ID         int
	Name       string
	Website    string
	CreateDate string
	UpdateDate string
}

SocialSite represents a social media website.

type SocialSiteService

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

SocialSiteService provides access to the BreweryDB Social Site API. Use Client.SocialSite.

See: http://www.brewerydb.com/developers/docs-endpoint/socialsite_index

func (*SocialSiteService) Get

func (ss *SocialSiteService) Get(id int) (s SocialSite, err error)

Get retrieves the SocialSite having the given ID.

See: http://www.brewerydb.com/developers/docs-endpoint/socialsite_index#2

func (*SocialSiteService) List

func (ss *SocialSiteService) List() (sl []SocialSite, err error)

List returns a slice of all SocialSites in the BreweryDB.

See: http://www.brewerydb.com/developers/docs-endpoint/socialsite_index#1

type Style

type Style struct {
	ID          int
	Name        string
	ShortName   string
	Description string
	CategoryID  int
	Category    Category
	IbuMin      string
	IbuMax      string
	SrmMin      string
	SrmMax      string
	OgMin       string
	OgMax       string
	FgMin       string
	FgMax       string
	AbvMin      string
	AbvMax      string
	CreateDate  string
	UpdateDate  string
}

Style represents a style of Beer.

type StyleList

type StyleList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Styles        []Style `json:"data"`
}

StyleList represents a single "page" containing a slice of Styles.

type StyleService

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

StyleService provides access to the BreweryDB Style API. Use Client.Style.

See: http://www.brewerydb.com/developers/docs-endpoint/style_index

func (*StyleService) Get

func (ss *StyleService) Get(id int) (s Style, err error)

Get obtains the Style with the given Style ID.

See: http://www.brewerydb.com/developers/docs-endpoint/style_index#2

func (*StyleService) List

func (ss *StyleService) List(page int) (sl StyleList, err error)

List returns all Styles on the given page.

See: http://www.brewerydb.com/developers/docs-endpoint/style_index#1

type Volume

type Volume string

Volume represents a fluidsize volume.

type Yeast

type Yeast struct {
	ID                  int
	Name                string
	Description         string
	Category            string // This will always be set to "yeast"
	CategoryDisplay     string // This will always be set to "Yeast"
	YeastType           YeastType
	AttenuationMin      float64
	AttenuationMax      float64
	FermentTempMin      float64
	FermentTempMax      float64
	AlcoholToleranceMin float64
	AlcoholToleranceMax float64
	ProductID           string
	Supplier            string
	YeastFormat         string
	CreateDate          string
	UpdateDate          string
}

Yeast represents a type of yeast used in making a Beer.

type YeastList

type YeastList struct {
	CurrentPage   int
	NumberOfPages int
	TotalResults  int
	Yeasts        []Yeast `json:"data"`
}

YeastList represents a single "page" containing a slice of Yeasts.

type YeastService

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

YeastService provides access to the BreweryDB Yeast API. Use Client.Yeast.

See: http://www.brewerydb.com/developers/docs-endpoint/yeast_index

func (*YeastService) Get

func (ys *YeastService) Get(id int) (y Yeast, err error)

Get obtains the Yeast with the given Yeast ID.

See: http://www.brewerydb.com/developers/docs-endpoint/yeast_index#2

func (*YeastService) List

func (ys *YeastService) List(page int) (yl YeastList, err error)

List returns all Yeasts on the given page.

See: http://www.brewerydb.com/developers/docs-endpoint/yeast_index#1

type YeastType

type YeastType string

YeastType represents a specific type/usage of yeast.

type YesNo

type YesNo bool

YesNo is just a bool that is url-encoded into either "Y" or "S".

func (YesNo) EncodeValues

func (yn YesNo) EncodeValues(key string, v *url.Values) error

EncodeValues adds the value "Y" or "N" to the given url.Values for the given key if the YesNo value is true or false, respectively.

func (*YesNo) UnmarshalJSON

func (yn *YesNo) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the JSON value "Y" or "N" into a boolean true or false, respectively.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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