Skip to content

Commit

Permalink
Implementing account related Lists methods
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Feb 25, 2014
1 parent 5e0541d commit dbfbe85
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 8 deletions.
24 changes: 24 additions & 0 deletions examples/lists/api/add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once('../../../vendor/autoload.php');
require_once('../../../apikey.php');

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN);
$client->setSessionToken($sessionToken);

$add = $client->getListsApi()->addMediaToList(TMDB_LIST_ID, 49047);

var_dump($add);
24 changes: 24 additions & 0 deletions examples/lists/api/item_status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once('../../../vendor/autoload.php');
require_once('../../../apikey.php');

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN);
$client->setSessionToken($sessionToken);

$remove = $client->getListsApi()->getItemStatus(TMDB_LIST_ID, 49047);

var_dump($remove);
24 changes: 24 additions & 0 deletions examples/lists/api/list_create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once('../../../vendor/autoload.php');
require_once('../../../apikey.php');

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN);
$client->setSessionToken($sessionToken);

$create = $client->getListsApi()->createList('test', 'test description');

var_dump($create);
24 changes: 24 additions & 0 deletions examples/lists/api/list_delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once('../../../vendor/autoload.php');
require_once('../../../apikey.php');

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN);
$client->setSessionToken($sessionToken);

$create = $client->getListsApi()->deleteList(TMDB_LIST_ID);

var_dump($create);
24 changes: 24 additions & 0 deletions examples/lists/api/remove.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* This file is part of the Tmdb PHP API created by Michael Roterman.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Tmdb
* @author Michael Roterman <[email protected]>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
require_once('../../../vendor/autoload.php');
require_once('../../../apikey.php');

$token = new \Tmdb\ApiToken(TMDB_API_KEY);
$client = new \Tmdb\Client($token);

$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN);
$client->setSessionToken($sessionToken);

$remove = $client->getListsApi()->removeMediaFromList(TMDB_LIST_ID, 49047);

var_dump($remove);
19 changes: 11 additions & 8 deletions lib/Tmdb/Api/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*/
namespace Tmdb\Api;

use Tmdb\Exception\NotImplementedException;

class Lists
extends AbstractApi
{
Expand Down Expand Up @@ -47,20 +45,25 @@ public function createList($name, $description, array $parameters = array(), arr
/**
* Check to see if a movie ID is already added to a list.
*
* @param $list_id
* @param string $id
* @param int $movieId
* @param array $parameters
* @param array $headers
* @return mixed
*/
public function getItemStatus($list_id, array $parameters = array(), array $headers = array())
public function getItemStatus($id, $movieId, array $parameters = array(), array $headers = array())
{
return $this->get('list/' . $list_id . '/item_status', $parameters, $headers);
return $this->get(
'list/' . $id . '/item_status',
array_merge($parameters, array('movie_id' => $movieId)),
$headers
);
}

/**
* Get the cast information for a specific list id.
*
* @param integer $id
* @param string $id
* @param string $mediaId
* @return mixed
*/
Expand All @@ -72,7 +75,7 @@ public function addMediaToList($id, $mediaId)
/**
* Get the images (posters and backdrops) for a specific list id.
*
* @param integer $id
* @param string $id
* @param string $mediaId
* @return mixed
*/
Expand All @@ -84,7 +87,7 @@ public function removeMediaFromList($id, $mediaId)
/**
* Get the plot keywords for a specific list id.
*
* @param integer $id
* @param string $id
* @return mixed
*/
public function deleteList($id)
Expand Down

0 comments on commit dbfbe85

Please sign in to comment.