1<?php 2/** 3 * This file is part of the Tmdb PHP API created by Michael Roterman. 4 * 5 * For the full copyright and license information, please view the LICENSE 6 * file that was distributed with this source code. 7 * 8 * @package Tmdb 9 * @author Michael Roterman <michael@wtfz.net> 10 * @copyright (c) 2013, Michael Roterman 11 * @version 0.0.1 12 */ 13namespace Tmdb\Repository; 14 15use Tmdb\Factory\ChangesFactory; 16use Tmdb\Model\Collection\People; 17use Tmdb\Model\Query\ChangesQuery; 18 19/** 20 * Class ChangesRepository 21 * @package Tmdb\Repository 22 * @see http://docs.themoviedb.apiary.io/#changes 23 */ 24class ChangesRepository extends AbstractRepository 25{ 26 /** 27 * Get a list of movie ids that have been edited. 28 * 29 * By default we show the last 24 hours and only 100 items per page. 30 * The maximum number of days that can be returned in a single request is 14. 31 * 32 * You can then use the movie changes API to get the actual data that has been changed. 33 * Please note that the change log system to support this was changed on October 5, 2012 34 * and will only show movies that have been edited since. 35 * 36 * @param ChangesQuery $query 37 * @param array $headers 38 * @return \Tmdb\Model\Common\GenericCollection 39 */ 40 public function getMovieChanges(ChangesQuery $query, array $headers = []) 41 { 42 $data = $this->getApi()->getMovieChanges($query->toArray(), $headers); 43 44 return $this->getFactory()->createResultCollection($data); 45 } 46 47 /** 48 * Get a list of people ids that have been edited. 49 * 50 * By default we show the last 24 hours and only 100 items per page. 51 * The maximum number of days that can be returned in a single request is 14. 52 * 53 * You can then use the person changes API to get the actual data that has been changed. 54 * Please note that the change log system to support this was changed on October 5, 2012 55 * and will only show people that have been edited since. 56 * 57 * @param ChangesQuery $query 58 * @param array $headers 59 * @return People 60 */ 61 public function getPeopleChanges(ChangesQuery $query, array $headers = []) 62 { 63 $data = $this->getApi()->getPersonChanges($query->toArray(), $headers); 64 65 return $this->getFactory()->createResultCollection($data); 66 } 67 68 /** 69 * Get a list of tv show ids that have been edited. 70 * 71 * By default we show the last 24 hours and only 100 items per page. 72 * The maximum number of days that can be returned in a single request is 14. 73 * 74 * You can then use the tv changes API to get the actual data that has been changed. 75 * 76 * Please note that the change log system to support this was changed 77 * on May 13, 2014 and will only show tv shows that have been edited since. 78 * 79 * @param ChangesQuery $query 80 * @param array $headers 81 * @return \Tmdb\Model\Common\GenericCollection 82 */ 83 public function getTvChanges(ChangesQuery $query, array $headers = []) 84 { 85 $data = $this->getApi()->getTvChanges($query->toArray(), $headers); 86 87 return $this->getFactory()->createResultCollection($data); 88 } 89 90 /** 91 * Return the related API class 92 * 93 * @return \Tmdb\Api\Changes 94 */ 95 public function getApi() 96 { 97 return $this->getClient()->getChangesApi(); 98 } 99 100 /** 101 * Changes does not support a generic factory 102 * 103 * @return ChangesFactory 104 */ 105 public function getFactory() 106 { 107 return new ChangesFactory($this->getClient()->getHttpClient()); 108 } 109} 110