dev-master
9999999-devAn API client for the Old Chicago World Beer Tour service
BSD-3-Clause
The Development Requires
Wallogit.com
2017 © Pedro Peláez
An API client for the Old Chicago World Beer Tour service
Allows interaction with the World Beer Tour Service hosted at ocwbt.com, (*1)
Installation is handled using Composer:, (*2)
"require": {
"dydro/wbt_client": "dev-master"
}
Simply provide a Client with with your keys, then ask for the data you want:, (*3)
$client = new Client($apiKey, $secretKey); $client->getBeer($beerId); // get a single beer $client->getBeers(); // get a list of beers $client->getLocation($locationId); // get a single location $client->getLocationBeers($locationId); // get a list of beers at a specific location $client->getLocations(); // get a list of locations $client->getLocationsBeers(); // get a list of beers for all locations $client->getMiniTour($miniTourId); // get a single minitour $client->getMiniTours(); // get a list of minitours $client->getUser($userId); // get a single user $client->getUserBeer($userId, $userBeerId); // get a single user beer $client->getUserBeers($userId); // get a list of user beers $client->getUserTours($userId); // get a list of user tours
Responses from list endpoints are wrapped in a ListResponse object, which allows you to iterate through pages:, (*4)
$cfg = new ListConfig();
$cfg->setPage(1);
do {
$response = $client->getBeers($cfg);
$beers = $response->getItems();
// work with each beer here
$cfg->setPage($response->getPage() + 1);
} while ($response->morePages());
An API client for the Old Chicago World Beer Tour service
BSD-3-Clause