* @link http://status.net/
* @see ApiBareAuthAction
*/
-
class ApiListsAction extends ApiBareAuthAction
{
var $lists = null;
*
* @return boolean success flag
*/
-
function prepare($args)
{
parent::prepare($args);
$this->user = $this->getTargetUser($this->arg('user'));
if (empty($this->user)) {
+ // TRANS: Client error displayed trying to perform an action related to a non-existing user.
$this->clientError(_('No such user.'), 404, $this->format);
return false;
}
* require authentication if it is a write action or user is ambiguous
*
*/
-
function requiresAuth()
{
return parent::requiresAuth() ||
* Show the lists the user has created if the request method is GET
* Create a new list by diferring to handlePost() if it is POST.
*/
-
function handle($args)
{
parent::handle($args);
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'),
404,
$this->format
*
* @return boolean success
*/
-
function handlePost()
{
$name=$this->arg('name');
if(empty($name)) {
// mimick twitter
- print _("A list's name can't be blank.");
+ // TRANS: Client error displayed when trying to create a list without a name.
+ print _("A list must have a name.");
exit(1);
}
break;
default:
$this->clientError(
+ // TRANS: Client error displayed when coming across a non-supported API method.
_('API method not found.'),
404,
$this->format
/**
* Get lists
*/
-
function getLists()
{
$cursor = (int) $this->arg('cursor', -1);
*
* @return string etag
*/
-
function etag()
{
if (!$this->create && !empty($this->lists) && (count($this->lists) > 0)) {
return null;
}
-
}