The member and company-page publishers were ~95% identical (~1200 lines). Extract AbstractLinkedInPublisher holding the whole pipeline (media-inferred dispatch, post/carousel/document payloads, image/video/document upload, processing polling, error handling); each concrete publisher now only declares its platform, author URN, and (for pages) the post URL. ~640 duplicated lines removed, single source of truth. Fix: multi-image posts sent each image URN under 'media', which LinkedIn's multiImage schema rejects with a 422 (unrecognized field 'media' / required 'id' missing). Send the URN under 'id'. Add assertions locking the 'id' field on both carousel tests, a company-page multi-image test that was missing, and a fail-fast assertion that a missing org id makes no HTTP call.
23 lines
448 B
PHP
23 lines
448 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\Social;
|
|
|
|
use App\Enums\SocialAccount\Platform;
|
|
|
|
/**
|
|
* Publishes posts to a member's personal LinkedIn profile.
|
|
*/
|
|
class LinkedInPublisher extends AbstractLinkedInPublisher
|
|
{
|
|
protected function platform(): Platform
|
|
{
|
|
return Platform::LinkedIn;
|
|
}
|
|
|
|
protected function authorUrn(): string
|
|
{
|
|
return "urn:li:person:{$this->account->platform_user_id}";
|
|
}
|
|
}
|