<?php

// Do initial application-wide set up
require_once 'bootstrap.php';
// sanity check output to screen
echo "NYT API Demo<br>";
// include the class which does the work
require_once 'nyt-api.php';
// define API key
$api_key = $config['books_API_key'];
// choose which list to display
$list_name = 'names';
// returns the names of Times best-seller lists.
#$list_name = 'overview'; // returns overview of week's best-seller lists.
#$list_name = 'hardcover-fiction'; // returns Hardcover Fiction list.
// instantiate class with api key
$nyt_api = new NYT_API($api_key);
// get JSON data
$json = $nyt_api->get_list($list_name);
// parse JSON into PHP array
$array = json_decode($json, true);
echo "Results from API request for: {$list_name}<br>";
// Output PHP array data in human readable format
echo "<pre>" . print_r($array, true) . "</pre>";
// all done
echo "The End!";
 *
 * @category NYT_API
 * @author Mark Noble <*****@*****.**>
 * Date: 3/28/2016
 * Time: 12:07 PM
 */
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
// Do initial application-wide set up
require_once 'bootstrap.php';
global $config;
require_once 'nyt-api.php';
$api_key = $config['books_API_key'];
// instantiate class with api key
$nyt_api = new NYT_API($api_key);
//Get the raw response from the API with a list of all the names
$availableListsRaw = $nyt_api->get_list('names');
//Convert into an object that can be processed
$availableLists = json_decode($availableListsRaw);
//If the user has selected a specific list, check Pika to see if a list exists already
$isListSelected = isset($_GET['selectedList']);
$selectedList = null;
if ($isListSelected) {
    $selectedList = $_GET['selectedList'];
    //Check Pika to see if the list has been created
    //  currently we have 2 options:
    //  1) Get a list of all public lists (for all people)
    //  2) Get a list of lists for a particular account
    $pikaUsername = $config['pika_username'];
    $pikaPassword = $config['pika_password'];