error_reporting(E_ALL);
ini_set('display_errors', '1');
require __DIR__ . '/bootstrap.php';
use Exception\ProtectimusApiException;
define("USERNAME", "");
define("API_KEY", "");
define("API_URL", "");
try {
    $api = new ProtectimusApi(USERNAME, API_KEY, API_URL);
    echo "CREATING A RESOURCE<br/>";
    $response = $api->addResource("resource", 5);
    echo print_r($response, true) . "<br/>";
    $resourceId = $response->response->id;
    echo "ID OF THE CREATED RESOURCE =>>> " . $resourceId . "<br/>";
    echo "<br/>GETTING A RESOURCE BY ID<br/>";
    $response = $api->getResource($resourceId);
    echo print_r($response, true) . "<br/>";
    echo "RESOURCE =>>> " . print_r($response->response->resource, true) . "<br/>";
    echo "<br/>UPDATING A RESOURCE<br/>";
    $response = $api->editResource($resourceId, "resourceNew", 8);
    echo print_r($response, true) . "<br/>";
    echo "UPDATED RESOURCE =>>> " . print_r($response->response->resource, true) . "<br/>";
    echo "<br/>GETTING A LIST OF RESOURCES<br/>";
    // gets a list of resources descending (10 records starting from 'offset' parameter)
    $response = $api->getResources(0);
    echo print_r($response, true) . "<br/>";
    echo "RESOURCES =>>> " . print_r($response->response->resources, true) . "<br/>";
    echo "<br/>GETTING A QUANTITY OF RESOURCES<br/>";
    $response = $api->getResourcesQuantity();
    echo print_r($response, true) . "<br/>";
    $quantity = $response->response->quantity;