appwrite/src/Appwrite/Event/Webhook.php

31 lines
731 B
PHP
Raw Normal View History

2024-11-04 15:05:54 +00:00
<?php
namespace Appwrite\Event;
2024-12-19 11:22:10 +00:00
use Utopia\Database\Document;
2024-12-19 11:26:17 +00:00
use Utopia\Queue\Connection;
2024-11-04 15:05:54 +00:00
class Webhook extends Event
{
public function __construct(protected Connection $connection)
{
parent::__construct($connection);
$this
->setQueue(Event::WEBHOOK_QUEUE_NAME)
->setClass(Event::WEBHOOK_CLASS_NAME);
}
2024-12-19 11:13:05 +00:00
public function trigger(): string|bool
{
/** Filter out context and trim project to keep the payload small */
$this->context = [];
2024-12-19 11:22:10 +00:00
$this->project = new Document([
2024-12-19 11:13:05 +00:00
'$id' => $this->project->getId(),
2024-12-19 15:45:13 +00:00
'$internalId' => $this->project->getAttribute('$internalId'),
2024-12-19 11:22:10 +00:00
]);
2024-12-19 11:13:05 +00:00
return parent::trigger();
}
2024-11-04 15:05:54 +00:00
}