. * */ namespace Friendica\Object\Api\Mastodon; use Friendica\BaseDataTransferObject; /** * Class Subscription * * @see https://docs.joinmastodon.org/entities/pushsubscription */ class Subscription extends BaseDataTransferObject { /** @var string */ protected $id; /** @var string|null (URL)*/ protected $endpoint; /** @var array */ protected $alerts; /** @var string */ protected $server_key; /** * Creates a subscription record from an item record. * * @param array $subscription * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function __construct(array $subscription, string $vapid) { $this->id = (string)$subscription['id']; $this->endpoint = $subscription['endpoint']; $this->alerts = [ 'follow' => $subscription['follow'], 'favourite' => $subscription['favourite'], 'reblog' => $subscription['reblog'], 'mention' => $subscription['mention'], 'mention' => $subscription['mention'], 'poll' => $subscription['poll'], ]; $this->server_key = $vapid; } }