Source for file Stories.php
Documentation is available at Stories.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* Stories endpoint driver
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @author Joe Stump <joe@joestump.net>
* @copyright 1997-2007 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @link http://pear.php.net/package/Services_Digg
* @author Joe Stump <joe@joestump.net>
* @param string $function API endpiont to call
* @throws Services_Digg_Exception
public function __call($function, array $args)
$endPoint = '/stories/' . $function;
if (isset ($args[0 ]) && is_array ($args[0 ])) {
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getAll(array $params = array ())
* Get a single story by ID
* @param int $id ID of story
* @param array $params API parameters
* @throws Services_Digg_Exception
$result = $this->sendRequest('/story/' . $id, $params);
return $result->stories [0 ];
* Get a single story by title
* @param string $title Clean title of story
* @param array $params API parameters
* @throws Services_Digg_Exception
$result = $this->sendRequest('/story/' . $title, $params);
return $result->stories [0 ];
* Get a list of stories by their ID's
* @param array $stories An array of story ID's
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getStoriesById(array $stories, array $params = array ())
$endPoint = '/stories/' . implode(',', $stories);
* Get a list of stories' comments
* @param array $stories An array of story ID's
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/' . implode(',', $stories) . '/comments';
* Get a list of stories' diggs
* @param array $stories An array of story ID's
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/' . implode(',', $stories) . '/diggs';
* Get stories by container
* @param string $container Name of container (ie. Sports)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getContainer($container, array $params = array ())
$endPoint = '/stories/container/' . $container;
* Get top stories by container
* @param string $container Name of container (ie. Sports)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/container/' . $container . '/top';
* Get hot stories by container
* @param string $container Name of container (ie. Sports)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/container/' . $container . '/hot';
* Get popular stories in a specific container
* @param string $container Name of container (ie. Sports)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/container/' . $container . '/popular';
* Get upcoming stories in a specific container
* @param string $container Name of container (ie. Sports)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/container/' . $container . '/upcoming';
* Get stories in a specific topic
* @param string $topic Name of topic (ie. Apple)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getTopic($topic, array $params = array ())
$endPoint = '/stories/topic/' . $topic;
* Get top stories by topic
* @param string $topic Name of topic (ie. Apple)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getTopicTop($topic, array $params = array ())
$endPoint = '/stories/topic/' . $topic . '/top';
* Get hot stories by topic
* @param string $topic Name of topic (ie. Apple)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
public function getTopicHot($container, array $params = array ())
$endPoint = '/stories/topic/' . $container . '/hot';
* Get popular stories in a specific topic
* @param string $topic Name of topic (ie. Apple)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/topic/' . $topic . '/popular';
* Get upcoming stories in a specific topic
* @param string $topic Name of topic (ie. Apple)
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
$endPoint = '/stories/topic/' . $topic . '/upcoming';
* Get popular stories' comments
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
return $this->sendRequest('/stories/popular/comments', $params);
* Get all comments on upcoming stories
* @param array $params API arguments
* @throws Services_Digg_Exception
return $this->sendRequest('/stories/upcoming/comments', $params);
* Get popular stories' diggs
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
return $this->sendRequest('/stories/popular/diggs', $params);
* Get upcoming stories' diggs
* @param array $params Digg API arguments
* @throws Services_Digg_Exception
return $this->sendRequest('/stories/upcoming/diggs', $params);
Documentation generated on Tue, 04 Dec 2007 15:00:12 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|