trypost/app/Actions/SocialAccount/ListPinterestBoards.php
Paulo Castellano e4779dfcdf Clamp media byte caps to upload limits and surface truncated board lists.
Align editor/API/MCP size ceilings with trypost.media hard caps, return truncated from Pinterest board pagination stop conditions, and rename the signed-upload claim key and rate limiter away from the MCP-only naming.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 22:49:04 -03:00

34 lines
959 B
PHP

<?php
declare(strict_types=1);
namespace App\Actions\SocialAccount;
use App\Models\SocialAccount;
use App\Services\Social\PinterestPublisher;
use Illuminate\Support\Collection;
class ListPinterestBoards
{
/**
* @return array{boards: list<array{id: string, name: string}>, truncated: bool}
*/
public static function execute(SocialAccount $account): array
{
$result = app(PinterestPublisher::class)->getBoards($account);
$boards = Collection::make(data_get($result, 'boards', []))
->map(fn (mixed $board): array => [
'id' => (string) data_get($board, 'id'),
'name' => (string) data_get($board, 'name'),
])
->filter(fn (array $board): bool => $board['id'] !== '')
->values()
->all();
return [
'boards' => $boards,
'truncated' => (bool) data_get($result, 'truncated', false),
];
}
}