This is a wrapper around PunkAPI v2 by @samjbmason you can find more informations about those APIs at https://punkapi.com/
Have you ever wanted to search through Brewdog's expansive back catalogue of beer in a programmatic way? Maybe build a tool that pairs beer with food, or search beers with an abv of more than 4%? Well now your prayers have been answered!
The Punk API takes Brewdog's DIY Dog and turns it into a searchable, filterable API that's completely free and open source.
To run the example project, clone the repo, and run pod install
from the Example directory first.
let punkApi = PunkApi(configuration: .default)
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
punkApi.get(BeerRequest(id: 1), queue: .main) { beersResult in }
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
punkApi.get(BeersRequest(filter: [.abv(condition: .more, value: 3),
.beerName(value: "Punk")]),
queue: .main) { beersResult in }
Get a random beer request
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
Get a beer from given id
punkApi.get(BeerRequest(id: 1), queue: .main) { beersResult in }
Get beers that match the passed in options, if no options are passed in it will return all beers in ascending order of id
.
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
Options
Condition: Condition
Value: Float
Will return beers with an abv greater or lower than the passed in value.
Condition: Condition
Value: Float
Will return beers with an ibu greater or lower than the passed in value.
Condition: Condition
Value: Float
Will return beers with an ebc greater or lower than the passed in value.
Value: String
Will return beers matching the string passed in (we use fuzzy matching to find the names).
Value: String
Will return beers which match the name of the yeast of the string passed in (we use fuzzy matching to find the yeast names).
Condition: Condition
Value: Date
Will return beers brewed before or after the passed in date.
Value: String
Will return beers which match the name of the hops of the string passed in (we use fuzzy matching to find the hop names).
Value: String
Will return beers which match the name of the malt of the string passed in (we use fuzzy matching to find the hop names).
Value: String
Will return beers which match food pairings of the string passed in (we use fuzzy matching to find the foods).
Value: Array<Int>
Will return beers which match the given ids.
PunkAPI is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PunkAPI'
@Oni_zerone, [email protected]
PunkAPI is available under the MIT license. See the LICENSE file for more info.