From 4fdc1ae13ab4e584fd77846aea520ce9a8f01c90 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 8 May 2021 05:55:06 +0000 Subject: [PATCH] "/statuses/id" is now supported --- src/Module/Api/Mastodon/Statuses.php | 45 ++++++++++++++++++++++++++++ static/routes.config.php | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/Module/Api/Mastodon/Statuses.php diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php new file mode 100644 index 0000000000..ee64329bcc --- /dev/null +++ b/src/Module/Api/Mastodon/Statuses.php @@ -0,0 +1,45 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon; + +use Friendica\Core\System; +use Friendica\DI; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/statuses/ + */ +class Statuses extends BaseApi +{ + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + if (empty($parameters['id'])) { + DI::mstdnError()->RecordNotFound(); + } + + System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], self::getCurrentUserID())); + } +} diff --git a/static/routes.config.php b/static/routes.config.php index e07befe027..40c17912b4 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -126,7 +126,7 @@ return [ '/scheduled_statuses' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::PUT, R::DELETE]], '/statuses' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], - '/statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::DELETE]], + '/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::DELETE]], '/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/statuses/{id:\d+}/favourited_by' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]],