API: New Mastodon endpoints added

This commit is contained in:
Michael 2022-04-21 19:58:56 +00:00
parent 45c4af3832
commit f34b7b91fa
3 changed files with 46 additions and 4 deletions

View file

@ -156,6 +156,9 @@ They refer to features or data that don't exist in Friendica yet.
- [`GET /api/v1/accounts/:id/featured_tags`](https://docs.joinmastodon.org/methods/accounts/) - [`GET /api/v1/accounts/:id/featured_tags`](https://docs.joinmastodon.org/methods/accounts/)
- [`POST /api/v1/accounts/:id/pin`](https://docs.joinmastodon.org/methods/accounts/) - [`POST /api/v1/accounts/:id/pin`](https://docs.joinmastodon.org/methods/accounts/)
- [`POST /api/v1/accounts/:id/unpin`](https://docs.joinmastodon.org/methods/accounts/) - [`POST /api/v1/accounts/:id/unpin`](https://docs.joinmastodon.org/methods/accounts/)
- [`POST /api/v1/accounts/:id/remove_from_followers`](https://github.com/mastodon/mastodon/pull/16864)
- [`GET /api/v1/accounts/familiar_followers`](https://github.com/mastodon/mastodon/pull/17700)
- [`GET /api/v1/accounts/lookup`](https://github.com/mastodon/mastodon/pull/15740)
- [`GET /api/v1/admin/accounts`](https://docs.joinmastodon.org/methods/admin/) - [`GET /api/v1/admin/accounts`](https://docs.joinmastodon.org/methods/admin/)
- [`GET /api/v1/admin/accounts/:id`](https://docs.joinmastodon.org/methods/admin/) - [`GET /api/v1/admin/accounts/:id`](https://docs.joinmastodon.org/methods/admin/)
- [`POST /api/v1/admin/accounts/:id/{action}`](https://docs.joinmastodon.org/methods/admin/) - [`POST /api/v1/admin/accounts/:id/{action}`](https://docs.joinmastodon.org/methods/admin/)
@ -168,6 +171,7 @@ They refer to features or data that don't exist in Friendica yet.
- [`GET /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/) - [`GET /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/)
- [`POST /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/) - [`POST /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/)
- [`DELETE /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/) - [`DELETE /api/v1/domain_blocks`](https://docs.joinmastodon.org/methods/accounts/domain_blocks/)
- [`DELETE /api/v1/emails/confirmations`](https://github.com/mastodon/mastodon/pull/15816)
- [`GET /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/) - [`GET /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
- [`POST /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/) - [`POST /api/v1/featured_tags`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
- [`DELETE /api/v1/featured_tags/:id`](https://docs.joinmastodon.org/methods/accounts/featured_tags/) - [`DELETE /api/v1/featured_tags/:id`](https://docs.joinmastodon.org/methods/accounts/featured_tags/)
@ -182,5 +186,10 @@ They refer to features or data that don't exist in Friendica yet.
- [`POST /api/v1/polls/:id/votes`](https://docs.joinmastodon.org/methods/statuses/polls/) - [`POST /api/v1/polls/:id/votes`](https://docs.joinmastodon.org/methods/statuses/polls/)
- [`POST /api/v1/reports`](https://docs.joinmastodon.org/methods/accounts/reports/) - [`POST /api/v1/reports`](https://docs.joinmastodon.org/methods/accounts/reports/)
- [`PUT /api/v1/scheduled_statuses/:id`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/) - [`PUT /api/v1/scheduled_statuses/:id`](https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/)
- [`GET /api/v1/statuses/{id:\d+}/history'](https://github.com/mastodon/mastodon/pull/16697)
- [`GET /api/v1/statuses/{id:\d+}/source'](https://github.com/mastodon/mastodon/pull/16697)
- [`GET /api/v1/streaming`](https://docs.joinmastodon.org/methods/timelines/streaming/) - [`GET /api/v1/streaming`](https://docs.joinmastodon.org/methods/timelines/streaming/)
- [`DELETE /api/v1/suggestions/:id`](https://docs.joinmastodon.org/methods/accounts/suggestions/) - [`DELETE /api/v1/suggestions/:id`](https://docs.joinmastodon.org/methods/accounts/suggestions/)
- [`GET /api/v1/trends/links'](https://github.com/mastodon/mastodon/pull/16917)
- [`GET /api/v1/trends/statuses'](https://github.com/mastodon/mastodon/pull/17431)
- [`GET /api/v1/trends/tags'](https://github.com/mastodon/mastodon/pull/16917)

View file

@ -21,6 +21,7 @@
namespace Friendica\Module\Api\Mastodon; namespace Friendica\Module\Api\Mastodon;
use Friendica\App\Router;
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
@ -41,6 +42,14 @@ use Friendica\Util\Images;
*/ */
class Statuses extends BaseApi class Statuses extends BaseApi
{ {
public function put(array $request = [])
{
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
$this->response->unsupported(Router::PUT, $request);
}
protected function post(array $request = []) protected function post(array $request = [])
{ {
self::checkAllowedScope(self::SCOPE_WRITE); self::checkAllowedScope(self::SCOPE_WRITE);

View file

@ -188,14 +188,22 @@ return [
'/accounts/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported '/accounts/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported '/accounts/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/{id:\d+}/note' => [Module\Api\Mastodon\Accounts\Note::class, [ R::POST]], '/accounts/{id:\d+}/note' => [Module\Api\Mastodon\Accounts\Note::class, [ R::POST]],
'/accounts/{id:\d+}/remove_from_followers' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/familiar_followers' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/accounts/lookup' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/accounts/relationships' => [Module\Api\Mastodon\Accounts\Relationships::class, [R::GET ]], '/accounts/relationships' => [Module\Api\Mastodon\Accounts\Relationships::class, [R::GET ]],
'/accounts/search' => [Module\Api\Mastodon\Accounts\Search::class, [R::GET ]], '/accounts/search' => [Module\Api\Mastodon\Accounts\Search::class, [R::GET ]],
'/accounts/update_credentials' => [Module\Api\Mastodon\Accounts\UpdateCredentials::class, [R::PATCH ]], '/accounts/update_credentials' => [Module\Api\Mastodon\Accounts\UpdateCredentials::class, [R::PATCH ]],
'/accounts/verify_credentials' => [Module\Api\Mastodon\Accounts\VerifyCredentials::class, [R::GET ]], '/accounts/verify_credentials' => [Module\Api\Mastodon\Accounts\VerifyCredentials::class, [R::GET ]],
'/accounts/{name}' => [Module\Api\Mastodon\Accounts::class, [R::GET ]], '/accounts/{name}' => [Module\Api\Mastodon\Accounts::class, [R::GET ]],
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/accounts/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported '/admin/accounts/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/accounts/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported '/admin/accounts/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/admin/dimensions' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/admin/measures' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/admin/retention' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/admin/trends/links' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/trends/statuses' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/trends/tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/reports' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported '/admin/reports' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/reports/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported '/admin/reports/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/reports/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported '/admin/reports/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
@ -212,6 +220,7 @@ return [
'/custom_emojis' => [Module\Api\Mastodon\CustomEmojis::class, [R::GET ]], '/custom_emojis' => [Module\Api\Mastodon\CustomEmojis::class, [R::GET ]],
'/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::DELETE]], // not supported '/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::DELETE]], // not supported
'/directory' => [Module\Api\Mastodon\Directory::class, [R::GET ]], '/directory' => [Module\Api\Mastodon\Directory::class, [R::GET ]],
'/emails/confirmations' => [Module\Api\Mastodon\Unimplemented::class, [R::POST ]], // not supported
'/endorsements' => [Module\Api\Mastodon\Endorsements::class, [R::GET ]], // Dummy, not supported '/endorsements' => [Module\Api\Mastodon\Endorsements::class, [R::GET ]], // Dummy, not supported
'/favourites' => [Module\Api\Mastodon\Favourited::class, [R::GET ]], '/favourites' => [Module\Api\Mastodon\Favourited::class, [R::GET ]],
'/featured_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not supported '/featured_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not supported
@ -243,7 +252,7 @@ return [
'/scheduled_statuses' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET ]], '/scheduled_statuses' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET ]],
'/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET, R::PUT, R::DELETE]], '/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET, R::PUT, R::DELETE]],
'/statuses' => [Module\Api\Mastodon\Statuses::class, [ R::POST]], '/statuses' => [Module\Api\Mastodon\Statuses::class, [ R::POST]],
'/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::DELETE]], '/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::PUT, R::DELETE]],
'/statuses/{id:\d+}/card' => [Module\Api\Mastodon\Statuses\Card::class, [R::GET ]], '/statuses/{id:\d+}/card' => [Module\Api\Mastodon\Statuses\Card::class, [R::GET ]],
'/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Statuses\Context::class, [R::GET ]], '/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Statuses\Context::class, [R::GET ]],
'/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Statuses\RebloggedBy::class, [R::GET ]], '/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Statuses\RebloggedBy::class, [R::GET ]],
@ -258,8 +267,18 @@ return [
'/statuses/{id:\d+}/unmute' => [Module\Api\Mastodon\Statuses\Unmute::class, [ R::POST]], '/statuses/{id:\d+}/unmute' => [Module\Api\Mastodon\Statuses\Unmute::class, [ R::POST]],
'/statuses/{id:\d+}/pin' => [Module\Api\Mastodon\Statuses\Pin::class, [ R::POST]], '/statuses/{id:\d+}/pin' => [Module\Api\Mastodon\Statuses\Pin::class, [ R::POST]],
'/statuses/{id:\d+}/unpin' => [Module\Api\Mastodon\Statuses\Unpin::class, [ R::POST]], '/statuses/{id:\d+}/unpin' => [Module\Api\Mastodon\Statuses\Unpin::class, [ R::POST]],
'/streaming' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/statuses/{id:\d+}/history' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]], '/statuses/{id:\d+}/source' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/direct' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/hashtag' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/hashtag/local' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/health' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/list' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/public' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/public/local' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/public/remote' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/user' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/streaming/user/notification' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented '/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented
'/timelines/direct' => [Module\Api\Mastodon\Timelines\Direct::class, [R::GET ]], '/timelines/direct' => [Module\Api\Mastodon\Timelines\Direct::class, [R::GET ]],
'/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]], '/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]],
@ -267,10 +286,15 @@ return [
'/timelines/public' => [Module\Api\Mastodon\Timelines\PublicTimeline::class, [R::GET ]], '/timelines/public' => [Module\Api\Mastodon\Timelines\PublicTimeline::class, [R::GET ]],
'/timelines/tag/{hashtag}' => [Module\Api\Mastodon\Timelines\Tag::class, [R::GET ]], '/timelines/tag/{hashtag}' => [Module\Api\Mastodon\Timelines\Tag::class, [R::GET ]],
'/trends' => [Module\Api\Mastodon\Trends::class, [R::GET ]], '/trends' => [Module\Api\Mastodon\Trends::class, [R::GET ]],
'/trends/links' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/trends/statuses' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/trends/tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
], ],
'/v{version:\d+}' => [ '/v{version:\d+}' => [
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/media' => [Module\Api\Mastodon\Media::class, [ R::POST]], '/media' => [Module\Api\Mastodon\Media::class, [ R::POST]],
'/search' => [Module\Api\Mastodon\Search::class, [R::GET ]], '/search' => [Module\Api\Mastodon\Search::class, [R::GET ]],
'/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]],
], ],
'/meta' => [Module\Api\Mastodon\Unimplemented::class, [R::POST ]], // not supported '/meta' => [Module\Api\Mastodon\Unimplemented::class, [R::POST ]], // not supported
'/oembed' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/oembed' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]],