2020-10-29 13:07:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Webhook extends Model
|
|
|
|
|
{
|
2020-11-12 05:12:14 +00:00
|
|
|
/**
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
protected $public = false;
|
|
|
|
|
|
2020-10-29 13:07:56 +00:00
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('$id', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Webhook ID.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => '5e5ea5c16897e',
|
|
|
|
|
])
|
|
|
|
|
->addRule('name', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Webhook name.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => 'My Webhook',
|
|
|
|
|
])
|
|
|
|
|
->addRule('url', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Webhook URL endpoint.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => '',
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => 'https://example.com/webhook',
|
|
|
|
|
])
|
|
|
|
|
->addRule('events', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Webhook trigger events.',
|
|
|
|
|
'default' => [],
|
2021-02-01 21:31:54 +00:00
|
|
|
'example' => 'database.collections.update',
|
2020-10-29 13:07:56 +00:00
|
|
|
'array' => true,
|
|
|
|
|
])
|
|
|
|
|
->addRule('security', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_BOOLEAN,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'Indicated if SSL / TLS Certificate verification is enabled.',
|
2021-01-13 15:06:36 +00:00
|
|
|
'default' => true,
|
2020-10-29 13:07:56 +00:00
|
|
|
'example' => true,
|
|
|
|
|
])
|
|
|
|
|
->addRule('httpUser', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'HTTP basic authentication username.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'username',
|
|
|
|
|
])
|
|
|
|
|
->addRule('httpPass', [
|
2020-11-07 22:14:48 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
2020-10-29 13:07:56 +00:00
|
|
|
'description' => 'HTTP basic authentication password.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'password',
|
|
|
|
|
])
|
2022-06-07 15:11:07 +00:00
|
|
|
->addRule('signatureKey', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
2022-06-08 07:19:50 +00:00
|
|
|
'description' => 'Signature key which can be used to validated incoming requests',
|
2022-06-07 15:11:07 +00:00
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'ad3d581ca230e2b7059c545e5a0d1defd8c349f8979b12579e03890aab973bcd23318e4b0ff6190fa3be09d746358821e19147d995210d45855eb3c069f6fd6e',
|
|
|
|
|
])
|
2020-10-29 13:07:56 +00:00
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
2021-10-06 14:22:38 +00:00
|
|
|
*
|
2020-10-29 13:07:56 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getName(): string
|
2020-10-29 13:07:56 +00:00
|
|
|
{
|
|
|
|
|
return 'Webhook';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-12-15 10:19:29 +00:00
|
|
|
* Get Type
|
2021-10-06 14:22:38 +00:00
|
|
|
*
|
2020-10-29 13:07:56 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2022-05-23 14:54:50 +00:00
|
|
|
public function getType(): string
|
2020-10-29 13:07:56 +00:00
|
|
|
{
|
|
|
|
|
return Response::MODEL_WEBHOOK;
|
|
|
|
|
}
|
2021-10-06 14:22:38 +00:00
|
|
|
}
|