trypost/app/Actions/SocialAccount/ListPinterestBoards.php
Paulo Castellano ff0bfa8a06 Expose Pinterest board IDs via MCP and REST API.
Agents need board_id to publish pins; list boards per connected account so create/update can set platforms[].meta.board_id.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 21:47:51 -03:00

29 lines
765 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 list<array{id: string, name: string}>
*/
public static function execute(SocialAccount $account): array
{
$boards = app(PinterestPublisher::class)->getBoards($account);
return Collection::make($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();
}
}