Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (48 sloc) 2.67 KB
{"exec-mode":"default","platform":"iOS","uti":"com.xamarin.workbook","packages":[{"id":"Newtonsoft.Json","version":"8.0.3"},{"id":"Microsoft.Net.Http","version":"2.2.29"},{"id":"BreweryDB","version":"1.1.5"},{"id":"Microsoft.Bcl","version":"1.1.10"}]}

BreweryDB .NET SDK

BreweryDB Logo

About the SDK

BreweryDB .NET is a simple to use .NET based API for calling into BreweryDB.

BreweryDB is your database of breweries, beers, beer events and guilds!

Learning Objectives

Discover the awesomeness of the BreweryDB REST API using a .NET SDK. In this workbook, you’ll learn the following:

  • Create a BreweryDB .NET Client

  • Query all beers

  • Search the DB

  • Query breweries

  • Download artwork asynchronously

Requirements


Setup

First, we'll start by adding the BreweryDB SDK to the workbook, then we’ll import several namespaces that we will need.

#r "BreweryDB"

using BreweryDB;
using BreweryDB.Helpers;
using BreweryDB.Models;

Creating a Client

We'll need to create an instance of the BreweryDBClient. The client is responsible for dealing with your API key as well as acting as an entry point for the availableendpoints.

private readonly BreweryDbClient client = new BreweryDbClient("b7da1c5827026053a276f0dbe2234962");

The client allows us to query the following enpoints:

Querying Beers

In our first example, lets go ahead and ask BreweryDB to return a beer by its ID. It’ll be returning data on one of my favourite beers (a Kasteel Donker).

var response = await client.Beers.Get("J4UYYJ");
var beer = response.Data;