mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Add API Search ResultsTransformer
This commit is contained in:
parent
ba8c101703
commit
84960d701c
1 changed files with 23 additions and 5 deletions
|
@ -8,12 +8,12 @@ class ResultsTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
|
||||
protected $defaultIncludes = [
|
||||
'account',
|
||||
'mentions',
|
||||
'media_attachments',
|
||||
'tags',
|
||||
'accounts',
|
||||
'statuses',
|
||||
'hashtags',
|
||||
];
|
||||
public function transform()
|
||||
|
||||
public function transform($results)
|
||||
{
|
||||
return [
|
||||
'accounts' => [],
|
||||
|
@ -21,4 +21,22 @@ class ResultsTransformer extends Fractal\TransformerAbstract
|
|||
'hashtags' => []
|
||||
];
|
||||
}
|
||||
|
||||
public function includeAccounts($results)
|
||||
{
|
||||
$accounts = $results->accounts;
|
||||
return $this->collection($accounts, new AccountTransformer());
|
||||
}
|
||||
|
||||
public function includeStatuses($results)
|
||||
{
|
||||
$statuses = $results->statuses;
|
||||
return $this->collection($statuses, new StatusTransformer());
|
||||
}
|
||||
|
||||
public function includeTags($results)
|
||||
{
|
||||
$hashtags = $status->hashtags;
|
||||
return $this->collection($hashtags, new HashtagTransformer());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue