2023-08-07 15:26:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class Topic extends Model
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
2023-08-07 15:31:25 +00:00
|
|
|
protected bool $public = false;
|
2023-08-07 15:26:03 +00:00
|
|
|
|
2023-08-07 15:31:25 +00:00
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this
|
|
|
|
|
->addRule('$id', [
|
2023-08-07 15:26:03 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Topic ID.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '259125845563242502',
|
2023-08-07 15:31:25 +00:00
|
|
|
])
|
|
|
|
|
->addRule('providerId', [
|
2023-08-07 15:26:03 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Provider ID.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => '259125845563242502',
|
2023-08-07 15:31:25 +00:00
|
|
|
])
|
|
|
|
|
->addRule('name', [
|
2023-08-07 15:26:03 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'The name of the topic.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'example' => 'events',
|
2023-08-07 15:31:25 +00:00
|
|
|
])
|
|
|
|
|
->addRule('description', [
|
2023-08-07 15:26:03 +00:00
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Description of the topic.',
|
|
|
|
|
'default' => '',
|
|
|
|
|
'required' => false,
|
|
|
|
|
'example' => 'All events related messages will be sent to this topic.',
|
2023-08-07 15:31:25 +00:00
|
|
|
]);
|
|
|
|
|
}
|
2023-08-07 15:26:03 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2023-08-07 15:31:25 +00:00
|
|
|
public function getName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Topic';
|
|
|
|
|
}
|
2023-08-07 15:26:03 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Type
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2023-08-07 15:31:25 +00:00
|
|
|
public function getType(): string
|
|
|
|
|
{
|
|
|
|
|
return Response::MODEL_TOPIC;
|
|
|
|
|
}
|
2023-08-07 15:26:03 +00:00
|
|
|
}
|