API: Added trending links

This commit is contained in:
Michael 2022-11-28 20:19:57 +00:00
parent e391328cbf
commit de76e860ad
8 changed files with 74 additions and 8 deletions

View file

@ -30,13 +30,14 @@ use Friendica\Util\Strings;
class Card extends BaseFactory
{
/**
* @param int $uriId Uri-ID of the item
* @param int $uriId Uri-ID of the item
* @param array $history Link request history
*
* @return \Friendica\Object\Api\Mastodon\Card
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException*@throws \Exception
*/
public function createFromUriId(int $uriId): \Friendica\Object\Api\Mastodon\Card
public function createFromUriId(int $uriId, array $history = []): \Friendica\Object\Api\Mastodon\Card
{
$item = Post::selectFirst(['body'], ['uri-id' => $uriId]);
if (!empty($item['body'])) {
@ -76,6 +77,6 @@ class Card extends BaseFactory
}
}
return new \Friendica\Object\Api\Mastodon\Card($data);
return new \Friendica\Object\Api\Mastodon\Card($data, $history);
}
}