*
 * Please fill in the correct value of your Content API instance.
 */
define('API_HOST', '');
define('API_PORT', 80);
define('API_PROTOCOL', null);
define('API_CLIENT_ID', '');
define('API_USERNAME', '');
define('API_PASSWORD', '');
/**
 * End of configuration
 */
$parameters = new RequestParameters();
$parameters->setStartDate(date('Y-m-d', strtotime('-1 year')))->setPage(1)->setMaxResults(1);
$genericClient = new CurlClient();
$authentication = new OAuthPasswordAuthentication($genericClient);
$authentication->setClientId(API_CLIENT_ID)->setUsername(API_USERNAME)->setPassword(API_PASSWORD);
$apiClient = new DefaultApiClient($genericClient, $authentication);
$contentApi = new ContentApiSdk($apiClient, API_HOST, API_PORT, API_PROTOCOL);
echo ".:  Getting items  :.\n\n";
$items = $contentApi->getItems($parameters);
$items->setMaxPerPage($parameters->getMaxResults());
$items->setCurrentPage($parameters->getPage());
echo "Total items: {$items->getNbResults()}\n";
echo "Items per page: {$items->getMaxPerPage()}\n";
echo "Total pages: {$items->getNbPages()}\n\n";
// Some limit, so we dont accicentally get every item
$maxPages = $items->getNbPages() < 10 ? $items->getNbPages() : 10;
if ($items->haveToPaginate()) {
    for ($i = 1; $i <= $maxPages; $i++) {
        echo "Current page: {$items->getCurrentPage()}\n";
 /**
  * Get an instance of the HTTP client. The returned class should implement
  * the \Superdesk\ContentApiSdk\Client\ApiClientInterface interface.
  *
  * @return GuzzleApiClient
  */
 private function getClient()
 {
     $authentication = new OAuthPasswordAuthentication(new GuzzleClient());
     $authentication->setClientId($this->container->getParameter('swp_bridge.auth.client_id'))->setUsername($this->container->getParameter('swp_bridge.auth.username'))->setPassword($this->container->getParameter('swp_bridge.auth.password'));
     $apiClient = new GuzzleApiClient(new GuzzleClient(), $authentication);
     $apiClient->setOptions($this->container->getParameter('swp_bridge.options'));
     return $apiClient;
 }