]> git.mxchange.org Git - friendica.git/commitdiff
Add missing Twitter API routes for IDs
authorPhilipp <admin@philipp.info>
Sat, 8 Jan 2022 20:53:19 +0000 (21:53 +0100)
committerPhilipp <admin@philipp.info>
Sat, 8 Jan 2022 20:53:19 +0000 (21:53 +0100)
src/Module/Api/Twitter/Statuses/Retweet.php
static/routes.config.php

index 587defb06f2c2968fdffbd2fe91c955901300928..0c2401cf31781abcef8fc595a3ab2ce32d5dcc4f 100644 (file)
@@ -21,7 +21,6 @@
 
 namespace Friendica\Module\Api\Twitter\Statuses;
 
-use Friendica\Content\Text\BBCode;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -45,10 +44,12 @@ class Retweet extends BaseApi
                self::checkAllowedScope(self::SCOPE_WRITE);
                $uid = self::getCurrentUserID();
 
-               $id = $request['id'] ?? 0;
-
-               if (empty($id)) {
-                       throw new BadRequestException('Item id not specified');
+               if (!empty($this->parameters['id'])) {
+                       $id = (int)$this->parameters['id'];
+               } elseif (!empty($request['id'])) {
+                       $id = (int)$request['id'];
+               } else {
+                       throw new BadRequestException('An id is missing.');
                }
 
                $fields = ['uri-id', 'network', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink'];
index 37c3d54d04f2f8fcc98bb209ffbdc35f5ae65449..63c968c6c7ecdb18d26e2aeaeae629a948761786 100644 (file)
@@ -120,6 +120,7 @@ $apiRoutes = [
 
        '/statuses' => [
                '/destroy[.{extension:json|xml|rss|atom}]'                 => [Module\Api\Twitter\Statuses\Destroy::class,               [        R::POST]],
+               '/destroy/{id:\d+}[.{extension:json|xml|rss|atom}]'        => [Module\Api\Twitter\Statuses\Destroy::class,               [        R::POST]],
                '/followers[.{extension:json|xml|rss|atom}]'               => [Module\Api\Twitter\Followers\Lists::class,                [R::GET         ]],
                '/friends[.{extension:json|xml|rss|atom}]'                 => [Module\Api\Twitter\Friends\Lists::class,                  [R::GET         ]],
                '/friends_timeline[.{extension:json|xml|rss|atom}]'        => [Module\Api\Twitter\Statuses\HomeTimeline::class,          [R::GET         ]],
@@ -131,6 +132,7 @@ $apiRoutes = [
                '/public_timeline[.{extension:json|xml|rss|atom}]'         => [Module\Api\Twitter\Statuses\PublicTimeline::class,        [R::GET         ]],
                '/replies[.{extension:json|xml|rss|atom}]'                 => [Module\Api\Twitter\Statuses\Mentions::class,              [R::GET         ]],
                '/retweet[.{extension:json|xml|rss|atom}]'                 => [Module\Api\Twitter\Statuses\Retweet::class,               [        R::POST]],
+               '/retweet/{id:\d+}[.{extension:json|xml|rss|atom}]'        => [Module\Api\Twitter\Statuses\Retweet::class,               [        R::POST]],
                '/show[.{extension:json|xml|rss|atom}]'                    => [Module\Api\Twitter\Statuses\Show::class,                  [R::GET         ]],
                '/show/{id:\d+}[.{extension:json|xml|rss|atom}]'           => [Module\Api\Twitter\Statuses\Show::class,                  [R::GET         ]],
                '/update[.{extension:json|xml|rss|atom}]'                  => [Module\Api\Twitter\Statuses\Update::class,                [        R::POST]],