Skip to content

Commit

Permalink
Added most of the API functionality, except for anything that requrie…
Browse files Browse the repository at this point in the history
…s sessions, such as the accounts and lists etc.
  • Loading branch information
wtfzdotnet committed Nov 1, 2013
1 parent 0d4e0d7 commit 14a13d3
Show file tree
Hide file tree
Showing 16 changed files with 1,064 additions and 1 deletion.
109 changes: 109 additions & 0 deletions lib/Tmdb/Api/Account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

use Tmdb\Exception\NotImplementedException;

class Account
extends AbstractApi
{
/**
* Get the basic information for an account. You will need to have a valid session id.
*
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getAccount(array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Get the lists that you have created and marked as a favorite.
*
* @param $account_id
* @param $options array
* @throws NotImplementedException
* @return mixed
*/
public function getLists($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Get the list of favorite movies for an account.
*
* @param $account_id
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getFavoriteMovies($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Add or remove a movie to an accounts favorite list.
*
* @param $account_id
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function favorite($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Get the list of rated movies (and associated rating) for an account.
*
* @param $account_id
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getRatedMovies($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Get the list of movies on an accounts watchlist.
*
* @param $account_id
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getMovieWatchlist($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* Add or remove a movie to an accounts watch list.
*
* @param $account_id
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function watchlist($account_id, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}
}
69 changes: 69 additions & 0 deletions lib/Tmdb/Api/Authentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

use Tmdb\Exception\NotImplementedException;

class Authentication
extends AbstractApi
{
/**
* This method is used to generate a valid request token for user based authentication.
* A request token is required in order to request a session id.
*
* You can generate any number of request tokens but they will expire after 60 minutes.
* As soon as a valid session id has been created the token will be destroyed.
*
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getNewToken(array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* This method is used to generate a session id for user based authentication.
* A session id is required in order to use any of the write methods.
*
* @param $request_token
* @param $options array
* @throws NotImplementedException
* @return mixed
*/
public function getNewSession($request_token, array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}

/**
* This method is used to generate a guest session id.
*
* A guest session can be used to rate movies without having a registered TMDb user account.
* You should only generate a single guest session per user (or device)
* as you will be able to attach the ratings to a TMDb user account in the future.
*
* There is also IP limits in place so you should always make sure it's the end user doing the guest session actions.
*
* If a guest session is not used for the first time within 24 hours, it will be automatically discarded.
*
* @param array $options
* @throws NotImplementedException
* @return mixed
*/
public function getNewGuestSession(array $options = array())
{
throw new NotImplementedException(__METHOD__ . ' has not been implemented yet.');
}
}
55 changes: 55 additions & 0 deletions lib/Tmdb/Api/Changes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

class Changes
extends AbstractApi
{
/**
* Get a list of movie ids that have been edited.
*
* By default we show the last 24 hours and only 100 items per page.
* The maximum number of days that can be returned in a single request is 14.
*
* You can then use the movie changes API to get the actual data that has been changed.
*
* Please note that the change log system to support this was changed
* on October 5, 2012 and will only show movies that have been edited since.
*
* @param array $options
* @return mixed
*/
public function getMovieChanges(array $options = array())
{
return $this->get('movie/changes/', $options);
}

/**
* Get a list of people ids that have been edited.
*
* By default we show the last 24 hours and only 100 items per page.
* The maximum number of days that can be returned in a single request is 14.
*
* You can then use the movie changes API to get the actual data that has been changed.
*
* Please note that the change log system to support this was changed
* on October 5, 2012 and will only show movies that have been edited since.
*
* @param array $options
* @return mixed
*/
public function getPeopleChanges(array $options = array())
{
return $this->get('person/changes/', $options);
}
}
47 changes: 47 additions & 0 deletions lib/Tmdb/Api/Collections.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

class Collections
extends AbstractApi
{
/**
* Get the basic collection information for a specific collection id.
*
* You can get the ID needed for this method by making a /movie/{id} request
* and paying attention to the belongs_to_collection hash.
*
* Movie parts are not sorted in any particular order.
* If you would like to sort them yourself you can use the provided release_date.
*
* @param $collection_id
* @param array $options
* @return mixed
*/
public function getCollection($collection_id, array $options = array())
{
return $this->get('collection/' . $collection_id, $options);
}

/**
* Get all of the images for a particular collection by collection id.
*
* @param $collection_id
* @param array $options
* @return mixed
*/
public function getImages($collection_id, array $options = array())
{
return $this->get('collection/' . $collection_id . '/images', $options);
}
}
41 changes: 41 additions & 0 deletions lib/Tmdb/Api/Companies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

class Companies
extends AbstractApi
{
/**
* This method is used to retrieve all of the basic information about a company.
*
* @param $company_id
* @param array $options
* @return mixed
*/
public function getCompany($company_id, array $options = array())
{
return $this->get('company/' . $company_id, $options);
}

/**
* Get the list of movies associated with a particular company.
*
* @param $company_id
* @param array $options
* @return mixed
*/
public function getMovies($company_id, array $options = array())
{
return $this->get('company/' . $company_id . '/movies', $options);
}
}
41 changes: 41 additions & 0 deletions lib/Tmdb/Api/Configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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 <michael@wtfz.net>
* @copyright (c) 2013, Michael Roterman
* @version 0.0.1
*/
namespace Tmdb\Api;

class Configuration
extends AbstractApi
{
/**
* Get the system wide configuration information.
*
* Some elements of the API require some knowledge of this configuration data.
*
* The purpose of this is to try and keep the actual API responses as light as possible.
* It is recommended you store this data within your application and check for updates every so often.
*
* This method currently holds the data relevant to building image URLs as well as the change key map.
*
* To build an image URL, you will need 3 pieces of data.
* The base_url, size and file_path.
*
* Simply combine them all and you will have a fully qualified URL. Here’s an example URL:
*
* http://d3gtl9l2a4fn1j.cloudfront.net/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg
*
* @return mixed
*/
public function getConfiguration()
{
return $this->get('configuration');
}
}
Loading

0 comments on commit 14a13d3

Please sign in to comment.