1
1
Fork 0

Add missing Twitter API routes for IDs

This commit is contained in:
Philipp Holzer 2022-01-08 21:53:19 +01:00
parent 1d5206d594
commit 20934d73b0
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
2 changed files with 8 additions and 5 deletions

View 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'];

View 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]],