mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:10:11 +00:00
API: Many item related endpoints added
This commit is contained in:
parent
84efabbfb6
commit
b34ee320b0
17 changed files with 712 additions and 32 deletions
|
@ -21,8 +21,11 @@
|
|||
|
||||
namespace Friendica\Module\Api\Mastodon;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Module\BaseApi;
|
||||
|
||||
/**
|
||||
|
@ -38,7 +41,23 @@ class Statuses extends BaseApi
|
|||
|
||||
public static function delete(array $parameters = [])
|
||||
{
|
||||
self::unsupported('delete');
|
||||
self::login();
|
||||
$uid = self::getCurrentUserID();
|
||||
|
||||
if (empty($parameters['id'])) {
|
||||
DI::mstdnError()->UnprocessableEntity();
|
||||
}
|
||||
|
||||
$item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $parameters['id'], 'uid' => $uid]);
|
||||
if (empty($item['id'])) {
|
||||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
||||
if (!Item::markForDeletionById($item['id'])) {
|
||||
DI::mstdnError()->RecordNotFound();
|
||||
}
|
||||
|
||||
System::jsonExit([]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue