Move Api\Mastodon\Instance\Extended to ExtendedDescription

- Add reference to Mastodon documentation
pull/13918/head
Hypolite Petovan 2024-02-18 18:47:59 -05:00
parent 7d5d3b3c29
commit d1cd9a016e
2 changed files with 8 additions and 9 deletions

View File

@ -25,23 +25,22 @@ use DateTime;
use Friendica\App; use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Database\Database;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Module\Api\ApiResponse; use Friendica\Module\Api\ApiResponse;
use Friendica\Module\BaseApi; use Friendica\Module\BaseApi;
use Friendica\Object\Api\Mastodon\ExtendedDescription; use Friendica\Network\HTTPException;
use Friendica\Object\Api\Mastodon;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Undocumented API endpoint that is implemented by both Mastodon and Pleroma * @see https://docs.joinmastodon.org/methods/instance/#extended_description
*/ */
class Extended extends BaseApi class ExtendedDescription extends BaseApi
{ {
/** @var IManageConfigValues */ private IManageConfigValues $config;
private $config;
public function __construct(\Friendica\Factory\Api\Mastodon\Error $errorFactory, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, Database $database, IManageConfigValues $config, array $server, array $parameters = []) public function __construct(\Friendica\Factory\Api\Mastodon\Error $errorFactory, App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, IManageConfigValues $config, array $server, array $parameters = [])
{ {
parent::__construct($errorFactory, $app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($errorFactory, $app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
@ -55,6 +54,6 @@ class Extended extends BaseApi
{ {
$account = User::getSystemAccount(); $account = User::getSystemAccount();
$this->jsonExit(new ExtendedDescription(new DateTime($account['updated']), $this->config->get('config', 'info'))); $this->jsonExit(new Mastodon\ExtendedDescription(new DateTime($account['updated']), $this->config->get('config', 'info')));
} }
} }

View File

@ -254,7 +254,7 @@ return [
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/instance/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/extended_description' => [Module\Api\Mastodon\Instance\Extended::class, [R::GET ]], '/instance/extended_description' => [Module\Api\Mastodon\Instance\ExtendedDescription::class, [R::GET ]],
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]], '/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
'/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], '/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]],
'/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]], '/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]],