appwrite/src/Appwrite/Utopia/Response/Model/Webhook.php

102 lines
3 KiB
PHP
Raw Normal View History

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